repair the bug causing crash when set to record mode in gym_hil sim e… #2079
+6
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I modified the code based on v0.3.3. Please merged into v0.3.3. I can't pull request merging into v0.3.3. #2000 shows that when open the record mode in gym_hil sim environment. It will raise wrong
Initialized gamepad: Xbox Series X Controller Controller Xbox Series X Controller not found in config. Using default configuration. Gamepad controls: 5 button: Intervention Left analog stick: Move in X-Y plane Right analog stick (vertical): Move in Z axis 6 button: Close gripper 7 button: Open gripper 1/Circle button: Exit 3/Triangle button: End episode with SUCCESS 0/Cross button: End episode with FAILURE 2/Square button: Rerecord episode INFO:datasets:PyTorch version 2.7.1 available. INFO:root:Reset delay of 1.0 seconds INFO:root:Recording episode 0 Traceback (most recent call last): File "/home/hw/miniconda3/envs/lerobot1/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/hw/miniconda3/envs/lerobot1/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/hw/下载/lerobot-0.3.3/src/lerobot/scripts/rl/gym_manipulator.py", line 2263, in <module> main() File "/home/hw/下载/lerobot-0.3.3/src/lerobot/configs/parser.py", line 225, in wrapper_inner response = fn(cfg, *args, **kwargs) File "/home/hw/下载/lerobot-0.3.3/src/lerobot/scripts/rl/gym_manipulator.py", line 2216, in main record_dataset( File "/home/hw/下载/lerobot-0.3.3/src/lerobot/scripts/rl/gym_manipulator.py", line 2102, in record_dataset "action": info["action_intervention"].cpu().squeeze(0).float() if policy is None else action KeyError: 'action_intervention' /home/hw/miniconda3/envs/lerobot1/lib/python3.10/site-packages/glfw/__init__.py:917: GLFWError: (65537) b'The GLFW library is not initialized' warnings.warn(message, GLFWError)
I check the keys of the dict info and find that "action_intervention" is not exist and changed to teleop_action which is a numpy array. So the final modification is
For teleop, get action from intervention recorded_action = { "action": torch.tensor(info["teleop_action"], dtype=torch.float32) if policy is None else action }