RTK
RTK 接口使用 camelCase 字段。配置和实际转发状态分开;启用保存配置不代表 Caster 已连通或机器人已经获得差分定位。
16.1 GET /v1/api/rtk
无参数,返回唯一的本机配置,未配置为 data=null。响应不含 password:
{"deviceId":"SN1234567890","enabled":true,"casterHost":"caster.example.com","casterPort":2101,"mountpoint":"MOUNT","username":"example-user","ggaIntervalSeconds":1.0,"createdAt":"2026-11-13T08:00:00Z","updatedAt":"2026-11-13T08:00:00Z"}
16.2 POST /v1/api/rtk
创建或完整更新配置:
| 字段 | 类型 | 要求 |
|---|---|---|
enabled | boolean | 必填,false 合法 |
casterHost | string | 必填,主机名或 IP;不能带 http://、端口或路径 |
casterPort | integer | 必填,1–65535 |
mountpoint、username | string | 必填,非空 |
password | string | 首次保存必填非空;后续省略保留原密码;空白字符串被拒绝 |
ggaIntervalSeconds | number | 必填,有限且 >0,允许小数 |
{"enabled":true,"casterHost":"caster.example.com","casterPort":2101,"mountpoint":"MOUNT","username":"example-user","password":"replace-with-caster-password","ggaIntervalSeconds":1.5}
即使 enabled=false,其余非密码配置字段仍必填。deviceId、createdAt 由服务端管理,不通过该接口改写。成功响应与 GET 配置相同,密码不返回;转发服务随后异步重载,连接失败不会让保存接口失败。参数错误为 400/1001,存储或服务未配置为 500/1003。
16.3 GET /v1/api/rtk/status
无参数,返回当前转发内存快照;未配置、禁用或断线仍可能 HTTP 200/code=0。
| 字段 | 类型 | 说明 |
|---|---|---|
observedAt | string | 服务端采样时间 |
state | string | stopped / unconfigured / disabled / not_deployed / invalid_config / running |
detail | string,可省略 | 诊断说明 |
dataReceive、caster、rosbridge | LinkStatus | 三条独立链路 |
lastNmeaAt | string / null | 最近 NMEA 接收 |
lastValidGgaAt | string / null | 最近合法 GGA 接收 |
lastReportedGgaAt | string / null | 最近向 Caster 上报 GGA |
lastRtcmAt | string / null | 最近收到差分数据 |
lastPublishedAt | string / null | 最近成功写入 rosbridge,不保证机器人已接收 |
lastGgaRejection、lastRemoteError | string,可省略 | 最近错误 |
ggaRejected、badMessages | integer | GGA 拒绝、坏消息计数 |
framesRead、framesCorrupt、framesSent、framesDropped | integer | 帧读取、损坏、发送、丢弃计数 |
LinkStatus:state 为 stopped/connecting/connected/reconnecting,lastError 可省略,lastConnectedAt 为 string|null,reconnects 为 integer。计数随进程重启清零,保存配置不清零。running 只代表正在维护连接,应同时看三条链路和最近收发时间。没有发生过的事件时间返回 null,不用空字符串代替。