mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-09-04 15:23:42 +08:00
Update latcontrol_curvature.py roll compoensation after PID
This commit is contained in:
@@ -30,14 +30,14 @@ class LatControlCurvature(LatControl):
|
||||
assert calibrated_pose is not None
|
||||
actual_curvature_pose = calibrated_pose.angular_velocity.yaw / CS.vEgo
|
||||
actual_curvature = np.interp(CS.vEgo, [2.0, 5.0], [actual_curvature_vm, actual_curvature_pose])
|
||||
|
||||
roll_compensation = -VM.roll_compensation(params.roll, CS.vEgo)
|
||||
gravity_adjusted_curvature = desired_curvature - roll_compensation
|
||||
|
||||
pid_log.error = float(gravity_adjusted_curvature - actual_curvature)
|
||||
pid_log.error = float(desired_curvature - actual_curvature)
|
||||
freeze_integrator = steer_limited_by_controls or CS.steeringPressed or CS.vEgo < 5
|
||||
|
||||
output_curvature = self.pid.update(pid_log.error, feedforward=gravity_adjusted_curvature, speed=CS.vEgo, freeze_integrator=freeze_integrator)
|
||||
corrected_curvature = self.pid.update(pid_log.error, feedforward=desired_curvature, speed=CS.vEgo, freeze_integrator=freeze_integrator)
|
||||
|
||||
roll_compensation = -VM.roll_compensation(params.roll, CS.vEgo)
|
||||
output_curvature = corrected_curvature - roll_compensation
|
||||
|
||||
pid_log.active = True
|
||||
pid_log.p = float(self.pid.p)
|
||||
|
||||
Reference in New Issue
Block a user