Skip to content

Commit

Permalink
Prevent multiple readings of the pid params file (#119)
Browse files Browse the repository at this point in the history
..only load the pid values when we initiate the LoC
  • Loading branch information
tb205gti authored and BogGyver committed Nov 7, 2019
1 parent 4557733 commit 86d29e1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions selfdrive/car/tesla/PCC_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ def reset(self, v_pid):
def update_stat(self, CS, enabled):
if not self.LoC:
self.LoC = LongControl(CS.CP, tesla_compute_gb)
# Get v_id from the stored file when initiating the LoC and reset_on_disengage==false
if (not RESET_PID_ON_DISENGAGE):
self.load_pid()


can_sends = []
if CS.pedal_interceptor_available and not CS.cstm_btns.get_button_status("pedal"):
Expand Down Expand Up @@ -406,11 +410,7 @@ def update_pdl(self, enabled, CS, frame, actuators, pcm_speed, speed_limit_ms, s
# how much accel and break we have to do
####################################################################
if PCCModes.is_selected(FollowMode(), CS.cstm_btns):
# Get v_id from the stored file, only the first activation where v_pid eq 0
if (not RESET_PID_ON_DISENGAGE and self.v_pid == 0.):
self.load_pid()
else:
self.v_pid = self.calc_follow_speed_ms(CS,alca_enabled)
self.v_pid = self.calc_follow_speed_ms(CS,alca_enabled)

if mapd is not None:
v_curve = max_v_in_mapped_curve_ms(mapd.liveMapData, self.pedal_speed_kph)
Expand Down

0 comments on commit 86d29e1

Please sign in to comment.