Acceleration profiles
Added toggle to use DragonPilot's acceleration profiles. Credit goes to DragonPilot! https: //github.com/dragonpilot-community/dragonpilot Co-Authored-By: eFini <16603033+efinilan@users.noreply.github.com> Co-Authored-By: Kumar <36933347+rav4kumar@users.noreply.github.com>
This commit is contained in:
@@ -45,7 +45,7 @@ class CarController:
|
||||
|
||||
def update_frogpilot_variables(self, params):
|
||||
|
||||
def update(self, CC, CS, now_nanos):
|
||||
def update(self, CC, CS, now_nanos, sport_plus):
|
||||
actuators = CC.actuators
|
||||
hud_control = CC.hudControl
|
||||
pcm_cancel_cmd = CC.cruiseControl.cancel
|
||||
@@ -118,7 +118,10 @@ class CarController:
|
||||
interceptor_gas_cmd = clip(pedal_command, 0., MAX_INTERCEPTOR_GAS)
|
||||
else:
|
||||
interceptor_gas_cmd = 0.
|
||||
pcm_accel_cmd = clip(actuators.accel, self.params.ACCEL_MIN, self.params.ACCEL_MAX)
|
||||
if sport_plus:
|
||||
pcm_accel_cmd = clip(actuators.accel, self.params.ACCEL_MIN, self.params.ACCEL_MAX_PLUS)
|
||||
else:
|
||||
pcm_accel_cmd = clip(actuators.accel, self.params.ACCEL_MIN, self.params.ACCEL_MAX)
|
||||
|
||||
# TODO: probably can delete this. CS.pcm_acc_status uses a different signal
|
||||
# than CS.cruiseState.enabled. confirm they're not meaningfully different
|
||||
|
||||
@@ -15,8 +15,11 @@ SteerControlType = car.CarParams.SteerControlType
|
||||
|
||||
class CarInterface(CarInterfaceBase):
|
||||
@staticmethod
|
||||
def get_pid_accel_limits(CP, current_speed, cruise_speed):
|
||||
return CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX
|
||||
def get_pid_accel_limits(CP, current_speed, cruise_speed, sport_plus):
|
||||
if sport_plus:
|
||||
return CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX_PLUS
|
||||
else:
|
||||
return CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX
|
||||
|
||||
@staticmethod
|
||||
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
|
||||
@@ -316,5 +319,5 @@ class CarInterface(CarInterfaceBase):
|
||||
|
||||
# pass in a car.CarControl
|
||||
# to be called @ 100hz
|
||||
def apply(self, c, now_nanos):
|
||||
return self.CC.update(c, self.CS, now_nanos)
|
||||
def apply(self, c, now_nanos, sport_plus):
|
||||
return self.CC.update(c, self.CS, now_nanos, sport_plus)
|
||||
|
||||
@@ -17,6 +17,7 @@ PEDAL_TRANSITION = 10. * CV.MPH_TO_MS
|
||||
|
||||
class CarControllerParams:
|
||||
ACCEL_MAX = 1.5 # m/s2, lower than allowed 2.0 m/s2 for tuning reasons
|
||||
ACCEL_MAX_PLUS = 4.0
|
||||
ACCEL_MIN = -3.5 # m/s2
|
||||
|
||||
STEER_STEP = 1
|
||||
|
||||
Reference in New Issue
Block a user