7000 上位机服务协议(0x9512–0x95A6)
端口 7000,TCP 或 UDP,控制器为服务端(
HostComputerService::MAIN_PORT)。命令字取自HostComputerService::Cmd(src/hostComputerService/hostComputerService.h),共 9 条,不计入 6000/6001 的 970 条统计。
连接
- 帧格式同 6000/6001 端口(见帧格式说明)。
- 命令字取自
HostComputerService::Cmd(src/hostComputerService/hostComputerService.h),共 9 条:
| 命令字 | 说明 | 处理/应答函数 |
|---|---|---|
0x9512 | — | parsingQueryData() |
0x9513 | — | getQueryReplyData() |
0x9521 | — | parsingRunControlData() |
0x9523 | — | replyRunControl() |
0x9531 | — | parsingVarIOControlData() |
0x95A1 | — | parsingServoPosSwitchData() |
0x95A3 | — | replyServoPosSwitch() |
0x95A4 | — | parsingServoPosControlData() |
0x95A6 | — | replyServoPosControl() |
QueryRequest(0x9512)
parsingQueryData() 读取的字段:
| 参数名 | 类型 | 说明 | 取值范围 |
|---|---|---|---|
channel | int | 通道 | [1,9] |
stop | int | 停止 | — |
robot | int | 机器人号 | [1,4] |
mode | int | 模式 | [0,2] |
interval | int | 间隔 | [1,60000] |
queryType[] | array<string> | — | 数组 |
typeCfg.numGVar[] | array<string> | — | 数组 |
typeCfg.IO[] | array<string> | — | 数组 |
typeCfg.ShenTuoTorqueSensor[] | array<int> | — | 数组 |
typeCfg.detailedMotionPos.num | uint | 编号/数量 | — |
typeCfg.detailedMotionPos.optional[] | array<string> | — | 数组 |
json
{
"channel": 1,
"stop": 1,
"robot": 1,
"mode": 1,
"interval": 1,
"queryType": [
""
],
"typeCfg": {
"numGVar": [
""
],
"IO": [
""
],
"ShenTuoTorqueSensor": [
1
],
"detailedMotionPos": {
"num": 1,
"optional": [
""
]
}
}
}QueryReply(0x9513)
应答 JSON 的顶层字段由 getQueryReplyData() 写入;查询项各自写入 replyData 下的键:
| 写入函数 | 写入的键 | 类型 |
|---|---|---|
getQueryReplyData | channel | int |
getQueryReplyData | robot | — |
getQueryReplyData | replyData.timestamp[] | array<int> |
getQueryReplyData | replyData.serialNum | — |
getRealPosACS | replyData.realPosACS[] | array<any> |
getRealPosMCS | replyData.realPosMCS[] | array<any> |
getRealPosPCS | replyData.realPosPCS[] | array<any> |
getRealPosUCS | replyData.realPosUCS[] | array<any> |
getAxisVel | replyData.axisVel[] | array<any> |
getAxisAcc | replyData.axisAcc[] | array<any> |
getTorque | replyData.torque[] | array<any> |
getRunControlPosRunNum | replyData.runControlPosRunNum | — |
getProgramRunStatus | replyData.programRunStatus | int |
getServoStatus | replyData.servoStatus | int |
getOperationMode | replyData.operationMode | int |
getGlobalSpeed | replyData.globalSpeed | — |
getSyncPosition | replyData.syncPosition[] | array<any> |
getDetailedMotionPos | replyData.detailedMotionPos.num | int |
getDetailedMotionPos | replyData.detailedMotionPos.data[].time[] | array<any> |
getDetailedMotionPos | replyData.detailedMotionPos.data[].ACS[] | array<any> |
getDetailedMotionPos | replyData.detailedMotionPos.data[].MCS[] | array<any> |
getIOData | replyData.IO | object |
getVarData | replyData.numGVar | object |
RunControl(0x9521)
parsingRunControlData() 读取 robot/targetPos/count/sum/cfg.moveMode,并调用 cacheRecvRunControlDataParam() 读取下列参数:
| 参数名 | 类型 | 说明 | 取值范围 |
|---|---|---|---|
robot | int | 机器人号 | [1,4] |
targetPos[] | array<double> | 目标位置 | 数组 |
count | int | 计数 | — |
sum | int | 总数 | >=1 |
cfg.moveMode | string | 运动模式 | 字符串 |
clearBuffer | int | 清除缓冲 | — |
targetMode | int | 目标模式 | [0,1] |
sendMode | int | 发送模式 | [0,1] |
runMode | int | 运行模式 | [0,1] |
cfg.coord | string | 坐标系 | 字符串 |
cfg.extMove | bool | 外部运动 | true / false |
cfg.sync | int | 同步 | — |
cfg.speed | int | 速度 | [1,最大速度] |
cfg.acc | int | 加速度 | [1,100] |
cfg.pl | int | 平滑等级 | [0,5] |
cfg.timeout | int | 超时 | [10,10000] |
end | int | 结束 | — |
json
{
"robot": 1,
"targetPos": [
1.0
],
"count": 1,
"sum": 1,
"cfg": {
"moveMode": "",
"coord": "",
"extMove": true,
"sync": 1,
"speed": 1,
"acc": 1,
"pl": 1,
"timeout": 1
},
"clearBuffer": 1,
"targetMode": 1,
"sendMode": 1,
"runMode": 1,
"end": 1
}readRecvRunControlDataPos() 读取的连续轨迹字段:
| 参数名 | 类型 | 说明 |
|---|---|---|
targetVec[].pos[] | array<double> | 位置 |
targetVec[].axisVel[] | array<double> | 轴速度 |
targetVec[].axisAcc[] | array<double> | 轴加速度 |
targetVec[].vel | double | 速度 |
targetVec[].acc | double | 加速度 |
targetVec[].pl | int | 平滑等级 |
targetVec[].timeStamp | int | — |
json
{
"targetVec": [
{
"pos": [
1.0
],
"axisVel": [
1.0
],
"axisAcc": [
1.0
],
"vel": 1.0,
"acc": 1.0,
"pl": 1,
"timeStamp": 1
}
]
}RunControlReply(0x9523)
replyRunControl() 构造的应答;size 仅在 success 为 true 时写入:
| 参数名 | 类型 | 说明 |
|---|---|---|
robot | int | 机器人号 |
success | bool | 成功 |
cause | string | — |
size | int | 大小/数量 |
json
{
"robot": 1,
"success": true,
"cause": "",
"size": 1
}VarIOControl(0x9531)
numGVar 与 IO 是以变量名/端口名为键的 JSON 对象(源码用 getMemberNames() 遍历),不是数组。
| 参数名 | 类型 | 说明 |
|---|---|---|
numGVar | object<string,double> | — |
IO | object<string,int / double> | — |
json
{
"numGVar": {
"key": 1.0
},
"IO": {
"key": 1
}
}ServoPosSwitch(0x95A1)
| 参数名 | 类型 | 说明 | 取值范围 |
|---|---|---|---|
robot | int | 机器人号 | [1,4] |
switch | bool | 开关 | true / false |
json
{
"robot": 1,
"switch": true
}ServoPosSwitchReply(0x95A3)
replyServoPosSwitch() 构造的应答:
| 参数名 | 类型 | 说明 |
|---|---|---|
robot | int | 机器人号 |
success | bool | 成功 |
cause | string | — |
json
{
"robot": 1,
"success": true,
"cause": ""
}ServoPosControl(0x95A4)
| 参数名 | 类型 | 说明 | 取值范围 |
|---|---|---|---|
robot | int | 机器人号 | [1,4] |
end | int | 结束 | — |
count | int | 计数 | — |
sum | int | 总数 | >=1 |
PosVec[][] | array<array<double>> | — | 数组 |
json
{
"robot": 1,
"end": 1,
"count": 1,
"sum": 1,
"PosVec": [
[
1.0
]
]
}ServoPosControlReply(0x95A6)
replyServoPosControl() 构造的应答:
| 参数名 | 类型 | 说明 |
|---|---|---|
robot | int | 机器人号 |
success | bool | 成功 |
cause | string | — |
json
{
"robot": 1,
"success": true,
"cause": ""
}