Skip to content

Commit

Permalink
card: vcruise all in one place (#34387)
Browse files Browse the repository at this point in the history
* no reason to not be here

* oh this was off by a frame!

* ref
  • Loading branch information
sshane authored Jan 15, 2025
1 parent a1d81e6 commit 3d38b13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions selfdrive/car/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,11 @@ def state_update(self) -> tuple[car.CarState, structs.RadarDataT | None]:
if can_rcv_valid and REPLAY:
self.can_log_mono_time = messaging.log_from_bytes(can_strs[0]).logMonoTime

# TODO: mirror the carState.cruiseState struct?
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:
self.v_cruise_helper.initialize_v_cruise(CS, self.experimental_mode)

# TODO: mirror the carState.cruiseState struct?
CS.vCruise = float(self.v_cruise_helper.v_cruise_kph)
CS.vCruiseCluster = float(self.v_cruise_helper.v_cruise_cluster_kph)

Expand Down Expand Up @@ -238,9 +241,6 @@ def controls_update(self, CS: car.CarState, CC: car.CarControl):
def step(self):
CS, RD = self.state_update()

if self.sm['carControl'].enabled and not self.CC_prev.enabled:
self.v_cruise_helper.initialize_v_cruise(CS, self.experimental_mode)

self.state_publish(CS, RD)

initialized = (not any(e.name == EventName.selfdriveInitializing for e in self.sm['onroadEvents']) and
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/test/process_replay/ref_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f74fe264ab57d6698a4eb550a5769c46f3d03021
9758f1868c1c07d5a8d294f19bf6bf7b8b1beeda

0 comments on commit 3d38b13

Please sign in to comment.