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.6.1).
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

設定

gym_hilをLeRobotで使用するには、設定ファイルを作成する必要があります。例はこちらにあります。主な設定セクションは以下の通りです:

環境タイプとタスク

{
  "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

Datasetの記録

データセットを収集するには、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