灯带控制模块
灯带控制模块
Section titled “灯带控制模块”本模块位于 ORIN 开发板上,对应模块名称为 skill pilot,HTTP 端口号为 52893。
RPC 接口
Section titled “RPC 接口”| 接口名 | 接口描述 | 请求消息类型 | 答复消息类型 | 备注 | 通信后端 |
|---|---|---|---|---|---|
pb:/aimdk.protocol.HalRgbLightService/SetRgbLightCommand | 设置灯带 | aimdk::protocol::RgbLightCommandReq | aimdk::protocol::CommonResponse | 注意本接口 ip 为 192.168.100.110,端口号为 52893 | http |
pb:/aimdk.protocol.HalRgbLightService/GetRgbLightState | 获取灯带状态 | aimdk::protocol::CommonRequest | aimdk::protocol::RgbLightStateRsp | 注意本接口 ip 为 192.168.100.100,端口号为 56421 | http |
灯光控制逻辑如下:
- 所有灯带灯珠统一控制,可以设置常亮、流水灯、呼吸灯等几个预置灯效,无法单独控制某个灯带或灯珠。
- 机器人默认灯光为蓝色呼吸灯,可被用户自定义控制指令覆盖。
- 低电量、关节过温等红色闪烁告警灯光优先级高于所有用户自定义控制指令,无法被覆盖。
Protobuf 协议
Section titled “Protobuf 协议”aimdk::protocol::RgbLightCommandReq
Section titled “aimdk::protocol::RgbLightCommandReq”RGB灯光控制请求
| Field | Type | Description |
|---|---|---|
| header | aimdk::protocol::RequestHeader | 消息头 |
| cmd | aimdk::protocol::RgbLightCommand | RGB灯光控制指令 |
aimdk::protocol::RgbLightStateRsp
Section titled “aimdk::protocol::RgbLightStateRsp”获取RGB灯光状态响应
| Field | Type | Description |
|---|---|---|
| header | aimdk::protocol::ResponseHeader | 消息头 |
| data | aimdk::protocol::RgbLightState | RGB灯光状态数据 |
aimdk::protocol::RgbLightCommand
Section titled “aimdk::protocol::RgbLightCommand”RGB灯光控制指令
| Field | Type | Description |
|---|---|---|
| red | uint32 | 范围:0~255 |
| green | uint32 | 范围:0~255 |
| blue | uint32 | 范围:0~255 |
| effect | aimdk::protocol::RgbEffectStatus | RGB灯效 |
| control | uint32 | 灯光控制权: 0代表嵌入式接管, 1代表端侧接管 |
aimdk::protocol::RgbEffectStatus
Section titled “aimdk::protocol::RgbEffectStatus”| Name | Number | Description |
|---|---|---|
| RgbEffectStatus_IDLE | 0 | 熄灭 |
| RgbEffectStatus_MONOCHROME | 1 | 单色光 |
| RgbEffectStatus_BREATHING | 2 | 呼吸灯 |
| RgbEffectStatus_FLASHING | 3 | 闪烁灯 |
| RgbEffectStatus_FLOWING | 4 | 流水灯 |
aimdk::protocol::RgbLightState
Section titled “aimdk::protocol::RgbLightState”RGB灯光状态
| Field | Type | Description |
|---|---|---|
| red | uint32 | 范围:0~255 |
| green | uint32 | 范围:0~255 |
| blue | uint32 | 范围:0~255 |
| effect | aimdk::protocol::RgbEffectStatus | RGB灯效 |
| control | uint32 | 灯光控制权: 0代表嵌入式接管, 1代表端侧接管 |
# 设置灯带http调用curl -i -H "content-type:application/json" \ -H "timeout: 60000" \ -X POST 'http://192.168.100.110:52893/rpc/aimdk.protocol.HalRgbLightService/SetRgbLightCommand' \ -d '{"cmd":{"red":255, "green":0, "blue":0, "effect":2, "control":1}}'
# 获取灯带http调用curl -i -H "content-type:application/json" \ -H "timeout: 60000" \ -X POST 'http://192.168.100.100:56421/rpc/aimdk.protocol.HalRgbLightService/GetRgbLightState' \ -d '{}'