body: add crc and counter (#24120)

* add crc and counter for body

* add msg

* move counter

* whitespace

* ..

* bump opendbc

* update_refs
old-commit-hash: 7df1c025ae
taco
Igor Biletskyy 3 years ago committed by GitHub
parent 0b36e75d20
commit c64fd227ef
  1. 2
      opendbc
  2. 5
      selfdrive/car/body/bodycan.py
  3. 4
      selfdrive/car/body/carcontroller.py
  4. 7
      selfdrive/car/body/carstate.py
  5. 2
      selfdrive/test/process_replay/ref_commit

@ -1 +1 @@
Subproject commit 08b1564ba9dac2d9748ab8610f90cf98cb581baa
Subproject commit cc45cc1bc045a98d12ffdfd9923b23ead9638b87

@ -1,8 +1,9 @@
def create_control(packer, torque_l, torque_r):
def create_control(packer, torque_l, torque_r, idx):
can_bus = 0
values = {
"TORQUE_L": torque_l,
"TORQUE_R": torque_r,
}
return packer.make_can_msg("TORQUE_CMD", can_bus, values)
return packer.make_can_msg("TORQUE_CMD", can_bus, values, idx)

@ -14,6 +14,7 @@ MAX_TURN_INTEGRATOR = 0.1 # meters
class CarController():
def __init__(self, dbc_name, CP, VM):
self.frame = 0
self.packer = CANPacker(dbc_name)
self.i_speed = 0
@ -102,10 +103,11 @@ class CarController():
# ///////////////////////////////////////
can_sends = []
can_sends.append(bodycan.create_control(self.packer, torque_l, torque_r))
can_sends.append(bodycan.create_control(self.packer, torque_l, torque_r, self.frame // 2))
new_actuators = CC.actuators.copy()
new_actuators.accel = torque_l
new_actuators.steer = torque_r
self.frame += 1
return new_actuators, can_sends

@ -38,10 +38,13 @@ class CarState(CarStateBase):
("SPEED_R", "MOTORS_DATA"),
("ELEC_ANGLE_L", "MOTORS_DATA"),
("ELEC_ANGLE_R", "MOTORS_DATA"),
("MOTOR_ERR_L", "MOTORS_DATA"),
("MOTOR_ERR_R", "MOTORS_DATA"),
("COUNTER", "MOTORS_DATA"),
("CHECKSUM", "MOTORS_DATA"),
("IGNITION", "VAR_VALUES"),
("ENABLE_MOTORS", "VAR_VALUES"),
("FAULT", "VAR_VALUES"),
("MOTOR_ERR_L", "VAR_VALUES"),
("MOTOR_ERR_R", "VAR_VALUES"),
("MCU_TEMP", "BODY_DATA"),
("BATT_VOLTAGE", "BODY_DATA"),
]

@ -1 +1 @@
f6c93d48d14fa7be45961f7325a7957f53126671
594f0e291d2a9720c854f6d0f074b7734ed3c741
Loading…
Cancel
Save