1. 架构 Architecture

上手与环境见 §0;各模块 API 见 §2–§12。本文描述 栈内位置、内部分层、部署形态、数据流与生命周期

本文 §1

相关文档

分层、数据流、环境

§0 指南 · §13 综述 Survey


1.1 栈内位置

Autonomy 算法模块不直接操作 DDS/SHM,而是经 Node + 消息边界autolink 交互。

应用层 planning · control · localization · navigator C++ autonomy::commsgs::* struct,进程内算法逻辑
ToProto / FromProto
通信 API autolink Node Writer/Reader · Service/Client · Action · Parameter
INTRA · SHM · RTPS
传输层 同进程 / 同机 / 跨主机 发现:UDP 多播,无 central master

相关模块

关系

commsgs

消息类型与 proto

Framework

Server 装配与 Lua 配置

Bridge

外部协议互通


1.2 内部分层

autolink 运行时自顶向下分为五层;发现与数据路径分离——拓扑匹配后,业务数据不经发现通道。

L1 应用 Node 端点 CreateWriter/Reader · Service/Client · Action · Parameter
RoleAttributes · channel 名 · QoS
L2 发现 Service Discovery UDP 多播 · 拓扑注册与匹配
匹配完成
L3 传输 Transport 按拓扑自动选择 INTRA / SHM / RTPS
收包 → pending_queue
L4 调度 Scheduler + CRoutine Reader 回调 · Component::Proc · Timer(classic / choreography)
class_loader / PluginManager
L5 扩展 Component .so · 算法 Plugin DAG 配置 · XML 描述文件 · RegisterInProcessClass

1.3 两种部署形态

形态

入口

调度

适用

Binary

main()Init + CreateNode

自建 Rate 循环

示例、工具、快速验证

Component

mainboard / autolink_launch

Scheduler + DataVisitor

生产模块、车载部署

Binary talker / listener
Component DAG + mainboard

详见 §2 节点 Node · §9 启动 Launch · §10 组件 Component


1.4 Component 数据流

多输入 Component 由 DataVisitor 缓存并对齐各路最新消息,齐备后唤醒 Proc

数据流 DAG → 收包 → 对齐 → 调度 → 输出 channel 名由 DAG readers[] 注入;Writer 在 Init() 中创建
DAG readers[]
Reader
DataVisitor
Scheduler
Proc()
Writer
多路齐备才触发 TimerComponent 无 readers 见 §3.7 直驱回调

TimerComponent 无输入 channel,由 DAG interval(ms)直接触发 Proc(),见 §11

Channel 直驱回调路径见 §3.7


1.5 生命周期

状态机 Init → Ready → Running → Shutdown Binary 与 Component 共用 autolink::Init;运行期调度方式不同
状态 Init
Ready
Running
Shutdown
Clear
状态触发 / 含义
Initautolink::Init(argv),加载配置与子系统
ReadyCreateNodemainboard LoadAll
RunningOK() 循环;Reader 回调 / Proc / Timer
ShutdownSIGINT 或异常;Component::Shutdown
阶段BinaryComponent
启动InitCreateNodemainboard -d foo.dag
运行while (OK()) + RateScheduler 调度 Proc
退出析构 / ClearShutdownUnloadLibrary

1.6 环境与路径变量

GetFilePathWithEnv 按变量解析相对路径;未设置时回退到 AUTOLINK_PATH 下默认目录。

变量

解析对象

典型值

AUTOLINK_PATH

运行时根(conf/autolink.pb.conf

build/autolink/usr/local/share/autolink

AUTOLINK_DISTRIBUTION_HOME

安装前缀

/usr/local

AUTOLINK_CONF_PATH

模块配置、调度 conf

$AUTOLINK_PATH/conf

AUTOLINK_DAG_PATH

.dag 文件

安装 share 目录

AUTOLINK_LIB_PATH

Component .so

lib/autolink/examples/...

AUTOLINK_LAUNCH_PATH

.launch 文件

同 DAG

AUTOLINK_PLUGIN_*

插件描述与 .so

§7

AUTOLINK_SCHED_CONF

调度配置

conf/compute_sched_choreography.conf

AUTOLINK_DOMAIN_ID

RTPS 发现域

setup.bash 默认 80

GLOG_*

日志

§8

Python 另需 PYTHONPATH 指向 autolink_py3examples/python/README.md)。


1.7 CLI 工具

工具

作用

mainboard

-d foo.dag 加载 Component;--plugin= 加载插件

autolink_launch

多 module 进程编排

autolink_channel

诊断 channel 匹配

autolink_monitor

实时流量

autolink_recorder

录放(§3.9

构建:cmake ... -DAUTOLINK_BUILD_TOOLS=ON


1.8 Autonomy 集成

system::Autonomy 各 Server 在内部 CreateNode,将 commsgs 与 autolink 对接:

Server

autolink 用法

Planning

Plugin 加载 GlobalPlanner

Navigator

Action Client → Controller

各模块

Lua 配置 + 可选 Parameter

详见 Framework §3


导航← §0 指南 · §2 节点 Node →