Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
Fix for lead accel calculation algorithm (#83)
Browse files Browse the repository at this point in the history
* add profile mods to opParams for live tuning to debug FCW

* debug

* revert

* Test stock

* fix accel algorithm

* tmp

* tmp

* tmp
  • Loading branch information
sshane authored Mar 22, 2020
1 parent 48d8586 commit 80deeaa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions selfdrive/controls/lib/long_mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def calculate_lead_accel(self):
return a_calculated

if a_calculated < 0 <= a_lead: # accel over time is negative and current accel is zero or positive
if a_lead < -a_calculated * 0.5:
if a_lead < -a_calculated * 0.55:
# half of accel over time is less than current positive accel, we're not decelerating after long decel
return a_calculated

if a_lead <= 0 < a_calculated: # accel over time is positive and current accel is zero or negative
if -a_lead < a_calculated * 0.5:
if -a_lead < a_calculated * 0.45:
# half of accel over time is greater than current negative accel, we're not accelerating after long accel
return a_calculated

Expand Down

0 comments on commit 80deeaa

Please sign in to comment.