publish experimental mode state (#26512)

* publish experimental mode state

* remove that
pull/26513/head
Adeeb Shihadeh 2 years ago committed by GitHub
parent 2ad9a4f95a
commit 9c96b21367
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cereal
  2. 1
      selfdrive/controls/controlsd.py
  3. 8
      selfdrive/ui/qt/onroad.cc
  4. 1
      selfdrive/ui/ui.cc
  5. 2
      selfdrive/ui/ui.h

@ -1 +1 @@
Subproject commit afafa0a2a537d775842ab2e1bf20cb9a33b34f9a Subproject commit 3bae09cf6527674d7eda3a9956242aad94a8f3d2

@ -777,6 +777,7 @@ class Controls:
controlsState.startMonoTime = int(start_time * 1e9) controlsState.startMonoTime = int(start_time * 1e9)
controlsState.forceDecel = bool(force_decel) controlsState.forceDecel = bool(force_decel)
controlsState.canErrorCounter = self.can_rcv_timeout_counter controlsState.canErrorCounter = self.can_rcv_timeout_counter
controlsState.experimentalMode = self.params.get_bool("ExperimentalMode") and self.CP.openpilotLongitudinalControl
lat_tuning = self.CP.lateralTuning.which() lat_tuning = self.CP.lateralTuning.which()
if self.joystick_mode: if self.joystick_mode:

@ -446,6 +446,8 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
painter.save(); painter.save();
const UIScene &scene = s->scene; const UIScene &scene = s->scene;
SubMaster &sm = *(s->sm);
// lanelines // lanelines
for (int i = 0; i < std::size(scene.lane_line_vertices); ++i) { for (int i = 0; i < std::size(scene.lane_line_vertices); ++i) {
painter.setBrush(QColor::fromRgbF(1.0, 1.0, 1.0, std::clamp<float>(scene.lane_line_probs[i], 0.0, 0.7))); painter.setBrush(QColor::fromRgbF(1.0, 1.0, 1.0, std::clamp<float>(scene.lane_line_probs[i], 0.0, 0.7)));
@ -461,8 +463,8 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
// paint path // paint path
QLinearGradient bg(0, height(), 0, height() / 4); QLinearGradient bg(0, height(), 0, height() / 4);
float start_hue, end_hue; float start_hue, end_hue;
if (scene.experimental_mode) { if (sm["controlsState"].getControlsState().getExperimentalMode()) {
const auto &acceleration = (*s->sm)["modelV2"].getModelV2().getAcceleration(); const auto &acceleration = sm["modelV2"].getModelV2().getAcceleration();
float acceleration_future = 0; float acceleration_future = 0;
if (acceleration.getZ().size() > 16) { if (acceleration.getZ().size() > 16) {
acceleration_future = acceleration.getX()[16]; // 2.5 seconds acceleration_future = acceleration.getX()[16]; // 2.5 seconds
@ -555,7 +557,7 @@ void AnnotatedCameraWidget::paintGL() {
} else if (v_ego > 15) { } else if (v_ego > 15) {
wide_cam_requested = false; wide_cam_requested = false;
} }
wide_cam_requested = wide_cam_requested && s->scene.experimental_mode; wide_cam_requested = wide_cam_requested && sm["controlsState"].getControlsState().getExperimentalMode();
// TODO: also detect when ecam vision stream isn't available // TODO: also detect when ecam vision stream isn't available
// for replay of old routes, never go to widecam // for replay of old routes, never go to widecam
wide_cam_requested = wide_cam_requested && s->scene.calibration_wide_valid; wide_cam_requested = wide_cam_requested && s->scene.calibration_wide_valid;

@ -174,7 +174,6 @@ void ui_update_params(UIState *s) {
auto params = Params(); auto params = Params();
s->scene.is_metric = params.getBool("IsMetric"); s->scene.is_metric = params.getBool("IsMetric");
s->scene.map_on_left = params.getBool("NavSettingLeftSide"); s->scene.map_on_left = params.getBool("NavSettingLeftSide");
s->scene.experimental_mode = params.getBool("ExperimentalMode");
} }
void UIState::updateStatus() { void UIState::updateStatus() {

@ -104,7 +104,7 @@ typedef struct UIScene {
QPointF lead_vertices[2]; QPointF lead_vertices[2];
float light_sensor; float light_sensor;
bool started, ignition, is_metric, map_on_left, longitudinal_control, experimental_mode; bool started, ignition, is_metric, map_on_left, longitudinal_control;
uint64_t started_frame; uint64_t started_frame;
} UIScene; } UIScene;

Loading…
Cancel
Save