@@ -256,9 +256,9 @@ def update(self, CS, lead, v_cruise_setpoint):
256
256
if CS .readdistancelines == 1 :
257
257
# If one bar distance, auto set to 2 bar distance under current conditions to prevent rear ending lead car
258
258
if self .street_speed and (self .lead_car_gap_shrinking or self .tailgating ):
259
- TR = 2.0
259
+ TR = 2.1
260
260
if self .lastTR != 0 :
261
- self .libmpc .init (MPC_COST_LONG .TTC , 0.0875 , MPC_COST_LONG .ACCELERATION , MPC_COST_LONG .JERK )
261
+ self .libmpc .init (MPC_COST_LONG .TTC , 0.0825 , MPC_COST_LONG .ACCELERATION , MPC_COST_LONG .JERK )
262
262
self .lastTR = 0
263
263
else :
264
264
TR = 0.9 # 10m at 40km/hr
@@ -267,10 +267,17 @@ def update(self, CS, lead, v_cruise_setpoint):
267
267
self .lastTR = CS .readdistancelines
268
268
269
269
elif CS .readdistancelines == 2 :
270
- TR = 1.8 # 20m at 40km/hr
271
- if CS .readdistancelines != self .lastTR :
272
- self .libmpc .init (MPC_COST_LONG .TTC , 0.1 , MPC_COST_LONG .ACCELERATION , MPC_COST_LONG .JERK )
273
- self .lastTR = CS .readdistancelines
270
+ # More conservative braking than comma default
271
+ if self .street_speed and (self .lead_car_gap_shrinking or self .tailgating ):
272
+ TR = 2.0
273
+ if self .lastTR != 0 :
274
+ self .libmpc .init (MPC_COST_LONG .TTC , 0.0875 , MPC_COST_LONG .ACCELERATION , MPC_COST_LONG .JERK )
275
+ self .lastTR = 0
276
+ else :
277
+ TR = 1.8 # 20m at 40km/hr
278
+ if CS .readdistancelines != self .lastTR :
279
+ self .libmpc .init (MPC_COST_LONG .TTC , 0.1 , MPC_COST_LONG .ACCELERATION , MPC_COST_LONG .JERK )
280
+ self .lastTR = CS .readdistancelines
274
281
275
282
elif CS .readdistancelines == 3 :
276
283
TR = 2.7 # 30m at 40km/hr
0 commit comments