Skip to content

Commit

Permalink
LatControlTorque: fix deadzone and missing steer saturated warning (c…
Browse files Browse the repository at this point in the history
…ommaai#24294)

* fix steer saturated alert and deadzone

* fix and formatting

* update refs

* update refs

* not needed

* remove
  • Loading branch information
sshane authored and spektor56 committed May 7, 2022
1 parent 5fde416 commit 53e477b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions selfdrive/controls/lib/latcontrol_torque.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ def update(self, active, CS, CP, VM, params, last_actuators, desired_curvature,
pid_log.error = error

ff = desired_lateral_accel - params.roll * ACCELERATION_DUE_TO_GRAVITY
# convert friction into lateral accel units for feedforward
friction_compensation = interp(desired_lateral_jerk, [-JERK_THRESHOLD, JERK_THRESHOLD], [-self.friction, self.friction])
ff += friction_compensation / CP.lateralTuning.torque.kf
output_torque = self.pid.update(error,
override=CS.steeringPressed, feedforward=ff,
speed=CS.vEgo,
freeze_integrator=CS.steeringRateLimited)

friction_compensation = interp(desired_lateral_jerk, [-JERK_THRESHOLD, JERK_THRESHOLD], [-self.friction, self.friction])
output_torque += friction_compensation

pid_log.active = True
pid_log.p = self.pid.p
pid_log.i = self.pid.i
Expand All @@ -75,5 +75,5 @@ def update(self, active, CS, CP, VM, params, last_actuators, desired_curvature,
pid_log.output = -output_torque
pid_log.saturated = self._check_saturation(self.steer_max - abs(output_torque) < 1e-3, CS)

#TODO left is positive in this convention
# TODO left is positive in this convention
return -output_torque, 0.0, pid_log
2 changes: 1 addition & 1 deletion selfdrive/test/process_replay/ref_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17141a8240bd8ec5defa1de2da937544c52ef0fe
999b5f3bfe249b40758dc62601a6e4118dad82ae

0 comments on commit 53e477b

Please sign in to comment.