Skip to content

Commit

Permalink
card: remove old canRcvtimeout field (#32650)
Browse files Browse the repository at this point in the history
* card: remove old canRcvtimeout field

* deprecate
  • Loading branch information
adeebshihadeh authored Jun 8, 2024
1 parent 2bad3c2 commit b42b156
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cereal/car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ struct CarState {
canValid @26 :Bool; # invalid counter/checksums
canTimeout @40 :Bool; # CAN bus dropped out
canErrorCounter @48 :UInt32;
canRcvTimeout @49 :Bool;

# car speed
vEgo @1 :Float32; # best estimate of speed
Expand Down Expand Up @@ -282,6 +281,7 @@ struct CarState {
brakeLightsDEPRECATED @19 :Bool;
steeringRateLimitedDEPRECATED @29 :Bool;
canMonoTimesDEPRECATED @12: List(UInt64);
canRcvTimeoutDEPRECATED @49 :Bool;
}

# ******* radar state @ 20hz *******
Expand Down
9 changes: 1 addition & 8 deletions selfdrive/car/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def __init__(self, CI=None):
self.sm = messaging.SubMaster(['pandaStates', 'carControl', 'onroadEvents'])
self.pm = messaging.PubMaster(['sendcan', 'carState', 'carParams', 'carOutput'])

self.can_rcv_timeout_counter = 0 # consecutive timeout count
self.can_rcv_cum_timeout_counter = 0 # cumulative timeout count
self.can_rcv_cum_timeout_counter = 0

self.CC_prev = car.CarControl.new_message()
self.CS_prev = car.CarState.new_message()
Expand Down Expand Up @@ -96,12 +95,7 @@ def state_update(self) -> car.CarState:

# Check for CAN timeout
if not can_rcv_valid:
self.can_rcv_timeout_counter += 1
self.can_rcv_cum_timeout_counter += 1
else:
self.can_rcv_timeout_counter = 0

self.can_rcv_timeout = self.can_rcv_timeout_counter >= 5

if can_rcv_valid and REPLAY:
self.can_log_mono_time = messaging.log_from_bytes(can_strs[0]).logMonoTime
Expand Down Expand Up @@ -141,7 +135,6 @@ def state_publish(self, CS: car.CarState):
cs_send = messaging.new_message('carState')
cs_send.valid = CS.canValid
cs_send.carState = CS
cs_send.carState.canRcvTimeout = self.can_rcv_timeout
cs_send.carState.canErrorCounter = self.can_rcv_cum_timeout_counter
cs_send.carState.cumLagMs = -self.rk.remaining * 1000.
self.pm.send('carState', cs_send)
Expand Down

0 comments on commit b42b156

Please sign in to comment.