|
|
@ -59,14 +59,14 @@ class LatControlTorque(LatControl): |
|
|
|
pid_log.error = error |
|
|
|
pid_log.error = error |
|
|
|
|
|
|
|
|
|
|
|
ff = desired_lateral_accel - params.roll * ACCELERATION_DUE_TO_GRAVITY |
|
|
|
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, |
|
|
|
output_torque = self.pid.update(error, |
|
|
|
override=CS.steeringPressed, feedforward=ff, |
|
|
|
override=CS.steeringPressed, feedforward=ff, |
|
|
|
speed=CS.vEgo, |
|
|
|
speed=CS.vEgo, |
|
|
|
freeze_integrator=CS.steeringRateLimited) |
|
|
|
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.active = True |
|
|
|
pid_log.p = self.pid.p |
|
|
|
pid_log.p = self.pid.p |
|
|
|
pid_log.i = self.pid.i |
|
|
|
pid_log.i = self.pid.i |
|
|
@ -75,5 +75,5 @@ class LatControlTorque(LatControl): |
|
|
|
pid_log.output = -output_torque |
|
|
|
pid_log.output = -output_torque |
|
|
|
pid_log.saturated = self._check_saturation(self.steer_max - abs(output_torque) < 1e-3, CS) |
|
|
|
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 |
|
|
|
return -output_torque, 0.0, pid_log |
|
|
|