Skip to content

Commit

Permalink
MSPA: lateralPlanSP legacy support (commaai#274)
Browse files Browse the repository at this point in the history
* MSPA: `lateralPlanSP` legacy support

* bump cereal
  • Loading branch information
sunnyhaibin authored Feb 2, 2024
1 parent 8f0b4c4 commit fbabd57
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cereal
4 changes: 2 additions & 2 deletions selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(self, CI=None):
self.sm = messaging.SubMaster(['deviceState', 'pandaStates', 'peripheralState', 'modelV2', 'liveCalibration',
'driverMonitoringState', 'longitudinalPlan', 'lateralPlan', 'liveLocationKalman',
'managerState', 'liveParameters', 'radarState', 'liveTorqueParameters',
'testJoystick', 'longitudinalPlanSP', 'lateralPlanSP'] + self.camera_packets + self.sensor_packets,
'testJoystick', 'longitudinalPlanSP', 'lateralPlanSPDEPRECATED'] + self.camera_packets + self.sensor_packets,
ignore_alive=ignore, ignore_avg_freq=['radarState', 'testJoystick'])

if CI is None:
Expand Down Expand Up @@ -299,7 +299,7 @@ def update_events(self, CS):
lane_change_set_timer = int(self.params.get("AutoLaneChangeTimer", encoding="utf8"))
if self.sm['lateralPlan'].laneChangeState == LaneChangeState.preLaneChange:
direction = self.sm['lateralPlan'].laneChangeDirection
lc_prev = self.sm['lateralPlanSP'].laneChangePrev
lc_prev = self.sm['lateralPlanSPDEPRECATED'].laneChangePrev
if (CS.leftBlindspot and direction == LaneChangeDirection.left) or \
(CS.rightBlindspot and direction == LaneChangeDirection.right):
self.events.add(EventName.laneChangeBlocked)
Expand Down
12 changes: 6 additions & 6 deletions selfdrive/controls/lib/lateral_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ def publish(self, sm, pm):

pm.send('lateralPlan', plan_send)

plan_sp_send = messaging.new_message('lateralPlanSP')
plan_sp_send = messaging.new_message('lateralPlanSPDEPRECATED')
plan_sp_send.valid = sm.all_checks(service_list=['carState', 'controlsState', 'modelV2'])

lateralPlanSP = plan_sp_send.lateralPlanSP
lateralPlanSP.laneChangePrev = self.DH.prev_lane_change
lateralPlanSPDEPRECATED = plan_sp_send.lateralPlanSPDEPRECATED
lateralPlanSPDEPRECATED.laneChangePrev = self.DH.prev_lane_change

lateralPlanSP.dPathWLinesX = [float(x) for x in self.d_path_w_lines_xyz[:, 0]]
lateralPlanSP.dPathWLinesY = [float(y) for y in self.d_path_w_lines_xyz[:, 1]]
lateralPlanSPDEPRECATED.dPathWLinesX = [float(x) for x in self.d_path_w_lines_xyz[:, 0]]
lateralPlanSPDEPRECATED.dPathWLinesY = [float(y) for y in self.d_path_w_lines_xyz[:, 1]]

pm.send('lateralPlanSP', plan_sp_send)
pm.send('lateralPlanSPDEPRECATED', plan_sp_send)
2 changes: 1 addition & 1 deletion selfdrive/controls/plannerd.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def plannerd_thread():
longitudinal_planner = LongitudinalPlanner(CP)
lateral_planner = LateralPlanner(CP, debug=debug_mode)

pm = messaging.PubMaster(['longitudinalPlan', 'lateralPlan', 'uiPlan', 'longitudinalPlanSP', 'lateralPlanSP'])
pm = messaging.PubMaster(['longitudinalPlan', 'lateralPlan', 'uiPlan', 'longitudinalPlanSP', 'lateralPlanSPDEPRECATED'])
sm = messaging.SubMaster(['carControl', 'carState', 'controlsState', 'radarState', 'modelV2'],
poll=['radarState', 'modelV2'], ignore_avg_freq=['radarState'])

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/debug/cycle_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def cycle_alerts(duration=200, is_metric=False):
CP = CarInterface.get_non_essential_params("HONDA CIVIC 2016")
sm = messaging.SubMaster(['deviceState', 'pandaStates', 'roadCameraState', 'modelV2', 'liveCalibration',
'driverMonitoringState', 'longitudinalPlan', 'lateralPlan', 'liveLocationKalman',
'managerState', 'longitudinalPlanSP', 'lateralPlanSP',
'managerState', 'longitudinalPlanSP', 'lateralPlanSPDEPRECATED',
'driverMonitoringStateSP'] + cameras)

pm = messaging.PubMaster(['controlsState', 'pandaStates', 'deviceState'])
Expand Down

0 comments on commit fbabd57

Please sign in to comment.