IQ.Pilot Release Commit @ e46d557
This commit is contained in:
@@ -168,8 +168,11 @@ class Controls(IQControlsLayer):
|
||||
|
||||
CC.latActive = _lat_active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \
|
||||
(not standstill or self.CP.steerAtStandstill)
|
||||
# long control may stay active through a gas override on platforms that opt in
|
||||
override_longitudinal = any(e.overrideLongitudinal for e in self.sm['onroadEvents'])
|
||||
long_through_override = self.CP_IQ.longActiveWithGasOverride and self.CP.openpilotLongitudinalControl
|
||||
CC.longActive = CC.enabled and not getattr(CS, 'cruiseFaultLateralMode', False) and \
|
||||
not any(e.overrideLongitudinal for e in self.sm['onroadEvents']) and \
|
||||
(not override_longitudinal or long_through_override) and \
|
||||
(self.CP.openpilotLongitudinalControl or not self.CP_IQ.pcmCruiseSpeed)
|
||||
|
||||
actuators = CC.actuators
|
||||
@@ -184,7 +187,7 @@ class Controls(IQControlsLayer):
|
||||
# accel PID loop
|
||||
pid_accel_limits = self.CI.get_pid_accel_limits(self.CP, self.CP_IQ, CS.vEgo, CS.vCruise * CV.KPH_TO_MS)
|
||||
actuators.accel = float(self.LoC.update(CC.longActive, CS, long_plan.aTarget, long_plan.shouldStop, pid_accel_limits,
|
||||
long_plan.leadDistance, long_plan.hasLead))
|
||||
long_plan.leadDistance, long_plan.hasLead, gas_override=override_longitudinal))
|
||||
|
||||
# Steering PID loop and lateral MPC
|
||||
# Reset desired curvature to current to avoid violating the limits on engage
|
||||
|
||||
@@ -53,7 +53,7 @@ class LongControl:
|
||||
def reset(self):
|
||||
self.pid.reset()
|
||||
|
||||
def update(self, active, CS, a_target, should_stop, accel_limits, lead_distance=0.0, has_lead=False):
|
||||
def update(self, active, CS, a_target, should_stop, accel_limits, lead_distance=0.0, has_lead=False, gas_override=False):
|
||||
"""Update longitudinal control. This updates the state machine and runs a PID loop"""
|
||||
self.pid.neg_limit = accel_limits[0]
|
||||
self.pid.pos_limit = accel_limits[1]
|
||||
@@ -87,8 +87,13 @@ class LongControl:
|
||||
else:
|
||||
error = a_target - CS.aEgo
|
||||
output_accel = self.pid.update(error, speed=CS.vEgo,
|
||||
feedforward=a_target)
|
||||
feedforward=a_target,
|
||||
freeze_integrator=gas_override)
|
||||
self.smooth.reset()
|
||||
|
||||
if gas_override:
|
||||
# safety blocks braking while the gas is pressed, and a blocked tx drops the whole frame
|
||||
output_accel = max(output_accel, 0.0)
|
||||
|
||||
self.last_output_accel = np.clip(output_accel, accel_limits[0], accel_limits[1])
|
||||
return self.last_output_accel
|
||||
|
||||
Reference in New Issue
Block a user