控制命令
这些是按 tick 处理、非持久化的命令,通过每个设备的 commands
映射发送。它们只会使用一次,随后即被丢弃——如果停止发送,设备将恢复至空闲状态。
除非另有说明,所有控制命令均仅适用于 WebSocket(没有对应的 HTTP 命令)。
set_cursor_force
对光标(末端执行器)施加笛卡尔力。
{
"inverse3": [{
"device_id": "049D",
"commands": {
"set_cursor_force": {
"vector": { "x": 0.0, "y": 0.0, "z": 1.5 }
}
}
}]
}
| 字段 | 类型 | 说明 |
|---|---|---|
vector | vec3 | 力,单位为牛顿,位于应用空间中 |
在同一个 tick 内,力是可叠加的——来自多个来源(您的应用、SDF HFX、导航)的力会在发送至设备之前先进行求和。
set_cursor_position
将光标指令移动到目标位置(位置模式控制)。
{
"inverse3": [{
"device_id": "049D",
"commands": {
"set_cursor_position": {
"position": { "x": 0.0, "y": -0.12, "z": 0.15 }
}
}
}]
}
| 字段 | 类型 | 说明 |
|---|---|---|
position | vec3 | 目标位置,单位为米,位于应用空间中 |
该服务会计算将光标移动到目标位置所需的力。如果启用了 safe-trajectory(安全轨迹),则光标速度将受到速率限制。
set_angular_torques
对三个关节施加扭矩(角度力模式控制)。
{
"inverse3": [{
"device_id": "049D",
"commands": {
"set_angular_torques": {
"torques": { "a0": 0.0, "a1": 0.0, "a2": 0.0 }
}
}
}]
}
| 字段 | 类型 | 说明 |
|---|---|---|
torques | angles3 | 关节扭矩 |
set_angular_position
向关节发出目标角度指令(角度位置模式控制)。
{
"inverse3": [{
"device_id": "049D",
"commands": {
"set_angular_position": {
"angles": { "a0": 30.0, "a1": 45.0, "a2": 60.0 }
}
}
}]
}
| 字段 | 类型 | 说明 |
|---|---|---|
angles | angles3 | 目标关节角度,单位为度 |
set_transform
设置工作区变换(设备空间 → 应用空间)。与其他命令不同,set_transform 是持久的——该服务会记住您最后发送的值。您可以在相机运动期间持续发送数据流,也可以只发送一次并保持不变。
- WebSocket
- 超文本传输协定
{
"inverse3": [{
"device_id": "049D",
"commands": {
"set_transform": {
"transform": {
"position": { "x": 1.0, "y": 0.0, "z": 0.0 },
"rotation": { "x": 0.0, "y": 0.0, "z": 0.0, "w": 1.0 },
"scale": { "x": 1.0, "y": 1.0, "z": 1.0 }
}
}
}
}]
}
curl -X POST "http://localhost:10001/inverse3/049D/state/transform?session=:0" \
-H "Content-Type: application/json" \
-d '{"transform":{"position":{"x":1,"y":0,"z":0},"rotation":{"w":1,"x":0,"y":0,"z":0},"scale":{"x":1,"y":1,"z":1}}}'
Verse Grip / 无线 Verse Grip
对于抓握设备(Verse Grip / 无线 Verse Grip),仅 rotation 有效。position 和 scale 这是为了与Inverse3 保持架构一致而被采纳的,但对抓握设备没有任何效果。
使用导航模块实现自动漂移
如果需要持续移动,请使用导航模块,而不是手动流式发送 set_transform。该模块将为您处理物理计算、触觉反馈以及工作区边界限制。
probe_position / probe_orientation
仅用于监控的保活命令,适用于不发送控制命令的会话(例如用于观察设备的Haply Hub会话)。
{
"inverse3": [{ "device_id": "049D", "commands": { "probe_position": {} } }]
}
{
"verse_grip": [{ "device_id": "DEF456", "commands": { "probe_orientation": {} } }]
}
您可能并不需要这些
如果您的会话已发送任何控制命令(set_cursor_force、
set_cursor_position 等),设备状态会在每次响应时自动刷新。探测命令仅对只读监控会话有效。