Skip to content

Commit

Permalink
Toyota: increase torque rate limit (#887)
Browse files Browse the repository at this point in the history
* Closer to HYUNDAI

* Change tests too

* Change MAX_RT_DELTA too

* Change test too

* Lower buffer to 20%

Co-authored-by: Harald Schafer <harald.the.engineer@gmail.com>
  • Loading branch information
adeebshihadeh and haraschax committed Mar 23, 2022
1 parent 0591f68 commit e01c645
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions board/safety/safety_toyota.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/safety/test_toyota.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e01c645

Please sign in to comment.