Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent multiple readings of the pid params file #119

Merged
merged 1 commit into from
Nov 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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