Skip to content

Commit

Permalink
Merge pull request #13 from commaai/controller-history
Browse files Browse the repository at this point in the history
Start the controller update before actually using the outputs
  • Loading branch information
nuwandavek authored May 22, 2024
2 parents c319dcd + fb71c75 commit a615066
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tinyphysics.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ def sim_step(self, step_idx: int) -> None:
self.current_lataccel_history.append(self.current_lataccel)

def control_step(self, step_idx: int) -> None:
if step_idx >= CONTROL_START_IDX:
action = self.controller.update(self.target_lataccel_history[step_idx], self.current_lataccel, self.state_history[step_idx])
else:
action = self.controller.update(self.target_lataccel_history[step_idx], self.current_lataccel, self.state_history[step_idx])
if step_idx < CONTROL_START_IDX:
action = self.data['steer_command'].values[step_idx]
action = np.clip(action, STEER_RANGE[0], STEER_RANGE[1])
self.action_history.append(action)
Expand Down

0 comments on commit a615066

Please sign in to comment.