Skip to content

Conversation

@hcooch2ch3
Copy link

@hcooch2ch3 hcooch2ch3 commented Oct 28, 2025

What this does

Title Label
Fixes #2000, Fixes #2155 🐛 Bug

In gym_hil (Hardware-In-the-Loop) simulation environments where no teleop device is available, the record mode was failing with a AttributeError when trying to access teleop_device.action_features.

This fix checks if a teleop device is available and:

  • Uses teleop_device.action_features when available (normal case)
  • Falls back to deriving action features from the environment's action space when teleop device is None (gym_hil case)

This allows users to record trajectories in simulation environments without a physical teleop device.

How it was tested

  • Verified the code handles a case without teleop device
  • The action features are correctly derived from env.action_space with dtype "float32" and appropriate shape
  • Record mode can now proceed without throwing an error in gym_hil environments

How to checkout & try?

Record trajectories in a gym_hil environment without teleop device

  1. Make gym_hil_env.json file like this:
{
  "env": {
    "name": "gym_hil",
    "task": "PandaPickCubeKeyboard-v0",
    "fps": 10,
    "processor": {
      "control_mode": "keyboard",
      "gripper": {
        "use_gripper": true,
        "gripper_penalty": -0.02
      },
      "reset": {
        "fixed_reset_joint_positions": [0.0, 0.195, 0.0, -2.43, 0.0, 2.62, 0.785],
        "reset_time_s": 2.0,
        "control_time_s": 15.0,
        "terminate_on_success": false
      }
    }
  },
  "dataset": {
    "repo_id": "aractingi/franka_sim_pick_lift_6",
    "root": "/Users/yimsungmin/lerobot/my_hil_dataset/PandaPickCubeKeyboard-v0/",
    "task": "pick_cube",
    "num_episodes_to_record": 1,
    "replay_episode": 0,
    "push_to_hub": false
  },
  "mode": "record",
  "device": "mps"
}
  1. Launch the simulator(gym_hil) and start recording using:
mjpython -m lerobot.rl.gym_manipulator --config_path ./gym_hil_env.json
  1. Check Recorded Data
    The recorded dataset of simulation will be saved in the specified directory.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Imitation Learning in Sim error bug when recording the gymhil dataset

1 participant