Skip to content

Commit

Permalink
1 or 2 bar: more conservative braking
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonGalaxy75 authored Dec 16, 2018
1 parent 950bfe1 commit 0959a0b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions selfdrive/controls/lib/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ def update(self, CS, lead, v_cruise_setpoint):
# If one bar distance, auto set to 2 bar distance under current conditions to prevent rear ending lead car
if self.street_speed and (self.lead_car_gap_shrinking or self.tailgating):
TR=2.1
if self.lastTR != 0:
if self.lastTR != -1:
self.libmpc.init(MPC_COST_LONG.TTC, 0.0825, MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK)
self.lastTR = 0
self.lastTR = -1
else:
TR=0.9 # 10m at 40km/hr
if CS.readdistancelines != self.lastTR:
Expand All @@ -270,9 +270,9 @@ def update(self, CS, lead, v_cruise_setpoint):
# More conservative braking than comma default
if self.street_speed and (self.lead_car_gap_shrinking or self.tailgating):
TR=2.0
if self.lastTR != 0:
if self.lastTR != -2:
self.libmpc.init(MPC_COST_LONG.TTC, 0.0875, MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK)
self.lastTR = 0
self.lastTR = -2
else:
TR=1.8 # 20m at 40km/hr
if CS.readdistancelines != self.lastTR:
Expand Down

0 comments on commit 0959a0b

Please sign in to comment.