Merge branch 'hkg-can-jerk' into master-dev-c3

This commit is contained in:
Jason Wen
2024-08-05 19:38:03 -04:00
3 changed files with 17 additions and 7 deletions
+6 -2
View File
@@ -104,10 +104,14 @@ class CarInterface(CarInterfaceBase):
ret.stoppingControl = True
ret.startingState = True
ret.vEgoStarting = 0.1
ret.startAccel = 1.6
ret.stopAccel = -1.0
ret.stopAccel = -0.5
ret.longitudinalActuatorDelay = 0.5
if ret.flags & (HyundaiFlags.HYBRID | HyundaiFlags.EV):
ret.startAccel = 1.0
else:
ret.startAccel = 1.5
if DBC[ret.carFingerprint]["radar"] is None:
if ret.spFlags & (HyundaiFlagsSP.SP_ENHANCED_SCC | HyundaiFlagsSP.SP_CAMERA_SCC_LEAD):
ret.radarUnavailable = False
+7 -1
View File
@@ -643,9 +643,15 @@ class Controls:
self.LoC.reset()
if not self.joystick_mode:
speeds = long_plan.speeds
if len(speeds):
resume = self.enabled_long and CS.standstill and speeds[-1] > 0.1
else:
resume = False
# accel PID loop
pid_accel_limits = self.CI.get_pid_accel_limits(self.CP, CS.vEgo, self.v_cruise_helper.v_cruise_kph * CV.KPH_TO_MS)
actuators.accel = self.LoC.update(CC.longActive, CS, long_plan.aTarget, long_plan.shouldStop, pid_accel_limits)
actuators.accel = self.LoC.update(CC.longActive, CS, long_plan.aTarget, long_plan.shouldStop, pid_accel_limits, resume)
# Steering PID loop and lateral MPC
if self.model_use_lateral_planner:
+4 -4
View File
@@ -11,10 +11,10 @@ LongCtrlState = car.CarControl.Actuators.LongControlState
def long_control_state_trans(CP, active, long_control_state, v_ego,
should_stop, brake_pressed, cruise_standstill):
should_stop, brake_pressed, cruise_standstill, resume):
# Ignore cruise standstill if car has a gas interceptor
cruise_standstill = cruise_standstill and not CP.enableGasInterceptorDEPRECATED
stopping_condition = should_stop
stopping_condition = should_stop and not resume
starting_condition = (not should_stop and
not cruise_standstill and
not brake_pressed)
@@ -58,14 +58,14 @@ class LongControl:
def reset(self):
self.pid.reset()
def update(self, active, CS, a_target, should_stop, accel_limits):
def update(self, active, CS, a_target, should_stop, accel_limits, resume):
"""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]
self.long_control_state = long_control_state_trans(self.CP, active, self.long_control_state, CS.vEgo,
should_stop, CS.brakePressed,
CS.cruiseState.standstill)
CS.cruiseState.standstill, resume)
if self.long_control_state == LongCtrlState.off:
self.reset()
output_accel = 0.