设置指南
从 CAN 总线启动到第一次遥控操作。 涵盖 Piper_sdk、ROS2 发布和 Meta Quest 3 VR 远程操作。
CAN 总线和主机设置
约 15 分钟AgileX Piper 专门通过以下方式进行通信 1 Mbps 的 CAN 总线。 您需要一个 USB 转 CAN 适配器(例如 CANable、GS_USB)来在 Linux 主机上公开 SocketCAN 接口。
调出CAN接口
连接 USB 至 CAN 适配器,然后运行:
# Set bitrate and bring up the CAN interface
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 up
# Verify the interface is active
ifconfig can0
piper_sdk 存储库包括一个 can_activate.sh 帮手。 运行它作为: bash can_activate.sh can0 1000000。 这与使用的脚本相同 piper_ros.
can1, can2等使用 ip link show 列出所有 CAN 接口并将正确的名称传递给 C_PiperInterface.
操作系统支持
Ubuntu 18.04、20.04 和 22.04 是官方测试的平台。 需要 Python 3.6+。
安装piper_sdk
约20分钟这 piper_sdk Python 库处理 CAN 帧、关节状态反馈和夹具控制。 从 PyPI(推荐)或从源安装。
# Option A: Install from PyPI (recommended)
pip3 install piper_sdk
# Option B: Install from source
git clone https://github.com/agilexrobotics/piper_sdk.git
cd piper_sdk
pip install -e .
# Verify installation
python3 -c "import piper_sdk; print('piper_sdk OK')"
SDK自动安装 python-can 作为 CAN 总线通信的依赖项。
连接并启用
这 C_PiperInterface 类是主要入口点。 连接后,必须先启用手臂,然后才能接受运动命令。 EnableArm(7) 启用所有六个关节以及夹具。
from piper_sdk import C_PiperInterface
# Initialize with the CAN interface name (default: "can0")
piper = C_PiperInterface("can0")
# Connect to the arm
piper.ConnectPort()
# Enable all joints (required before motion commands)
piper.EnableArm(7)
print("Piper connected and enabled.")
piper_sdk/demo/V2/。 开始于 demo_joint_ctrl.py 在构建您自己的控制回路之前验证基本运动。
第一项动议
约20分钟连接并启用手臂后,读取关节状态并发送第一个位置命令。
读取关节状态
import time
# Read joint angles in a polling loop
for _ in range(10):
joint_state = piper.GetArmJointMsgs()
print(joint_state)
time.sleep(0.1)
# Read end-effector pose
end_pose = piper.GetArmEndPoseMsgs()
print(end_pose)
发送关节位置命令
# Move to a joint configuration (angles in degrees)
# Arguments: joint1, joint2, joint3, joint4, joint5, joint6
piper.MotionCtrl_2(
0, # joint 1
0, # joint 2
90, # joint 3
0, # joint 4
0, # joint 5
0 # joint 6
)
time.sleep(2) # wait for motion to complete
夹具控制
# Open gripper
piper.GripperCtrl(0, 1000)
# Close gripper (check your gripper's max value)
piper.GripperCtrl(70, 1000)
# Read gripper state
gripper_state = piper.GetArmGripperMsgs()
print(gripper_state)
piper.DisableArm(7) 当完成时。 启用的手臂会立即响应任何命令 - 包括由于错误或丢弃数据包而导致的错误命令。
双臂(主从)设置
对于双手配置,在单独的 CAN 接口上连接两个 Piper:
piper_left = C_PiperInterface("can0")
piper_right = C_PiperInterface("can1")
piper_left.ConnectPort()
piper_right.ConnectPort()
piper_left.EnableArm(7)
piper_right.EnableArm(7)
print("Both arms connected.")
ROS2/MoveIt 集成
约 60 分钟这 piper_ros 软件包提供了完整的 ROS Noetic 驱动程序,具有 MoveIt 运动规划和 Gazebo 模拟功能。 它包裹着 piper_sdk 内部并公开标准 ROS 接口。
安装依赖项
# Install required ROS packages
sudo apt-get install -y \
ros-noetic-moveit \
ros-noetic-ruckig \
ros-noetic-ompl
# Install Python CAN dependency
pip3 install python-can piper_sdk
发射
# Step 1: Activate CAN interface
bash can_activate.sh can0 1000000
# Step 2: Launch the Piper control node
roslaunch piper start_single_piper.launch
# For dual-arm:
roslaunch piper start_double_piper.launch
移动规划
# Launch MoveIt with RViz for interactive planning
roslaunch piper_moveit_config demo.launch
# Gazebo simulation (no physical arm required)
roslaunch piper piper_gazebo.launch
S-V1.6-3 需要遗产 piper_description_old.urdf 文件。 较新的固件使用标准 piper_description.urdf。 在加载 ROS 模型之前,请检查手臂底座上的固件版本标签。
请参阅 规格页面 查看完整的 ROS 主题和服务表。
Meta Quest 3 VR 远程操作
〜90分钟Piper 可以使用实时控制 元任务 3 耳机。 该架构在本地网络上使用 UDP:Quest 运行一个 Unity 应用程序来传输手势数据,机器人 PC 上的 Python 服务器将其转换为 Piper SDK 命令。
建筑学
Unity 方面 (VRHandPoseSender.cs, VRGripperController.cs, VRTeleoperationManager.cs)并且 UDP 层可以从 xArm 设置中完全重用 — 只需要换出机器人控制器模块。
设置步骤
-
启动CAN接口并启用手臂。
sudo ip link set can0 type can bitrate 1000000 sudo ip link set can0 up -
创建一个
PiperController包裹C_PiperInterface. 更换XArmController在现有的远程操作堆栈中使用新的类piper_controller.py。 实施connect(),set_pose(x, y, z, roll, pitch, yaw),set_gripper(value), 和emergency_stop()使用 Piper_sdk 调用。 -
在机器人 PC 上启动 Python UDP 服务器。
服务器侦听 UDP 端口 8888/8889,并将收到的手势数据包转发到 Piper。python3 teleoperation_main.py --robot-type piper -
在 Quest 3 上启动 Unity 应用程序并连接到 PC 的 IP 地址。
调整
positionOffset,rotationOffset, 和scaleFactor在 Unity 中以匹配 Piper 的工作区。 由于 Piper 的范围较小,这些参数与 xArm 不同。
scaleFactor 在 Unity 中防止手臂在远程操作期间触及关节极限。 从保守的比例开始,并在监测关节角度的同时逐渐增加。
数据收集
进行中远程操作工作后,使用 SVRC 平台记录、标记和导出操作演示。
- 通过Python UDP服务器或直接通过
piper_ros包录音 - 导出于 RLDS 或者 乐机器人 下游政策培训的形式
- 使用 SVRC平台 管理数据集、运行质量检查以及训练 ACT 或扩散策略模型
piper.GetArmJointMsgs() 和 piper.GetArmEndPoseMsgs() 在后台线程中以约 50 Hz 的频率捕获远程操作期间的同步关节和末端执行器状态。