本项目是对Open Duck Mini项目的DIY复现记录。
placo(PlaCo is Rhoban's planning and control library):生成步态相关参数的库
- placo安装可能碰到的问题(本质是因为pinocchio用的numpy 1.x的版本): Rhoban/placo#18
- 类似的issue: stack-of-tasks/pinocchio#2733
- 类似的issue: stack-of-tasks/pinocchio#2645
- 类似的issue: stack-of-tasks/pinocchio#2349
- 如果是源码编译安装的方式,要把编译后的placo库路径添加到PYTHONPATH
# 假设我的源码仓库地址为:/home/jay/workspace/placo,python版本为3.10 export PYTHONPATH="/home/jay/workspace/placo/build/lib/python3.10/site-packages:$PYTHONPATH"
Open Duck Reference Motion Generator:使用placo,生成polynomial_coefficients.pkl用于后续训练
- Generate motions(This will write in a directory called
recordings/)
uv run scripts/auto_waddle.py (-j?) --duck ["go_bdx", "open_duck_mini", "open_duck_mini_v2"] (--num <> / --sweep) --output_dir <>从
auto_waddle.py源码中看到加载的参数文件和文件夹有/open_duck_reference_motion_generator/robots/{args.duck}/auto_gait.json和/open_duck_reference_motion_generator/robots/{args.duck}/placo_presets
从
auto_waddle.py源码中看到有调用/open_duck_reference_motion_generator/gait_generator.py去生成步态数据。gait_generator.py的处理核心逻辑是调用/open_duck_reference_motion_generator/placo_walk_engine.py的实例去计算和生成步态:pwe = PlacoWalkEngine(asset_path, robot_urdf, gait_parameters)。gait_generator.py是一个命令行脚本,用来基于 PlacoWalkEngine 生成并记录一段机器人步态(motion)数据,然后把记录保存为 JSON 文件以供后续使用(例如播放、训练、分析等)。脚本会以固定采样率(FPS)轮询 PlacoWalkEngine,按帧收集机器人位姿、关节角、速度、脚部位置信息和支撑相(共55个参数:"root_pos": 3,"root_quat": 4,"joints_pos": 14,"left_toe_pos": 3,"right_toe_pos": 3,"world_linear_vel": 3,"world_angular_vel": 3,"joints_vel": 14,"left_toe_vel": 3,"right_toe_vel": 3,"foot_contacts": 2),并把这些帧序列写入一个包含元数据(参数、速度平均值等)的 JSON 文件。支持通过 meshcat(可选)做实时可视化,并支持若干命令行参数(preset、速度、时长、duck 类型等)。
从
auto_waddle.py源码中出现的脚本参数运行描述为:Generate AMP walking animations,其中AMP是Adversarial Motion Prior的缩写,是一种结合了对抗性学习和物理模拟的技术,主要用于生成自然和生动的物理角色动画。AMP通过一个训练好的判别器来指导策略学习,该判别器能够区分模拟角色的动作和参考运动数据集中的动作,从而为角色的动作提供风格奖励。这种方法不需要手动设计的模仿目标或者动作选择机制,也不需要对数据集进行任务特定的注释或分割。主要实现还是在gait_generator.py中。
- Fit polynomials(This will generate
polynomial_coefficients.pklfrom data (in json files) inrecordings/)
uv run scripts/fit_poly.py --ref_motion recordings/
Open Duck Playground:训练和输出onnx模型(这一步是强化学习的关键步骤)
- 添加一个新机器人,并进行配置和训练
- Create a new directory in
playgroundnamed after<your robot>. You can copy theopen_duck_mini_v2directory as a starting point. - Edit
base.py: Mainly renaming stuff to match you robot's name - Edit
constants.py: specify the names of some important geoms, sensors etc- In your
mjcf, you'll probably have to add some sites, name some bodies/geoms and add the sensors. Look at how we did it foropen_duck_mini_v2
- In your
- Add your
mjcfassets inxmls. - Edit
joystick.py: to choose the rewards you are interested in- Note: for now there is still some hard coded values etc. We'll improve things on the way
- Edit
runner.pyand then run it(mujoco will be lauched automatically?)
# in Windows(unsuccessful) pip install uv uv venv -p 3.12 uv run playground/<robot>/runner.py #这一步还是会报You're on Windows (`win_amd64`), but `jax-cuda12-plugin` (v0.6.1) only has wheels for the following platforms: `manylinux2014_aarch64`, `manylinux2014_x86_64`; consider adding your platform to `tool.uv.required-environments` to ensure uv resolves to a version with compatible wheels # wsl2(ubuntu 22.04.5) conda env list conda create -n mujoco python=3.11 conda activate mujoco pip install mujoco -i https://mirrors.aliyun.com/pypi/simple/ git clone https://github.com/apirrone/Open_Duck_Playground.git cd Open_Duck_Playground curl -LsSf https://astral.sh/uv/install.sh | sh uv run playground/open_duck_mini_v2/runner.py # in linux(suppose to be ok) uv run playground/<robot>/runner.py
- Create a new directory in
- 在mujoco里跑onnx模型(即查看onnx模型)
uv run playground/open_duck_mini_v2/mujoco_infer.py -o <path_to_.onnx> (-k)
- 最新的onnx模型:latest policy checkpoint
- Mujoco Playground
mujoco_rl.mp4
- Reference motion generation for imitation learning
ref_motion_demo.mp4
- Actuator identification: We used Rhoban's BAM: Better Actuator Models
Open Duck Mini Runtime:加载onnx模型,实物运行
- onnx模型的实物加载使用:Run the walk
- hardware
- Raspberry Pi zero 2W
- IMU: BNO055
- Motor: Feetech 7.4v STS 3215
- Charger: 2S2A(8.4V, 2A)
- 输入电压:DC 3-6V(推荐DC 3.7V 5V)
- 输入电流:1A(1A版);2A(2A版);4A(4A版)
- 充电电压:8.4V
- 充电电流:0.55A(1A版);1.1A(2A版);2.2A(4A版)
- BMS: 7.4V(output)
- When charger is connected on P+/P- port( and power switch is off), it's for battery charging
- When charger is disconnected and power switch is on, it's for power output
- Battery: 18650 x 2
- OS: Raspberry Pi OS Lite (64-bit)
-
硬件资源:RTX 5070ti 16G(NVIDIA-SMI:575.57.04,Driver version: 576.52,CUDA Version:12.9)
-
软件环境:
- 操作系统:Windows 10
- WSL2安装的ubuntu系统:Ubuntu 22.04.5
- ROS2 Humble版本:小鱼ROS
- gazebo版本:Gazebo Classic Simulator (ROS2 Humble),注意不是更新的Gazebo Harmonic Simulator (ROS2 Jazzy&Humble)版本
- mujoco版本:3.3.3
- Issac Sim及对应的Isaac Sim Assets版本:4.5.0
-
各步骤参考:
有条脚本要修订下:
wget http://fishros.com/install -O fishros && . fishros
- WSL2的安装与配置(创建Anaconda虚拟环境、更新软件包、安装PyTorch、VSCode)
- Ubuntu 22.04(WSL2)安装Miniconda详细指南
- 基于WSL2 & ROS2 humble上安装gazebo及调试
- 如何更改wsl2中的ubuntu默认安装位置
- mujoco
- mujoco windows:直接运行windows版本的mujoco文件夹下/bin文件夹下的simulate.exe即可
- Issac Sim下载、安装和启动:下载Isaac Sim包和关联资产包并设置后,解压直接运行Isaac Sim包下的isaac-sim.selector.bat
- 硬件资源:RTX 5070ti 16G(NVIDIA-SMI:570.153.02,Driver version: 570.153.02,CUDA Version:12.8)
- 软件环境:
- 操作系统:Ubuntu 22.04.5 desktop
- ROS2 Humble版本:小鱼ROS
- gazebo版本:Gazebo Classic Simulator (ROS2 Humble),注意不是更新的Gazebo Harmonic Simulator (ROS2 Jazzy&Humble)版本
- mujoco版本:3.3.3
- Issac Sim及对应的Isaac Sim Assets版本:5.0
- Isaac Lab版本:2.2
# isaaclab install(https://isaac-sim.github.io/IsaacLab/main/source/setup/installation/pip_installation.html#installing-isaac-lab) conda create -n env_isaaclab python=3.11 # isaaclab 5.0 needs python 3.11 conda activate env_isaaclab pip install --upgrade --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu128 ./isaaclab.sh --install # cd isaaclab root directory source _isaac_sim/setup_conda_env.sh # avoid ModuleNotFoundError: No module named 'isaacsim' error ./isaaclab.sh -p scripts/tutorials/00_sim/create_empty.py # or python scripts/tutorials/00_sim/create_empty.py ./isaaclab.sh -p scripts/reinforcement_learning/rsl_rl/train.py --task=Isaac-Ant-v0 --headless
- issues:
- GUI blur: Need to wait for the upgration of isaac sim (kit version should upper than 106.5.3, you can see the kit version in 'help'->'about'). You can try to upgrade issac sim from 4.5.0 to 5.0(not release the production version yet, you can build from github repository)?
- saac Sim ROS Workspace
- 先安装python 3.11
- 执行
./build_ros.sh -d humble -v 22.04可能下载有些包失败,直接修改对应的dockerfile(例如dockerfiles/ubuntu_22_humble_python_311_minimal.dockerfile),把python镜像源加入相应失败的下载指令后
- ROS on Ubuntu 20.04, No module named 'rclpy._rclpy_pybind11':切换默认的python的版本
- 脚本记录(Isaac Sim和ROS2互相通讯,用h1跑强化学习policy):
# ros2 cmd init
source /opt/ros/humble/setup.bash
# ros2 cmd
ros topic list
ros2 run demo_nodes_cpp talker
ros2 run demo_nodes_py listener
# ros2 isaac sim workspace init(https://github.com/isaac-sim/IsaacSim-ros_workspaces)
source /opt/ros/humble/setup.bash
#cd repository/humble_ws, for example: ~/IsaacSim-ros_workspaces/humble_ws
cd ~/IsaacSim-ros_workspaces/humble_ws
source install/local_setup.bash
# cd the h1_fullbody_controller ROS2 package and then run the ROS2 policy
cd ~/IsaacSim-ros_workspaces/humble_ws/src/humanoid_locomotion_policy_example/h1_fullbody_controller/launch
ros2 launch h1_fullbody_controller h1_fullbody_controller.launch.py # run the ROS2 policy
- [Isaac Sim倒入]
- Issac Sim导入urdf
- 视频教程1
- 视频教程2
- Joint Physics: Computing Stiffness and Damping in URDF Importers:带多个教程集锦,例如解释urdf导入时的刚度和阻尼参数含义。
- Isaac Gym(RL)
- Installation
- python joint_monkey.py缺少libpython3.7m.so.1.0库:
export LD_LIBRARY_PATH=/home/jay/miniconda3/envs/rlgpu/lib
- python joint_monkey.py缺少libpython3.7m.so.1.0库:
- robot project: OpenTinker-V2
- Installation
- 子豪群的飞书文档链接
- Issac Sim导入open mini duck的urdf时,报accessed invalid null prim(未解决)
- playground运行runner报错:jaxlib._jax.XlaRuntimeError:已解决,更改pyproject.toml中nvidia-cublas-cu12的版本
- playground运行runner下载包超时:已解决,设置clash的tun模式,见链接的评论区
- playground运行runner报错:'cuModuleLoadData(&module, data)' failed with 'CUDA_ERROR_INVALID_PTX'(未解决,链接1 链接2)
- Isaaclab运行报No module named 'carb._carb':已解决,conda建虚拟环境时选择python 3.11官方discuss