Apollo learning notes for beginners.
protobuf
类型对照(c++ & python )
proto 文件基本概念
syntax = "proto2";
package tutorial;
message Person {
optional string name = 1;
optional int32 id = 2;
optional string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
optional string number = 1;
optional PhoneType type = 2 [default = HOME];
}
repeated PhoneNumber phones = 4;
}
message AddressBook {
repeated Person people = 1;
}
每个字段必须有三个允许的修饰符之一: required, optional, repeated.
required:应该很少使用, 因为它可能会损害消息格式未来的可移植性.
repeated:是指数据字段可能连续出现几次,类似动态数组.
optional:表示可设置,也不设置. 当从未设置的字段中检索值时,返回系统默认值: 整数为0, 字符串为空
-
编译为 c++文件对应名称为
xxx.pb.h
和xxx.pb.cc
-
编译为 python 文件对应名称为
xxx_pb2.py
插件
buildtool create --namespace perception --template plugin modules/perception/fp_filter
分布式调试配置
两台设备如何实现通信,都在docker中跑Apollo,例如一台设备上放包,另外一台设备上用cyber_monitor看相应的消息。
这个可以通过配置CYBER_IP这个环境变量实现,两个设备需要同处一个网段内
比如机器A的IP是 192.168.0.1 机器B的IP是 192.168.0.2
那么对于机器A配置export CYBER_IP=192.168.0.1 对于机器B配置 export CYBER_IP=192.168.0.2
代码下载
aem enter 容器内运行 buildtool install 包名,其中包名可以在github代码库中对应的cyberfile.xml文件中找到。
高精地图(语义地图)
关于高精地图和语义apollo园区版本提供了编辑和采集工具,需要和apollo进行申请使用权限,此部分为付费项。
lane
lane {
id {
id: "Lane_1"
}
central_curve {
segment {
line_segment {
point {
x: 746759.4694
y: 3857105.41885
}
point {
x: 746731.40885
y: 3857037.1782
}
}
s: 0
start_position {
x: 746759.4694
y: 3857105.41885
}
heading: -1.9609203680950062
length: 73.7846920351708
}
}
left_boundary {
curve {
segment {
line_segment {
point {
x: 746760.9606
y: 3857104.8057
}
point {
x: 746732.9001
y: 3857036.565
}
}
s: 0
start_position {
x: 746760.9606
y: 3857104.8057
}
heading: -1.9609194836537249
length: 73.7847192631374
}
segment {
line_segment {
point {
x: 746760.9606
y: 3857104.8057
}
point {
x: 746732.9001
y: 3857036.565
}
}
s: 0
start_position {
x: 746760.9606
y: 3857104.8057
}
heading: -1.9609194836537249
length: 73.7847192631374
}
}
length: 73
virtual: true
boundary_type {
s: 0
types: SOLID_WHITE
}
}
right_boundary {
curve {
segment {
line_segment {
point {
x: 746757.9782
y: 3857106.032
}
point {
x: 746729.9176
y: 3857037.7914
}
}
s: 0
start_position {
x: 746757.9782
y: 3857106.032
}
heading: -1.9609212525369402
length: 73.784664807261947
}
segment {
line_segment {
point {
x: 746757.9782
y: 3857106.032
}
point {
x: 746729.9176
y: 3857037.7914
}
}
s: 0
start_position {
x: 746757.9782
y: 3857106.032
}
heading: -1.9609212525369402
length: 73.784664807261947
}
}
length: 73
virtual: true
boundary_type {
s: 0
types: SOLID_WHITE
}
}
length: 73.7846920351708
speed_limit: 2.7777777777777777
predecessor_id {
id: "Lane_5"
}
predecessor_id {
id: "Lane_7"
}
right_neighbor_forward_lane_id {
id: "Lane_4"
}
type: CITY_DRIVING
turn: NO_TURN
left_sample {
s: 0
width: 1.6123369256272906
}
left_sample {
s: 73.7846920351708
width: 1.6124021838548854
}
right_sample {
s: 0
width: 1.6123369255760496
}
right_sample {
s: 73.7846920351708
width: 1.6124021838548848
}
direction: FORWARD
left_road_sample {
s: 2.754493728731102e-05
width: 1.612336925685725
}
left_road_sample {
s: 73.7847192631374
width: 1.6124021838352771
}
right_road_sample {
s: 0
width: 4.8361446623067055
}
right_road_sample {
s: 73.671474772297159
width: 4.83711406540551
}
}
overlap
overlap {
id {
id: "Overlap_Lane_4ParkingSpace_1"
}
object {
id {
id: "Lane_4"
}
lane_overlap_info {
start_s: 2.743004301916907e-15
end_s: 1.3360939031131659e-15
is_merge: false
}
}
object {
id {
id: "ParkingSpace_1"
}
parking_space_overlap_info {
}
}
}
road
road {
id {
id: "Road_5"
}
section {
id {
id: "1"
}
lane_id {
id: "Lane_6"
}
lane_id {
id: "Lane_5"
}
boundary {
outer_polygon {
edge {
curve {
segment {
line_segment {
point {
x: 746761.4588
y: 3857104.6131
}
point {
x: 746761.46886286826
y: 3857104.6464105146
}
point {
x: 746761.47197348939
y: 3857104.678909834
}
point {
x: 746761.4687054283
y: 3857104.710363653
}
point {
x: 746761.45963225013
y: 3857104.7405376658
}
point {
x: 746761.44532752
y: 3857104.769197566
}
point {
x: 746761.426364803
y: 3857104.7961090482
}
point {
x: 746761.40331766417
y: 3857104.8210378061
}
point {
x: 746761.3767596687
y: 3857104.8437495343
}
point {
x: 746761.34726438159
y: 3857104.8640099266
}
point {
x: 746761.315405368
y: 3857104.8815846774
}
point {
x: 746761.281756193
y: 3857104.8962394805
}
point {
x: 746761.24689042161
y: 3857104.90774003
}
point {
x: 746761.211381619
y: 3857104.9158520205
}
point {
x: 746761.17580335028
y: 3857104.9203411457
}
point {
x: 746761.14072918054
y: 3857104.9209731002
}
point {
x: 746761.10673267476
y: 3857104.9175135777
}
point {
x: 746761.07438739808
y: 3857104.9097282724
}
point {
x: 746761.04426691565
y: 3857104.8973828787
}
point {
x: 746761.01694479259
y: 3857104.8802430904
}
point {
x: 746760.99299459392
y: 3857104.8580746017
}
point {
x: 746760.97298988467
y: 3857104.8306431072
}
point {
x: 746760.9606
y: 3857104.8057
}
}
s: 0
start_position {
x: 746761.4588
y: 3857104.6131
}
heading: 1.2774205924230826
length: 0.74405622771261681
}
segment {
line_segment {
point {
x: 746761.4588
y: 3857104.6131
}
point {
x: 746761.46886286826
y: 3857104.6464105146
}
point {
x: 746761.47197348939
y: 3857104.678909834
}
point {
x: 746761.4687054283
y: 3857104.710363653
}
point {
x: 746761.45963225013
y: 3857104.7405376658
}
point {
x: 746761.44532752
y: 3857104.769197566
}
point {
x: 746761.426364803
y: 3857104.7961090482
}
point {
x: 746761.40331766417
y: 3857104.8210378061
}
point {
x: 746761.3767596687
y: 3857104.8437495343
}
point {
x: 746761.34726438159
y: 3857104.8640099266
}
point {
x: 746761.315405368
y: 3857104.8815846774
}
point {
x: 746761.281756193
y: 3857104.8962394805
}
point {
x: 746761.24689042161
y: 3857104.90774003
}
point {
x: 746761.211381619
y: 3857104.9158520205
}
point {
x: 746761.17580335028
y: 3857104.9203411457
}
point {
x: 746761.14072918054
y: 3857104.9209731002
}
point {
x: 746761.10673267476
y: 3857104.9175135777
}
point {
x: 746761.07438739808
y: 3857104.9097282724
}
point {
x: 746761.04426691565
y: 3857104.8973828787
}
point {
x: 746761.01694479259
y: 3857104.8802430904
}
point {
x: 746760.99299459392
y: 3857104.8580746017
}
point {
x: 746760.97298988467
y: 3857104.8306431072
}
point {
x: 746760.9606
y: 3857104.8057
}
}
s: 0
start_position {
x: 746761.4588
y: 3857104.6131
}
heading: 1.2774205924230826
length: 0.74405622771261681
}
}
type: LEFT_BOUNDARY
}
edge {
curve {
segment {
line_segment {
point {
x: 746766.6555
y: 3857102.6757
}
point {
x: 746766.79927221918
y: 3857103.0842235903
}
point {
x: 746766.89697851625
y: 3857103.488281372
}
point {
x: 746766.95052502351
y: 3857103.8870949731
}
point {
x: 746766.961817873
y: 3857104.2798860203
}
point {
x: 746766.932763197
y: 3857104.6658761408
}
point {
x: 746766.86526712764
y: 3857105.0442869621
}
point {
x: 746766.761235797
y: 3857105.4143401114
}
point {
x: 746766.62257533742
y: 3857105.7752572163
}
point {
x: 746766.45119188086
y: 3857106.126259903
}
point {
x: 746766.24899155961
y: 3857106.4665697995
}
point {
x: 746766.01788050588
y: 3857106.7954085325
}
point {
x: 746765.75976485177
y: 3857107.11199773
}
point {
x: 746765.47655072948
y: 3857107.4155590185
}
point {
x: 746765.17014427111
y: 3857107.7053140257
}
point {
x: 746764.84245160886
y: 3857107.9804843785
}
point {
x: 746764.49537887482
y: 3857108.240291704
}
point {
x: 746764.13083220134
y: 3857108.48395763
}
point {
x: 746763.75071772048
y: 3857108.7107037832
}
point {
x: 746763.35694156436
y: 3857108.9197517908
}
point {
x: 746762.95140986517
y: 3857109.1103232806
}
point {
x: 746762.53602875513
y: 3857109.2816398791
}
point {
x: 746762.11270436645
y: 3857109.432923214
}
point {
x: 746761.68334283109
y: 3857109.5633949125
}
point {
x: 746761.24985028151
y: 3857109.6722766017
}
point {
x: 746760.81413284957
y: 3857109.7587899086
}
point {
x: 746760.3780966677
y: 3857109.822156461
}
point {
x: 746759.94364786788
y: 3857109.8615978854
}
point {
x: 746759.51269258233
y: 3857109.8763358095
}
point {
x: 746759.08713694324
y: 3857109.8655918604
}
point {
x: 746758.66888708284
y: 3857109.8285876657
}
point {
x: 746758.25984913309
y: 3857109.7645448521
}
point {
x: 746757.86192922643
y: 3857109.6726850467
}
point {
x: 746757.47703349474
y: 3857109.5522298771
}
point {
x: 746757.10706807044
y: 3857109.4024009705
}
point {
x: 746756.75393908552
y: 3857109.2224199539
}
point {
x: 746756.41955267231
y: 3857109.011508455
}
point {
x: 746756.10581496276
y: 3857108.7688881005
}
point {
x: 746755.81463208923
y: 3857108.493780518
}
point {
x: 746755.54791018378
y: 3857108.185407334
}
point {
x: 746755.30755537865
y: 3857107.8429901768
}
point {
x: 746755.09547380591
y: 3857107.4657506729
}
point {
x: 746754.9536
y: 3857107.1534
}
}
s: 0
start_position {
x: 746766.6555
y: 3857102.6757
}
heading: 1.2324020514433136
length: 17.464895567408178
}
segment {
line_segment {
point {
x: 746766.6555
y: 3857102.6757
}
point {
x: 746766.79927221918
y: 3857103.0842235903
}
point {
x: 746766.89697851625
y: 3857103.488281372
}
point {
x: 746766.95052502351
y: 3857103.8870949731
}
point {
x: 746766.961817873
y: 3857104.2798860203
}
point {
x: 746766.932763197
y: 3857104.6658761408
}
point {
x: 746766.86526712764
y: 3857105.0442869621
}
point {
x: 746766.761235797
y: 3857105.4143401114
}
point {
x: 746766.62257533742
y: 3857105.7752572163
}
point {
x: 746766.45119188086
y: 3857106.126259903
}
point {
x: 746766.24899155961
y: 3857106.4665697995
}
point {
x: 746766.01788050588
y: 3857106.7954085325
}
point {
x: 746765.75976485177
y: 3857107.11199773
}
point {
x: 746765.47655072948
y: 3857107.4155590185
}
point {
x: 746765.17014427111
y: 3857107.7053140257
}
point {
x: 746764.84245160886
y: 3857107.9804843785
}
point {
x: 746764.49537887482
y: 3857108.240291704
}
point {
x: 746764.13083220134
y: 3857108.48395763
}
point {
x: 746763.75071772048
y: 3857108.7107037832
}
point {
x: 746763.35694156436
y: 3857108.9197517908
}
point {
x: 746762.95140986517
y: 3857109.1103232806
}
point {
x: 746762.53602875513
y: 3857109.2816398791
}
point {
x: 746762.11270436645
y: 3857109.432923214
}
point {
x: 746761.68334283109
y: 3857109.5633949125
}
point {
x: 746761.24985028151
y: 3857109.6722766017
}
point {
x: 746760.81413284957
y: 3857109.7587899086
}
point {
x: 746760.3780966677
y: 3857109.822156461
}
point {
x: 746759.94364786788
y: 3857109.8615978854
}
point {
x: 746759.51269258233
y: 3857109.8763358095
}
point {
x: 746759.08713694324
y: 3857109.8655918604
}
point {
x: 746758.66888708284
y: 3857109.8285876657
}
point {
x: 746758.25984913309
y: 3857109.7645448521
}
point {
x: 746757.86192922643
y: 3857109.6726850467
}
point {
x: 746757.47703349474
y: 3857109.5522298771
}
point {
x: 746757.10706807044
y: 3857109.4024009705
}
point {
x: 746756.75393908552
y: 3857109.2224199539
}
point {
x: 746756.41955267231
y: 3857109.011508455
}
point {
x: 746756.10581496276
y: 3857108.7688881005
}
point {
x: 746755.81463208923
y: 3857108.493780518
}
point {
x: 746755.54791018378
y: 3857108.185407334
}
point {
x: 746755.30755537865
y: 3857107.8429901768
}
point {
x: 746755.09547380591
y: 3857107.4657506729
}
point {
x: 746754.9536
y: 3857107.1534
}
}
s: 0
start_position {
x: 746766.6555
y: 3857102.6757
}
heading: 1.2324020514433136
length: 17.464895567408178
}
}
type: RIGHT_BOUNDARY
}
}
}
}
type: UNKNOWN
}
parking_sapce
parking_space {
id {
id: "ParkingSpace_1"
}
polygon {
point {
x: 746739.9989
y: 3857079.8509
z: 0
}
point {
x: 746739.3216
y: 3857078.291
z: 0
}
point {
x: 746742.5405
y: 3857076.9106
z: 0
}
point {
x: 746743.2114
y: 3857078.4742
z: 0
}
}
overlap_id {
id: "Overlap_Lane_4ParkingSpace_1"
}
heading: 0
}
仿真
自带的仿真部分不能仿控制部分,没法进行动力学的一些验证。比如自己写控制算法想去验证暂时不行,carla可以和apollo仿真但目前存在大大小小的问题,官方说后考虑续会支持。
定位
园区版主要有RTK定位和SLAM组合定位
关于NTRIP、RTCM、NMEA的学习_nmea和rtcm的区别-CSDN博客
RTK 定位
RTK硬件模块可以使用华测230和430(内置一年cros帐号)组合惯导.
GnssDriver 中DataParser 从USB串⼝获取数据,然后数据透传,发出两个channel供下游使⽤
使用 sudo screen /dev/ttyTHS1 460800可以产看对应硬件数据
park部署安装
# aem 安装
sudo apt install apollo-neo-env-manager-dev --reinstall
# 园区版本功能包
unzip apollo-park-generic.zip
cd apollo-park-generic
# 环境配置:会识别主机系统是x86_64还是aarch64修改对应的.env 和 .workspace.json配置
bash setup.sh
# 拉取并启动docker容器,只有第一次容器不存在的时候需要,以后包括系统重启后直接aem enter即可
aem start_gpu
# 进入容器: 注意后续进入容器请先到cd apollo-park-generic目录下
aem enter
# 账号登录:使用apollo团队提供的用户名和密码,每次aem start_gpu创建容器后输入一次即可
# 把下面的user换成您的用户名,password换成您的密码
buildtool login user password
# 下载安装依赖包: 会拉取安装park-generic/cyberfile.xml里面所有的依赖包
# 不输入帐号密码,会提示无法进行buildtool build编译
buildtool build --gpu --opt
常用命令
# 切换车型配置 (可能会报错提示,通常忽略即可)
aem profile use sample
# 启动dreamview_plus
aem bootstrap restart --plus
# 打开dreamview,推荐chrome浏览器;其他可能会出现显示不正常情况
http://localhost:8888