目前官方推荐使用 Ubuntu 22.04 系统,并且 C++ 版本仅支持从源码构建安装。首先就是cmake以及工具链的版本,如下所示,可以比当前更高。
这里我们通过拉取AimRT的代码进行编译及运行,从而验证AimRT的基础环境是否安装成功
通过git指令拉取代码,ubuntu拉取网络问题可以先配置如下,
也就是自己clash的端口同下就行,然后重启防火墙
sudo ufw allow 8000/tcp
sudo ufw reload
git clone https://github.com/AimRT/AimRT
开始运行编译脚本
cd AimRT
./build.sh
另一种就是gitee的方式了,如下所示:
source url_cn.bashrc
./build.sh $AIMRT_DOWNLOAD_FLAGS
编译之后可以看到如下提示:可以看到build下的Example的内容。
我们运行一个案例,如下所示:
yewh@yewh-pc:~/AimRT/build$ ./start_examples_cpp_helloworld.sh
AimRT start, version: 1.1.0
[2025-06-23 21:47:03.882314][Info][7071][/home/yewh/AimRT/src/runtime/core/configurator/configurator_manager.cc:57 @Ini tialize]Cfg file path: /home/yewh/AimRT/build/cfg/examples_cpp_helloworld_cfg.yaml
[2025-06-23 21:47:03.886086][Info][7071][/home/yewh/AimRT/src/runtime/core/configurator/configurator_manager.cc:87 @Ini tialize]Configurator manager init complete
[2025-06-23 21:47:03.887283][Info][7071][/home/yewh/AimRT/src/runtime/core/plugin/plugin_manager.cc:135 @Initialize]Plu gin manager init complete
[2025-06-23 21:47:03.887328][Info][7071][/home/yewh/AimRT/src/runtime/core/executor/main_thread_executor.cc:63 @Initial ize]Main thread executor init complete
[2025-06-23 21:47:03.887470][Info][7071][/home/yewh/AimRT/src/runtime/core/executor/guard_thread_executor.cc:113 @Initi alize]Guard thread executor init complete
[2025-06-23 21:47:03.887622][Info][7071][/home/yewh/AimRT/src/runtime/core/executor/executor_manager.cc:102 @Initialize ]Executor manager init complete
[2025-06-23 21:47:03.889119][Info][7071][/home/yewh/AimRT/src/runtime/core/logger/logger_manager.cc:105 @Initialize]Log ger manager init complete
[2025-06-23 21:47:03.889146][Info][7071][core][/home/yewh/AimRT/src/runtime/core/aimrt_core.cc:47 @PrintStartupInfo]
╔═══════════════════════════════════════════════════════════╗
║ ║
║ █████╗ ██╗███╗ ███╗██████╗ ████████╗ ║
║ ██╔══██╗██║████╗ ████║██╔══██╗╚══██╔══╝ ║
║ ███████║██║██╔████╔██║██████╔╝ ██║ ║
║ ██╔══██║██║██║╚██╔╝██║██╔══██╗ ██║ ║
║ ██║ ██║██║██║ ╚═╝ ██║██║ ██║ ██║ ║
║ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ║
║ ║
║ Modern High Performance Robotics Framework ║
║ Official Website: https://aimrt.org ║
║ Documentation: https://docs.aimrt.org ║
║ Version: v1.1.0 ║
╚═══════════════════════════════════════════════════════════╝
[2025-06-23 21:47:03.889197][Info][7071][core][/home/yewh/AimRT/src/runtime/core/allocator/allocator_manager.cc:37 @Ini tialize]Allocator manager init complete
[2025-06-23 21:47:03.890130][Info][7071][core][/home/yewh/AimRT/src/runtime/core/rpc/rpc_manager.cc:175 @Initialize]Rpc manager init complete
[2025-06-23 21:47:03.890702][Info][7071][core][/home/yewh/AimRT/src/runtime/core/channel/channel_manager.cc:176 @Initia lize]Channel manager init complete
[2025-06-23 21:47:03.890735][Info][7071][core][/home/yewh/AimRT/src/runtime/core/parameter/parameter_manager.cc:37 @Ini tialize]Parameter manager init complete
[2025-06-23 21:47:03.894310][Info][7071][HelloWorldModule][/home/yewh/AimRT/src/examples/cpp/helloworld/module/hellowor ld_module/helloworld_module.cc:21 @Initialize]cfg [key1 : val1]
[2025-06-23 21:47:03.894353][Info][7071][HelloWorldModule][/home/yewh/AimRT/src/examples/cpp/helloworld/module/hellowor ld_module/helloworld_module.cc:21 @Initialize]cfg [key2 : val2]
[2025-06-23 21:47:03.894359][Info][7071][HelloWorldModule][/home/yewh/AimRT/src/examples/cpp/helloworld/module/hellowor ld_module/helloworld_module.cc:25 @Initialize]Init succeeded.
[2025-06-23 21:47:03.894393][Info][7071][core][/home/yewh/AimRT/src/runtime/core/module/module_manager.cc:217 @Initiali ze]Module manager init complete
[2025-06-23 21:47:03.894823][Info][7071][core][/home/yewh/AimRT/src/runtime/core/aimrt_core.cc:141 @StartImpl]Gen initi alization report:
----------------------- AimRT Initialization Report Begin ----------------------
[1]. Base Info
+-----------------+-------------------------------------------------------------+
| Version | 1.1.0 |
| Cfg File Path | /home/yewh/AimRT/build/cfg/examples_cpp_helloworld_cfg.yaml |
| Executable Path | /home/yewh/AimRT/build/aimrt_main |
| Process PID | 7071 |
+-----------------+-------------------------------------------------------------+
[2]. AimRT Core Option
configurator:
temp_cfg_path: ./cfg/tmp
plugin:
plugins: ~
main_thread:
name: aimrt_main
thread_sched_policy: ""
thread_bind_cpu:
[]
guard_thread:
name: aimrt_guard
thread_sched_policy: ""
thread_bind_cpu:
[]
queue_threshold: 10000
executor:
executors: ~
log:
core_lvl: Info
default_module_lvl: Info
backends:
- type: console
options:
color: true
module_filter: (.*)
log_executor_name: ""
pattern: ""
allocator: ~
rpc:
backends: ~
clients_options: ~
servers_options: ~
channel:
backends: ~
pub_topics_options: ~
sub_topics_options: ~
parameter: ~
module:
pkgs:
- path: /home/yewh/AimRT/build/libhelloworld_pkg.so
disable_modules:
[]
enable_modules:
[]
modules:
- name: HelloWorldModule
enable: true
log_lvl: Info
[3]. Plugin List
+------+------+
| name | path |
+------+------+
+------+------+
[4]. Executor Type List
[ time_wheel , simple_thread , tbb_thread , asio_strand , asio_thread ]
[5]. Executor List
+------+------+-------------+-----------------------+
| name | type | thread safe | support time schedule |
+------+------+-------------+-----------------------+
+------+------+-------------+-----------------------+
[6]. Log Backend List
[ console ]
[7]. Rpc Backend List
[ local ]
[8]. Rpc Client Filter List
[ debug_log ]
[9]. Rpc Server Filter List
[ debug_log ]
[10]. Rpc Client Info
+------+--------+----------+---------+
| func | module | backends | filters |
+------+--------+----------+---------+
+------+--------+----------+---------+
[11]. Rpc Server Info
+------+--------+----------+---------+
| func | module | backends | filters |
+------+--------+----------+---------+
+------+--------+----------+---------+
[12]. Channel Backend List
[ local ]
[13]. Channel Pub Filter List
[ debug_log ]
[14]. Channel Sub Filter List
[ debug_log ]
[15]. Channel Pub Topic Info
+-------+----------+--------+----------+---------+
| topic | msg type | module | backends | filters |
+-------+----------+--------+----------+---------+
+-------+----------+--------+----------+---------+
[16]. Channel Sub Topic Info
+-------+----------+--------+----------+---------+
| topic | msg type | module | backends | filters |
+-------+----------+--------+----------+---------+
+-------+----------+--------+----------+---------+
[17]. Module Info List
+------------------+---------------------------------------------+---------+
| name | pkg | version |
+------------------+---------------------------------------------+---------+
| HelloWorldModule | /home/yewh/AimRT/build/libhelloworld_pkg.so | 0.0.0.0 |
+------------------+---------------------------------------------+---------+
----------------------- AimRT Initialization Report End ------------------------
[2025-06-23 21:47:03.894844][Info][7071][core][/home/yewh/AimRT/src/runtime/core/configurator/configurator_manager.cc:9 5 @Start]Configurator manager start completed.
[2025-06-23 21:47:03.894848][Info][7071][core][/home/yewh/AimRT/src/runtime/core/plugin/plugin_manager.cc:143 @Start]Pl ugin manager start completed.
[2025-06-23 21:47:03.894850][Info][7071][core][/home/yewh/AimRT/src/runtime/core/executor/executor_manager.cc:114 @Star t]Executor manager start completed.
[2025-06-23 21:47:03.894853][Info][7071][core][/home/yewh/AimRT/src/runtime/core/logger/logger_manager.cc:117 @Start]Lo gger manager start completed.
[2025-06-23 21:47:03.894854][Info][7071][core][/home/yewh/AimRT/src/runtime/core/allocator/allocator_manager.cc:45 @Sta rt]Allocator manager start completed.
[2025-06-23 21:47:03.894857][Info][7071][core][/home/yewh/AimRT/src/runtime/core/rpc/rpc_manager.cc:185 @Start]Rpc mana ger start completed.
[2025-06-23 21:47:03.894859][Info][7071][core][/home/yewh/AimRT/src/runtime/core/channel/channel_manager.cc:187 @Start] Channel manager start completed.
[2025-06-23 21:47:03.894861][Info][7071][core][/home/yewh/AimRT/src/runtime/core/parameter/parameter_manager.cc:45 @Sta rt]Parameter manager start completed.
[2025-06-23 21:47:03.894864][Info][7071][HelloWorldModule][/home/yewh/AimRT/src/examples/cpp/helloworld/module/hellowor ld_module/helloworld_module.cc:31 @Start]Start succeeded.
[2025-06-23 21:47:03.894866][Info][7071][core][/home/yewh/AimRT/src/runtime/core/module/module_manager.cc:239 @Start]Mo dule manager start completed.
[2025-06-23 21:47:03.894868][Info][7071][core][/home/yewh/AimRT/src/runtime/core/aimrt_core.cc:251 @Start]AimRT startup completed, will wait for shutdown.
^C[2025-06-23 22:00:24.145147][Info][7071][core][/home/yewh/AimRT/src/runtime/core/aimrt_core.cc:277 @Shutdown]Received shutdown signal.
[2025-06-23 22:00:24.145205][Info][7071][core][/home/yewh/AimRT/src/runtime/core/aimrt_core.cc:195 @ShutdownImpl]AimRT start shutdown.
[2025-06-23 22:00:24.145211][Info][7071][core][/home/yewh/AimRT/src/runtime/core/module/module_manager.cc:246 @Shutdown ]Module manager shutdown.
[2025-06-23 22:00:24.145217][Info][7071][HelloWorldModule][/home/yewh/AimRT/src/examples/cpp/helloworld/module/hellowor ld_module/helloworld_module.cc:37 @Shutdown]Shutdown succeeded.
[2025-06-23 22:00:24.145222][Info][7071][core][/home/yewh/AimRT/src/runtime/core/parameter/parameter_manager.cc:52 @Shu tdown]Parameter manager shutdown.
[2025-06-23 22:00:24.145226][Info][7071][core][/home/yewh/AimRT/src/runtime/core/channel/channel_manager.cc:194 @Shutdo wn]Channel manager shutdown.
[2025-06-23 22:00:24.145232][Info][7071][core][/home/yewh/AimRT/src/runtime/core/rpc/rpc_manager.cc:192 @Shutdown]Rpc m anager Shutdown.
[2025-06-23 22:00:24.145238][Info][7071][core][/home/yewh/AimRT/src/runtime/core/allocator/allocator_manager.cc:52 @Shu tdown]Allocator manager shutdown.
[2025-06-23 22:00:24.345615][Info][7071][/home/yewh/AimRT/src/runtime/core/logger/logger_manager.cc:124 @Shutdown]Logge r manager shutdown.
[2025-06-23 22:00:24.345652][Info][7071][/home/yewh/AimRT/src/runtime/core/executor/executor_manager.cc:121 @Shutdown]E xecutor manager shutdown.
[2025-06-23 22:00:24.345855][Info][7071][/home/yewh/AimRT/src/runtime/core/executor/guard_thread_executor.cc:136 @Shutd own]Guard thread executor shutdown.
[2025-06-23 22:00:24.345879][Info][7071][/home/yewh/AimRT/src/runtime/core/executor/main_thread_executor.cc:76 @Shutdow n]Main thread executor shutdown.
[2025-06-23 22:00:24.345885][Info][7071][/home/yewh/AimRT/src/runtime/core/plugin/plugin_manager.cc:150 @Shutdown]Plugi n manager shutdown.
[2025-06-23 22:00:24.345889][Info][7071][/home/yewh/AimRT/src/runtime/core/configurator/configurator_manager.cc:102 @Sh utdown]Configurator manager shutdown.
AimRT exit.
yewh@yewh-pc:~/AimRT/build$ cmake --version
cmake version 3.29.6
CMake suite maintained and supported by Kitware (kitware.com/cmake).
yewh@yewh-pc:~/AimRT/build$ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
表示你使用的 AimRT 框架版本是 1.1.0
。
ConfiguratorManager
初始化:加载配置文件路径成功。加载的配置文件是:/home/yewh/AimRT/build/cfg/examples_cpp_helloworld_cfg.yaml
配置管理器(Configurator Manager)完成初始化,配置文件解析成功。插件管理器初始化完成。说明配置中可能加载了一些插件(比如接口、功能组件等)。主线程调度器初始化完成。看门狗线程调度器初始化完成(可能用于异常检测或服务稳定性保障)。总调度器初始化完成。日志模块初始化完成,后续的日志信息会按设定格式输出。
AimRT Framework 启动 Logo,组件初始化继续完成
Allocator manager init complete
Rpc manager init complete
Channel manager init complete
Parameter manager init complete
内存分配器、RPC 管理器、通信通道管理器、参数管理器等运行时模块均初始化成功。
HelloWorld 示例模块初始化
[HelloWorldModule] cfg [key1 : val1]
[HelloWorldModule] cfg [key2 : val2]
[HelloWorldModule] Init succeeded.
表明加载的 helloworld_module 模块成功解析配置文件中的参数(如 key1: val1, key2: val2);
并且成功初始化:helloworld_module.cc:25 @Initialize] Init succeeded.模块管理器启动完成Module manager init complete 即将生成初始化报告 Gen initialization report:
AimRT Initialization Report 表示 HelloWorld 示例确实已经完整加载并运行成功。
基础信息 Base Info
项目 | 内容 |
---|---|
Version | 1.1.0 |
Cfg File Path | /home/yewh/AimRT/build/cfg/examples_cpp_helloworld_cfg.yaml |
Executable Path | /home/yewh/AimRT/build/aimrt_main |
Process PID | 7071 |
说明运行的是 examples_cpp_helloworld
示例程序,配置文件与可执行文件路径都没问题。
Core Options 关键运行配置
所有模块核心功能启用正常(plugin、main_thread、guard_thread、log、module)。
log
配置里明确输出到了 console
,并且 module_filter: (.*)
表示所有模块日志都应能输出。
module 配置如下:
module:
pkgs:
- path: /home/yewh/AimRT/build/libhelloworld_pkg.so
modules:
- name: HelloWorldModule
enable: true
log_lvl: Info
所以 HelloWorldModule
是加载成功的,并且设置了日志级别为 Info
(你确实也看到了 cfg [key1: val1]
这类输出)。
但为什么没看到“Hello World”相关的运行行为呢?
问题可能在于:你只是加载并初始化了模块,但没有启动模块的“周期执行”逻辑,也没有配置 executor 来调度它!
关键缺失:executor 未配置!
executor:
executors: ~
而模块需要通过 executor 调度(比如:simple_thread 或 time_wheel)来调用它的 Tick()
或 Start()
函数。
Rpc 相关信息如上以及Channel 相关信息 Module 相关信息
最后是一些提示初始化完成的日志:
该案例是简单启动了 AimRT 没有配置任何东西。