Skip to content

Commit 98f29fc

Browse files
haraschaxrjsmith1999
authored andcommitted
Torque control: low speed boost (commaai#24859)
* Make very low speed more aggressive * Less extreme low speed boost * Update ref (cherry picked from commit a6652a5)
1 parent fa0dae5 commit 98f29fc

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

selfdrive/controls/lib/latcontrol_torque.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
# move it at all, this is compensated for too.
2020

2121

22-
LOW_SPEED_FACTOR = 200
23-
JERK_THRESHOLD = 0.2
22+
FRICTION_THRESHOLD = 0.2
2423

2524

2625
def set_torque_tune(tune, MAX_LAT_ACCEL=2.5, FRICTION=0.01):
@@ -65,14 +64,16 @@ def update(self, active, CS, VM, params, last_actuators, desired_curvature, desi
6564
actual_lateral_accel = actual_curvature * CS.vEgo ** 2
6665
lateral_accel_deadzone = curvature_deadzone * CS.vEgo ** 2
6766

68-
setpoint = desired_lateral_accel + LOW_SPEED_FACTOR * desired_curvature
69-
measurement = actual_lateral_accel + LOW_SPEED_FACTOR * actual_curvature
67+
68+
low_speed_factor = interp(CS.vEgo, [0, 15], [500, 0])
69+
setpoint = desired_lateral_accel + low_speed_factor * desired_curvature
70+
measurement = actual_lateral_accel + low_speed_factor * actual_curvature
7071
error = apply_deadzone(setpoint - measurement, lateral_accel_deadzone)
7172
pid_log.error = error
7273

7374
ff = desired_lateral_accel - params.roll * ACCELERATION_DUE_TO_GRAVITY
7475
# convert friction into lateral accel units for feedforward
75-
friction_compensation = interp(error, [-JERK_THRESHOLD, JERK_THRESHOLD], [-self.friction, self.friction])
76+
friction_compensation = interp(error, [-FRICTION_THRESHOLD, FRICTION_THRESHOLD], [-self.friction, self.friction])
7677
ff += friction_compensation / self.kf
7778
freeze_integrator = CS.steeringRateLimited or CS.steeringPressed or CS.vEgo < 5
7879
output_torque = self.pid.update(error,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
123506cad1877e93bfe5c91ecdce654ef339959b
1+
1d66eed104dbc124c4e5679f5dddf40197b86ce9

0 commit comments

Comments
 (0)