angle safety: add comment about rate limits at 0 (#1389)

* up when 0

* Revert "up when 0"

This reverts commit fc9b459651.

* add comment

* whoops
This commit is contained in:
Shane Smiskol 2023-05-03 00:07:23 +00:00 committed by GitHub
parent 14cfb78ab2
commit 69ad3dd8e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -623,6 +623,7 @@ bool steer_angle_cmd_checks(int desired_angle, bool steer_control_enabled, const
int delta_angle_up = (interpolate(limits.angle_rate_up_lookup, vehicle_speed - 1.) * limits.angle_deg_to_can) + 1.;
int delta_angle_down = (interpolate(limits.angle_rate_down_lookup, vehicle_speed - 1.) * limits.angle_deg_to_can) + 1.;
// allow down limits at zero since small floats will be rounded to 0
int highest_desired_angle = desired_angle_last + ((desired_angle_last > 0) ? delta_angle_up : delta_angle_down);
int lowest_desired_angle = desired_angle_last - ((desired_angle_last >= 0) ? delta_angle_down : delta_angle_up);