# openpi：用 DROID 策略在 Franka/DROID 上做远程推理（policy server + client）

> 原文链接：https://robotics.hellobike.com/tutorials/openpi-droid-inference
> 频道：tutorials | 更新日期：2026-10-22 | 标签：openpi, DROID, Franka, remote inference, policy server, openpi-client
> 核心摘要：本文整理 openpi 的 DROID 远程推理流程：在带强 GPU 的机器上启动 policy server，在 DROID 控制笔记本上安装 openpi-client、配置相机并运行 main.py，通过远程服务执行 π0.5-DROID 策略。

# openpi：用 DROID 策略在 Franka/DROID 上做远程推理（policy server + client）

&gt; 本文依据以下官方文档整理：[raw.githubusercontent.com/Physical-Intelligence/openpi/main/](https://raw.githubusercontent.com/Physical-Intelligence/openpi/main/examples/droid/README.md)、[raw.githubusercontent.com/Physical-Intelligence/openpi/main/](https://raw.githubusercontent.com/Physical-Intelligence/openpi/main/docs/remote_inference.md)。命令与版本以文档当前版本为准。

## 前置条件

- 一台带较强 GPU 的机器，文档示例为 ~NVIDIA 4090
- DROID control laptop 和 NUC 上安装最新版本的 DROID package
- DROID control laptop 上可激活 DROID conda environment
- GPU 机器已 clone 并安装 openpi repository
- DROID control laptop 能访问 policy server 的 IP 和端口
- 已连接相机，并能通过 ZED_Explorer 或 ZED_Explore 查看 camera IDs

## 1. 1. 确认远程推理架构

DROID control laptop 没有强 GPU，因此推理服务放在另一台更强 GPU 机器上运行；机器人侧只作为 client，在执行时查询远程 policy server。openpi 也说明这种方式适合在机器人外部 GPU 上跑模型，并让 robot 和 policy environments 保持分离。

## 2. 2. 在 GPU 机器启动 π0.5-DROID policy server

在带强 GPU 的机器上，先按 openpi README clone 并安装 openpi repository。然后启动 OpenPI server，加载 fine-tuned π0.5-DROID checkpoint：

```bash
uv run scripts/serve_policy.py policy:checkpoint --policy.config=pi05_droid --policy.dir=gs://openpi-assets/checkpoints/pi05_droid
```

文档还给出等价命令：

```bash
uv run scripts/serve_policy.py --env=DROID
```

## 3. 3. 在 DROID 控制笔记本安装 client 依赖

确认 DROID control laptop 和 NUC 都安装了最新 DROID package。然后在 control laptop 激活 DROID conda environment，clone openpi repo，并安装依赖很少的 openpi client：

```bash
cd $OPENPI_ROOT/packages/openpi-client && pip install -e .
```

再安装用于命令行解析的 tyro：

```bash
pip install tyro
```

## 4. 4. 放置 main.py 并配置相机 ID

将当前目录中的 `main.py` 文件复制到 `$DROID_ROOT/scripts` 目录。随后把 `main.py` 文件中的 camera IDs 替换成你的相机 ID。文档说明可在命令行运行 `ZED_Explorer`，打开工具查看所有已连接相机及其 IDs，也可用它确认相机位置能看到机器人要交互的场景。

## 5. 5. 从控制笔记本连接 policy server 并运行机器人

运行 `main.py` 时，需要把 IP 和 host address 指向 policy server。若要确认 server machine 能从 DROID laptop 访问，可在 DROID laptop 上运行 `ping <server_ip>`。同时指定 policy 使用的 external camera；文档说明只输入一个 external camera，可从 `["left", "right"]` 选择。

```bash
python3 scripts/main.py --remote_host=<server_ip> --remote_port=<server_port> --external_camera="left"
```

## 6. 6. 输入任务语言指令并开始推理

脚本会要求输入一条 free-form language instruction，让机器人按该指令执行。运行前确保相机对准要交互的场景。文档说明不需要仔细控制 camera angle、object positions 等；根据作者经验，该 policy fairly robust。

## 验证是否跑通

确认 policy server 已启动且端口可用；在 DROID laptop 上可用 `ping <server_ip>` 检查 server machine 是否 reachable。运行 `python3 scripts/main.py --remote_host=<server_ip> --remote_port=<server_port> --external_camera="left"` 后，脚本会要求输入 free-form language instruction，即表示 client 已进入远程推理流程。

## 文档里点名的注意事项

- Cannot reach policy server：确保 server 正在运行，IP 和 port 正确；可在 DROID laptop 上运行 `ping <server_ip>` 检查 server machine 是否 reachable。
- Cannot find cameras：确保 camera IDs 正确，且 cameras 已连接到 DROID laptop；有时重新插拔 cameras 会有帮助；可在命令行运行 `ZED_Explore` 查看所有已连接相机。
- Policy inference is slow / inconsistent：尝试给 DROID laptop 使用 wired internet connection 以降低延迟；0.5 - 1 sec latency per chunk is normal。
- Policy does not perform the task well：可调整 scene 或 object placement 降低任务难度；确保传给 policy 的 camera view 能看到场景中所有相关物体。policy 只基于 single external camera + wrist camera，需要确保传入的是期望 camera。

## 相关 SDK 条目

- [openpi](/sdks/openpi)

## 原始参考来源 (Sources)

- [raw.githubusercontent.com/Physical-Intelligence/openpi/main/examples/droid/README.md](https://raw.githubusercontent.com/Physical-Intelligence/openpi/main/examples/droid/README.md)
- [raw.githubusercontent.com/Physical-Intelligence/openpi/main/docs/remote_inference.md](https://raw.githubusercontent.com/Physical-Intelligence/openpi/main/docs/remote_inference.md)