Skip to content

Commit

Permalink
New auto-df model with 45 seconds or temporal context (from 35) (comm…
Browse files Browse the repository at this point in the history
…aai#115)

* New auto-df model! 45 seconds of temporal context

* Update dynamic follow for new auto-df model

* whoops, forgot to add a_lead

* delete readme backup
  • Loading branch information
sshane authored Jun 18, 2020
1 parent d6fbfef commit 44083a0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 28 deletions.
20 changes: 0 additions & 20 deletions README_backup.md

This file was deleted.

7 changes: 4 additions & 3 deletions selfdrive/controls/lib/dynamic_follow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ def __init__(self, mpc_id):

# Model variables
mpc_rate = 1 / 20.
self.model_scales = {'v_ego': [-0.06112159043550491, 37.96522521972656], 'v_lead': [0.0, 35.27671432495117], 'x_lead': [2.4600000381469727, 139.52000427246094]}
self.model_scales = {'v_ego': [-0.06112159043550491, 37.96522521972656], 'a_lead': [-3.109330892562866, 3.3612186908721924], 'v_lead': [0.0, 35.27671432495117], 'x_lead': [2.4600000381469727, 141.44000244140625]}
self.predict_rate = 1 / 4.
self.skip_every = round(0.2 / mpc_rate)
self.model_input_len = round(35 / mpc_rate) # int: model input time
self.skip_every = round(0.25 / mpc_rate)
self.model_input_len = round(45 / mpc_rate)

# Dynamic follow variables
self.default_TR = 1.8
Expand Down Expand Up @@ -146,6 +146,7 @@ def _store_df_data(self):
# Store data for auto-df model
self.auto_df_model_data.append([self._norm(self.car_data.v_ego, 'v_ego'),
self._norm(self.lead_data.v_lead, 'v_lead'),
self._norm(self.lead_data.a_lead, 'a_lead'),
self._norm(self.lead_data.x_lead, 'x_lead')])
while len(self.auto_df_model_data) > self.model_input_len:
del self.auto_df_model_data[0]
Expand Down
6 changes: 2 additions & 4 deletions selfdrive/controls/lib/dynamic_follow/auto_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ def predict(x):
l1 = np.dot(l0, w[1]) + b[1]
l1 = np.maximum(0, l1)
l2 = np.dot(l1, w[2]) + b[2]
l2 = np.maximum(0, l2)
l3 = np.dot(l2, w[3]) + b[3]
l3 = softmax(l3)
return l3
l2 = softmax(l2)
return l2
Binary file modified selfdrive/controls/lib/dynamic_follow/auto_df_weights.npz
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import time
import numpy as np

samples = np.random.rand(2000, 800).astype(np.float32)
samples = np.random.rand(2000, 720).astype(np.float32)

t = time.time()
for sample in samples:
Expand Down

0 comments on commit 44083a0

Please sign in to comment.