body: add crc and counter (#24120)

* add crc and counter for body

* add msg

* move counter

* whitespace

* ..

* bump opendbc

* update_refs
This commit is contained in:
Igor Biletskyy
2022-04-04 19:19:30 -07:00
committed by GitHub
parent 468f0efbef
commit 7df1c025ae
5 changed files with 13 additions and 7 deletions
+1 -1
Submodule opendbc updated: 08b1564ba9...cc45cc1bc0
+3 -2
View File
@@ -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)
+3 -1
View File
@@ -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
+5 -2
View File
@@ -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
View File
@@ -1 +1 @@
f6c93d48d14fa7be45961f7325a7957f53126671
594f0e291d2a9720c854f6d0f074b7734ed3c741