Fix dynamic replay of position-velocity expert actions - #699
Conversation
Decode persisted position-velocity expert actions into controller commands during dynamic replay. Add provider-free coverage for replay modes and preserve broadcast lengths for tensor metadata.
|
| action = env.received_actions[0] | ||
| assert isinstance(action, ControllerAction) | ||
| assert torch.equal(action.value["qpos"], torch.tensor([[0.0, 1.0]])) | ||
| assert torch.equal(action.value["qvel"], torch.tensor([[2.0, 3.0]])) |
There was a problem hiding this comment.
Controller application remains untested The new position-velocity test checks only what
_FakeEnv.step() receives; the fake environment stores the action but never applies it. Existing simulator-backed dynamic replay tests cover position-only and policy actions, so a mistake in applying either qpos or qvel during real position-velocity replay would go undetected. Please add a focused integration test when the simulator test environment is available.
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/gym/envs/test_replay_wrapper.py
Line: 191-194
Comment:
**Controller application remains untested** The new position-velocity test checks only what `_FakeEnv.step()` receives; the fake environment stores the action but never applies it. Existing simulator-backed dynamic replay tests cover position-only and policy actions, so a mistake in applying either qpos or qvel during real position-velocity replay would go undetected. Please add a focused integration test when the simulator test environment is available.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Description
Fix dynamic replay for expert trajectories recorded with
joint_command_mode="position_velocity".Position-velocity actions are persisted as a flat
[qpos, qvel]vector. Dynamic replay now reconstructs them as aControllerActionwith separate controller fields before callingenv.step(). Single-environment broadcast also preserves tensor-valued per-environment lengths.No linked issue was provided.
Dependencies: None.
Type of change
Validation
black .passed with the installed Black 24.3.0 environment.python docs/scripts/check_api_docs.pypassed (2298/2298exports documented).git diff --checkpassed.6 passed.Checklist
black .command to format the code base.