From e01c64574c03da825c9f467a377dde3f07ea6926 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Wed, 23 Mar 2022 13:48:49 -0700 Subject: [PATCH] Toyota: increase torque rate limit (#887) * Closer to HYUNDAI * Change tests too * Change MAX_RT_DELTA too * Change test too * Lower buffer to 20% Co-authored-by: Harald Schafer --- board/safety/safety_toyota.h | 8 ++++---- tests/safety/test_toyota.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/board/safety/safety_toyota.h b/board/safety/safety_toyota.h index 648d10d768..9493f51708 100644 --- a/board/safety/safety_toyota.h +++ b/board/safety/safety_toyota.h @@ -2,14 +2,14 @@ const int TOYOTA_MAX_TORQUE = 1500; // max torque cmd allowed ever // rate based torque limit + stay within actually applied -// packet is sent at 100hz, so this limit is 1000/sec -const int TOYOTA_MAX_RATE_UP = 10; // ramp up slow +// packet is sent at 100hz, so this limit is 1500/sec +const int TOYOTA_MAX_RATE_UP = 15; // ramp up slow const int TOYOTA_MAX_RATE_DOWN = 25; // ramp down fast const int TOYOTA_MAX_TORQUE_ERROR = 350; // max torque cmd in excess of torque motor // real time torque limit to prevent controls spamming -// the real time limit is 1500/sec -const int TOYOTA_MAX_RT_DELTA = 375; // max delta torque allowed for real time checks +// the real time limit is 1800/sec, a 20% buffer +const int TOYOTA_MAX_RT_DELTA = 450; // max delta torque allowed for real time checks const uint32_t TOYOTA_RT_INTERVAL = 250000; // 250ms between real time checks // longitudinal limits diff --git a/tests/safety/test_toyota.py b/tests/safety/test_toyota.py index 80b12812cf..51ff797e39 100755 --- a/tests/safety/test_toyota.py +++ b/tests/safety/test_toyota.py @@ -24,10 +24,10 @@ class TestToyotaSafety(common.PandaSafetyTest, common.InterceptorSafetyTest, FWD_BUS_LOOKUP = {0: 2, 2: 0} INTERCEPTOR_THRESHOLD = 845 - MAX_RATE_UP = 10 + MAX_RATE_UP = 15 MAX_RATE_DOWN = 25 MAX_TORQUE = 1500 - MAX_RT_DELTA = 375 + MAX_RT_DELTA = 450 RT_INTERVAL = 250000 MAX_TORQUE_ERROR = 350 TORQUE_MEAS_TOLERANCE = 1 # toyota safety adds one to be conversative for rounding