SendTeleopCommand
Bidi Stream:客户端持续发送 VELOCITY 帧,服务端 Stream 应答。与其他 Command 互斥;watchdog_timeout_sec 内无 VELOCITY 则自动 STOP / TIMEOUT。
10.1 方法签名
rpc SendTeleopCommand(stream TeleopCommandRequest)
returns (stream TeleopCommandResponse);
10.2 Proto 定义
源文件:autonomy/bridge/proto/external_command_service.proto
enum TeleopCommand {
TELEOP_CMD_UNSPECIFIED = 0;
TELEOP_CMD_START = 1;
TELEOP_CMD_STOP = 2;
TELEOP_CMD_VELOCITY = 3;
}
enum TeleopStatus {
TELEOP_STATUS_UNKNOWN = 0;
TELEOP_STATUS_IDLE = 1;
TELEOP_STATUS_ACTIVE = 2;
TELEOP_STATUS_TIMEOUT = 3;
TELEOP_STATUS_REJECTED = 4;
}
message TeleopCommandRequest {
RequestHeader header = 1;
TeleopCommand command = 2;
commsgs.proto.geometry_msgs.TwistStamped velocity = 3; // VELOCITY 时必填
commsgs.proto.builtin_interfaces.Duration session_timeout = 4;
float max_linear_speed = 5;
float max_angular_speed = 6;
float watchdog_timeout_sec = 7; // 无速度指令超时自动 STOP,0 = 默认
bool disable_collision_checks = 8;
}
message TeleopCommandResponse {
CommandAck ack = 1;
TeleopStatus status = 2;
}
10.3 字段说明
Request · TeleopCommandRequest
字段 |
类型 |
必填 |
说明 |
|---|---|---|---|
|
|
✓ |
|
|
|
✓ |
子命令;见下表 |
|
|
|
速度指令;Bidi 高频发送 |
|
|
— |
会话总超时 |
|
|
— |
线速度上限 (m/s) |
|
|
— |
角速度上限 (rad/s) |
|
|
— |
无 |
|
|
— |
是否跳过碰撞检测 |
TeleopCommand 枚举
值 |
常量 |
说明 |
|---|---|---|
1 |
|
开启遥操会话 |
2 |
|
结束会话 → |
3 |
|
发送速度(需会话 |
Response · TeleopCommandResponse
字段 |
类型 |
说明 |
|---|---|---|
|
|
流应答;末帧 |
|
|
遥操阶段 |
TeleopStatus:IDLE(1) · ACTIVE(2) · TIMEOUT(3) · REJECTED(4)
VELOCITY不改变TeleopStatus(保持ACTIVE),仅驱动底盘运动;连续发送见 13 §13.14。
10.4 示例(grpcurl)
环境:01 §1.1 · TC 全集:13 §13.9 · Bidi 完整测试:13 §13.14
Bidi Stream:上方 发送指令(蓝)、下方 收到结果(绿)。连续 VELOCITY 需 Python 客户端;grpcurl 仅适合 START / 看门狗超时探测。
10.4.1 示例索引
编号 |
在干什么 |
|
末帧预期 |
TC |
|---|---|---|---|---|
前置检查 · 确认无冲突任务 |
— |
无活跃任务 |
— |
|
开启会话并测看门狗 |
1 |
无 VELOCITY → |
|
|
结束遥操会话 |
2 |
|
|
|
连续 VELOCITY(Bidi) |
3 |
|
|
10.4.2 TEL-01 · 前置检查
发 START 前确认无其他 Command 占用任务槽(遥操与其他任务互斥)。
10.4.3 TEL-02 · START 看门狗
仅发送 START,不跟 VELOCITY:watchdog_timeout_sec 到期后 Stream 末帧为 TIMEOUT。
10.4.4 TEL-03 · STOP
结束遥操会话,底盘停止,任务槽释放。
前提:已有 ACTIVE 遥操会话(TEL-02 或 Python Bidi)。
10.4.5 TEL-04 · VELOCITY(Python)
连续发送 command=3 + velocity 需 Bidi Stream,grpcurl 无法完整模拟。
完整脚本 → 13 §13.14