diff --git a/.gitattributes b/.gitattributes index eda7cfb202..a105a64538 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,6 +4,7 @@ *.pb filter=lfs diff=lfs merge=lfs -text *.bin filter=lfs diff=lfs merge=lfs -text *.apk filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text *.ipynb filter=nbstripout -diff external/ffmpeg/bin/ffmpeg_cuda filter=lfs diff=lfs merge=lfs -text models/segnet.keras filter=lfs diff=lfs merge=lfs -text @@ -41,7 +42,6 @@ third_party/catch2/include/catch2/catch.hpp filter=lfs diff=lfs merge=lfs -text *.apkpatch filter=lfs diff=lfs merge=lfs -text *.jar filter=lfs diff=lfs merge=lfs -text *.pdf filter=lfs diff=lfs merge=lfs -text -*.jpg filter=lfs diff=lfs merge=lfs -text *.mp3 filter=lfs diff=lfs merge=lfs -text *.thneed filter=lfs diff=lfs merge=lfs -text *.tar.gz filter=lfs diff=lfs merge=lfs -text diff --git a/selfdrive/assets/offroad/circled-checkmark-empty.png b/selfdrive/assets/offroad/circled-checkmark-empty.png deleted file mode 100644 index 30c92c7fa7..0000000000 --- a/selfdrive/assets/offroad/circled-checkmark-empty.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e20ab7c7ff1aa7193fe5f1c357eb73e64858ead354a5d65928ab96527bbb3aad -size 1731 diff --git a/selfdrive/assets/offroad/circled-checkmark.png b/selfdrive/assets/offroad/circled-checkmark.png deleted file mode 100644 index fcf890401b..0000000000 --- a/selfdrive/assets/offroad/circled-checkmark.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7d183563de9d3a758e97af1d376cf3771e58c724ea77ad3be61ec201c5aa74ec -size 2236 diff --git a/selfdrive/assets/offroad/illustration_arrow.png b/selfdrive/assets/offroad/illustration_arrow.png deleted file mode 100644 index fe454c047e..0000000000 --- a/selfdrive/assets/offroad/illustration_arrow.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ab5348b245a239ed67972bdb69ec2d5e60d87255238328ae8018ba9fd5906cc2 -size 1265 diff --git a/selfdrive/assets/offroad/illustration_sim_absent.png b/selfdrive/assets/offroad/illustration_sim_absent.png deleted file mode 100644 index 148e75ebe6..0000000000 --- a/selfdrive/assets/offroad/illustration_sim_absent.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:73e1bc396026bfaf8e61a27add5baca4fb29131990bd19acfd6c2052d6fdf874 -size 6608 diff --git a/selfdrive/assets/offroad/illustration_sim_present.png b/selfdrive/assets/offroad/illustration_sim_present.png deleted file mode 100644 index 419c49402b..0000000000 --- a/selfdrive/assets/offroad/illustration_sim_present.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:163cc50c861ca3137c81ddb3cc6938e1076bd3616d96657c012539675da8cbe5 -size 6331 diff --git a/selfdrive/assets/offroad/illustration_training_lane_01.png b/selfdrive/assets/offroad/illustration_training_lane_01.png deleted file mode 100644 index 9e46c3a131..0000000000 --- a/selfdrive/assets/offroad/illustration_training_lane_01.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5861d3b84e80ef664806dbf2c2592a46a67e2f88d192ba3723fe3b95ba0f8788 -size 268080 diff --git a/selfdrive/assets/offroad/illustration_training_lane_02.png b/selfdrive/assets/offroad/illustration_training_lane_02.png deleted file mode 100644 index 99694f974c..0000000000 --- a/selfdrive/assets/offroad/illustration_training_lane_02.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ea18f3366732c57ea1bc9c10792f32a06f182f759f69bc2a0b1b00cc389f5bc6 -size 69907 diff --git a/selfdrive/assets/offroad/illustration_training_lead_01.png b/selfdrive/assets/offroad/illustration_training_lead_01.png deleted file mode 100644 index 57053eea74..0000000000 --- a/selfdrive/assets/offroad/illustration_training_lead_01.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:72be2ebd471ddc4308dda5b3f5ba59f5d56eadb6c9dc80861697b01859550ffc -size 1515 diff --git a/selfdrive/assets/offroad/illustration_training_lead_02.png b/selfdrive/assets/offroad/illustration_training_lead_02.png deleted file mode 100644 index 37e173ff73..0000000000 --- a/selfdrive/assets/offroad/illustration_training_lead_02.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e2e44f54137ee5a5a6edc3d82b16e146f0b45feb57146dbb9c334e06c5de603f -size 2054 diff --git a/selfdrive/assets/offroad/indicator_wifi_0.png b/selfdrive/assets/offroad/indicator_wifi_0.png deleted file mode 100644 index 42212b0377..0000000000 --- a/selfdrive/assets/offroad/indicator_wifi_0.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:eed7cde35bf5d10963201cda9299252167b79f470d021c349db1f5eb4b9c2e67 -size 3038 diff --git a/selfdrive/assets/offroad/indicator_wifi_100.png b/selfdrive/assets/offroad/indicator_wifi_100.png deleted file mode 100644 index 432920ac20..0000000000 --- a/selfdrive/assets/offroad/indicator_wifi_100.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1ba6e92b7d7e99f5b62eacd6997925c7585e9d88e6cb9d552904b94b3650758c -size 3270 diff --git a/selfdrive/assets/offroad/indicator_wifi_25.png b/selfdrive/assets/offroad/indicator_wifi_25.png deleted file mode 100644 index 75a8ec8bd1..0000000000 --- a/selfdrive/assets/offroad/indicator_wifi_25.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:755dd7fa5a92ac4cd5f800e37ab337a5870739a025d051bcc1c86828a7b277e6 -size 3087 diff --git a/selfdrive/assets/offroad/indicator_wifi_50.png b/selfdrive/assets/offroad/indicator_wifi_50.png deleted file mode 100644 index a5e3332664..0000000000 --- a/selfdrive/assets/offroad/indicator_wifi_50.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6f6856440f343735eab487559e9fa83ef570e3d221a3631d3cec3229588aa1a3 -size 3121 diff --git a/selfdrive/assets/offroad/indicator_wifi_75.png b/selfdrive/assets/offroad/indicator_wifi_75.png deleted file mode 100644 index cd1bd9a1d0..0000000000 --- a/selfdrive/assets/offroad/indicator_wifi_75.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:296ca507b947f18e4212180799be14d261e723aedeb49b0612b61b805183f87d -size 3186 diff --git a/selfdrive/assets/training/step0.jpg b/selfdrive/assets/training/step0.jpg new file mode 100644 index 0000000000..51146f989a --- /dev/null +++ b/selfdrive/assets/training/step0.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c6c04843346495360f87d7378f6b92d1284f26876e4c61772391c4239eabb9a +size 187644 diff --git a/selfdrive/assets/training/step1.jpg b/selfdrive/assets/training/step1.jpg new file mode 100644 index 0000000000..23c5e3644f --- /dev/null +++ b/selfdrive/assets/training/step1.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7ad4506e6e81e7b374676767be0037b1d27a5a6ba7e2354a639fe72510621c7 +size 251834 diff --git a/selfdrive/assets/training/step10.jpg b/selfdrive/assets/training/step10.jpg new file mode 100644 index 0000000000..55581babdc --- /dev/null +++ b/selfdrive/assets/training/step10.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25b8ed39ca149b5083c61765951cef34ebbd94ed70d6111250f1f21f89c92170 +size 263592 diff --git a/selfdrive/assets/training/step11.jpg b/selfdrive/assets/training/step11.jpg new file mode 100644 index 0000000000..10392b8307 --- /dev/null +++ b/selfdrive/assets/training/step11.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:01932662ce154ae0456aa5adf42e604df3342dad03651c7dfe596a982bc10de2 +size 220853 diff --git a/selfdrive/assets/training/step12.jpg b/selfdrive/assets/training/step12.jpg new file mode 100644 index 0000000000..60bc9a1e43 --- /dev/null +++ b/selfdrive/assets/training/step12.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de067b0da7f676428a82d445a29d386f135081c53fd6203437bc7abeef941301 +size 297138 diff --git a/selfdrive/assets/training/step13.jpg b/selfdrive/assets/training/step13.jpg new file mode 100644 index 0000000000..78835586ff --- /dev/null +++ b/selfdrive/assets/training/step13.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a89702a4b25a5dd8431689cb06125780c30642613ac11d88dd245e1e8924cd7 +size 376601 diff --git a/selfdrive/assets/training/step14.jpg b/selfdrive/assets/training/step14.jpg new file mode 100644 index 0000000000..e9c0d4ab0d --- /dev/null +++ b/selfdrive/assets/training/step14.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9f2b6fa133b102f2008a60dda0b344826ecfa57127ba43c7551d14c1b213d3b +size 234676 diff --git a/selfdrive/assets/training/step2.jpg b/selfdrive/assets/training/step2.jpg new file mode 100644 index 0000000000..b5c07ffa18 --- /dev/null +++ b/selfdrive/assets/training/step2.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd1b7ea05bdadba70f1aa12af9e044224ff751a9feb7336b0868dda99876c4ae +size 199105 diff --git a/selfdrive/assets/training/step3.jpg b/selfdrive/assets/training/step3.jpg new file mode 100644 index 0000000000..09ea3c7bb4 --- /dev/null +++ b/selfdrive/assets/training/step3.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ef49a4dde1309ca0e44de41ded5bf70a5e3dbf0cd503c50f03769c93c07e998 +size 259261 diff --git a/selfdrive/assets/training/step4.jpg b/selfdrive/assets/training/step4.jpg new file mode 100644 index 0000000000..d4d2e2ccc1 --- /dev/null +++ b/selfdrive/assets/training/step4.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10cc7c1a0515dcef8ae840d8d18cdfb6b60cbede409d25cfc8375c190763d7bc +size 269618 diff --git a/selfdrive/assets/training/step5.jpg b/selfdrive/assets/training/step5.jpg new file mode 100644 index 0000000000..02ef94f1e1 --- /dev/null +++ b/selfdrive/assets/training/step5.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58d340534194a7ba03466ce0f1eefaf2431d50ad6651702cb438b22d87b276bd +size 178004 diff --git a/selfdrive/assets/training/step6.jpg b/selfdrive/assets/training/step6.jpg new file mode 100644 index 0000000000..603450e6ae --- /dev/null +++ b/selfdrive/assets/training/step6.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d67cbc355c1f22e0ce20ff952a02df9b238774ebaf3076acfcc0f10944779aa +size 257768 diff --git a/selfdrive/assets/training/step7.jpg b/selfdrive/assets/training/step7.jpg new file mode 100644 index 0000000000..99a16f5e2e --- /dev/null +++ b/selfdrive/assets/training/step7.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21de74ca3ca3723c8d9e8e8671f07fede2a444c4ad1aeeb53dd91d25175a0d70 +size 294373 diff --git a/selfdrive/assets/training/step8.jpg b/selfdrive/assets/training/step8.jpg new file mode 100644 index 0000000000..8b530dfba3 --- /dev/null +++ b/selfdrive/assets/training/step8.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:441de6705aba7218327cb49866bf00927d2d8b6b724e91c9006b20a88f32c71a +size 216384 diff --git a/selfdrive/assets/training/step9.jpg b/selfdrive/assets/training/step9.jpg new file mode 100644 index 0000000000..8caa68ad61 --- /dev/null +++ b/selfdrive/assets/training/step9.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a7bfa7d4f48753409dd125d6a48b6b2d7e42a62b4b6fb1f2a7f5f11b212665a +size 200923 diff --git a/selfdrive/ui/qt/offroad/onboarding.cc b/selfdrive/ui/qt/offroad/onboarding.cc index a4caebebd3..948a9b144e 100644 --- a/selfdrive/ui/qt/offroad/onboarding.cc +++ b/selfdrive/ui/qt/offroad/onboarding.cc @@ -3,18 +3,73 @@ #include #include #include +#include +#include +#include +#include +#include #include "onboarding.hpp" #include "common/params.h" +#include "home.hpp" QLabel * title_label(QString text) { QLabel *l = new QLabel(text); - l->setStyleSheet(R"(font-size: 100px;)"); + l->setStyleSheet(R"(font-size: 100px; font-weight: bold;)"); return l; } -QWidget * OnboardingWindow::terms_screen() { +QWidget* layout2Widget(QLayout* l){ + QWidget* q = new QWidget; + q->setLayout(l); + return q; +} + + + + +void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) { + int leftOffset = (geometry().width()-1620)/2; + int mousex = e->x()-leftOffset; + int mousey = e->y(); + + // Check for restart + if (currentIndex == numberOfFrames-1) { + if (1050 <= mousex && mousex <= 1500 && 773 <= mousey && mousey <= 954){ + slayout->setCurrentIndex(0); + currentIndex = 0; + return; + } + } + + if (boundingBox[currentIndex][0] <= mousex && mousex <= boundingBox[currentIndex][1] && boundingBox[currentIndex][2] <= mousey && mousey <= boundingBox[currentIndex][3]) { + slayout->setCurrentIndex(++currentIndex); + } + if (currentIndex >= numberOfFrames) { + emit completedTraining(); + return; + } +} + +TrainingGuide::TrainingGuide(QWidget* parent) { + QHBoxLayout* hlayout = new QHBoxLayout; + + slayout = new QStackedLayout(this); + for (int i = 0; i <= 14; i++) { + QWidget* w = new QWidget; + w->setStyleSheet(".QWidget {background-image: url(../assets/training/step" + QString::number(i) + ".jpg);}"); + w->setFixedSize(1620, 1080); + slayout->addWidget(w); + } + + QWidget* sw = layout2Widget(slayout); + hlayout->addWidget(sw, 1, Qt::AlignCenter); + setLayout(hlayout); +} + + +QWidget* OnboardingWindow::terms_screen() { QGridLayout *main_layout = new QGridLayout(); main_layout->setMargin(100); @@ -35,7 +90,7 @@ QWidget * OnboardingWindow::terms_screen() { QPushButton *accept_btn = new QPushButton("Accept"); main_layout->addWidget(accept_btn, 2, 1); QObject::connect(accept_btn, &QPushButton::released, [=]() { - Params().write_db_value("HasAcceptedTerms", LATEST_TERMS_VERSION); + Params().write_db_value("HasAcceptedTerms", current_terms_version.toStdString()); updateActiveScreen(); }); @@ -55,34 +110,11 @@ QWidget * OnboardingWindow::terms_screen() { return widget; } -QWidget * OnboardingWindow::training_screen() { - - QVBoxLayout *main_layout = new QVBoxLayout(); - main_layout->setMargin(100); - main_layout->setSpacing(30); - - main_layout->addWidget(title_label("Training Guide")); - - main_layout->addWidget(new QLabel(), 1); // just a spacer - - QPushButton *btn = new QPushButton("Continue"); - main_layout->addWidget(btn); - QObject::connect(btn, &QPushButton::released, [=]() { - Params().write_db_value("CompletedTrainingVersion", LATEST_TRAINING_VERSION); - updateActiveScreen(); - }); - - QWidget *widget = new QWidget; - widget->setLayout(main_layout); - return widget; -} - void OnboardingWindow::updateActiveScreen() { - Params params = Params(); - bool accepted_terms = params.get("HasAcceptedTerms", false).compare(LATEST_TERMS_VERSION) == 0; - bool training_done = params.get("CompletedTrainingVersion", false).compare(LATEST_TRAINING_VERSION) == 0; - + + bool accepted_terms = params.get("HasAcceptedTerms", false).compare(current_terms_version.toStdString()) == 0; + bool training_done = params.get("CompletedTrainingVersion", false).compare(current_training_version.toStdString()) == 0; if (!accepted_terms) { setCurrentIndex(0); } else if (!training_done) { @@ -93,8 +125,13 @@ void OnboardingWindow::updateActiveScreen() { } OnboardingWindow::OnboardingWindow(QWidget *parent) : QStackedWidget(parent) { + Params params = Params(); + current_terms_version = QString::fromStdString(params.get("TermsVersion", false)); + current_training_version = QString::fromStdString(params.get("TrainingVersion", false)); addWidget(terms_screen()); - addWidget(training_screen()); + TrainingGuide* tr = new TrainingGuide(this); + connect(tr, &TrainingGuide::completedTraining, [=](){Params().write_db_value("CompletedTrainingVersion", current_training_version.toStdString()); updateActiveScreen();}); + addWidget(tr); setStyleSheet(R"( * { @@ -102,15 +139,11 @@ OnboardingWindow::OnboardingWindow(QWidget *parent) : QStackedWidget(parent) { background-color: black; } QPushButton { - font-size: 50px; padding: 50px; border-radius: 10px; background-color: #292929; } )"); - // TODO: remove this after training guide is done - Params().write_db_value("CompletedTrainingVersion", LATEST_TRAINING_VERSION); - updateActiveScreen(); } diff --git a/selfdrive/ui/qt/offroad/onboarding.hpp b/selfdrive/ui/qt/offroad/onboarding.hpp index 9e4aabeb75..be29256954 100644 --- a/selfdrive/ui/qt/offroad/onboarding.hpp +++ b/selfdrive/ui/qt/offroad/onboarding.hpp @@ -2,10 +2,29 @@ #include #include +#include +#include -// TODO: this is defined in python too -#define LATEST_TERMS_VERSION "2" -#define LATEST_TRAINING_VERSION "0.2.0" + +class TrainingGuide : public QWidget { + Q_OBJECT + +public: + explicit TrainingGuide(QWidget *parent = 0); + +protected: + void mouseReleaseEvent(QMouseEvent* e) override; +private: + int currentIndex = 0; + const int numberOfFrames = 15; + QStackedLayout* slayout; + //Vector of bounding boxes for the next step. (minx, maxx, miny, maxy) + QVector> boundingBox {{250, 930, 750, 900}, {280, 1280, 650, 950}, {330, 1130, 590, 900}, {910, 1580, 500, 1000}, {1180, 1300, 630, 720}, {290, 1050, 590, 960}, + {1090, 1240, 550, 660}, {1050, 1580, 250, 900}, {320, 1130, 670, 1020}, {1010, 1580, 410, 750}, {1040, 1500, 230, 1030}, {300, 1190, 590, 920}, {1050, 1310, 170, 870}, {950, 1530, 460, 770}, {190, 970, 750, 970}}; + +signals: + void completedTraining(); +}; class OnboardingWindow : public QStackedWidget { Q_OBJECT @@ -14,6 +33,8 @@ public: explicit OnboardingWindow(QWidget *parent = 0); private: + QString current_terms_version; + QString current_training_version; QWidget * terms_screen(); QWidget * training_screen();