Skip to content

Commit

Permalink
Latcontrol torque: integrator need not be reset (commaai#24606)
Browse files Browse the repository at this point in the history
slow integrators need not be reset
  • Loading branch information
haraschax authored and rjsmith1999 committed Jun 27, 2022
1 parent 9221f3f commit 14f5dab
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions selfdrive/controls/lib/latcontrol_torque.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ def update(self, active, CS, VM, params, last_actuators, desired_curvature, desi
if CS.vEgo < MIN_STEER_SPEED or not active:
output_torque = 0.0
pid_log.active = False
if not active:
self.pid.reset()
else:
if self.use_steering_angle:
actual_curvature = -VM.calc_curvature(math.radians(CS.steeringAngleDeg - params.angleOffsetDeg), CS.vEgo, params.roll)
Expand All @@ -62,10 +60,11 @@ def update(self, active, CS, VM, params, last_actuators, desired_curvature, desi
# 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 / self.kf
freeze_integrator = CS.steeringRateLimited or CS.steeringPressed or CS.vEgo < 5
output_torque = self.pid.update(error,
override=CS.steeringPressed, feedforward=ff,
feedforward=ff,
speed=CS.vEgo,
freeze_integrator=CS.steeringRateLimited)
freeze_integrator=freeze_integrator)

pid_log.active = True
pid_log.p = self.pid.p
Expand Down

0 comments on commit 14f5dab

Please sign in to comment.