Skip to content

Commit

Permalink
ACC: Don't autoresume if there is a slow car in front
Browse files Browse the repository at this point in the history
  • Loading branch information
David Abrahams committed Sep 19, 2018
1 parent e5c1762 commit d359f70
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion selfdrive/car/tesla/ACC_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,16 @@ def _should_autoengage_cc(self, CS, lead_car=None):
and CS.pcm_acc_status == 1
and CS.v_ego >= self.MIN_CRUISE_SPEED_MS
and _current_time_millis() > self.fast_decel_time + 2000)

no_slow_lead = not lead_car or lead_car.vRel >= 0

# "Autoresume" mode allows cruise to engage even after brake events, but
# shouldn't trigger DURING braking.
autoresume_ready = self.autoresume and CS.a_ego >= 0.1

braked = self.user_has_braked or self.has_gone_below_min_speed

return cruise_ready and (autoresume_ready or not braked)
return cruise_ready and no_slow_lead and (autoresume_ready or not braked)

def _fast_decel_required(self, CS, lead_car):
""" Identifies situations which call for rapid deceleration. """
Expand Down

0 comments on commit d359f70

Please sign in to comment.