Skip to content

Commit cb91f7c

Browse files
haraschaxkrkeegan
authored andcommitted
Tssp prius torque control (commaai#24669)
* use llk * use steering sensor at low speed stil * Try more simple * rm prius tune * updated ref
1 parent baaa47f commit cb91f7c

File tree

4 files changed

+6
-15
lines changed

4 files changed

+6
-15
lines changed

selfdrive/car/toyota/interface.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
3838
ret.steerRatio = 15.74 # unknown end-to-end spec
3939
tire_stiffness_factor = 0.6371 # hand-tune
4040
ret.mass = 3045. * CV.LB_TO_KG + STD_CARGO_KG
41-
set_lat_tune(ret.lateralTuning, LatTunes.INDI_PRIUS)
42-
ret.steerActuatorDelay = 0.3
41+
set_lat_tune(ret.lateralTuning, LatTunes.TORQUE, MAX_LAT_ACCEL=1.7, FRICTION=0.06)
4342

4443
elif candidate == CAR.PRIUS_V:
4544
stop_and_go = True

selfdrive/car/toyota/tunes.py

+1-11
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,9 @@ def set_long_tune(tune, name):
5050

5151

5252
###### LAT ######
53-
def set_lat_tune(tune, name, MAX_LAT_ACCEL=2.5, FRICTION=.1):
53+
def set_lat_tune(tune, name, MAX_LAT_ACCEL=2.5, FRICTION=.1, use_steering_angle=True):
5454
if name == LatTunes.TORQUE:
5555
set_torque_tune(tune, MAX_LAT_ACCEL, FRICTION)
56-
elif name == LatTunes.INDI_PRIUS:
57-
tune.init('indi')
58-
tune.indi.innerLoopGainBP = [0.]
59-
tune.indi.innerLoopGainV = [4.0]
60-
tune.indi.outerLoopGainBP = [0.]
61-
tune.indi.outerLoopGainV = [3.0]
62-
tune.indi.timeConstantBP = [0.]
63-
tune.indi.timeConstantV = [1.0]
64-
tune.indi.actuatorEffectivenessBP = [0.]
65-
tune.indi.actuatorEffectivenessV = [1.0]
6656
elif 'PID' in str(name):
6757
tune.init('pid')
6858
tune.pid.kiBP = [0.0]

selfdrive/controls/lib/latcontrol_torque.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ def update(self, active, CS, VM, params, last_actuators, desired_curvature, desi
5555
if self.use_steering_angle:
5656
actual_curvature = -VM.calc_curvature(math.radians(CS.steeringAngleDeg - params.angleOffsetDeg), CS.vEgo, params.roll)
5757
else:
58-
actual_curvature = llk.angularVelocityCalibrated.value[2] / CS.vEgo
58+
actual_curvature_vm = -VM.calc_curvature(math.radians(CS.steeringAngleDeg - params.angleOffsetDeg), CS.vEgo, params.roll)
59+
actual_curvature_llk = llk.angularVelocityCalibrated.value[2] / CS.vEgo
60+
actual_curvature = interp(CS.vEgo, [2.0, 5.0], [actual_curvature_vm, actual_curvature_llk])
5961
desired_lateral_accel = desired_curvature * CS.vEgo ** 2
6062
desired_lateral_jerk = desired_curvature_rate * CS.vEgo ** 2
6163
actual_lateral_accel = actual_curvature * CS.vEgo ** 2
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
336d77ad17b90af17b7eb24cc832e80b62d05a24
1+
0956446adfa91506f0a3d88f893e041bfb2890c1

0 commit comments

Comments
 (0)