mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-22 14:32:07 +08:00
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:
+1
-1
Submodule opendbc updated: 08b1564ba9...cc45cc1bc0
@@ -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
|
||||
Reference in New Issue
Block a user