Ram 1500 torque tune (#25117)

* torque control again

* 3mss per s

* no bad sensors

* tweaks

* Need more checks before we can do this

* update refs

* only ram for now

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
This commit is contained in:
HaraldSchafer
2022-07-11 15:19:55 -07:00
committed by GitHub
parent 30d88d6892
commit bdfaa1d1ee
7 changed files with 22 additions and 15 deletions

2
panda

Submodule panda updated: ca927fe931...baecd2ecc6

View File

@@ -16,6 +16,7 @@ class CarController:
self.lkas_active_prev = False
self.packer = CANPacker(dbc_name)
self.params = CarControllerParams(CP)
def update(self, CC, CS, low_speed_alert):
can_sends = []
@@ -40,8 +41,8 @@ class CarController:
# steering
if self.frame % 2 == 0:
# steer torque
new_steer = int(round(CC.actuators.steer * CarControllerParams.STEER_MAX))
apply_steer = apply_toyota_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorqueEps, CarControllerParams)
new_steer = int(round(CC.actuators.steer * self.params.STEER_MAX))
apply_steer = apply_toyota_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorqueEps, self.params)
if not lkas_active:
apply_steer = 0
self.steer_rate_limited = new_steer != apply_steer
@@ -56,6 +57,6 @@ class CarController:
self.lkas_active_prev = lkas_active
new_actuators = CC.actuators.copy()
new_actuators.steer = self.apply_steer_last / CarControllerParams.STEER_MAX
new_actuators.steer = self.apply_steer_last / self.params.STEER_MAX
return new_actuators, can_sends

View File

@@ -46,15 +46,15 @@ class CarInterface(CarInterfaceBase):
# Ram
elif candidate == CAR.RAM_1500:
ret.steerActuatorDelay = 0.2
ret.wheelbase = 3.88
ret.steerRatio = 16.3
ret.mass = 2493. + STD_CARGO_KG
ret.maxLateralAccel = 2.4
ret.minSteerSpeed = 14.5
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
ret.lateralTuning.pid.kpBP, ret.lateralTuning.pid.kiBP = [[0.], [0.]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.1], [0.02]]
ret.lateralTuning.pid.kf = 0.00003
else:
raise ValueError(f"Unsupported car: {candidate}")

View File

@@ -26,10 +26,16 @@ class CAR:
class CarControllerParams:
STEER_MAX = 261 # higher than this faults the EPS on Chrysler/Jeep. Ram DT allows more
STEER_DELTA_UP = 3
STEER_DELTA_DOWN = 3
STEER_ERROR_MAX = 80
def __init__(self, CP):
self.STEER_MAX = 261 # higher than this faults the EPS on Chrysler/Jeep. Ram DT allows more
self.STEER_ERROR_MAX = 80
if CP.carFingerprint in RAM_CARS:
self.STEER_DELTA_UP = 5
self.STEER_DELTA_DOWN = 5
else:
self.STEER_DELTA_UP = 3
self.STEER_DELTA_DOWN = 3
STEER_THRESHOLD = 120

View File

@@ -135,11 +135,11 @@ class CarInterfaceBase(ABC):
return ret
@staticmethod
def configure_torque_tune(candidate, tune, steering_angle_deadzone_deg=0.0):
def configure_torque_tune(candidate, tune, steering_angle_deadzone_deg=0.0, use_steering_angle=True):
params = get_torque_params(candidate)
tune.init('torque')
tune.torque.useSteeringAngle = True
tune.torque.useSteeringAngle = use_steering_angle
tune.torque.kp = 1.0 / params['LAT_ACCEL_FACTOR']
tune.torque.kf = 1.0 / params['LAT_ACCEL_FACTOR']
tune.torque.ki = 0.1 / params['LAT_ACCEL_FACTOR']

View File

@@ -21,7 +21,7 @@ COMMA BODY: [.nan, 1000, .nan]
# Totally new cars
KIA EV6 2022: [3.5, 2.5, 0.0]
RAM 1500 5TH GEN: [2.0, 2.0, 0.05]
RAM 1500 5TH GEN: [2.0, 2.0, 0.0]
# Dashcam or fallback configured as ideal car
mock: [10.0, 10, 0.0]

View File

@@ -1 +1 @@
825acfae98543c915c18d3b19a9c5d2503e431a6
d583bbd9643000e7f817171c583d31ae3141a652