LeRobot documentation

시뮬레이션에서 RL 학습

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.7.0).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

시뮬레이션에서 RL 학습

This guide explains how to use the gym_hil simulation environments as an alternative to real robots when working with the LeRobot framework for Human-In-the-Loop (HIL) reinforcement learning.

gym_hil은 Human-In-the-Loop 강화 학습을 위해 특별히 설계된 Gymnasium 호환 시뮬레이션 환경을 제공하는 패키지입니다. 이 환경을 사용하면 다음을 수행할 수 있습니다:

  • Train policies in simulation to test the RL stack before training on real robots

  • 게임패드나 키보드와 같은 외부 장치를 사용하여 시뮬레이션에서 데모를 수집합니다

  • 정책 학습 중 인간 개입 수행

현재, 주요 환경은 MuJoCo 기반의 Franka Panda 로봇 시뮬레이션이며, 큐브를 집는 등의 작업을 포함합니다.

설치

먼저 LeRobot 환경에서 gym_hil 패키지를 설치합니다:

pip install -e ".[hilserl]"

무엇이 필요한가요?

  • 로봇을 제어하기 위한 게임패드 또는 키보드
  • Nvidia GPU

구성

LeRobot와 gym_hil을 함께 사용하려면 구성 파일을 생성해야 합니다. 예제는 여기에서 확인할 수 있습니다. 주요 구성 섹션은 다음과 같습니다:

환경 유형 및 작업

{
  "env": {
    "type": "gym_manipulator",
    "name": "gym_hil",
    "task": "PandaPickCubeGamepad-v0",
    "fps": 10
  },
  "device": "cuda"
}

사용 가능한 작업:

  • PandaPickCubeBase-v0: 기본 환경
  • PandaPickCubeGamepad-v0: 게임패드 컨트롤
  • PandaPickCubeKeyboard-v0: 키보드 제어

프로세서 구성

{
  "env": {
    "processor": {
      "control_mode": "gamepad",
      "gripper": {
        "use_gripper": true,
        "gripper_penalty": -0.02
      },
      "reset": {
        "control_time_s": 15.0,
        "fixed_reset_joint_positions": [
          0.0, 0.195, 0.0, -2.43, 0.0, 2.62, 0.785
        ]
      },
      "inverse_kinematics": {
        "end_effector_step_sizes": {
          "x": 0.025,
          "y": 0.025,
          "z": 0.025
        }
      }
    }
  }
}

중요한 매개변수:

  • gripper.gripper_penalty: 과도한 그리퍼 움직임에 대한 페널티
  • gripper.use_gripper: 그리퍼 제어 활성화 여부
  • inverse_kinematics.end_effector_step_sizes: 엔드 이펙터의 x, y, z 축의 스텝 크기
  • control_mode: 게임패드 컨트롤러를 사용하려면 "gamepad"로 설정

LeRobot의 HIL RL로 실행

기본 사용법

환경을 실행하려면 mode를 null로 설정하세요:

python -m lerobot.rl.gym_manipulator --config_path path/to/gym_hil_env.json

데이터셋 기록

데이터셋을 수집하려면 record 모드로 설정하고 repo_id 및 기록할 에피소드 수를 정의합니다:

{
  "env": {
    "type": "gym_manipulator",
    "name": "gym_hil",
    "task": "PandaPickCubeGamepad-v0"
  },
  "dataset": {
    "repo_id": "username/sim_dataset",
    "root": null,
    "task": "pick_cube",
    "num_episodes_to_record": 10,
    "replay_episode": null,
    "push_to_hub": true
  },
  "mode": "record"
}
python -m lerobot.rl.gym_manipulator --config_path path/to/gym_hil_env.json

정책 학습

정책을 학습하려면 여기에서 사용할 수 있는 구성 예시를 확인하고 learner와 actor 서버를 실행하세요. actor가 learner에 연결되므로 먼저 learner를 시작해야 합니다:

python -m lerobot.rl.learner --config_path path/to/train_gym_hil_env.json

다른 터미널에서 actor 서버를 실행합니다:

python -m lerobot.rl.actor --config_path path/to/train_gym_hil_env.json

시뮬레이션 환경은 실제 로봇에 배포하기 전에 Human-In-the-Loop 강화 학습 구성 요소를 개발하고 테스트할 수 있는 안전하고 반복 가능한 방법을 제공합니다.

축하합니다 🎉, 이 튜토리얼을 완료했습니다!

질문이 있거나 도움이 필요하시면 Discord로 문의해 주세요.

논문 인용:

@article{luo2024precise,
  title={Precise and Dexterous Robotic Manipulation via Human-in-the-Loop Reinforcement Learning},
  author={Luo, Jianlan and Xu, Charles and Wu, Jeffrey and Levine, Sergey},
  journal={arXiv preprint arXiv:2410.21845},
  year={2024}
}
Update on GitHub