Longcontrol: do not clip vEgo to minSpeedCan (#22832)

* fix tss2 slow reacceleration in sng

(should) preserve stopping behavior

add comments since it's confusing

fix

* Revert "fix tss2 slow reacceleration in sng"

This reverts commit 42abde0eb945d8bc5ad9b502d1d89b3e3dc16f8a.

* don't max(vEgo)

* update ref

Co-authored-by: Willem Melching <willem.melching@gmail.com>
old-commit-hash: bdaea086f8
vw-mqb-aeb
sshane 4 years ago committed by GitHub
parent 8797c043bd
commit 9c994173ed
  1. 8
      selfdrive/controls/lib/longcontrol.py
  2. 2
      selfdrive/test/process_replay/ref_commit

@ -97,10 +97,8 @@ class LongControl():
v_target_future, self.v_pid, output_accel,
CS.brakePressed, CS.cruiseState.standstill, CP.minSpeedCan)
v_ego_pid = max(CS.vEgo, CP.minSpeedCan) # Without this we get jumps, CAN bus reports 0 when speed < 0.3
if self.long_control_state == LongCtrlState.off or CS.gasPressed:
self.reset(v_ego_pid)
self.reset(CS.vEgo)
output_accel = 0.
# tracking objects and driving
@ -110,10 +108,10 @@ class LongControl():
# Toyota starts braking more when it thinks you want to stop
# Freeze the integrator so we don't accelerate to compensate, and don't allow positive acceleration
prevent_overshoot = not CP.stoppingControl and CS.vEgo < 1.5 and v_target_future < 0.7
deadzone = interp(v_ego_pid, CP.longitudinalTuning.deadzoneBP, CP.longitudinalTuning.deadzoneV)
deadzone = interp(CS.vEgo, CP.longitudinalTuning.deadzoneBP, CP.longitudinalTuning.deadzoneV)
freeze_integrator = prevent_overshoot
output_accel = self.pid.update(self.v_pid, v_ego_pid, speed=v_ego_pid, deadzone=deadzone, feedforward=a_target, freeze_integrator=freeze_integrator)
output_accel = self.pid.update(self.v_pid, CS.vEgo, speed=CS.vEgo, deadzone=deadzone, feedforward=a_target, freeze_integrator=freeze_integrator)
if prevent_overshoot:
output_accel = min(output_accel, 0.0)

@ -1 +1 @@
b18661a3a66979d2c12a8bbde109cb7e50f00e1a
7480befa230cb020e5ddd3b4b86e2e8a589cde59
Loading…
Cancel
Save