mirror of https://github.com/commaai/panda.git
VW MQB: Updated message and signal data, round 1 (#632)
* EPS_01 -> LH_EPS_03
* Bump openpilot commit ref
* made echo test more stable
* update python to 3.8.5
* Revert "Bump openpilot commit ref"
This reverts commit 75ec1a0c
* Bump openpilot commit ref
* Bump openpilot commit ref
* Update Dockerfile.panda
* fixed torque signal name
* Signal naming fix, round 2
* fix CI
Co-authored-by: Robbe Derks <robbe.derks@gmail.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
This commit is contained in:
parent
f3cf165be0
commit
9108b82fb0
|
@ -57,7 +57,7 @@ jobs:
|
|||
run: |
|
||||
$RUN "cd /tmp/openpilot && \
|
||||
scons -c && \
|
||||
scons -j$(nproc) opendbc/ cereal/ && \
|
||||
scons -j$(nproc) -i opendbc/ cereal/ && \
|
||||
cd panda/tests/safety && \
|
||||
./test.sh"
|
||||
|
||||
|
|
|
@ -63,12 +63,12 @@ RUN cd /tmp && \
|
|||
git checkout 5463469f71e7861ccfbbd4d09b8e4ae56b8d3e45 && \
|
||||
git submodule update --init cereal opendbc && \
|
||||
mkdir /tmp/openpilot && \
|
||||
cp -pR SConstruct tools/ selfdrive/ common/ cereal/ opendbc/ /tmp/openpilot && \
|
||||
cp -pR SConstruct site_scons/ tools/ selfdrive/ common/ cereal/ opendbc/ /tmp/openpilot && \
|
||||
rm -rf /tmp/tmppilot
|
||||
|
||||
RUN cd /tmp/openpilot && \
|
||||
pip install --no-cache-dir -r opendbc/requirements.txt && \
|
||||
pip install --no-cache-dir aenum lru-dict pycurl tenacity atomicwrites
|
||||
pip install --no-cache-dir --upgrade aenum lru-dict pycurl tenacity atomicwrites scons
|
||||
|
||||
COPY . /tmp/openpilot/panda
|
||||
RUN rm -rf /tmp/openpilot/panda/.git
|
||||
|
|
|
@ -9,7 +9,7 @@ const int VOLKSWAGEN_DRIVER_TORQUE_FACTOR = 3;
|
|||
|
||||
// Safety-relevant CAN messages for the Volkswagen MQB platform
|
||||
#define MSG_ESP_19 0x0B2 // RX from ABS, for wheel speeds
|
||||
#define MSG_EPS_01 0x09F // RX from EPS, for driver steering torque
|
||||
#define MSG_LH_EPS_03 0x09F // RX from EPS, for driver steering torque
|
||||
#define MSG_ESP_05 0x106 // RX from ABS, for brake switch state
|
||||
#define MSG_TSK_06 0x120 // RX from ECU, for ACC status from drivetrain coordinator
|
||||
#define MSG_MOTOR_20 0x121 // RX from ECU, for driver throttle input
|
||||
|
@ -23,7 +23,7 @@ const int VOLKSWAGEN_MQB_TX_MSGS_LEN = sizeof(VOLKSWAGEN_MQB_TX_MSGS) / sizeof(V
|
|||
|
||||
AddrCheckStruct volkswagen_mqb_rx_checks[] = {
|
||||
{.msg = {{MSG_ESP_19, 0, 8, .check_checksum = false, .max_counter = 0U, .expected_timestep = 10000U}}},
|
||||
{.msg = {{MSG_EPS_01, 0, 8, .check_checksum = true, .max_counter = 15U, .expected_timestep = 10000U}}},
|
||||
{.msg = {{MSG_LH_EPS_03, 0, 8, .check_checksum = true, .max_counter = 15U, .expected_timestep = 10000U}}},
|
||||
{.msg = {{MSG_ESP_05, 0, 8, .check_checksum = true, .max_counter = 15U, .expected_timestep = 20000U}}},
|
||||
{.msg = {{MSG_TSK_06, 0, 8, .check_checksum = true, .max_counter = 15U, .expected_timestep = 20000U}}},
|
||||
{.msg = {{MSG_MOTOR_20, 0, 8, .check_checksum = true, .max_counter = 15U, .expected_timestep = 20000U}}},
|
||||
|
@ -86,7 +86,7 @@ static uint8_t volkswagen_mqb_compute_crc(CAN_FIFOMailBox_TypeDef *to_push) {
|
|||
|
||||
uint8_t counter = volkswagen_mqb_get_counter(to_push);
|
||||
switch(addr) {
|
||||
case MSG_EPS_01:
|
||||
case MSG_LH_EPS_03:
|
||||
crc ^= (uint8_t[]){0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5}[counter];
|
||||
break;
|
||||
case MSG_ESP_05:
|
||||
|
@ -156,9 +156,9 @@ static int volkswagen_mqb_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
|
|||
}
|
||||
|
||||
// Update driver input torque samples
|
||||
// Signal: EPS_01.Driver_Strain (absolute torque)
|
||||
// Signal: EPS_01.Driver_Strain_VZ (direction)
|
||||
if (addr == MSG_EPS_01) {
|
||||
// Signal: LH_EPS_03.EPS_Lenkmoment (absolute torque)
|
||||
// Signal: LH_EPS_03.EPS_VZ_Lenkmoment (direction)
|
||||
if (addr == MSG_LH_EPS_03) {
|
||||
int torque_driver_new = GET_BYTE(to_push, 5) | ((GET_BYTE(to_push, 6) & 0x1F) << 8);
|
||||
int sign = (GET_BYTE(to_push, 6) & 0x80) >> 7;
|
||||
if (sign == 1) {
|
||||
|
|
|
@ -16,7 +16,7 @@ DRIVER_TORQUE_ALLOWANCE = 80
|
|||
DRIVER_TORQUE_FACTOR = 3
|
||||
|
||||
MSG_ESP_19 = 0xB2 # RX from ABS, for wheel speeds
|
||||
MSG_EPS_01 = 0x9F # RX from EPS, for driver steering torque
|
||||
MSG_LH_EPS_03 = 0x9F # RX from EPS, for driver steering torque
|
||||
MSG_ESP_05 = 0x106 # RX from ABS, for brake light state
|
||||
MSG_TSK_06 = 0x120 # RX from ECU, for ACC status from drivetrain coordinator
|
||||
MSG_MOTOR_20 = 0x121 # RX from ECU, for driver throttle input
|
||||
|
@ -25,7 +25,7 @@ MSG_GRA_ACC_01 = 0x12B # TX by OP, ACC control buttons for cancel/resume
|
|||
MSG_LDW_02 = 0x397 # TX by OP, Lane line recognition and text alerts
|
||||
|
||||
class TestVolkswagenMqbSafety(common.PandaSafetyTest):
|
||||
cnt_eps_01 = 0
|
||||
cnt_lh_eps_03 = 0
|
||||
cnt_esp_05 = 0
|
||||
cnt_tsk_06 = 0
|
||||
cnt_motor_20 = 0
|
||||
|
@ -79,11 +79,11 @@ class TestVolkswagenMqbSafety(common.PandaSafetyTest):
|
|||
return self.packer.make_can_msg_panda("TSK_06", 0, values)
|
||||
|
||||
# Driver steering input torque
|
||||
def _eps_01_msg(self, torque):
|
||||
values = {"Driver_Strain": abs(torque), "Driver_Strain_VZ": torque < 0,
|
||||
"COUNTER": self.cnt_eps_01 % 16}
|
||||
self.__class__.cnt_eps_01 += 1
|
||||
return self.packer.make_can_msg_panda("EPS_01", 0, values)
|
||||
def _lh_eps_03_msg(self, torque):
|
||||
values = {"EPS_Lenkmoment": abs(torque), "EPS_VZ_Lenkmoment": torque < 0,
|
||||
"COUNTER": self.cnt_lh_eps_03 % 16}
|
||||
self.__class__.cnt_lh_eps_03 += 1
|
||||
return self.packer.make_can_msg_panda("LH_EPS_03", 0, values)
|
||||
|
||||
# openpilot steering output torque
|
||||
def _hca_01_msg(self, torque):
|
||||
|
@ -205,21 +205,21 @@ class TestVolkswagenMqbSafety(common.PandaSafetyTest):
|
|||
self.assertTrue(self._tx(self._hca_01_msg(sign * (MAX_RT_DELTA + 1))))
|
||||
|
||||
def test_torque_measurements(self):
|
||||
self._rx(self._eps_01_msg(50))
|
||||
self._rx(self._eps_01_msg(-50))
|
||||
self._rx(self._eps_01_msg(0))
|
||||
self._rx(self._eps_01_msg(0))
|
||||
self._rx(self._eps_01_msg(0))
|
||||
self._rx(self._eps_01_msg(0))
|
||||
self._rx(self._lh_eps_03_msg(50))
|
||||
self._rx(self._lh_eps_03_msg(-50))
|
||||
self._rx(self._lh_eps_03_msg(0))
|
||||
self._rx(self._lh_eps_03_msg(0))
|
||||
self._rx(self._lh_eps_03_msg(0))
|
||||
self._rx(self._lh_eps_03_msg(0))
|
||||
|
||||
self.assertEqual(-50, self.safety.get_torque_driver_min())
|
||||
self.assertEqual(50, self.safety.get_torque_driver_max())
|
||||
|
||||
self._rx(self._eps_01_msg(0))
|
||||
self._rx(self._lh_eps_03_msg(0))
|
||||
self.assertEqual(0, self.safety.get_torque_driver_max())
|
||||
self.assertEqual(-50, self.safety.get_torque_driver_min())
|
||||
|
||||
self._rx(self._eps_01_msg(0))
|
||||
self._rx(self._lh_eps_03_msg(0))
|
||||
self.assertEqual(0, self.safety.get_torque_driver_max())
|
||||
self.assertEqual(0, self.safety.get_torque_driver_min())
|
||||
|
||||
|
@ -228,10 +228,10 @@ class TestVolkswagenMqbSafety(common.PandaSafetyTest):
|
|||
# TODO: Would be ideal to check ESP_19 as well, but it has no checksum
|
||||
# or counter, and I'm not sure if we can easily validate Panda's simple
|
||||
# temporal reception-rate check here.
|
||||
for msg in [MSG_EPS_01, MSG_ESP_05, MSG_TSK_06, MSG_MOTOR_20]:
|
||||
for msg in [MSG_LH_EPS_03, MSG_ESP_05, MSG_TSK_06, MSG_MOTOR_20]:
|
||||
self.safety.set_controls_allowed(1)
|
||||
if msg == MSG_EPS_01:
|
||||
to_push = self._eps_01_msg(0)
|
||||
if msg == MSG_LH_EPS_03:
|
||||
to_push = self._lh_eps_03_msg(0)
|
||||
if msg == MSG_ESP_05:
|
||||
to_push = self._brake_msg(False)
|
||||
if msg == MSG_TSK_06:
|
||||
|
@ -246,18 +246,18 @@ class TestVolkswagenMqbSafety(common.PandaSafetyTest):
|
|||
# counter
|
||||
# reset wrong_counters to zero by sending valid messages
|
||||
for i in range(MAX_WRONG_COUNTERS + 1):
|
||||
self.__class__.cnt_eps_01 += 1
|
||||
self.__class__.cnt_lh_eps_03 += 1
|
||||
self.__class__.cnt_esp_05 += 1
|
||||
self.__class__.cnt_tsk_06 += 1
|
||||
self.__class__.cnt_motor_20 += 1
|
||||
if i < MAX_WRONG_COUNTERS:
|
||||
self.safety.set_controls_allowed(1)
|
||||
self._rx(self._eps_01_msg(0))
|
||||
self._rx(self._lh_eps_03_msg(0))
|
||||
self._rx(self._brake_msg(False))
|
||||
self._rx(self._pcm_status_msg(True))
|
||||
self._rx(self._gas_msg(0))
|
||||
else:
|
||||
self.assertFalse(self._rx(self._eps_01_msg(0)))
|
||||
self.assertFalse(self._rx(self._lh_eps_03_msg(0)))
|
||||
self.assertFalse(self._rx(self._brake_msg(False)))
|
||||
self.assertFalse(self._rx(self._pcm_status_msg(True)))
|
||||
self.assertFalse(self._rx(self._gas_msg(0)))
|
||||
|
@ -266,7 +266,7 @@ class TestVolkswagenMqbSafety(common.PandaSafetyTest):
|
|||
# restore counters for future tests with a couple of good messages
|
||||
for i in range(2):
|
||||
self.safety.set_controls_allowed(1)
|
||||
self._rx(self._eps_01_msg(0))
|
||||
self._rx(self._lh_eps_03_msg(0))
|
||||
self._rx(self._brake_msg(False))
|
||||
self._rx(self._pcm_status_msg(True))
|
||||
self._rx(self._gas_msg(0))
|
||||
|
|
Loading…
Reference in New Issue