card: fix cruise speed initialization w/ buttons (#34386)

* fix initialize w/ buttons

* what

* comment
pull/34391/head
Shane Smiskol 3 months ago committed by GitHub
parent b3fc407538
commit 38fad751cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      selfdrive/car/card.py

@ -72,6 +72,7 @@ class Car:
self.can_rcv_cum_timeout_counter = 0 self.can_rcv_cum_timeout_counter = 0
self.CC_prev = car.CarControl.new_message() self.CC_prev = car.CarControl.new_message()
self.CS_prev = car.CarState.new_message()
self.initialized_prev = False self.initialized_prev = False
self.last_actuators_output = structs.CarControl.Actuators() self.last_actuators_output = structs.CarControl.Actuators()
@ -182,7 +183,8 @@ class Car:
self.v_cruise_helper.update_v_cruise(CS, self.sm['carControl'].enabled, self.is_metric) self.v_cruise_helper.update_v_cruise(CS, self.sm['carControl'].enabled, self.is_metric)
if self.sm['carControl'].enabled and not self.CC_prev.enabled: if self.sm['carControl'].enabled and not self.CC_prev.enabled:
self.v_cruise_helper.initialize_v_cruise(CS, self.experimental_mode) # Use CarState w/ buttons from the step selfdrived enables on
self.v_cruise_helper.initialize_v_cruise(self.CS_prev, self.experimental_mode)
# TODO: mirror the carState.cruiseState struct? # TODO: mirror the carState.cruiseState struct?
CS.vCruise = float(self.v_cruise_helper.v_cruise_kph) CS.vCruise = float(self.v_cruise_helper.v_cruise_kph)
@ -249,6 +251,7 @@ class Car:
self.controls_update(CS, self.sm['carControl']) self.controls_update(CS, self.sm['carControl'])
self.initialized_prev = initialized self.initialized_prev = initialized
self.CS_prev = CS
def params_thread(self, evt): def params_thread(self, evt):
while not evt.is_set(): while not evt.is_set():

Loading…
Cancel
Save