Files
acRealman_xr_from_Yikai/README.md
2026-05-21 17:39:42 +08:00

190 lines
5.6 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# XR-RM75 双臂阶段一遥操作 ROS2 工作空间
这个 `src/` 目录面向 **Ubuntu 22.04 + ROS2 Humble**,用于先跑通阶段一闭环:
```text
PICO 4 Ultra 双手柄 UDP 位姿/按键
-> /xr/left_controller 与 /xr/right_controller
-> 左右 RM75 相对位移速度遥操
-> PC 端查看 D405/D405/D435 视频,后续再接记录节点
```
当前配置参考了最新 `acDual-arm-YikaiFuTest` 中的双臂 acRealman 参数,但本项目仍然采用 PICO 手柄相对位移遥操,不直接搬用戴盟的绝对 `PoseStamped` retarget 链路。
## 当前范围
- 已纳入PICO 双手柄输入、左右 RM75 相对位移控制、左右臂独立/双臂调试 launch。
- 暂不纳入末端执行器、AUBO 移动底盘、升降柱、XR 视频流、自动采摘算法。
## 关键配置来源
来自 `acDual-arm-YikaiFuTest/realman_pkg/core/arg_cfg.py`
- 左臂 IP`192.168.192.18`
- 右臂 IP`192.168.192.19`
- 左右臂 TCP 端口:`8080`
- 左臂工作空间:`x[-0.50, 0.50] y[-0.60, -0.20] z[0.10, 0.50]`
- 右臂工作空间:`x[-0.70, 0.50] y[-0.60, 0.40] z[0.10, 0.70]`
- 圆柱半径限制:左右臂均为 `r[0.20, 0.60]`,低高度区域最小半径收紧到 `0.21`
- 左右臂初始化关节/末端点位、工作空间和 IP 沿用最新 acRealman 配置。
`dual_arm_rm75.yaml` 里的左右 `xr_to_robot_matrix` 依据论文中的 OpenXR/PICO 手柄坐标和现场双臂 base 坐标图设置:
- PICO/OpenXR`+X` 向右,`+Y` 向上,`+Z` 向后。
- 左臂:`+X` 向下,`+Z` 向右,前方工作区对应 `-Y`
- 右臂:`+X` 向上,`+Z` 向左,前方工作区对应 `-Y`
真机上仍需低速确认方向。
## 构建
在包含 `src/` 的工作空间根目录执行:
```bash
source /opt/ros/humble/setup.bash
rosdep update
rosdep install --from-paths src -y --ignore-src
colcon build --symlink-install
source install/setup.bash
```
## UI 启动面板
项目内置了一个类似 acRealman 的 Tkinter 启动面板包含仿真、左臂真机、右臂真机、双臂真机、sample UDP 发送、常用 topic 检查和清理按钮。
从工作空间根目录直接运行源码脚本:
```bash
python3 src/xr_rm_bringup/tools/launcher_ui.py
```
构建并 `source install/setup.bash` 后,也可以通过 ROS2 入口运行:
```bash
ros2 run xr_rm_bringup launcher_ui
```
## 优先验证:双臂 mock
mock 模式不会连接真实 RM75适合先验证 UDP 输入、左右手柄路由和相对位移控制。
终端 1
```bash
source /opt/ros/humble/setup.bash
source install/setup.bash
ros2 launch xr_rm_bringup dual_arm_mock.launch.py
```
终端 2
```bash
source /opt/ros/humble/setup.bash
source install/setup.bash
ros2 run xr_rm_input sample_udp_sender --hand both --host 127.0.0.1 --port 15000
```
检查话题:
```bash
ros2 topic echo /xr/left_controller
ros2 topic echo /xr/right_controller
ros2 topic echo /xr_rm/left_rm75/cmd_vel
ros2 topic echo /xr_rm/right_rm75/cmd_vel
```
也可以使用统一调试入口分别验证:
```bash
ros2 launch xr_rm_bringup arm_debug.launch.py arm:=left use_mock:=true
ros2 launch xr_rm_bringup arm_debug.launch.py arm:=right use_mock:=true
ros2 launch xr_rm_bringup arm_debug.launch.py arm:=both use_mock:=true
```
## 连接双 RM75
先安装睿尔曼 Python API2并确认两台控制器网络可达。
```bash
source /opt/ros/humble/setup.bash
source install/setup.bash
ros2 launch xr_rm_bringup dual_arm_realman.launch.py \
left_robot_ip:=192.168.192.18 \
right_robot_ip:=192.168.192.19
```
更推荐用统一调试入口按阶段放开:
```bash
# 左臂单独调试
ros2 launch xr_rm_bringup arm_debug.launch.py arm:=left use_mock:=false
# 右臂单独调试
ros2 launch xr_rm_bringup arm_debug.launch.py arm:=right use_mock:=false
# 双臂一起调试
ros2 launch xr_rm_bringup arm_debug.launch.py arm:=both use_mock:=false
```
真机 launch 默认不会让机械臂自动移动到 acRealman 初始化点。若现场确认安全区已清空,可显式开启:
```bash
ros2 launch xr_rm_bringup dual_arm_realman.launch.py move_to_initial_pose_on_connect:=true
```
## UDP JSON 格式
单个手柄数据:
```json
{
"hand": "right",
"grip": true,
"trigger": 0.2,
"pos": [0.12, 1.05, -0.32],
"quat": [0.0, 0.0, 0.0, 1.0]
}
```
也支持一次发送左右手柄:
```json
{
"controllers": {
"left": {
"grip": true,
"trigger": 0.0,
"pos": [-0.12, 1.05, -0.32],
"quat": [0.0, 0.0, 0.0, 1.0]
},
"right": {
"grip": true,
"trigger": 0.4,
"pos": [0.12, 1.05, -0.32],
"quat": [0.0, 0.0, 0.0, 1.0]
}
}
}
```
`grip` 是机械臂运动使能:按下时锁定当前手柄和 TCP 起点,之后只跟随相对位移;松开、超时或节点退出都会发送零速度。
## 真机前方向验证
第一轮保持 `max_linear_speed <= 0.04`,先只上右臂:
1. 按住右手 `grip`,手柄缓慢上移,确认 TCP 方向。
2. 手柄缓慢前推/后拉,确认 TCP 方向。
3. 手柄缓慢左移/右移,确认 TCP 方向。
4. 若任一方向相反,只改 `dual_arm_rm75.yaml` 中对应臂的 `xr_to_robot_matrix` 符号。
5. 右臂确认后再开放左臂。
当前双臂是两个独立控制节点,没有跨臂碰撞模型;首次测试请让两臂工作区物理分离。
## 从 acRealman 迁入的优化
- 右臂工作空间改为 acRealman 独立右臂边界,不再沿用左臂窄范围。
- 速度遥操目标在笛卡尔边界外增加基座圆柱半径限制,减少低位近基座不可达目标。
- 真机连接后会下发 acRealman 同款 RM75 硬件速度、加速度和避奇异配置。
- 保留 acRealman 的左右臂 `movej`/`movel` 初始化点位,可通过 launch 参数显式启用。