Client&WebSocket 通信协议
Client 端 WebSocket 通信协议
桌面主从机器:TeleTwin Desktop
(1)同步
同步 client 是 DesktopClient。PC 异步 DesktopPCAsyncClient 的报文与下面这份相同。
发送数据格式
{
// 任务 async_params.embodiment,原样放进请求
"embodiment": "teletwin_desktop/gripper-g",
// 只有配置了才出现。client 只允许 "provided"(别名 "catalog" 会先改成 provided)
"normalization": "provided",
// 任务 instruction,已从字符串数组收成一个字符串
"instruction": "pick up the cup",
"observation": {
"images": {
"front": "<JPEG bytes>", // 内部 camera_front,脸部相机
"left_wrist": "<JPEG bytes>", // 内部 camera_left
"right_wrist": "<JPEG bytes>" // 内部 camera_right。某一路是 null 时该键不出现
},
"state": {
// 由 follow1_pos 的 7 个数拆出。位置米,旋转弧度
// rotation_rpy = [roll, pitch, yaw],旋转矩阵 Rz(yaw)·Ry(pitch)·Rx(roll)
"left_ee": {
"position": [0.42, 0.18, 0.31],
"rotation_rpy": [0.01, 1.55, 0.02],
"gripper": 0.04
},
"right_ee": {
"position": [0.41, -0.19, 0.30],
"rotation_rpy": [-0.02, 1.57, 0.01],
"gripper": 0.03
}
},
// 没有映射进 state 的内部字段。服务端当前推理不读这里
"extra_state": {
// 六轴臂:6 个关节 + 末尾夹爪,共 7 维。七轴臂是 8 维
"follow1_joints": [0.1, -0.4, 0.2, 1.2, 0.0, 0.3], // 去掉末尾夹爪,(N,)
"follow2_joints": [0.1, 0.4, 0.2, 1.2, 0.0, 0.3],
"follow1_joints_cur": [0.2, 0.1, 0.0, 0.4, 0.0, 0.1, 0.05], // 关节力矩 + 夹爪力矩
"follow2_joints_cur": [0.2, 0.1, 0.0, 0.4, 0.0, 0.1, 0.04],
"follow1_joints_dev": [0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0], // (N,) 只有手臂速度,末位是夹爪占位 0
"follow2_joints_dev": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
"follow1_end_effort_force": [0.1, -0.2, 1.4], // 末端力,local,(3,)
"follow1_end_effort_torque": [0.0, 0.01, 0.0], // 末端力矩,local,(3,)
"follow2_end_effort_force": [0.0, 0.1, 1.2],
"follow2_end_effort_torque": [0.0, 0.0, 0.0]
}
}
}接收数据格式
Desktop 的状态里没有头、升降、底盘,响应里也就没有这三项。
{
"embodiment": "teletwin_desktop/gripper-g", // 原样回显请求
"actions": {
"left_ee": {
"position": [ // 实际形状 [32, 3],这里只写前 2 帧
[0.421, 0.181, 0.309],
[0.422, 0.182, 0.308]
],
"rotation_rpy": [ // 实际形状 [32, 3],[roll, pitch, yaw]
[0.011, 1.549, 0.021],
[0.012, 1.548, 0.022]
],
"gripper": [0.041, 0.042] // 实际形状 [32]
},
"right_ee": {
"position": [
[0.411, -0.191, 0.301],
[0.412, -0.190, 0.302]
],
"rotation_rpy": [
[-0.019, 1.569, 0.011],
[-0.018, 1.568, 0.012]
],
"gripper": [0.031, 0.032]
}
}
}同一下标是同一帧。actions.left_ee.gripper[5] 和 actions.left_ee.position[5] 一起执行。
(2)RTC
RTC client 是 DesktopRTCAsyncClient。下面是已经有上一拍动作时的一帧。第一拍没有 use_rtc 这一组,其余与同步相同。follow1_joints 在 RTC 里保留末尾夹爪(Desktop 同步版和 EX001 都不带夹爪,这是 client 实现差异)。
发送数据格式
{
"embodiment": "teletwin_desktop/gripper-g",
"normalization": "provided",
"instruction": "pick up the cup",
"observation": {
"images": {
"front": "<JPEG bytes>",
"left_wrist": "<JPEG bytes>",
"right_wrist": "<JPEG bytes>"
},
"state": {
"left_ee": {
"position": [0.42, 0.18, 0.31],
"rotation_rpy": [0.01, 1.55, 0.02],
"gripper": 0.04
},
"right_ee": {
"position": [0.41, -0.19, 0.30],
"rotation_rpy": [-0.02, 1.57, 0.01],
"gripper": 0.03
}
},
"extra_state": {
// RTC 保留末尾夹爪,比同步多 1 维
"follow1_joints": [0.1, -0.4, 0.2, 1.2, 0.0, 0.3, 0.04],
"follow2_joints": [0.1, 0.4, 0.2, 1.2, 0.0, 0.3, 0.03],
"follow1_joints_cur": [0.2, 0.1, 0.0, 0.4, 0.0, 0.1, 0.05],
"follow2_joints_cur": [0.2, 0.1, 0.0, 0.4, 0.0, 0.1, 0.04],
"follow1_joints_dev": [0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0],
"follow2_joints_dev": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
"follow1_end_effort_force": [0.1, -0.2, 1.4],
"follow1_end_effort_torque": [0.0, 0.01, 0.0],
"follow2_end_effort_force": [0.0, 0.1, 1.2],
"follow2_end_effort_torque": [0.0, 0.0, 0.0]
}
},
// 仅上一拍还有可用前缀时出现。服务端 inference_delay 只接受 1、2、3、4
"rtc_mode": "training_time",
"use_rtc": true,
"inference_delay": 4,
"num_flow_steps": 10,
"prev_action_chunk": {
"left_ee": {
"position": [[0.420, 0.180, 0.310], [0.421, 0.181, 0.309]],
"rotation_rpy": [[0.010, 1.550, 0.020], [0.011, 1.549, 0.021]],
"gripper": [0.040, 0.041]
},
"right_ee": {
"position": [[0.410, -0.190, 0.300], [0.411, -0.191, 0.301]],
"rotation_rpy": [[-0.020, 1.570, 0.010], [-0.019, 1.569, 0.011]],
"gripper": [0.030, 0.031]
}
}
}接收数据格式
{
"embodiment": "teletwin_desktop/gripper-g",
"actions": {
"left_ee": {
"position": [[0.421, 0.181, 0.309], [0.422, 0.182, 0.308]],
"rotation_rpy": [[0.011, 1.549, 0.021], [0.012, 1.548, 0.022]],
"gripper": [0.041, 0.042]
},
"right_ee": {
"position": [[0.411, -0.191, 0.301], [0.412, -0.190, 0.302]],
"rotation_rpy": [[-0.019, 1.569, 0.011], [-0.018, 1.568, 0.012]],
"gripper": [0.031, 0.032]
}
}
// "rtc": {"enabled": true, "effective_delay": 4, "trained_max_delay": 4}
}inference_delay 大于 4 时,服务端回 rtc_delay_exceeds_training,没有 actions。
量子 1 号 Pro:Quanta_X1_Pro(x86)
状态里写了头、升降、底盘速度,服务端按轮式 quanta_x1_pro 推理。observation.state.car_pose 是速度 [vx, vy, wz],不是位姿。
(1)同步
同步 client 是 EX001Client。PC 异步 EX001PCAsyncClient 的公开字段与下面相同。
发送数据格式
{
"embodiment": "quanta_x1_pro/gripper-g",
"normalization": "provided",
"instruction": "fold the towel",
"observation": {
"images": {
"front": "<JPEG bytes>",
"left_wrist": "<JPEG bytes>",
"right_wrist": "<JPEG bytes>"
},
"state": {
"left_ee": {
"position": [0.35, 0.20, 0.90],
"rotation_rpy": [0.02, 1.20, -0.01],
"gripper": 0.02
},
"right_ee": {
"position": [0.36, -0.21, 0.91],
"rotation_rpy": [0.01, 1.22, 0.00],
"gripper": 0.02
},
"head_pose": [0.10, -0.20], // [yaw, pitch],弧度
"lift": 0.45, // 升降高度,米
"car_pose": [0.05, 0.00, 0.01] // 速度 [vx, vy, wz]。第一帧是 [0, 0, 0]
},
"extra_state": {
"follow1_joints": [0.2, -0.5, 0.1, 1.4, 0.0, 0.2], // 纯手臂,不含夹爪
"follow2_joints": [0.2, 0.5, 0.1, 1.4, 0.0, 0.2],
"follow1_joints_cur": [0.1, 0.0, 0.2, 0.3, 0.0, 0.1, 0.01],
"follow2_joints_cur": [0.1, 0.0, 0.2, 0.3, 0.0, 0.1, 0.01],
"follow1_joints_dev": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], // 末位夹爪占位 0
"follow2_joints_dev": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
// 这是相对起点的位姿 [x, y, yaw],和上面的速度 car_pose 不是同一个量
"car_pose": [0.12, -0.03, 0.08]
}
}
}接收数据格式
{
"embodiment": "quanta_x1_pro/gripper-g",
"actions": {
"left_ee": {
"position": [[0.351, 0.201, 0.901], [0.352, 0.202, 0.900]],
"rotation_rpy": [[0.021, 1.201, -0.009], [0.022, 1.200, -0.008]],
"gripper": [0.021, 0.022]
},
"right_ee": {
"position": [[0.361, -0.211, 0.911], [0.362, -0.210, 0.910]],
"rotation_rpy": [[0.011, 1.221, 0.001], [0.012, 1.220, 0.002]],
"gripper": [0.021, 0.022]
},
"head_pose": [[0.10, -0.20], [0.11, -0.19]], // 实际 [32, 2]
"lift": [0.45, 0.451], // 实际 [32]
"velocity_decomposed_odom": [[0.05, 0.00, 0.01], [0.05, 0.00, 0.02]] // 实际 [32, 3],速度
}
}(2)RTC
RTC client 是 EX001AsyncClient。第一拍没有 use_rtc。prev_action_chunk 只有左右臂。
发送数据格式
{
"embodiment": "quanta_x1_pro/gripper-g",
"normalization": "provided",
"instruction": "fold the towel",
"observation": {
"images": {
"front": "<JPEG bytes>",
"left_wrist": "<JPEG bytes>",
"right_wrist": "<JPEG bytes>"
},
"state": {
"left_ee": {
"position": [0.35, 0.20, 0.90],
"rotation_rpy": [0.02, 1.20, -0.01],
"gripper": 0.02
},
"right_ee": {
"position": [0.36, -0.21, 0.91],
"rotation_rpy": [0.01, 1.22, 0.00],
"gripper": 0.02
},
"head_pose": [0.10, -0.20],
"lift": 0.45,
"car_pose": [0.05, 0.00, 0.01]
},
"extra_state": {
"follow1_joints": [0.2, -0.5, 0.1, 1.4, 0.0, 0.2],
"follow2_joints": [0.2, 0.5, 0.1, 1.4, 0.0, 0.2],
"follow1_joints_cur": [0.1, 0.0, 0.2, 0.3, 0.0, 0.1, 0.01],
"follow2_joints_cur": [0.1, 0.0, 0.2, 0.3, 0.0, 0.1, 0.01],
"follow1_joints_dev": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
"follow2_joints_dev": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
"car_pose": [0.12, -0.03, 0.08]
}
},
"rtc_mode": "training_time",
"use_rtc": true,
"inference_delay": 4,
"num_flow_steps": 10,
"prev_action_chunk": {
"left_ee": {
"position": [[0.350, 0.200, 0.900], [0.351, 0.201, 0.901]],
"rotation_rpy": [[0.020, 1.200, -0.010], [0.021, 1.201, -0.009]],
"gripper": [0.020, 0.021]
},
"right_ee": {
"position": [[0.360, -0.210, 0.910], [0.361, -0.211, 0.911]],
"rotation_rpy": [[0.010, 1.220, 0.000], [0.011, 1.221, 0.001]],
"gripper": [0.020, 0.021]
}
}
}接收数据格式
{
"embodiment": "quanta_x1_pro/gripper-g",
"actions": {
"left_ee": {
"position": [[0.351, 0.201, 0.901], [0.352, 0.202, 0.900]],
"rotation_rpy": [[0.021, 1.201, -0.009], [0.022, 1.200, -0.008]],
"gripper": [0.021, 0.022]
},
"right_ee": {
"position": [[0.361, -0.211, 0.911], [0.362, -0.210, 0.910]],
"rotation_rpy": [[0.011, 1.221, 0.001], [0.012, 1.220, 0.002]],
"gripper": [0.021, 0.022]
},
"head_pose": [[0.10, -0.20], [0.11, -0.19]],
"lift": [0.45, 0.451],
"velocity_decomposed_odom": [[0.05, 0.00, 0.01], [0.05, 0.00, 0.02]]
}
// "rtc": {"enabled": true, "effective_delay": 4, "trained_max_delay": 4}
}量子 1 号 Pro:Quanta_X1_Pro(Orin)
三路图来自共享内存 NV12,公开键名仍是 front、left_wrist、right_wrist,内容是 JPEG 字节(image_wire_format=base64 时为 Base64 字符串)。
(1)同步
同步、PC 异步的字段和 EX001 x86 同步相同。图像来自 xrcam_head_left_eye、xrcam_left_wrist、xrcam_right_wrist。
发送数据格式
{
"embodiment": "quanta_x1_pro/gripper-g",
"normalization": "provided",
"instruction": "fold the towel",
"observation": {
"images": {
"front": "<JPEG bytes>", // xrcam_head_left_eye
"left_wrist": "<JPEG bytes>", // xrcam_left_wrist
"right_wrist": "<JPEG bytes>" // xrcam_right_wrist
},
"state": {
"left_ee": {
"position": [0.35, 0.20, 0.90],
"rotation_rpy": [0.02, 1.20, -0.01],
"gripper": 0.02
},
"right_ee": {
"position": [0.36, -0.21, 0.91],
"rotation_rpy": [0.01, 1.22, 0.00],
"gripper": 0.02
},
"head_pose": [0.10, -0.20],
"lift": 0.45,
"car_pose": [0.05, 0.00, 0.01]
},
"extra_state": {
"follow1_joints": [0.2, -0.5, 0.1, 1.4, 0.0, 0.2],
"follow2_joints": [0.2, 0.5, 0.1, 1.4, 0.0, 0.2],
"follow1_joints_cur": [0.1, 0.0, 0.2, 0.3, 0.0, 0.1, 0.01],
"follow2_joints_cur": [0.1, 0.0, 0.2, 0.3, 0.0, 0.1, 0.01],
"follow1_joints_dev": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
"follow2_joints_dev": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
"car_pose": [0.12, -0.03, 0.08]
}
}
}接收数据格式
{
"embodiment": "quanta_x1_pro/gripper-g",
"actions": {
"left_ee": {
"position": [[0.351, 0.201, 0.901], [0.352, 0.202, 0.900]],
"rotation_rpy": [[0.021, 1.201, -0.009], [0.022, 1.200, -0.008]],
"gripper": [0.021, 0.022]
},
"right_ee": {
"position": [[0.361, -0.211, 0.911], [0.362, -0.210, 0.910]],
"rotation_rpy": [[0.011, 1.221, 0.001], [0.012, 1.220, 0.002]],
"gripper": [0.021, 0.022]
},
"head_pose": [[0.10, -0.20], [0.11, -0.19]],
"lift": [0.45, 0.451],
"velocity_decomposed_odom": [[0.05, 0.00, 0.01], [0.05, 0.00, 0.02]]
}
}(2)RTC
Orin RTC 使用 EX001OrinClientRTC。比 x86 RTC 多 image_encoding 和 image_pipeline。observation.images 是 JPEG 字节。
发送数据格式
{
"embodiment": "quanta_x1_pro/gripper-g",
"normalization": "provided",
"instruction": "fold the towel",
"observation": {
"images": {
"front": "<JPEG bytes>",
"left_wrist": "<JPEG bytes>",
"right_wrist": "<JPEG bytes>"
},
"state": {
"left_ee": {
"position": [0.35, 0.20, 0.90],
"rotation_rpy": [0.02, 1.20, -0.01],
"gripper": 0.02
},
"right_ee": {
"position": [0.36, -0.21, 0.91],
"rotation_rpy": [0.01, 1.22, 0.00],
"gripper": 0.02
},
"head_pose": [0.10, -0.20],
"lift": 0.45,
"car_pose": [0.05, 0.00, 0.01]
},
"extra_state": {
"follow1_joints": [0.2, -0.5, 0.1, 1.4, 0.0, 0.2],
"follow2_joints": [0.2, 0.5, 0.1, 1.4, 0.0, 0.2],
"follow1_joints_cur": [0.1, 0.0, 0.2, 0.3, 0.0, 0.1, 0.01],
"follow2_joints_cur": [0.1, 0.0, 0.2, 0.3, 0.0, 0.1, 0.01],
"follow1_joints_dev": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
"follow2_joints_dev": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
"car_pose": [0.12, -0.03, 0.08]
}
},
"image_encoding": "jpeg",
"image_pipeline": {
"resize": "cuda",
"encode": "jpeg",
"wire": "raw" // 默认 image_wire_format=jpeg,images 是 JPEG 字节;image_wire_format=base64 时这里是 "base64"
},
"rtc_mode": "training_time",
"use_rtc": true,
"inference_delay": 4,
"num_flow_steps": 10,
"prev_action_chunk": {
"left_ee": {
"position": [[0.350, 0.200, 0.900], [0.351, 0.201, 0.901]],
"rotation_rpy": [[0.020, 1.200, -0.010], [0.021, 1.201, -0.009]],
"gripper": [0.020, 0.021]
},
"right_ee": {
"position": [[0.360, -0.210, 0.910], [0.361, -0.211, 0.911]],
"rotation_rpy": [[0.010, 1.220, 0.000], [0.011, 1.221, 0.001]],
"gripper": [0.020, 0.021]
}
}
}接收数据格式
回包和 EX001 x86 RTC 相同。image_encoding 只出现在请求里。
{
"embodiment": "quanta_x1_pro/gripper-g",
"actions": {
"left_ee": {
"position": [[0.351, 0.201, 0.901], [0.352, 0.202, 0.900]],
"rotation_rpy": [[0.021, 1.201, -0.009], [0.022, 1.200, -0.008]],
"gripper": [0.021, 0.022]
},
"right_ee": {
"position": [[0.361, -0.211, 0.911], [0.362, -0.210, 0.910]],
"rotation_rpy": [[0.011, 1.221, 0.001], [0.012, 1.220, 0.002]],
"gripper": [0.021, 0.022]
},
"head_pose": [[0.10, -0.20], [0.11, -0.19]],
"lift": [0.45, 0.451],
"velocity_decomposed_odom": [[0.05, 0.00, 0.01], [0.05, 0.00, 0.02]]
}
// "rtc": {"enabled": true, "effective_delay": 4, "trained_max_delay": 4}
}