diff --git a/cereal/log.capnp b/cereal/log.capnp index 36ca692dcc..67c6f836a4 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -2244,7 +2244,6 @@ struct Event { carControl @23 :Car.CarControl; carOutput @127 :Car.CarOutput; longitudinalPlan @24 :LongitudinalPlan; - uiPlan @106 :UiPlan; ubloxGnss @34 :UbloxGnss; ubloxRaw @39 :Data; qcomGnss @31 :QcomGnss; @@ -2365,5 +2364,6 @@ struct Event { sensorEventsDEPRECATED @11 :List(SensorEventData); lateralPlanDEPRECATED @64 :LateralPlan; navModelDEPRECATED @104 :NavModelData; + uiPlanDEPRECATED @106 :UiPlan; } } diff --git a/cereal/services.py b/cereal/services.py index 2ab28f6d52..ca9139c431 100755 --- a/cereal/services.py +++ b/cereal/services.py @@ -66,7 +66,6 @@ _services: dict[str, tuple] = { "navInstruction": (True, 1., 10), "navRoute": (True, 0.), "navThumbnail": (True, 0.), - "uiPlan": (True, 20., 40.), "qRoadEncodeIdx": (False, 20.), "userFlag": (True, 0., 1), "microphone": (True, 10., 10), diff --git a/selfdrive/controls/plannerd.py b/selfdrive/controls/plannerd.py index eeeeda050e..681518be19 100755 --- a/selfdrive/controls/plannerd.py +++ b/selfdrive/controls/plannerd.py @@ -6,16 +6,6 @@ from openpilot.common.swaglog import cloudlog from openpilot.selfdrive.controls.lib.longitudinal_planner import LongitudinalPlanner import cereal.messaging as messaging -def publish_ui_plan(sm, pm, longitudinal_planner): - ui_send = messaging.new_message('uiPlan') - ui_send.valid = sm.all_checks(service_list=['carState', 'controlsState', 'modelV2']) - uiPlan = ui_send.uiPlan - uiPlan.frameId = sm['modelV2'].frameId - uiPlan.position.x = list(sm['modelV2'].position.x) - uiPlan.position.y = list(sm['modelV2'].position.y) - uiPlan.position.z = list(sm['modelV2'].position.z) - uiPlan.accel = longitudinal_planner.a_desired_trajectory_full.tolist() - pm.send('uiPlan', ui_send) def plannerd_thread(): config_realtime_process(5, Priority.CTRL_LOW) @@ -27,7 +17,7 @@ def plannerd_thread(): cloudlog.info("plannerd got CarParams: %s", CP.carName) longitudinal_planner = LongitudinalPlanner(CP) - pm = messaging.PubMaster(['longitudinalPlan', 'uiPlan']) + pm = messaging.PubMaster(['longitudinalPlan']) sm = messaging.SubMaster(['carControl', 'carState', 'controlsState', 'radarState', 'modelV2'], poll='modelV2', ignore_avg_freq=['radarState']) @@ -36,7 +26,7 @@ def plannerd_thread(): if sm.updated['modelV2']: longitudinal_planner.update(sm) longitudinal_planner.publish(sm, pm) - publish_ui_plan(sm, pm, longitudinal_planner) + def main(): plannerd_thread() diff --git a/selfdrive/test/process_replay/process_replay.py b/selfdrive/test/process_replay/process_replay.py index 739efcb985..a55396002b 100755 --- a/selfdrive/test/process_replay/process_replay.py +++ b/selfdrive/test/process_replay/process_replay.py @@ -505,7 +505,7 @@ CONFIGS = [ ProcessConfig( proc_name="plannerd", pubs=["modelV2", "carControl", "carState", "controlsState", "radarState"], - subs=["longitudinalPlan", "uiPlan"], + subs=["longitudinalPlan"], ignore=["logMonoTime", "longitudinalPlan.processingDelay", "longitudinalPlan.solverExecutionTime"], init_callback=get_car_params_callback, should_recv_callback=FrequencyBasedRcvCallback("modelV2"), diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index eaf61ccb81..227202839f 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -0ba779ec9f624872b1d038acb15095b726ff8983 +6438bd5edad674c2de3c7e2d126271cb2576383d diff --git a/selfdrive/ui/qt/onroad/annotated_camera.cc b/selfdrive/ui/qt/onroad/annotated_camera.cc index f7fb6b480f..241bb6ed34 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.cc +++ b/selfdrive/ui/qt/onroad/annotated_camera.cc @@ -235,8 +235,7 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { QLinearGradient bg(0, height(), 0, 0); if (sm["controlsState"].getControlsState().getExperimentalMode()) { // 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(); + const auto &acceleration = sm["modelV2"].getModelV2().getAcceleration().getX(); const int max_len = std::min(scene.track_vertices.length() / 2, acceleration.size()); for (int i = 0; i < max_len; ++i) { @@ -403,7 +402,7 @@ void AnnotatedCameraWidget::paintGL() { painter.setPen(Qt::NoPen); if (s->scene.world_objects_visible) { - update_model(s, model, sm["uiPlan"].getUiPlan()); + update_model(s, model); drawLaneLines(painter, s); if (s->scene.longitudinal_control && sm.rcv_frame("radarState") > s->scene.started_frame) { diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index c70b7594c9..06b8b13bc1 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -77,14 +77,10 @@ void update_line_data(const UIState *s, const cereal::XYZTData::Reader &line, } void update_model(UIState *s, - const cereal::ModelDataV2::Reader &model, - const cereal::UiPlan::Reader &plan) { + const cereal::ModelDataV2::Reader &model) { UIScene &scene = s->scene; - auto plan_position = plan.getPosition(); - if (plan_position.getX().size() < model.getPosition().getX().size()) { - plan_position = model.getPosition(); - } - float max_distance = std::clamp(*(plan_position.getX().end() - 1), + auto model_position = model.getPosition(); + float max_distance = std::clamp(*(model_position.getX().end() - 1), MIN_DRAW_DISTANCE, MAX_DRAW_DISTANCE); // update lane lines @@ -110,8 +106,8 @@ void update_model(UIState *s, const float lead_d = lead_one.getDRel() * 2.; max_distance = std::clamp((float)(lead_d - fmin(lead_d * 0.35, 10.)), 0.0f, max_distance); } - max_idx = get_path_length_idx(plan_position, max_distance); - update_line_data(s, plan_position, 0.9, 1.22, &scene.track_vertices, max_idx, false); + max_idx = get_path_length_idx(model_position, max_distance); + update_line_data(s, model_position, 0.9, 1.22, &scene.track_vertices, max_idx, false); } void update_dmonitoring(UIState *s, const cereal::DriverStateV2::Reader &driverstate, float dm_fade_state, bool is_rhd) { @@ -212,8 +208,7 @@ static void update_state(UIState *s) { scene.world_objects_visible = scene.world_objects_visible || (scene.started && sm.rcv_frame("liveCalibration") > scene.started_frame && - sm.rcv_frame("modelV2") > scene.started_frame && - sm.rcv_frame("uiPlan") > scene.started_frame); + sm.rcv_frame("modelV2") > scene.started_frame); } void ui_update_params(UIState *s) { @@ -249,7 +244,7 @@ UIState::UIState(QObject *parent) : QObject(parent) { sm = std::make_unique>({ "modelV2", "controlsState", "liveCalibration", "radarState", "deviceState", "pandaStates", "carParams", "driverMonitoringState", "carState", "liveLocationKalman", "driverStateV2", - "wideRoadCameraState", "managerState", "navInstruction", "navRoute", "uiPlan", "clocks", + "wideRoadCameraState", "managerState", "navInstruction", "navRoute", "clocks", }); Params params; diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 7238159dda..9ef79b2eff 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -184,8 +184,7 @@ Device *device(); void ui_update_params(UIState *s); int get_path_length_idx(const cereal::XYZTData::Reader &line, const float path_height); void update_model(UIState *s, - const cereal::ModelDataV2::Reader &model, - const cereal::UiPlan::Reader &plan); + const cereal::ModelDataV2::Reader &model); void update_dmonitoring(UIState *s, const cereal::DriverStateV2::Reader &driverstate, float dm_fade_state, bool is_rhd); void update_leads(UIState *s, const cereal::RadarState::Reader &radar_state, const cereal::XYZTData::Reader &line); void update_line_data(const UIState *s, const cereal::XYZTData::Reader &line,