Microduck 避障:基于 Isaac Lab 和 Newton 的仿真到现实工作流
原题Microduck Obstacle Avoidance: A Sim2Real Workflow with Isaac Lab and Newton
推荐理由手上已有行走策略的团队,可以参考把避障做成独立控制层的取舍,并提前为上机前的感知复验留出步骤。
读前速览
本教程展示了如何利用 Isaac Lab 训练、Newton 进行物理仿真,为 Microduck 机器人添加避障功能,并通过 ToF 感知和游戏手柄控制将其部署到实体机器人上。
该工作流将避障与平衡控制分开:训练导航策略来调整游戏手柄指令,同时保持行走策略不变
这种模块化方法无需重新训练机器人的行走行为,就能让机器人学会避障。系统利用 ToF 感知以 50 Hz 调整速度指令,再由固定不变的行走策略将这些指令转换为关节动作,以维持平衡。
训练使用 16,384 个并行环境,通过 PPO 进行 1,500 次迭代,并加入传感器噪声和延迟以提升真实环境中的鲁棒性
大规模并行仿真训练采用随机化的障碍布局,并模拟 ToF 传感器噪声和测量缺失,确保策略能够更好地泛化到现实部署场景。
部署时先将训练好的策略导出为 ONNX,再在笔记本电脑上运行;笔记本电脑向机器人传输 ToF 数据,并发送调整后的速度指令
部署工具通过 SSH 通信,让实体 Microduck 机器人实现实时避障,并提供安全功能,例如将速度限制在 0.15 m/s,以及在输入过时或障碍物过近时自动停止。
文章提供了传感器建模、奖励设计和评估流程等完整技术细节,讲解如何实现机器人仿真到现实的迁移
文中还给出了 ToF 传感器配置、训练命令和部署脚本的详细代码示例,可作为实现类似机器人仿真到现实工作流的实用指南。
完整摘要
本文介绍了为 Microduck 机器人实现避障功能的完整仿真到现实工作流。首先复用已有的行走策略,再利用飞行时间(ToF)感知训练独立的导航控制器。工作流涵盖使用 SimReady 资产搭建多样化障碍场地、在 Newton 物理仿真中模拟 VL53L5CX ToF 传感器、在 16,384 个并行环境中训练 PPO 策略,以及将模型导出为 ONNX 并部署到实体机器人上。控制器会调整游戏手柄的速度指令以绕过障碍,固定不变的行走策略则负责保持平衡。文章还提供了详细的安装说明、训练命令和部署步骤,包括空跑测试以及在监督下通过游戏手柄导航,并介绍了 Microduck 任务集合中其他可用的运动技能。
目录 · 14 节
简而言之 TL;DR
在保持 Microduck 行走策略固定的同时,为其添加局部避障功能。使用可复用的 SimReady 资产搭建多样化的路线,利用 Newton 的射线投射器模拟 ToF 传感,并在 Isaac Lab 中训练控制器,使其能够调整游戏手柄的速度指令以绕开障碍物。本教程涵盖仿真训练、评估、导出和实机部署。Add local obstacle avoidance to Microduck while keeping its walking policy fixed. Build varied courses with reusable SimReady assets, model ToF sensing with Newton’s raycaster, and train a controller in Isaac Lab to adjust gamepad velocity commands around obstacles. This tutorial covers simulation training, evaluation, export, and real-robot deployment.
引言 Introduction
行走策略可以让 Microduck 保持平衡,但无法告诉机器人如何绕开路径上的障碍物。在这个工作流中,我们复用第一篇 Microduck 教程中的行走策略,并固定其权重。本篇教程将使用飞行时间(ToF)传感器训练一个独立的避障控制器。你可以通过游戏手柄选择方向;控制器会在将速度指令传递给行走策略之前对其进行调整。A walking policy can keep Microduck balanced, but it does not tell the robot how to steer around an obstacle in its path. In this workflow, we reuse the walking policy from our first Microduck tutorial and keep its weights fixed. This follow-up trains a separate avoidance controller using time-of-flight (ToF) sensing. You choose a direction with a gamepad; the controller adjusts the velocity command before passing it to the walking policy.
NVIDIA Isaac Lab 是一个开源框架,可在数千个 GPU 并行仿真中训练策略,并提供机器人学习环境。Newton 用于模拟物理过程和传感器的深度测量。我们将介绍控制架构,在多种障碍物布局下进行训练,评估训练得到的策略,并为硬件测试准备接口。NVIDIA Isaac Lab is an open-source framework for training policies across thousands of GPU-parallel simulations and it provides the robot-learning environment. Newton simulates physics and the sensor’s depth measurements. We will cover the control architecture, train on varied obstacle layouts, evaluate the resulting policies, and prepare the interface for hardware testing.
用于模拟和培训,请准备:For simulation and training, prepare:
- 配备兼容 NVIDIA GPU 和驱动程序的 Linux 系统。平台要求请参阅 Isaac Lab 安装指南。
A Linux system with a compatible NVIDIA GPU and driver. See the Isaac Lab installation guide for platform requirements.
- Git、Git LFS 和 uv 包管理器。
Git with Git LFS, and the uv package manager.
进行实体机器人测试时,请准备:For physical-robot testing, prepare:
- 已配置的 Microduck。加载导航任务使用的同一份 backlash 步行策略导出文件。
A configured Microduck. Load the same backlash walking-policy export used by the navigation task.
- 已记录配置的受支持 ToF 传感器。
A supported ToF sensor with its configuration recorded.
- 一台配对的游戏手柄和一个带有障碍物的关卡测试区域。
A paired gamepad and a level test area with obstacles.
快速安装 Quick install
如果尚未安装 uv,请先安装。然后克隆 Isaac Lab 仓库的 exp/microduck 分支,并安装其依赖项:Install uv if it is not already installed. Then clone the exp/microduck branch of the Isaac Lab repository and install its dependencies:
git lfs install
git clone --branch exp/microduck https://github.com/isaac-sim/IsaacLab.git
cd IsaacLab
uv sync --frozen
设置完成后,列出可用的 Microduck 环境和预设:Once setup is complete, list the available Microduck environments and presets:
uv run isaaclab list_envs --keyword MicroDuck --show_presets
下载步行策略 Download the walking policy
训练前先下载并导出一次上游的反向行走检查点。避障任务会自动加载导出的行走策略。Download and export the upstream backlash walking checkpoint once before training. The obstacle avoidance task loads the exported walking policy automatically.
uv run isaaclab play \
--task IsaacContrib-Velocity-Rough-MicroDuck \
--rl_library rsl_rl --checkpoint pretrained \
--num_envs 1 --visualizer none \
--video newton_gl --video_length 1 \
presets=backlash
2. 搭建障碍赛道 2. Build the obstacle course
该环境将简单几何体与可通过 Hugging Face 上的 SimReady Central 获取的 OpenUSD 资产结合起来。我们使用纸箱、办公室垃圾桶、床头柜以及锥桶。从 IsaacLab 仓库根目录下载指定版本的纸箱、垃圾桶和床头柜资源包,并放入 assets/simready。The environment combines simple primitives with OpenUSD assets available through SimReady Central on Hugging Face. We use a cardboard box, office bin, bedside cabinet alongside cones. From the IsaacLab repository root, download the pinned box, bin and cabinet packages into assets/simready.
uvx --from huggingface-hub hf download nvidia/simready-assets \
--repo-type dataset \
--revision 9d4556bfe80868c1d27a7a7ba1c2774e63e8cedd \
--include "box_cardboard_a01/*" \
--include "trashCan_office_black_a03/*" \
--include "table_bedside_b01/*" \
--local-dir ./assets/simready
每次回合重置时,环境代码都会自动采样一种布局、打乱道具,并改变它们的位置和旋转角度。大多数路线会在鸭子前方散布障碍物,少数路线则由畅通路径、屏障和通道混合构成。代码还会镜像布局,并混合排列对齐和错列的行。At each episode reset, the environment code automatically samples a layout, shuffles the props, and varies their placement and rotation. Most courses scatter obstacles ahead of the duck, with a smaller mix of clear paths, barriers and passages. The code also mirrors layouts and mixes aligned and staggered rows.
目标位于鸭子的前方。移动指令引导它朝目标前进,同时策略会根据障碍物调整这些指令。Goals start ahead of the duck. Movement commands guide it toward the goal while the policy adjusts them around obstacles.
图 1. 使用 SimReady 资产和基本几何体构建的多种障碍赛道布局。Figure 1. Varied obstacle-course layouts with SimReady assets and primitive geometry.
3. 了解 ToF 传感如何引导行走策略 3. Understand how ToF sensing guides the walking policy
IsaacContrib-ObstacleAvoidance-Flat-MicroDuck 任务将避障与平衡分离。导航策略利用 ToF 传感来调整前进、横向移动和偏航指令,频率为 50 Hz。随后,冻结的行走策略将这些指令转换为关节动作,使机器人能够学习避障,而无需重新训练其行走行为。The IsaacContrib-ObstacleAvoidance-Flat-MicroDuck task separates obstacle avoidance from balance. A navigation policy uses ToF sensing to adjust forward, lateral, and yaw commands at 50 Hz. The frozen walking policy then converts those commands into joint actions, allowing the robot to learn obstacle avoidance without retraining its walking behavior.
训练期间,导航策略的 actor 会接收真实机器人上可获取的 ToF 历史数据、机体状态和控制器状态。其 critic 可以访问额外的仿真状态以指导学习,但部署时不需要这些状态。During training, the navigation policy’s actor receives ToF history and body and controller state available on the real robot. Its critic has access to additional simulation state to guide learning, but is not needed for deployment.
奖励机制鼓励机器人朝目标前进、安全抵达并绕开障碍物。只有在机器人取得进展且保持足够安全间距时,遵循移动指令才会获得奖励;采取有风险的接近方式会减少奖励。惩罚机制则用于抑制快速接近、指令突变、碰撞和跌倒。Rewards encourage progress toward the goal, safe arrivals, and movement around obstacles. Following a movement command earns credit only when the robot makes progress with sufficient clearance; risky approaches reduce that credit. Penalties discourage fast approaches, abrupt command changes, collisions, and falls.
避障任务位于 isaaclab_tasks.contrib.microduck_obstacle 中。其配置位于 obstacle_avoidance_env_cfg.py,ToF 感知位于 sensors.py,动作、指令、观测和奖励则按类别组织在 mdp/ 下。The obstacle-avoidance task lives in isaaclab_tasks.contrib.microduck_obstacle. Its configuration is in obstacle_avoidance_env_cfg.py, ToF sensing is in sensors.py, and actions, commands, observations and rewards are organized under mdp/.
对 ToF 传感器进行建模 Model the ToF sensor
MicroDuckToFCamera 扩展了 Newton 的 LegacyMultiMeshRayCasterCamera,用于模拟 VL53L5CX——安装在 microduck 上的一款紧凑型飞行时间(ToF)传感器,以 15Hz 的频率测量 8×8 网格范围内的距离。该模拟传感器的视场角为 45°,测距范围为 0.12–4 m。它会跟随鸭头移动,安装位置与真实鸭子上的传感器相似。MicroDuckToFCamera extends Newton’s LegacyMultiMeshRayCasterCamera to model the VL53L5CX—a compact time-of-flight (ToF) sensor on the microduck that measures distance across an 8×8 grid at 15Hz. The simulated sensor has a 45° field of view and a 0.12–4 m range. It follows the duck’s head, with placement similar to the sensor on the real duck.
真实录制数据为仿真中的传感器布置和地面读数提供了依据。训练过程中会加入噪声、延迟和缺失测量值(包括网格边缘附近的情况),让策略适应不完美的数据。下方摘录展示了任务配置中已包含的部分传感器设置。你无需单独编辑或运行这段代码。Real recordings informed the sensor placement and floor readings in simulation. Training adds noise, delays and missing measurements—including near the grid’s edges—to expose the policy to imperfect data. The excerpt below shows selected sensor settings already included in the task configuration. You do not need to edit or run this code separately.
# Selected settings; mount and raycast targets omitted.
head_tof = MicroDuckToFCameraCfg(
prim_path=MICRODUCK_HEAD_BODY_PATH,
update_period=1.0 / 15.0,
pattern_cfg=patterns.PinholeCameraPatternCfg(
focal_length=1.0, width=8, height=8,
horizontal_aperture=_TOF_APERTURE,
vertical_aperture=_TOF_APERTURE,
),
randomization=ToFRandomizationCfg(
mount_pitch_degrees=(-10.0, 10.0),
mount_height_m=(-0.02, 0.02),
floor_validity_midpoint_offset_m=(0.0, 0.13),
near_floor_edge_impairment_probability=0.5,
),
data_types=["distance_to_image_plane", "distance_to_camera"],
max_distance=TOF_MAX_RANGE,
depth_clipping_behavior="zero",
)
4. 在并行环境中训练 Microduck 策略 4. Train the Microduck policy across parallel environments
使用 PPO 在 16,384 个并行环境中训练导航策略,共进行 1,500 次训练迭代。其 actor、critic、归一化器和优化器均从头开始。任务配置会加载固定的行走检查点、机器人模型和障碍物资源。Train the navigation policy with PPO across 16,384 parallel environments for 1,500 training iterations. Its actor, critic, normalizers, and optimizer start fresh. The task configuration loads the fixed walking checkpoint, robot model, and obstacle assets.
此处展示的 16,384 个环境是可配置的,并非最低要求。请调低 --num_envs,以适应 GPU 的可用显存。并行收集经验的环境越少,要达到相近的策略性能,可能就需要更多训练迭代和更长的训练时间。我们还在 NVIDIA DGX Spark 上训练了这一策略,使用 4,096 个并行环境进行了 3,000 次 PPO 更新,耗时约 6 小时,展示了同一工作流的小规模配置。The 16,384 environments shown here are configurable, not a minimum requirement. Lower --num_envs to fit your GPU’s available memory. With fewer environments collecting experience in parallel, reaching comparable policy performance may require more training iterations and longer training time. We also trained this policy on NVIDIA DGX Spark in approximately 6 hours using 4,096 parallel environments for 3,000 PPO updates, demonstrating a smaller-scale configuration for the same workflow.
运行此命令以训练策略:Run this command to train the policy:
uv run isaaclab train \
--task IsaacContrib-ObstacleAvoidance-Flat-MicroDuck \
--rl_library rsl_rl \
--num_envs 16384 \
--max_iterations 1500 \
--seed 42 \
--device cuda:0 \
--visualizer none \
presets=backlash
图 2. Parallel MicroDuck 避障仿真Figure 2. Parallel MicroDuck obstacle-avoidance simulation
5. 检查行为并将策略导出为 ONNX 5. Inspect behavior and export the policy to ONNX
回放使用与训练相同的属性、基元、冻结的行走器和传感器随机化方式,但采用不同的随机种子来生成新的障碍物布局。Playback uses the same props, primitives, frozen walker and sensor randomization as training, with a different seed for new obstacle arrangements.
导航检查点保存在相对于仓库根目录的 logs/rsl_rl/microduck_obstacle_avoidance_tof_flat_backlash/<timestamp>/ 下。从你的运行中选择一个 model_<iteration>.pt 文件,并将下方的 /absolute/path/to/model.pt 替换为其路径。此操作会运行策略、打开 Newton 可视化器,并录制 20 秒的仿真。无头录制时,将 --viz 设置为 none。Navigation checkpoints are saved under logs/rsl_rl/microduck_obstacle_avoidance_tof_flat_backlash/<timestamp>/ relative to the repository root. Choose a model_<iteration>.pt file from your run and replace /absolute/path/to/model.pt below with its path. This plays the policy, opens the Newton viewer and records 20 seconds of simulation. Set --viz to none for headless recording.
uv run --extra video isaaclab play \
--task IsaacContrib-ObstacleAvoidance-Flat-MicroDuck \
--rl_library rsl_rl \
--checkpoint /absolute/path/to/model.pt \
--num_envs 1 \
--seed 6173 \
--device cuda:0 \
--viz newton_gl \
--video newton_gl \
--video_length 1000 \
presets=backlash
Playback 会将 TorchScript 和 ONNX 模型保存在检查点的导出文件夹中。请将 ONNX 数据文件与模型放在一起。Playback saves TorchScript and ONNX models in the checkpoint’s exported folder. Keep the ONNX data file alongside the model.
图3. 锥桶赛道评估,叠加显示请求运动、策略转向和 ToF 输入。Figure 3. Cone-course evaluation with requested motion, policy steering, and ToF input overlays.
6. 在真实的 Microduck 上测试避障功能 6. Test obstacle avoidance on a real Microduck
这些部署工具会在笔记本电脑上运行导航模型,并将调整后的游戏手柄指令发送给机器人上的行走策略。请使用导航训练期间使用的同一行走策略。These deployment tools run the navigation model on a laptop and send adjusted gamepad commands to the walking policy on the robot. Use the same walking policy that was used during navigation training.
第 1 节将行走器的 ONNX 导出文件保存到相对于 Isaac Lab 仓库根目录的 .pretrained_checkpoints/rsl_rl/https/omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/6.2/Isaac/IsaacLab/PretrainedCheckpoints/rsl_rl/exported/policy.onnx。Section 1 saves the walker’s ONNX export to .pretrained_checkpoints/rsl_rl/https/omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/6.2/Isaac/IsaacLab/PretrainedCheckpoints/rsl_rl/exported/policy.onnx, relative to the Isaac Lab repository root.
使用 Pollen 的策略加载指南加载该行走策略。部署 README 中包含迁移步骤,包括如何打包使用外部数据文件的 ONNX 导出文件。Load that walking policy using Pollen’s policy-loading guide. The deployment README includes the transfer steps, including how to package an ONNX export that uses an external data file.
在你的 Isaac Lab 检出目录中设置 SSH 访问,并在机器人直立静止时检查推理效果:From your Isaac Lab checkout, set up SSH access and check inference with the robot standing upright and still:
cd scripts/deploy/microduck_tof_nav
ssh-copy-id microduck@ROBOT_HOST
uv run nav_pad.py --robot ROBOT_HOST \
--model /absolute/path/to/navigation/exported/policy.onnx \
--dry-run --seconds 30
Dry-run 会复制辅助程序并传输传感器数据,但不会发送任何移动指令。当障碍物进入传感器视野时,观察拟议的指令。请将导航 ONNX 文件与任何配套的 .data 文件放在一起。Dry-run copies the helpers and streams sensor data, but sends no movement commands. Watch the proposed commands as obstacles enter the sensor’s view. Keep the navigation ONNX and any companion .data file together.
通过这些检查后,开始受监督的游戏手柄导航:Once those checks pass, start supervised gamepad navigation:
uv run nav_pad.py --robot ROBOT_HOST \
--model /absolute/path/to/navigation/exported/policy.onnx
将操纵杆向前推以请求移动;策略会调整指令以避开障碍物。松开操纵杆即可停止,按 X 键切换导航,按 Ctrl-C 结束会话。默认情况下,前进速度上限为 0.15 m/s,此外还设有近距离障碍物制动和输入过期时停止功能。请在空旷区域启动,并在测试路线前确认设备能够停止。Hold the stick forward to request movement; the policy adjusts the command to avoid obstacles. Release the stick to stop, press X to toggle navigation, and use Ctrl-C to end the session. Forward speed is capped at 0.15 m/s by default, with an additional close-obstacle brake and stale-input stopping. Start in a clear area and verify stopping before testing a course.
有关控制项、日志和故障排除,请参阅部署 README。See the deployment README for controls, logs and troubleshooting.
图 4. Microduck 使用其 8×8 ToF 传感器绕过锥桶,左侧为真实拍摄画面,右侧为根据其日志重建的 3D 场景。蓝色表示策略控制的转向,紫色表示操作员的干预。Figure 4. Microduck steers around cones using its 8×8 ToF sensor, with real footage on the left and a 3D rebuild from its logs on the right. Blue shows the policy steering, purple shows the operator intervention.
7. 在 Isaac Lab 中探索 Microduck 的其他运动技能 7. Explore other locomotion skills for Microduck in Isaac Lab
Microduck 任务集合包括在平坦和崎岖地形上进行速度跟踪、站起恢复、坐站转换,以及行走并在跌倒后恢复(VelStand)。Roulade 任务包括踢球、从地面捡起物体和前滚翻。轮滑任务则增加了速度跟踪和摇摆滑行、下蹲滑行、下坡、穿着轮滑鞋站起以及旋转动作。The Microduck task collection includes velocity tracking on flat and rough terrain; stand-up recovery, sit–stand transitions, and walking with fall recovery (VelStand); ball kicking, ground picking, and forward rolls (Roulade). Roller-skating tasks add velocity tracking and swizzle motion, crouch-gliding, slope descent, standing up on skates, and spins.
图 5. Microduck 的十五种任务视图:平地与崎岖地形行走、恢复、物体交互和轮滑动作。Figure 5. Fifteen Microduck task views: flat and rough-terrain walking, recovery, object interaction, and roller-skating motions.
制定你的下一项政策 Build your next policy
先从第一个 Microduck 教程开始,然后从 Microduck 任务集中选择一项任务,使用 Newton 在 Isaac Lab 中构建你的下一个策略。通过更改指令、奖励或环境来探索新行为——从崎岖地形行走到由感知驱动的避障。在机器人上测试之前,先在训练集之外的场景中评估你的策略。Start with the first Microduck tutorial, then choose a task from the Microduck task collection to build your next policy in Isaac Lab with Newton. Explore new behaviors by changing commands, rewards, or environments—from rough-terrain walking to perception-driven obstacle avoidance. Evaluate your policy on scenes outside the training set before testing on the robot.
资源 Resources
- Microduck 首页(订购、快速入门、安装)
Microduck home page (ordering, quick start, installation)
- 在 Isaac Lab 中训练 Microduck
- 利用 AI 智能体、NVIDIA Isaac Lab 和 RTX Spark 训练机器人实现导航
- 在仿真环境中训练,在真实机器人上部署:使用 Isaac Lab 3.0 的 Microduck
- Isaac Lab 安装指南
- Microduck 训练环境与配置
- 基于牛顿法的 BAM 执行器文档
- Microduck Arena 与 ONNX 提交指南
- 前往 SimReady Central,探索 OEM 和资产提供商提供的更多适用于仿真的 OpenUSD 资产。
- 了解如何使用 SimReady 资产构建机器人抓取与放置仿真
- Microduck 机器人软件与部署指南
致谢 Acknowledgments
此工作流基于 Pollen Robotics 的 Microduck 硬件和软件、原始 Microduck 强化学习项目、BAM 执行器建模工作,以及 Isaac Lab 和 Newton 集成。This workflow builds on Pollen Robotics’ Microduck hardware and software, the original Microduck reinforcement-learning project, BAM actuator modeling work, and the Isaac Lab and Newton integrations.




