Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

Commit

Permalink
nda speed recovery process
Browse files Browse the repository at this point in the history
  • Loading branch information
jc01rho committed Nov 19, 2023
1 parent d3e5436 commit b8340bb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions selfdrive/controls/lib/cruise_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,19 +664,20 @@ def update_v_cruise_apilot(self, v_cruise_kph, buttonEvents, enabled, metric, co
self.frame = controls.sm.frame
self.update_params(self.frame)


self.naviSpeed, self.roadSpeed = self.update_speed_nda(CS, controls)

if self.naviSpeed > 0 :
self.naviSpeedPrev = self.naviSpeed
self.naviSpeedRecoveryProcessOngoing = True

if self.naviSpeedRecoveryProcessOngoing and self.naviSpeed == 0:
if self.frame % 50 == 0:
elif self.naviSpeedRecoveryProcessOngoing and self.naviSpeed <= 0:
if self.frame % 40 == 0:
self.naviSpeedRecoveryProcessCounter += 1
speed_diff = self.v_cruise_kph_apply - self.naviSpeedPrev
self.naviSpeed = round(self.naviSpeedPrev + speed_diff * (self.naviSpeedRecoveryProcessCounter/10.0))
speed_diff = self.v_cruise_kph - self.naviSpeedPrev
self.naviSpeed = ceil(self.naviSpeedPrev + speed_diff * (self.naviSpeedRecoveryProcessCounter/15.0))

if self.naviSpeedRecoveryProcessCounter > 10 :
if self.naviSpeedRecoveryProcessCounter > 15 :
self.naviSpeedRecoveryProcessOngoing = False
self.naviSpeedRecoveryProcessCounter = 0
self.naviSpeedPrev = 0
Expand Down

0 comments on commit b8340bb

Please sign in to comment.