外观
教程raw.githubusercontent.com6 天前
星海图 GalaxeaManipSim 安装、任务环境与数据采集实操
> 本文依据以下官方文档整理:raw.githubusercontent.com/OpenGalaxea/GalaxeaManipSim/main/R。命令与版本以文档当前版本为准。
前置条件
- Linux + CUDA GPU
- Python 3.10+
- CUDA 11.8
- conda
- LeRobot
- 可选:使用 --use_video 时需要 ffmpeg installed
1. 创建 GalaxeaManipSim 环境并安装
在 Galaxea Manipulation Simulator 代码目录中创建 conda 环境,文档指定 Python 版本为 3.10,并以 editable 方式安装当前项目。
bash
## Create conda environment
conda create -n galaxea-sim python=3.10 -y
conda activate galaxea-sim
pip install -e .2. 安装 LeRobot 并设置 PYTHONPATH
退出当前目录到上一级,克隆 LeRobot,切换到文档指定提交,再进行 editable 安装。最后把 LeRobot 代码路径加入 PYTHONPATH。
bash
## Install lerobot
cd ..
git clone https://github.com/huggingface/lerobot.git
cd lerobot
git checkout a5e0aae13a3efd0080ac7ab6b461980d644014ab
pip install -e .
export PYTHONPATH="your_lerobot_codebase_path:$PYTHONPATH"3. 下载并放置仿真资产
按文档下载并解压资产包,然后将 robotwin_models 移动到 galaxea_sim/assets/。这是注册和运行仿真任务所需的模型资产。
bash
gdown https://drive.google.com/file/d/1ZvtCv1H4FLrse_ElUWzsVDt8xRK4CyaC/
unzip robotwin_models.zip
mv robotwin_models galaxea_sim/assets/4. 选择机器人、任务和控制器
文档示例支持 R1、R1 Pro、R1 Lite。R1 示例任务为 R1DualBottlesPickEasy,R1 Pro 为 R1ProBlocksStackEasy,R1 Lite 为 R1LiteBlocksStackEasy。控制器可选 bimanual_joint_position / bimanual_relaxed_ik,但 R1 Lite 示例仅列出 bimanual_joint_position。
5. 用 mplib 生成原始演示数据
使用 collect_demos 生成 raw demos。默认 --obs_mode 是 state,速度更快,推荐给 replay 时再获取图像观测的 eef policies。默认数据保存到 datasets/<env-name>/<data-time>,格式为 h5。
bash
## Example of R1 Picking up Bottles
python -m galaxea_sim.scripts.collect_demos --env-name R1DualBottlesPickEasy --num-demos 100
## Example of R1 Pro Stacking Blocks
python -m galaxea_sim.scripts.collect_demos --env-name R1ProBlocksStackEasy --num-demos 100
## Example of R1 Lite Stacking Blocks:
python -m galaxea_sim.scripts.collect_demos --env-name R1LiteBlocksStackEasy --num-demos 1006. 指定控制器回放并过滤演示
使用 replay_demos 将记录的末端执行器位姿轨迹传给 relaxed_ik 控制器,并检查任务是否完成。带有 inverse kinematics solutions 的 demos 会被过滤,image/depth observations 会保存到 datasets/<env-name>/final。
bash
## Example of R1 Picking up Bottles by Joints Control
python -m galaxea_sim.scripts.replay_demos --env-name R1DualBottlesPickEasy --target_controller_type bimanual_joint_position --num-demos 100
## Example of R1 Pro Stacking Blocks by End Effector Control
python -m galaxea_sim.scripts.replay_demos --env-name R1ProBlocksStackEasy --target_controller_type bimanual_relaxed_ik --num-demos 100
## Example of R1 Lite Stacking Blocks by Joint Control
python -m galaxea_sim.scripts.replay_demos --env-name R1LiteBlocksStackEasy --target_controller_type bimanual_joint_position --num-demos 1007. 转换为 LeRobot Dataset
若使用 Lerobot Diffusion Policy implementation,使用 convert_single_galaxea_sim_to_lerobot。--tag 决定转换哪些 demos;使用 --use_eef 时,arm observation 和 action 会替换为末端位姿。
bash
## If you want to use Lerobot Diffusion Policy implementation, please use script convert_single_galaxea_sim_to_lerobot
## For Joint Control
## Example of R1 Picking up Bottles
python -m galaxea_sim.scripts.convert_single_galaxea_sim_to_lerobot --task R1DualBottlesPickEasy --tag final --robot r1
## Example of R1 Pro Stacking Blocks
python -m galaxea_sim.scripts.convert_single_galaxea_sim_to_lerobot --task R1ProBlocksStackEasy --tag final --robot r1_pro
## Example of R1 Lite Stacking Blocks
python -m galaxea_sim.scripts.convert_single_galaxea_sim_to_lerobot --task R1LiteBlocksStackEasy --tag final --robot r1_lite
## For End Effector Control
## Example of R1 Pro Picking up Bottles
python -m galaxea_sim.scripts.convert_single_galaxea_sim_to_lerobot --robot r1_pro --task R1ProDualBottlesPickEasy --tag final --use_eef
## Example of R1 Pro Stacking Blocks
python -m galaxea_sim.scripts.convert_single_galaxea_sim_to_lerobot --robot r1_pro --task R1ProBlocksStackEasy --tag final --use_eef8. 训练并评估 LeRobot Diffusion Policy
转换后可训练 LeRobot Diffusion Policy。默认策略保存到 outputs/train/<env-name>/diffusion/<date-time>。评估结果保存到指定 checkpoint dir,可用 --save-video 保存评估视频。
bash
## Example of R1 Picking up Bottles
python -m galaxea_sim.scripts.train_lerobot_dp_policy --task R1DualBottlesPickEasy
## Example of R1 Pro Stacking Blocks
python -m galaxea_sim.scripts.train_lerobot_dp_policy --task R1ProBlocksStackEasy
## Example of R1 Lite Stacking Blocks
python -m galaxea_sim.scripts.train_lerobot_dp_policy --task R1LiteBlocksStackEasybash
## Example of R1 Picking up Bottles
python -m galaxea_sim.scripts.eval_lerobot_dp_policy --task R1DualBottlesPickEasy --pretrained-policy-path outputs/train/R1DualBottlesPickEasy/diffusion/.../checkpoint --target_controller_type bimanual_joint_position
## Example of R1 Pro Stacking Blocks
python -m galaxea_sim.scripts.eval_lerobot_dp_policy --task R1ProBlocksStackEasy --pretrained-policy-path outputs/train/R1ProBlocksStackEasy/diffusion/.../checkpoint --target_controller_type bimanual_joint_position
## Example of R1 Lite Stacking Blocks
python -m galaxea_sim.scripts.eval_lerobot_dp_policy --task R1LiteBlocksStackEasy --pretrained-policy-path outputs/train/R1LiteBlocksStackEasy/diffusion/.../checkpoint --target_controller_type bimanual_joint_position验证是否跑通
安装后能完成资产放置;采集后在 datasets/<env-name>/<data-time> 看到 h5 files;回放后在 datasets/<env-name>/final 看到输出;转换后数据生成到 HF_LEROBOT_HOME,未指定时为 ~/.cache/huggingface/lerobot;训练后在 outputs/train/<env-name>/diffusion/<date-time> 生成策略,评估结果保存到指定 checkpoint dir。
文档里点名的注意事项
- If installing together with Galaxea-DP, please refer to this link.
- If you find
datasetpackage version conflict. Please clear the package cache in~/.cache/huggingface/datasets. - The default
--obs_modeisstate, which is faster so it is recommended for eef policies that will get image observations during replay. - Replay demonstrations will pass the recorded end effector's pose trajectory to the relaxed_ik controller and check if task is completed.
- The demos with inverse kinematics solutions will be filtered out, and image/depth observations will be saved.
--use_videorequires ffmpeg installed, and you may want to change vcodec to "libh264" in.../site-packages/lerobot/common/datasets/video_utils.pyif default "libsvtav1" is not available.--tagdetermines which demos will be convert, by defult it will convert all demos indatasets/<env-name>.- If
--use_eefis used, the arm's observation and action will be replace by end effector's pose(x,y,z,qw,qx,qy,qz). - Restoring from checkpoints is currently not supported.
来源
本页事实对应的公开页面,以原文为准。