关于 physicalai-runtime-running-policy-on-robot
使用 physicalai-runtime 在机器人上运行策略的开发技能,介绍 Python 与 YAML 入口、执行模式、回调及模拟硬件验证。
主要功能
- 01Python 与 YAML 配置指南
- 02同步与 RTC 执行模式
- 03运行时回调指南
- 04模拟机器人和相机测试
- 05配置与动作验证
适用场景
- 01在 Notebook 中运行策略
- 02通过 physicalai run 部署
- 03无硬件测试运行时
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ openvinotoolkit/ physicalai --skill physicalai-runtime-running-policy-on-robot安装后在 Claude Code 中输入/physicalai-runtime-running-policy-on-robot确认已加载。
详细介绍
在机器人上运行策略
PolicyRuntime(src/physicalai/runtime/runtime.py)负责控制循环;InferenceModel 负责策略计算。执行策略位于 src/physicalai/runtime/execution.py 和 src/physicalai/runtime/rtc_execution.py 中。CLI:src/physicalai/cli/run.py 中的 physicalai run 通过 jsonargparse 从 YAML 实例化。
工作流
-
选择 API 还是配置:笔记本和测试使用 Python;可复现部署使用 YAML +
physicalai run。- 完成标准:入口点符合用户的任务需求。
-
Python 最简循环(参见
docs/how-to/runtime/run-policy-on-robot.md):from physicalai.runtime import PolicyRuntime, SyncExecution from physicalai.inference import InferenceModel from physicalai.robot import SO101 from physicalai.capture import UVCCamera runtime = PolicyRuntime( fps=30, robot=SO101(port="/dev/ttyACM0"), model=InferenceModel("./exports/act_policy"), cameras={"wrist": UVCCamera(device="/dev/video0", width=640, height=480)}, execution=SyncExecution(), ) with runtime: runtime.run(duration_s=60)- 完成标准:各组件已连接,且循环在测试或使用伪对象的试运行中正常运行。
-
YAML 配置——为机器人、模型、相机和执行嵌套设置
class_path/init_args;运行:physicalai run --config runtime.yaml --run.duration_s=60 -
执行模式——根据
docs/how-to/runtime/use-execution-modes.md选择同步模式还是 RTC;当队列应由PolicyRuntime管理时,不要围绕InferenceModel.select_action自行构建临时计时逻辑。 -
回调——使用运行时回调 API(
docs/how-to/runtime/add-runtime-callbacks.md)注册遥测/延迟回调,不要将其放在推理适配器中。
验证循环
uv run pytest tests/unit/runtime/ -q
无法使用硬件时,请使用运行时测试中的伪机器人/相机。
必要检查
fps和相机读取速率保持一致。- 动作维度符合机器人
send_action的预期。 - 配置中的
class_path指向的目标无需训练包即可导入。 - 在
docs/reference/config-schema.md中记录运行时配置架构的破坏性变更。
参考资料
docs/how-to/runtime/run-policy-on-robot.mddocs/how-to/config/write-runtime-config.md