定位接口
初始化和重置定位
Section titled “初始化和重置定位”用户可通过该请求初始化机器人定位。
| Type字段值 | Command字段值 | 消息类型 |
|---|---|---|
| 1048579(0x0010 0003) | 2097154(0x0020 0002) | 初始化和重置定位 |
JSON格式请求:
{ "PatrolDevice": { "Type": 1048579, "Command": 2097154, "Time": "2026-01-01 00:00:00.000", "Items": { "PosX": 0.0, "PosY": 0.0, "PosZ": 0.0, "Yaw": 0.0 } }}XML格式请求:
<?xml version="1.0" encoding="UTF-8"?><PatrolDevice> <Type>1048579</Type> <Command>2097154</Command> <Time>2026-01-01 00:00:00.000</Time> <Items> <PosX>0.0</PosX> <PosY>0.0</PosY> <PosZ>0.0</PosZ> <Yaw>0.0</Yaw> </Items></PatrolDevice>| 参数项 | 含义 | 数据类型 | 单位 |
|---|---|---|---|
| PosX | 机器人在地图坐标系下需要重新定位的X轴坐标 | float | m |
| PosY | 机器人在地图坐标系下需要重新定位的Y轴坐标 | float | m |
| PosZ | 机器人在地图坐标系下需要重新定位的Z轴坐标 | float | m |
| Yaw | 机器人在地图坐标系下绕Z轴旋转的姿态角 | float | rad |
获取地图坐标系下的位置信息
Section titled “获取地图坐标系下的位置信息”用户可通过该请求获取机器人当前在地图坐标系下的位置信息。
| Type字段值 | Command字段值 | 消息类型 |
|---|---|---|
| 1048579(0x0010 0003) | 2097153(0x0020 0001) | 获取地图坐标系下机器人位置信息 |
请求
JSON格式请求:
{ "PatrolDevice": { "Type": 1048579, "Command": 2097153, "Time": "2026-01-01 00:00:00.000", "Items": {} }}XML格式请求:
<?xml version="1.0" encoding="UTF-8"?><PatrolDevice> <Type>1048579</Type> <Command>2097153</Command> <Time>2026-01-01 00:00:00.000</Time> <Items/></PatrolDevice>该请求消息中,Items字段不包含任何参数项。
响应
JSON格式响应:
{ "PatrolDevice": { "Type": 1048579, "Command": 2097153, "Time": "2026-01-01 00:00:00.000", "Items": { "Location": 1, "PosX": 0.0, "PosY": 0.0, "PosZ": 0.0, "Roll": 0.0, "Pitch": 0.0, "Yaw": 0.0, "Confidence": 0.99, "Relocation": 1 } }}XML格式响应:
<?xml version="1.0" encoding="UTF-8"?><PatrolDevice> <Type>1048579</Type> <Command>2097153</Command> <Time>2026-01-01 00:00:01.000</Time> <Items> <Location>1</Location> <PosX>0.0</PosX> <PosY>0.0</PosY> <PosZ>0.0</PosZ> <Roll>0.0</Roll> <Pitch>0.0</Pitch> <Yaw>0.0</Yaw> <Confidence>0.99</Confidence> <Relocation>1</Relocation> </Items></PatrolDevice>Items字段中的参数项含义如下:
| 参数项 | 含义 | 数据类型 | 单位 | 参数值说明 |
|---|---|---|---|---|
| Location | 定位状态 | int | / | 定位正常 = 0;定位丢失 = 1 |
| PosX/PosY/PosZ | 机器人在地图坐标系下的坐标 | float | m | |
| Roll/Pitch/Yaw | 机器人在地图坐标系下的姿态角度 | float | rad | |
| Confidence | 定位置信度 | float | ||
| Relocation | 重定位状态 | int | 默认状态 = -1;运行状态(正在执行重定位)= 0;空闲状态(无重定位任务)= 1;重定位成功 = 2;重定位失败 = 3;取消重定位中 = 4 |
【注意】 Confidence数据范围0-1,越接近1代表置信度越高,该数据仅作参考。
获取导航状态
Section titled “获取导航状态”用户可通过该请求获取机器人导航中的感知软件状态信息。
| Type字段值 | Command字段值 | 消息类型 |
|---|---|---|
| 1048579(0x0010 0003) | 1114113(0x0011 0001) | 获取导航中的感知软件状态信息 |
请求
JSON格式请求:
{ "PatrolDevice": { "Type": 1048579, "Command": 1114113, "Time": "2026-01-01 00:00:00.000", "Items": {} }}XML格式请求:
<?xml version="1.0" encoding="UTF-8"?><PatrolDevice> <Type>1048579</Type> <Command>1114113</Command> <Time>2026-01-01 00:00:00.000</Time> <Items/></PatrolDevice>该请求消息中,Items字段不包含任何参数项。
响应
JSON格式响应:
{ "PatrolDevice": { "Type": 1048579, "Command": 1114113, "Time": "2026-01-01 00:00:00.000", "Items": { "Location": 1, "ObsState": 0 } }}XML格式响应:
<?xml version="1.0" encoding="UTF-8"?><PatrolDevice> <Type>1048579</Type> <Command>1114113</Command> <Time>2026-01-01 00:00:01.000</Time> <Items> <Location>1</Location> <ObsState>0</ObsState> </Items></PatrolDevice>Items字段中的参数项含义如下:
| 参数项 | 含义 | 数据类型 | 参数值说明 |
|---|---|---|---|
| Location | 定位状态 | int | 定位正常 = 0;定位丢失 = 1 |
| ObsState | 是否处于避障状态 | int | 无障碍物,未处于避障状态 = 0;有障碍物,处于避障状态 = 1 |
【注意】 ObsState仅对”直线导航”模式生效;“自主导航”状态下,该字段属于无效字段;导航模式定义见任务下发接口中的”下发单点导航任务”部分。