跳转到内容

uBot ROS Velocity Command

C++
UUBotROSVelocityCommandComponent
父类
UActorComponent
类型
组件 · 可在 Components 面板添加
模块
UBotROS · UBotROS 0.1.2
头文件
Source/UBotROS/Public/UBotROSVelocityCommandComponent.h

接收 ROS 2 的 geometry_msgs/msg/Twist 速度指令,换算后交给实现了 UBot Velocity Commandable 的目标。不含控制逻辑,只做解码、换算、限速、分发和超时。话题是 /<namespace>/cmd_vel(best_effort / volatile / 10)。

纯函数 · UUBotROSVelocityCommandComponent.GetCommandError

最近一条错误的文字;自上次启动以来没有错误时为空。

引脚方向类型
Return Value输出String

纯函数 · UUBotROSVelocityCommandComponent.GetCommandTarget

指令交给的对象;没有目标(只触发事件)时为空。

引脚方向类型
Return Value输出Object对象引用

纯函数 · UUBotROSVelocityCommandComponent.GetLastCommand

最近一条有效指令(限速之后),收到第一条之前全为 0。

引脚方向类型
Return Value输出UBot Velocity Command结构体

纯函数 · UUBotROSVelocityCommandComponent.GetResolvedCommandTopic

正在订阅的话题;没有订阅时,是下一次启动会用的话题。

引脚方向类型
Return Value输出String

纯函数 · UUBotROSVelocityCommandComponent.IsCommandActive

从收到有效指令到超时为 true;超时关闭时,收到过指令后一直为 true。

引脚方向类型
Return Value输出Boolean

纯函数 · UUBotROSVelocityCommandComponent.IsCommandReceiverReady

已订阅时为 true,与桥是否连上无关。

引脚方向类型
Return Value输出Boolean

函数 · UUBotROSVelocityCommandComponent.RestartCommandReceiver

取消订阅后用当前设置重新订阅,超时计时继续。成功返回 true。

引脚方向类型
Return Value输出Boolean

函数 · UUBotROSVelocityCommandComponent.SetTargetComponent

用一个组件直接替换 Target Component;传空则恢复在所属 Actor 上自动查找。

引脚方向类型
New Target输入Actor Component对象引用

函数 · UUBotROSVelocityCommandComponent.StopCommandReceiver

取消订阅;已经生效的指令仍然按时超时。

在 Components 面板选中组件,在 Details 面板底部 Events 区点事件旁的 + 即可生成事件节点。

事件 · UUBotROSVelocityCommandComponent.OnCommandError

订阅失败、消息畸形或含非有限值、目标不可用或拒绝了指令时触发,Error Message 是原因。

引脚方向类型
Error Message输出String

事件 · UUBotROSVelocityCommandComponent.OnCommandTimeout

每次超时触发一次,在目标收到 Stop Motion 之后。

事件 · UUBotROSVelocityCommandComponent.OnVelocityCommand

每条有效指令换算、限速之后触发,有没有目标都触发,Command 是结果。

引脚方向类型
Command输出UBot Velocity Command结构体

未特别标注的属性:蓝图里只读,Details 面板里可以编辑。

属性类型默认值说明
Auto Start ReceiverbAutoStartReceiver · uBot|ROS|Velocity CommandBooleantrueBegin Play 时订阅;关闭后调用 Restart Command Receiver 开始接收。
Robot Namespace OverrideRobotNamespaceOverride · uBot|ROS|Velocity Command|IdentityString""留空时用 uBot Identity 解析出的命名空间。前后的 / 被忽略,每一段都会被净化;只含 / 表示根命名空间(话题 /cmd_vel)。
Max Angular Speed Radians Per SecondMaxAngularSpeedRadiansPerSecond · uBot|ROS|Velocity Command|LimitsFloat0.0角速度的上限,单位 rad/s,按向量模长限制并保持轴向;0 表示不限制。最小 0.0
Max Linear Speed Meters Per SecondMaxLinearSpeedMetersPerSecond · uBot|ROS|Velocity Command|LimitsFloat0.0线速度的上限,单位 m/s,按向量模长限制并保持方向;0 表示不限制。最小 0.0
Command Timeout SecondsCommandTimeoutSeconds · uBot|ROS|Velocity Command|SafetyFloat0.5超过这么多仿真秒没有新指令,就让目标停车;0 关闭超时。最小 0.0;单位 s
Target ComponentTargetComponent · uBot|ROS|Velocity Command|TargetComponent Reference结构体()接收指令的组件,必须实现 UBot Velocity Commandable。留空时用所属 Actor,或它第一个实现该接口的组件;只设了 Referenced Actor 时,在那个 Actor 上同样查找。
Command Topic OverrideCommandTopicOverride · uBot|ROS|Velocity Command|TopicString""非空时替代 /<namespace>/cmd_vel,缺少前导 / 会补上。