Skip to content

Commit

Permalink
Merge pull request commaai#393 from ShaneSmiskol/release2
Browse files Browse the repository at this point in the history
add a_rel to data logger
  • Loading branch information
sshane authored Jun 21, 2019
2 parents d5ed9b0 + 20549cd commit e083e59
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion selfdrive/controls/lib/long_mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,14 @@ def update(self, CS, lead, v_cruise_setpoint):
x_lead = lead.dRel
v_lead = max(0.0, lead.vLead)
a_lead = lead.aLeadK
a_rel = lead.aRel

if (v_lead < 0.1 or -a_lead / 2.0 > v_lead):
v_lead = 0.0
a_lead = 0.0

if self.mpc_id == 1 and not CS.carState.cruiseState.enabled:
self.df_data.append([v_ego, a_ego, v_lead, x_lead, a_lead, gas, brake, time.time()])
self.df_data.append([v_ego, a_ego, v_lead, x_lead, a_lead, a_rel, gas, brake, time.time()])
if self.df_frame >= 200: # every 5 seconds, write to file
try:
with open("/data/openpilot/selfdrive/data_collection/df-data", "a") as f:
Expand Down

0 comments on commit e083e59

Please sign in to comment.