3. 系统架构
本文描述 Autonomy 的逻辑分层、核心模块关系与运行时数据流。

上图自上而下分为四层:Cloud Service(仿真 / 数据 / 训练 / Tasks)、Software Application(应用与扩展插件)、Software Core(地图 / 定位 / 感知 / 规划 / 控制 / 仿真 + Autolink + OS)、Hardware Device(硬件接口)。下文 HTML 架构图与文档各章节一一对应。
3.1 设计目标
分层解耦:感知/定位 → 地图 → 规划 → 控制 → 底盘,各层通过接口与消息通信
统一入口:
system::Autonomy构造并持有各 Server,对外提供NavigateToPose等 API配置集中:
config/autonomy.lua聚合各子系统 Lua 配置通信抽象:算法模块使用 C++ struct(
commsgs),跨进程经 Autolink 序列化
3.2 分层架构
<div class="plan-arch-link">
<span class="plan-arch-link-arrow">◄</span>
<span class="plan-arch-link-text">读写<br/>地图</span>
<span class="plan-arch-link-arrow">►</span>
</div>
<div class="plan-arch-layer plan-arch-map">
<div class="plan-arch-header">
<span class="plan-arch-badge">地图层</span>
<span class="plan-arch-title">map / costmap_2d</span>
</div>
<div class="plan-arch-body">
<div class="nav-body-block">
<div class="nav-body-label">能力</div>
<div class="nav-chip-list">
<span class="nav-chip">OccupancyGrid</span>
<span class="nav-chip">static/obstacle/inflation</span>
<span class="nav-chip">grid_map</span>
</div>
</div>
</div>
</div>
3.3 模块地图
目录 |
职责 |
文档 |
|---|---|---|
|
通信运行时 |
|
|
顶层 |
|
|
定位 / VSLAM |
|
|
地图与代价地图 |
|
|
全局路径规划 |
|
|
局部运动控制 |
|
|
行为树导航编排 |
|
|
gRPC 等外部桥接 |
|
|
消息类型 |
|
|
TF 缓冲与变换 |
— |
|
传感器同步 |
— |
|
感知(扩展) |
|
|
预测(扩展) |
3.4 配置管线
config/autonomy.lua
├── include map/map.lua
├── include planner/planner.lua
├── include controller/controller.lua
├── include navigator/navigator.lua
└── include localization/localization.lua
│
▼
system::CreateOptions("config")
│
▼
AutonomyOptions (protobuf)
│
▼
system::Autonomy(options)
3.5 运行时数据流
flowchart TB
subgraph Input["输入"]
S[传感器 Laser/Camera]
G[导航目标 Goal]
end
subgraph Core["Autonomy 核心"]
SYS[system::Autonomy]
NAV[navigator BT]
PLN[PlannerServer]
CTL[ControllerServer]
MAP[MapServer / Costmap]
LOC[Localization / Atlas]
end
subgraph Output["输出"]
VEL[cmd_vel]
PATH[Path 可视化]
TF[TF map→odom→base]
end
S --> MAP
S --> LOC
G --> SYS
SYS --> NAV
NAV --> PLN
NAV --> CTL
PLN --> MAP
CTL --> MAP
LOC --> TF
PLN --> PATH
CTL --> VEL
3.6 线程与进程
场景 |
策略 |
|---|---|
单进程部署 |
|
地图更新 vs 规划 |
Costmap mutex,规划时复制快照 |
Atlas VSLAM |
Tracking 主线程 + Mapping / GBA 独立线程 |
BT tick |
单线程 |