diff --git a/cereal/custom.capnp b/cereal/custom.capnp index 0afe048e2a..db5b2119bb 100644 --- a/cereal/custom.capnp +++ b/cereal/custom.capnp @@ -211,8 +211,7 @@ struct CarControlSP @0xb86e6369214c01c8 { cruiseButton @1 :Int16; finalSpeedKph @2 :Float32; targetSpeed @3 :Float32; - vSetDis @4 :Float32; - buttonType @5 :Int16; + vCruise @4 :Float32; enum ButtonControlState { inactive @0; # No button press or default state diff --git a/selfdrive/car/card.py b/selfdrive/car/card.py index 1962ffa1a3..105e6891a5 100755 --- a/selfdrive/car/card.py +++ b/selfdrive/car/card.py @@ -189,6 +189,8 @@ class Car: car_control_sp_send = messaging.new_message('carControlSP') car_control_sp_send.valid = self.sm.all_checks(['carControl']) + if not self.CP.pcmCruiseSpeed: + car_control_sp_send.CustomStockLongitudinalControl = self.custom_stock_longitudinal_controller.state_publish() self.pm.send('carControlSP', car_control_sp_send) def step(self): diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 9f60e284bb..4e8f7203c1 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -288,8 +288,6 @@ class CarInterface(CarInterfaceBase): if self.CS.params_list.hyundai_radar_tracks_available and not self.CS.params_list.hyundai_radar_tracks_available_cache: events.add(car.CarEvent.EventName.hyundaiRadarTracksAvailable) - ret.customStockLong = self.update_custom_stock_long() - ret.events = events.to_msg() return ret diff --git a/selfdrive/controls/lib/sunnypilot/custom_stock_longitudinal_controller/controllers.py b/selfdrive/controls/lib/sunnypilot/custom_stock_longitudinal_controller/controllers.py index 148d2f2965..0f50d811a4 100644 --- a/selfdrive/controls/lib/sunnypilot/custom_stock_longitudinal_controller/controllers.py +++ b/selfdrive/controls/lib/sunnypilot/custom_stock_longitudinal_controller/controllers.py @@ -54,6 +54,14 @@ class CustomStockLongitudinalControllerBase(ABC): ButtonControlState.loading: LoadingState(), } + def state_publish(self): + customStockLongitudinalControl = custom.CarControlSP.CustomStockLongitudinalControl.new_message() + customStockLongitudinalControl.state = self.button_state + customStockLongitudinalControl.cruiseButton = 0 if self.cruise_button is None else int(self.cruise_button) + customStockLongitudinalControl.finalSpeedKph = float(self.final_speed_kph) + customStockLongitudinalControl.targetSpeed = float(self.target_speed) + customStockLongitudinalControl.vCruise = float(self.v_cruise) + def get_set_speed_buttons(self, CS: car.CarState) -> bool: return any(be.type in self.set_speed_buttons for be in CS.out.buttonEvents)