experimental mode: gate navigate on openpilot (#28883)

* first draft copy, needs updates

* gate behind exp mode

* can be one line

* this is no longer true

* toggle isn't just e2e long now, rename

* don't enable/disable

* kinda works!

* remove old giant qstring

* comment clean up

* similar breakpoint

* more clean up

* fixup onroad

* preserve planner behavior, and we don't need to look at confirmed param if we're onroad

* update translations

* vanish translations

* use scene for op long

* lowercase!

* updated copy

* need to check longitudinal here now too

* clean up!

* here is better

* used

* no nav emoji

* don't check param if not valid

* revert this

revert this

* ed
old-commit-hash: f973d605b2
beeps
Shane Smiskol 2 years ago committed by GitHub
parent 22ad05a0e0
commit 296de39f48
  1. 4
      selfdrive/controls/controlsd.py
  2. 2
      selfdrive/controls/lib/drive_helpers.py
  3. 2
      selfdrive/controls/lib/longitudinal_planner.py
  4. 7
      selfdrive/modeld/modeld.cc
  5. 50
      selfdrive/ui/qt/offroad/settings.cc
  6. 8
      selfdrive/ui/qt/onroad.cc
  7. 26
      selfdrive/ui/translations/main_de.ts
  8. 26
      selfdrive/ui/translations/main_ja.ts
  9. 28
      selfdrive/ui/translations/main_ko.ts
  10. 28
      selfdrive/ui/translations/main_pt-BR.ts
  11. 26
      selfdrive/ui/translations/main_zh-CHS.ts
  12. 28
      selfdrive/ui/translations/main_zh-CHT.ts

@ -134,8 +134,6 @@ class Controls:
# cleanup old params
if not self.CP.experimentalLongitudinalAvailable or is_release_branch():
self.params.remove("ExperimentalLongitudinalEnabled")
if not self.CP.openpilotLongitudinalControl:
self.params.remove("ExperimentalMode")
self.CC = car.CarControl.new_message()
self.CS_prev = car.CarState.new_message()
@ -845,7 +843,7 @@ class Controls:
self.prof.checkpoint("Ratekeeper", ignore=True)
self.is_metric = self.params.get_bool("IsMetric")
self.experimental_mode = self.params.get_bool("ExperimentalMode") and self.CP.openpilotLongitudinalControl
self.experimental_mode = self.params.get_bool("ExperimentalMode")
# Sample data from sockets and get a carState
CS = self.data_sample()

@ -132,7 +132,7 @@ class VCruiseHelper:
if self.CP.pcmCruise:
return
initial = V_CRUISE_INITIAL_EXPERIMENTAL_MODE if experimental_mode else V_CRUISE_INITIAL
initial = V_CRUISE_INITIAL_EXPERIMENTAL_MODE if experimental_mode and self.CP.openpilotLongitudinalControl else V_CRUISE_INITIAL
# 250kph or above probably means we never had a set speed
if any(b.type in (ButtonType.accelCruise, ButtonType.resumeCruise) for b in CS.buttonEvents) and self.v_cruise_kph_last < 250:

@ -90,7 +90,7 @@ class LongitudinalPlanner:
if self.param_read_counter % 50 == 0:
self.read_param()
self.param_read_counter += 1
self.mpc.mode = 'blended' if sm['controlsState'].experimentalMode else 'acc'
self.mpc.mode = 'blended' if sm['controlsState'].experimentalMode and self.CP.openpilotLongitudinalControl else 'acc'
v_ego = sm['carState'].vEgo
v_cruise_kph = sm['controlsState'].vCruise

@ -62,6 +62,8 @@ void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcCl
PubMaster pm({"modelV2", "cameraOdometry"});
SubMaster sm({"lateralPlan", "roadCameraState", "liveCalibration", "driverMonitoringState", "navModel"});
Params params;
// setup filter to track dropped frames
FirstOrderFilter frame_dropped_filter(0., 10., 1. / MODEL_FREQ);
@ -140,9 +142,10 @@ void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcCl
// Enable/disable nav features
uint64_t timestamp_llk = sm["navModel"].getNavModel().getLocationMonoTime();
bool nav_valid = sm["navModel"].getValid() && (nanos_since_boot() - timestamp_llk < 1e9);
if (!nav_enabled && nav_valid) {
bool use_nav = nav_valid && params.getBool("ExperimentalMode");
if (!nav_enabled && use_nav) {
nav_enabled = true;
} else if (nav_enabled && !nav_valid) {
} else if (nav_enabled && !use_nav) {
memset(nav_features, 0, sizeof(float)*NAV_FEATURE_LEN);
nav_enabled = false;
}

@ -125,19 +125,22 @@ void TogglesPanel::showEvent(QShowEvent *event) {
}
void TogglesPanel::updateToggles() {
auto e2e_toggle = toggles["ExperimentalMode"];
auto experimental_mode_toggle = toggles["ExperimentalMode"];
auto op_long_toggle = toggles["ExperimentalLongitudinalEnabled"];
const QString e2e_description = QString("%1<br>"
"<h4>%2</h4><br>"
"%3<br>"
"<h4>%4</h4><br>"
"%5")
.arg(tr("openpilot defaults to driving in <b>chill mode</b>. Experimental mode enables <b>alpha-level features</b> that aren't ready for chill mode. Experimental features are listed below:"))
.arg(tr("🌮 End-to-End Longitudinal Control 🌮"))
.arg(tr("Let the driving model control the gas and brakes. openpilot will drive as it thinks a human would, including stopping for red lights and stop signs. "
"Since the driving model decides the speed to drive, the set speed will only act as an upper bound. This is an alpha quality feature; mistakes should be expected."))
.arg(tr("New Driving Visualization"))
.arg(tr("The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner."));
QMap<QString, QString> exp_features;
exp_features["e2e_long"] = tr("Let the driving model control the gas and brakes. openpilot will drive as it thinks a human would, including stopping for red lights and stop signs. "
"Since the driving model decides the speed to drive, the set speed will only act as an upper bound. This is an alpha quality feature; mistakes should be expected.");
exp_features["nav_on_op"] = tr("When navigation has a destination, openpilot will input the map information into the model. This generally improves behavior and allows openpilot to keep left or right appropriately at forks/exits and take turns. "
"Lane change behavior is unchanged and still activated by the driver. This is an alpha quality feature; mistakes should be expected.");
exp_features["visualization"] = tr("The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner.");
// Ordering of the headers
QVector<QPair<QString, QString>> exp_features_headers {
{"e2e_long", tr("🌮 End-to-End Longitudinal Control 🌮")},
{"nav_on_op", tr("Navigate on openpilot")},
{"visualization", tr("New Driving Visualization")}
};
const bool is_release = params.getBool("IsReleaseBranch");
auto cp_bytes = params.get("CarParamsPersistent");
@ -152,34 +155,35 @@ void TogglesPanel::updateToggles() {
op_long_toggle->setVisible(CP.getExperimentalLongitudinalAvailable() && !is_release);
if (hasLongitudinalControl(CP)) {
// normal description and toggle
e2e_toggle->setEnabled(true);
e2e_toggle->setDescription(e2e_description);
long_personality_setting->setEnabled(true);
} else {
// no long for now
e2e_toggle->setEnabled(false);
long_personality_setting->setEnabled(false);
params.remove("ExperimentalMode");
const QString unavailable = tr("Experimental mode is currently unavailable on this car since the car's stock ACC is used for longitudinal control.");
// prepended note that end-to-end longitudinal control will not be used
const QString unavailable = tr("End-to-End Longitudinal Control is currently unavailable on this car since the car's stock ACC is used for longitudinal control.");
QString long_desc = unavailable + " " + \
tr("openpilot longitudinal control may come in a future update.");
if (CP.getExperimentalLongitudinalAvailable()) {
if (is_release) {
long_desc = unavailable + " " + tr("An alpha version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches.");
long_desc = unavailable + " " + tr("An alpha version of openpilot longitudinal control can be tested, along with End-to-End Longitudinal Control, on non-release branches.");
} else {
long_desc = tr("Enable experimental longitudinal control to allow Experimental mode.");
long_desc = tr("Enable experimental longitudinal control to use End-to-End Longitudinal Control.");
}
}
e2e_toggle->setDescription("<b>" + long_desc + "</b><br><br>" + e2e_description);
exp_features["e2e_long"].prepend("<b>" + long_desc + "</b><br><br>");
}
e2e_toggle->refresh();
} else {
e2e_toggle->setDescription(e2e_description);
op_long_toggle->setVisible(false);
}
// set experimental mode toggle description
QString e2e_description = tr("openpilot defaults to driving in <b>chill mode</b>. Experimental mode enables <b>alpha-level features</b> that aren't ready for chill mode. Experimental features are listed below:") + "<br>";
for (const auto& kv : exp_features_headers) {
e2e_description += QString("<h4>%1</h4><br>%2<br>").arg(kv.second).arg(exp_features.value(kv.first));
}
experimental_mode_toggle->setDescription(e2e_description);
}
DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {

@ -188,9 +188,7 @@ ExperimentalButton::ExperimentalButton(QWidget *parent) : experimental_mode(fals
}
void ExperimentalButton::changeMode() {
const auto cp = (*uiState()->sm)["carParams"].getCarParams();
bool can_change = hasLongitudinalControl(cp) && params.getBool("ExperimentalModeConfirmed");
if (can_change) {
if (params.getBool("ExperimentalModeConfirmed")) {
params.putBool("ExperimentalMode", !experimental_mode);
}
}
@ -454,8 +452,10 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
}
// paint path
const bool show_e2e_path = (sm["controlsState"].getControlsState().getExperimentalMode() &&
scene.longitudinal_control);
QLinearGradient bg(0, height(), 0, 0);
if (sm["controlsState"].getControlsState().getExperimentalMode()) {
if (show_e2e_path) {
// The first half of track_vertices are the points for the right side of the path
// and the indices match the positions of accel from uiPlan
const auto &acceleration = sm["uiPlan"].getUiPlan().getAccel();

@ -1083,18 +1083,10 @@ This may take up to a minute.</source>
<source>The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner.</source>
<translation>Die Fahrvisualisierung wechselt bei niedrigen Geschwindigkeiten zur Straßengewandten Weitwinkelkamera, um manche Kurven besser zu zeigen. Außerdem wird das Experimenteller Modus logo oben rechts angezeigt.</translation>
</message>
<message>
<source>Experimental mode is currently unavailable on this car since the car&apos;s stock ACC is used for longitudinal control.</source>
<translation>Der experimentelle Modus ist momentan für dieses Auto nicht verfügbar da es den eingebauten adaptiven Tempomaten des Autos benutzt.</translation>
</message>
<message>
<source>openpilot longitudinal control may come in a future update.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable experimental longitudinal control to allow Experimental mode.</source>
<translation>Aktiviere den experimentellen Openpilot Tempomaten für experimentelle Funktionen.</translation>
</message>
<message>
<source>openpilot Longitudinal Control (Alpha)</source>
<translation type="unfinished"></translation>
@ -1128,7 +1120,23 @@ This may take up to a minute.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An alpha version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches.</source>
<source>End-to-End Longitudinal Control is currently unavailable on this car since the car&apos;s stock ACC is used for longitudinal control.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An alpha version of openpilot longitudinal control can be tested, along with End-to-End Longitudinal Control, on non-release branches.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable experimental longitudinal control to use End-to-End Longitudinal Control.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When navigation has a destination, openpilot will input the map information into the model. This generally improves behavior and allows openpilot to keep left or right appropriately at forks/exits and take turns. Lane change behavior is unchanged and still activated by the driver. This is an alpha quality feature; mistakes should be expected.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Navigate on openpilot</source>
<translation type="unfinished"></translation>
</message>
</context>

@ -1075,18 +1075,10 @@ This may take up to a minute.</source>
<source>The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner.</source>
<translation></translation>
</message>
<message>
<source>Experimental mode is currently unavailable on this car since the car&apos;s stock ACC is used for longitudinal control.</source>
<translation>ACCがアクセル制御を行うため実験モードを利用することができません</translation>
</message>
<message>
<source>openpilot longitudinal control may come in a future update.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable experimental longitudinal control to allow Experimental mode.</source>
<translation>openpilotによるアクセル制御を有効にしてください</translation>
</message>
<message>
<source>openpilot Longitudinal Control (Alpha)</source>
<translation type="unfinished"></translation>
@ -1120,7 +1112,23 @@ This may take up to a minute.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An alpha version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches.</source>
<source>End-to-End Longitudinal Control is currently unavailable on this car since the car&apos;s stock ACC is used for longitudinal control.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An alpha version of openpilot longitudinal control can be tested, along with End-to-End Longitudinal Control, on non-release branches.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable experimental longitudinal control to use End-to-End Longitudinal Control.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When navigation has a destination, openpilot will input the map information into the model. This generally improves behavior and allows openpilot to keep left or right appropriately at forks/exits and take turns. Lane change behavior is unchanged and still activated by the driver. This is an alpha quality feature; mistakes should be expected.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Navigate on openpilot</source>
<translation type="unfinished"></translation>
</message>
</context>

@ -1077,18 +1077,10 @@ This may take up to a minute.</source>
<source>The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner.</source>
<translation> . .</translation>
</message>
<message>
<source>Experimental mode is currently unavailable on this car since the car&apos;s stock ACC is used for longitudinal control.</source>
<translation> ACC가 .</translation>
</message>
<message>
<source>openpilot longitudinal control may come in a future update.</source>
<translation> .</translation>
</message>
<message>
<source>Enable experimental longitudinal control to allow Experimental mode.</source>
<translation> .</translation>
</message>
<message>
<source>openpilot Longitudinal Control (Alpha)</source>
<translation>openpilot ()</translation>
@ -1122,8 +1114,24 @@ This may take up to a minute.</source>
<translation> . openpilot은 . openpilot은 .</translation>
</message>
<message>
<source>An alpha version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches.</source>
<translation>openpilot .</translation>
<source>End-to-End Longitudinal Control is currently unavailable on this car since the car&apos;s stock ACC is used for longitudinal control.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An alpha version of openpilot longitudinal control can be tested, along with End-to-End Longitudinal Control, on non-release branches.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable experimental longitudinal control to use End-to-End Longitudinal Control.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When navigation has a destination, openpilot will input the map information into the model. This generally improves behavior and allows openpilot to keep left or right appropriately at forks/exits and take turns. Lane change behavior is unchanged and still activated by the driver. This is an alpha quality feature; mistakes should be expected.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Navigate on openpilot</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>

@ -1081,18 +1081,10 @@ Isso pode levar até um minuto.</translation>
<source>The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner.</source>
<translation>A visualização da direção fará a transição para a câmera grande angular voltada para a estrada em baixas velocidades para mostrar melhor algumas curvas. O logotipo do modo Experimental também será exibido no canto superior direito.</translation>
</message>
<message>
<source>Experimental mode is currently unavailable on this car since the car&apos;s stock ACC is used for longitudinal control.</source>
<translation>O modo Experimental está atualmente indisponível para este carro que o ACC original do carro é usado para controle longitudinal.</translation>
</message>
<message>
<source>openpilot longitudinal control may come in a future update.</source>
<translation>O controle longitudinal openpilot poderá vir em uma atualização futura.</translation>
</message>
<message>
<source>Enable experimental longitudinal control to allow Experimental mode.</source>
<translation>Ative o controle longitudinal experimental para permitir o modo Experimental.</translation>
</message>
<message>
<source>openpilot Longitudinal Control (Alpha)</source>
<translation>Controle Longitudinal openpilot (Embrionário)</translation>
@ -1126,8 +1118,24 @@ Isso pode levar até um minuto.</translation>
<translation>Neutro é o recomendado. No modo disputa o openpilot seguirá o carro da frente mais de perto e será mais agressivo com a aceleração e frenagem. No modo calmo o openpilot se manterá mais longe do carro da frente.</translation>
</message>
<message>
<source>An alpha version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches.</source>
<translation>Uma versão embrionária do controle longitudinal openpilot pode ser testada em conjunto com o modo Experimental, em branches que não sejam de produção.</translation>
<source>End-to-End Longitudinal Control is currently unavailable on this car since the car&apos;s stock ACC is used for longitudinal control.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An alpha version of openpilot longitudinal control can be tested, along with End-to-End Longitudinal Control, on non-release branches.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable experimental longitudinal control to use End-to-End Longitudinal Control.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When navigation has a destination, openpilot will input the map information into the model. This generally improves behavior and allows openpilot to keep left or right appropriately at forks/exits and take turns. Lane change behavior is unchanged and still activated by the driver. This is an alpha quality feature; mistakes should be expected.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Navigate on openpilot</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>

@ -1075,18 +1075,10 @@ This may take up to a minute.</source>
<source>The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner.</source>
<translation>广便</translation>
</message>
<message>
<source>Experimental mode is currently unavailable on this car since the car&apos;s stock ACC is used for longitudinal control.</source>
<translation>使ACC纵向控制使</translation>
</message>
<message>
<source>openpilot longitudinal control may come in a future update.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable experimental longitudinal control to allow Experimental mode.</source>
<translation>便使</translation>
</message>
<message>
<source>openpilot Longitudinal Control (Alpha)</source>
<translation type="unfinished"></translation>
@ -1120,7 +1112,23 @@ This may take up to a minute.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An alpha version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches.</source>
<source>End-to-End Longitudinal Control is currently unavailable on this car since the car&apos;s stock ACC is used for longitudinal control.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An alpha version of openpilot longitudinal control can be tested, along with End-to-End Longitudinal Control, on non-release branches.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable experimental longitudinal control to use End-to-End Longitudinal Control.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When navigation has a destination, openpilot will input the map information into the model. This generally improves behavior and allows openpilot to keep left or right appropriately at forks/exits and take turns. Lane change behavior is unchanged and still activated by the driver. This is an alpha quality feature; mistakes should be expected.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Navigate on openpilot</source>
<translation type="unfinished"></translation>
</message>
</context>

@ -1077,18 +1077,10 @@ This may take up to a minute.</source>
<source>The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner.</source>
<translation></translation>
</message>
<message>
<source>Experimental mode is currently unavailable on this car since the car&apos;s stock ACC is used for longitudinal control.</source>
<translation>使ACC系統</translation>
</message>
<message>
<source>openpilot longitudinal control may come in a future update.</source>
<translation>openpilot </translation>
</message>
<message>
<source>Enable experimental longitudinal control to allow Experimental mode.</source>
<translation>使</translation>
</message>
<message>
<source>openpilot Longitudinal Control (Alpha)</source>
<translation>openpilot (Alpha )</translation>
@ -1122,8 +1114,24 @@ This may take up to a minute.</source>
<translation>使openpilot openpilot </translation>
</message>
<message>
<source>An alpha version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches.</source>
<translation> (release) openpilot Alpha </translation>
<source>End-to-End Longitudinal Control is currently unavailable on this car since the car&apos;s stock ACC is used for longitudinal control.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An alpha version of openpilot longitudinal control can be tested, along with End-to-End Longitudinal Control, on non-release branches.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable experimental longitudinal control to use End-to-End Longitudinal Control.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When navigation has a destination, openpilot will input the map information into the model. This generally improves behavior and allows openpilot to keep left or right appropriately at forks/exits and take turns. Lane change behavior is unchanged and still activated by the driver. This is an alpha quality feature; mistakes should be expected.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Navigate on openpilot</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>

Loading…
Cancel
Save