mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 08:14:00 +08:00
cleanup old nidec accel override logic (#22181)
* cleanup old nidec accel override logic * add ref without deprecated fields * no more override old-commit-hash: 74b6c872545ac64055a914789a89ccc173168d8b
This commit is contained in:
@@ -149,8 +149,6 @@ class Controls:
|
||||
self.events_prev = []
|
||||
self.current_alert_types = [ET.PERMANENT]
|
||||
self.logged_comm_issue = False
|
||||
self.v_target = 0.0
|
||||
self.a_target = 0.0
|
||||
|
||||
# TODO: no longer necessary, aside from process replay
|
||||
self.sm['liveParameters'].valid = True
|
||||
@@ -464,7 +462,7 @@ class Controls:
|
||||
if not self.joystick_mode:
|
||||
# accel PID loop
|
||||
pid_accel_limits = self.CI.get_pid_accel_limits(self.CP, CS.vEgo, self.v_cruise_kph * CV.KPH_TO_MS)
|
||||
actuators.accel, self.v_target, self.a_target = self.LoC.update(self.active, CS, self.CP, long_plan, pid_accel_limits)
|
||||
actuators.accel = self.LoC.update(self.active, CS, self.CP, long_plan, pid_accel_limits)
|
||||
|
||||
# Steering PID loop and lateral MPC
|
||||
desired_curvature, desired_curvature_rate = get_lag_adjusted_curvature(self.CP, CS.vEgo,
|
||||
@@ -527,20 +525,10 @@ class Controls:
|
||||
CC.enabled = self.enabled
|
||||
CC.actuators = actuators
|
||||
|
||||
CC.cruiseControl.override = True
|
||||
CC.cruiseControl.cancel = not self.CP.pcmCruise or (not self.enabled and CS.cruiseState.enabled)
|
||||
if self.joystick_mode and self.sm.rcv_frame['testJoystick'] > 0 and self.sm['testJoystick'].buttons[0]:
|
||||
CC.cruiseControl.cancel = True
|
||||
|
||||
# TODO remove car specific stuff in controls
|
||||
# Some override values for Honda
|
||||
# brake discount removes a sharp nonlinearity
|
||||
brake_discount = (1.0 - clip(-actuators.accel * (3.0/4.0), 0.0, 1.0))
|
||||
speed_override = max(0.0, (self.LoC.v_pid + CS.cruiseState.speedOffset) * brake_discount)
|
||||
CC.cruiseControl.speedOverride = float(speed_override if self.CP.pcmCruise else 0.0)
|
||||
CC.cruiseControl.accelOverride = float(self.CI.calc_accel_override(CS.aEgo, self.a_target,
|
||||
CS.vEgo, self.v_target))
|
||||
|
||||
CC.hudControl.setSpeed = float(self.v_cruise_kph * CV.KPH_TO_MS)
|
||||
CC.hudControl.speedVisible = self.enabled
|
||||
CC.hudControl.lanesVisible = self.enabled
|
||||
|
||||
@@ -136,4 +136,4 @@ class LongControl():
|
||||
self.last_output_accel = output_accel
|
||||
final_accel = clip(output_accel, accel_limits[0], accel_limits[1])
|
||||
|
||||
return final_accel, v_target, a_target
|
||||
return final_accel
|
||||
|
||||
Reference in New Issue
Block a user