跳到主要内容

常用类型

所有 JSON 载荷在 WebSocket 和 HTTP 接口中统一使用这些类型。

vec3​

三维向量。用于表示位置(米)、速度(m/s)、力(N)以及缩放系数。

{ "x": 0.0, "y": 0.0, "z": 0.0 }

四元数​

表示旋转的单位四元数。服务内部表示中**w 排在最前**,但在 JSON 中四个分量都使用具名键,因此顺序无关紧要。

{ "w": 1.0, "x": 0.0, "y": 0.0, "z": 0.0 }

An identity quaternion (w=1, x=y=z=0) means "no rotation".

angles3​

Joint angles in degrees (not radians). Used for angular position and angular velocity of the Inverse3's three joints.

{ "a0": 0.0, "a1": 0.0, "a2": 0.0 }

transform​

由位置、旋转和缩放组合而成。用于挂载变换(mount transform)、工作空间变换(workspace transform)以及 SDF 效果的放置。

{
"position": { "x": 0.0, "y": 0.0, "z": 0.0 },
"rotation": { "w": 1.0, "x": 0.0, "y": 0.0, "z": 0.0 },
"scale": { "x": 1.0, "y": 1.0, "z": 1.0 }
}
备注
命令与快照中 mount 的结构差异

通过 configure.mount 发送挂载时,变换包裹在一个 "transform" 键中:{ "mount": { "transform": { … } } }。 从设备快照读取挂载时,它是扁平的:{ "mount": { "position": …, "rotation": …, "scale": … } }。 这种不对称是有意设计的 —— 参见 挂载与工作空间。