Skip to content

Commit 84826d5

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
1 parent 7a2d3c1 commit 84826d5

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, steering_angle_deadzone_deg=0.0):
@@ -66,14 +65,16 @@ def update(self, active, CS, VM, params, last_actuators, desired_curvature, desi
6665
actual_lateral_accel = actual_curvature * CS.vEgo ** 2
6766
lateral_accel_deadzone = curvature_deadzone * CS.vEgo ** 2
6867

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

7475
ff = desired_lateral_accel - params.roll * ACCELERATION_DUE_TO_GRAVITY
7576
# convert friction into lateral accel units for feedforward
76-
friction_compensation = interp(error, [-JERK_THRESHOLD, JERK_THRESHOLD], [-self.friction, self.friction])
77+
friction_compensation = interp(error, [-FRICTION_THRESHOLD, FRICTION_THRESHOLD], [-self.friction, self.friction])
7778
ff += friction_compensation / self.kf
7879
freeze_integrator = CS.steeringRateLimited or CS.steeringPressed or CS.vEgo < 5
7980
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)