Skip to content

Commit

Permalink
Toyota: rename LTA torque wind down signal (#1757)
Browse files Browse the repository at this point in the history
* rename setme_x64

* bump opendbc ref
  • Loading branch information
sshane authored Dec 5, 2023
1 parent a9af9cb commit ea78657
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}"

ENV PANDA_PATH=/tmp/openpilot/panda
ENV OPENPILOT_REF="5690386d8d731c9bebda536a5c71c890f6dfe98c"
ENV OPENDBC_REF="12dd7675c5ab2f49aedb813a79e6131b370b379f"
ENV OPENDBC_REF="5b0c73977f1428700d0344d52874a90a4c5168fb"

COPY requirements.txt /tmp/
RUN pyenv install 3.11.4 && \
Expand Down
6 changes: 3 additions & 3 deletions board/safety/safety_toyota.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ static bool toyota_tx_hook(CANPacket_t *to_send) {
// LTA steering check
// only sent to prevent dash errors, no actuation is accepted
if (addr == 0x191) {
// check the STEER_REQUEST, STEER_REQUEST_2, SETME_X64 STEER_ANGLE_CMD signals
// check the STEER_REQUEST, STEER_REQUEST_2, TORQUE_WIND_DOWN, STEER_ANGLE_CMD signals
bool lta_request = GET_BIT(to_send, 0U) != 0U;
bool lta_request2 = GET_BIT(to_send, 25U) != 0U;
int setme_x64 = GET_BYTE(to_send, 5);
int torque_wind_down = GET_BYTE(to_send, 5);
int lta_angle = (GET_BYTE(to_send, 1) << 8) | GET_BYTE(to_send, 2);
lta_angle = to_signed(lta_angle, 16);

// block LTA msgs with actuation requests
if (lta_request || lta_request2 || (lta_angle != 0) || (setme_x64 != 0)) {
if (lta_request || lta_request2 || (lta_angle != 0) || (torque_wind_down != 0)) {
tx = false;
}
}
Expand Down
10 changes: 5 additions & 5 deletions tests/safety/test_toyota.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def _torque_cmd_msg(self, torque, steer_req=1):
values = {"STEER_TORQUE_CMD": torque, "STEER_REQUEST": steer_req}
return self.packer.make_can_msg_panda("STEERING_LKA", 0, values)

def _lta_msg(self, req, req2, angle_cmd, setme_x64=100):
values = {"STEER_REQUEST": req, "STEER_REQUEST_2": req2, "STEER_ANGLE_CMD": angle_cmd, "SETME_X64": setme_x64}
def _lta_msg(self, req, req2, angle_cmd, torque_wind_down=100):
values = {"STEER_REQUEST": req, "STEER_REQUEST_2": req2, "STEER_ANGLE_CMD": angle_cmd, "TORQUE_WIND_DOWN": torque_wind_down}
return self.packer.make_can_msg_panda("STEERING_LTA", 0, values)

def _accel_msg(self, accel, cancel_req=0):
Expand Down Expand Up @@ -78,14 +78,14 @@ def test_block_aeb(self):

# Only allow LTA msgs with no actuation
def test_lta_steer_cmd(self):
for engaged, req, req2, setme_x64, angle in itertools.product([True, False],
for engaged, req, req2, torque_wind_down, angle in itertools.product([True, False],
[0, 1], [0, 1],
[0, 50, 100],
np.linspace(-20, 20, 5)):
self.safety.set_controls_allowed(engaged)

should_tx = not req and not req2 and angle == 0 and setme_x64 == 0
self.assertEqual(should_tx, self._tx(self._lta_msg(req, req2, angle, setme_x64)))
should_tx = not req and not req2 and angle == 0 and torque_wind_down == 0
self.assertEqual(should_tx, self._tx(self._lta_msg(req, req2, angle, torque_wind_down)))

def test_rx_hook(self):
# checksum checks
Expand Down

0 comments on commit ea78657

Please sign in to comment.