Skip to content

Commit c73492a

Browse files
committed
fix off by one error
1 parent e294d30 commit c73492a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tinyphysics.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ def get_data(self, data_path: str) -> pd.DataFrame:
122122

123123
def sim_step(self, step_idx: int) -> None:
124124
pred = self.sim_model.get_current_lataccel(
125-
sim_states=self.state_history[max(0, step_idx - CONTEXT_LENGTH):step_idx],
126-
actions=self.action_history[max(0, step_idx - CONTEXT_LENGTH):step_idx],
127-
past_preds=self.current_lataccel_history[max(0, step_idx - CONTEXT_LENGTH):step_idx]
125+
sim_states=self.state_history[-CONTEXT_LENGTH:],
126+
actions=self.action_history[-CONTEXT_LENGTH:],
127+
past_preds=self.current_lataccel_history[-CONTEXT_LENGTH:]
128128
)
129129
pred = np.clip(pred, self.current_lataccel - MAX_ACC_DELTA, self.current_lataccel + MAX_ACC_DELTA)
130130
if step_idx >= CONTROL_START_IDX:

0 commit comments

Comments
 (0)