We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d41d8c3 commit 2f973f6Copy full SHA for 2f973f6
opendbc/safety/safety/safety_body.h
@@ -30,11 +30,9 @@ static bool body_tx_hook(const CANPacket_t *to_send) {
30
}
31
32
static safety_config body_init(uint16_t param) {
33
- // TODO: double check these
34
static RxCheck body_rx_checks[] = {
35
- {.msg = {{0x201, 0, 8, .ignore_checksum = true, .ignore_counter = true, .frequency = 100U}, { 0 }, { 0 }}},
36
- {.msg = {{0x250, 0, 6, .ignore_checksum = true, .ignore_counter = true, .frequency = 100U}, { 0 }, { 0 }}},
37
- {.msg = {{0x350, 0, 6, .ignore_checksum = true, .ignore_counter = true, .frequency = 100U}, { 0 }, { 0 }}},
+ {.msg = {{0x201, 0, 8, .ignore_checksum = true, .ignore_counter = true, .frequency = 100U}, { 0 }, { 0 }}}, // MOTORS_DATA
+ {.msg = {{0x203, 0, 4, .ignore_checksum = true, .ignore_counter = true, .frequency = 1U}, { 0 }, { 0 }}}, // BODY_DATA
38
};
39
40
static const CanMsg BODY_TX_MSGS[] = {{0x250, 0, 8, false}, {0x250, 0, 6, false}, {0x251, 0, 5, false}, // body
opendbc/safety/tests/test_body.py
@@ -22,6 +22,9 @@ def _motors_data_msg(self, speed_l, speed_r):
22
values = {"SPEED_L": speed_l, "SPEED_R": speed_r}
23
return self.packer.make_can_msg_panda("MOTORS_DATA", 0, values)
24
25
+ def _body_data_msg(self):
26
+ return self.packer.make_can_msg_panda("BODY_DATA", 0, {})
27
+
28
def _torque_cmd_msg(self, torque_l, torque_r):
29
values = {"TORQUE_L": torque_l, "TORQUE_R": torque_r}
return self.packer.make_can_msg_panda("TORQUE_CMD", 0, values)
@@ -39,7 +42,7 @@ def test_rx_hook(self):
42
self.assertFalse(self.safety.get_vehicle_moving())
43
41
44
# controls allowed when we get MOTORS_DATA message
- self.assertTrue(self._rx(self._torque_cmd_msg(0, 0)))
45
+ self.assertTrue(self._rx(self._body_data_msg()))
46
self.assertTrue(self.safety.get_vehicle_moving()) # always moving
47
self.assertFalse(self.safety.get_controls_allowed())
48
0 commit comments