Skip to content

Commit 0959a0b

Browse files
authored
1 or 2 bar: more conservative braking
1 parent 950bfe1 commit 0959a0b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

selfdrive/controls/lib/planner.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ def update(self, CS, lead, v_cruise_setpoint):
257257
# If one bar distance, auto set to 2 bar distance under current conditions to prevent rear ending lead car
258258
if self.street_speed and (self.lead_car_gap_shrinking or self.tailgating):
259259
TR=2.1
260-
if self.lastTR != 0:
260+
if self.lastTR != -1:
261261
self.libmpc.init(MPC_COST_LONG.TTC, 0.0825, MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK)
262-
self.lastTR = 0
262+
self.lastTR = -1
263263
else:
264264
TR=0.9 # 10m at 40km/hr
265265
if CS.readdistancelines != self.lastTR:
@@ -270,9 +270,9 @@ def update(self, CS, lead, v_cruise_setpoint):
270270
# More conservative braking than comma default
271271
if self.street_speed and (self.lead_car_gap_shrinking or self.tailgating):
272272
TR=2.0
273-
if self.lastTR != 0:
273+
if self.lastTR != -2:
274274
self.libmpc.init(MPC_COST_LONG.TTC, 0.0875, MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK)
275-
self.lastTR = 0
275+
self.lastTR = -2
276276
else:
277277
TR=1.8 # 20m at 40km/hr
278278
if CS.readdistancelines != self.lastTR:

0 commit comments

Comments
 (0)