remove uiPlan (#32721)

* remove uiPlan from ui

* remove publishing

* Update log.capnp

* Update services.py

* no uiPlan here

* Update ref_commit
pull/32724/head
Shane Smiskol 11 months ago committed by GitHub
parent 0bdab82423
commit 684209e077
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      cereal/log.capnp
  2. 1
      cereal/services.py
  3. 14
      selfdrive/controls/plannerd.py
  4. 2
      selfdrive/test/process_replay/process_replay.py
  5. 2
      selfdrive/test/process_replay/ref_commit
  6. 5
      selfdrive/ui/qt/onroad/annotated_camera.cc
  7. 19
      selfdrive/ui/ui.cc
  8. 3
      selfdrive/ui/ui.h

@ -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;
}
}

@ -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),

@ -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()

@ -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"),

@ -1 +1 @@
0ba779ec9f624872b1d038acb15095b726ff8983
6438bd5edad674c2de3c7e2d126271cb2576383d

@ -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<int>(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) {

@ -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<SubMaster, const std::initializer_list<const char *>>({
"modelV2", "controlsState", "liveCalibration", "radarState", "deviceState",
"pandaStates", "carParams", "driverMonitoringState", "carState", "liveLocationKalman", "driverStateV2",
"wideRoadCameraState", "managerState", "navInstruction", "navRoute", "uiPlan", "clocks",
"wideRoadCameraState", "managerState", "navInstruction", "navRoute", "clocks",
});
Params params;

@ -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,

Loading…
Cancel
Save