mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-28 01:52:06 +08:00
LatControlTorque: clean up class variable (#24526)
* move to super * no class variable * there's CP * whitespace * drop CI from latcontrol super * Revert "drop CI from latcontrol super" This reverts commit 9218273060ade6431c4fc4c310b27e7e210158b9. Co-authored-by: Shane Smiskol <shane@smiskol.com> old-commit-hash: a693b3a26b2dcbd7910e4fa98318f23c13c3d815
This commit is contained in:
@@ -25,12 +25,12 @@ JERK_THRESHOLD = 0.2
|
||||
class LatControlTorque(LatControl):
|
||||
def __init__(self, CP, CI):
|
||||
super().__init__(CP, CI)
|
||||
self.CP = CP
|
||||
self.pid = PIDController(CP.lateralTuning.torque.kp, CP.lateralTuning.torque.ki,
|
||||
k_f=CP.lateralTuning.torque.kf, pos_limit=self.steer_max, neg_limit=-self.steer_max)
|
||||
self.get_steer_feedforward = CI.get_steer_feedforward_function()
|
||||
self.use_steering_angle = CP.lateralTuning.torque.useSteeringAngle
|
||||
self.friction = CP.lateralTuning.torque.friction
|
||||
self.kf = CP.lateralTuning.torque.kf
|
||||
|
||||
def reset(self):
|
||||
super().reset()
|
||||
@@ -61,7 +61,7 @@ class LatControlTorque(LatControl):
|
||||
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 / self.CP.lateralTuning.torque.kf
|
||||
ff += friction_compensation / self.kf
|
||||
output_torque = self.pid.update(error,
|
||||
override=CS.steeringPressed, feedforward=ff,
|
||||
speed=CS.vEgo,
|
||||
|
||||
Reference in New Issue
Block a user