Skip to content

Commit

Permalink
Ford: higher curvature rate limits at low speed (commaai#2065)
Browse files Browse the repository at this point in the history
* use closer to EPS limits

* raise to upper bound of spread from injection plot

* we've seen ~0.009 at 7 m/s, so allow that

* fix test

* rounding errors cause the 2 to round to the same value

* adjust for latest opendbc change

* we should actually match what safety is doing! fix lack of test coverage near first brake point

fix

* and fix test
  • Loading branch information
sshane authored Oct 26, 2024
1 parent 2bd2f2a commit 3066f93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions board/safety/safety_ford.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ static const SteeringLimits FORD_STEERING_LIMITS = {
.max_angle_error = 100, // 0.002 * FORD_STEERING_LIMITS.angle_deg_to_can
.angle_rate_up_lookup = {
{5., 25., 25.},
{0.0002, 0.0001, 0.0001}
{0.00045, 0.0001, 0.0001}
},
.angle_rate_down_lookup = {
{5., 25., 25.},
{0.000225, 0.00015, 0.00015}
{0.00045, 0.00015, 0.00015}
},

// no blending at low speed due to lack of torque wind-up and inaccurate current curvature
Expand Down
8 changes: 4 additions & 4 deletions tests/safety/test_ford.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class TestFordSafetyBase(common.PandaCarSafetyTest):
CURVATURE_ERROR_MIN_SPEED = 10.0 # m/s

ANGLE_RATE_BP = [5., 25., 25.]
ANGLE_RATE_UP = [0.0002, 0.0001, 0.0001] # windup limit
ANGLE_RATE_DOWN = [0.000225, 0.00015, 0.00015] # unwind limit
ANGLE_RATE_UP = [0.00045, 0.0001, 0.0001] # windup limit
ANGLE_RATE_DOWN = [0.00045, 0.00015, 0.00015] # unwind limit

cnt_speed = 0
cnt_speed_2 = 0
Expand Down Expand Up @@ -290,7 +290,7 @@ def test_curvature_rate_limit_up(self):

for speed in np.arange(0, 40, 0.5):
limit_command = speed > self.CURVATURE_ERROR_MIN_SPEED
max_delta_up = np.interp(speed, self.ANGLE_RATE_BP, self.ANGLE_RATE_UP)
max_delta_up = np.interp(speed - 1, self.ANGLE_RATE_BP, self.ANGLE_RATE_UP)
max_delta_up_lower = np.interp(speed + 1, self.ANGLE_RATE_BP, self.ANGLE_RATE_UP)

cases = [
Expand All @@ -313,7 +313,7 @@ def test_curvature_rate_limit_down(self):

for speed in np.arange(0, 40, 0.5):
limit_command = speed > self.CURVATURE_ERROR_MIN_SPEED
max_delta_down = np.interp(speed, self.ANGLE_RATE_BP, self.ANGLE_RATE_DOWN)
max_delta_down = np.interp(speed - 1, self.ANGLE_RATE_BP, self.ANGLE_RATE_DOWN)
max_delta_down_lower = np.interp(speed + 1, self.ANGLE_RATE_BP, self.ANGLE_RATE_DOWN)

cases = [
Expand Down

0 comments on commit 3066f93

Please sign in to comment.