五分钟上手
需要:uBotSensor 0.1.x(含依赖 uBotCore)
给一个 Actor 装上 IMU,运行后在屏幕左上角看到采样序号不断增加,确认插件已经正常工作。
先按安装装好 UBotCore 和 UBotSensor,用 UE 5.5 打开工程。
添加一个 IMU 传感器
Section titled “添加一个 IMU 传感器”-
新建 Actor 蓝图
在「Content Browser」里右键,选「Blueprint Class → Actor」,命名为
BP_ImuProbe。 -
添加 IMU 组件
打开
BP_ImuProbe,在「Components」面板点「Add」,搜索uBot IMU Sensor,把新组件重命名为IMU。
组件默认在开始运行时自动启动(Auto Start),采样频率 100 Hz(Update Rate Hz)。
在屏幕上打印采样序号
Section titled “在屏幕上打印采样序号”选中 IMU 组件,在「Details」面板最下面的「Events」区点 On Sensor Sampled 旁的「+」,然后照下图连线:

连线:
- On Sensor Sampled (IMU) 的 执行,连到 Print String 的 执行
- On Sensor Sampled (IMU) 的 Header,连到 Break UBot Frame Header 的 UBot Frame Header
- Break UBot Frame Header 的 Sequence,连到 To String (Integer64) 的 In Int
- To String (Integer64) 的 Return Value,连到 Print String 的 In String
- 把
Sequence直接连到In String,编辑器会自动插入这个转换节点。 - 展开
Print String的高级引脚,给Key填一个固定值,同一行文字会原地刷新。
On Sensor Sampled (IMU)
UBot Sensor Component · UBotSensor
每次采样后触发,Header 是本次的帧头。每种传感器都有这个事件。
输出
- 执行
- Header
UBot Frame Header结构体
查看参考UUBotSensorComponent.OnSensorSampled
Break UBot Frame Header
UBotCore
把帧头拆成 Sensor Id、Frame Id、Sequence、Timestamp Seconds、Valid 和 Status。
输入
- UBot Frame Header
UBot Frame Header结构体
输出
- Sensor Id
String - Frame Id
String - Sequence
Integer64 - Timestamp Seconds
Float (double) - Valid
Boolean - Status
EUBot Sample Status枚举
查看参考Break:FUBotFrameHeader
To String (Integer64)
UE 引擎 · 中文界面:转换为字符串(Integer64)
Converts an 64-bit integer value to a string
输入
- In Int
Integer64
输出
- Return Value
String
查看参考UKismetStringLibrary.Conv_Int64ToString
Print String
UE 引擎 · 中文界面:打印字符串
Prints a string to the log, and optionally, to the screen If Print To Log is true, it will be visible in the Output Log window. Otherwise it will be logged only as 'Verbose', so it generally won't show up.
输入
- 执行
- In String
String - Print to Screen
Boolean - Print to Log
Boolean - Text Color
Linear Color结构体 - Duration
Float - Key
Name
输出
- 执行
查看参考UKismetSystemLibrary.PrintString
On Sensor Sampled 是所有 uBot 传感器共有的事件,Header 是这一次采样的帧头。
运行并查看结果
Section titled “运行并查看结果”-
放进关卡
把
BP_ImuProbe从「Content Browser」拖进关卡。 -
运行
点「Play」。屏幕左上角的数字不断增加。
采样频率是 100 Hz,但每帧最多采样一次。帧率低于 100 FPS 时,数字每秒增加的量等于帧率,原因见仿真时钟与采样调度。