Skip to content

Commit b04ea2c

Browse files
authored
Merge pull request #15725 from lolainta/docs-cyberrt
docs: fix document codeblock's indent & language type
2 parents 1020912 + 8b2626a commit b04ea2c

File tree

8 files changed

+528
-528
lines changed

8 files changed

+528
-528
lines changed

docs/应用实践/开发调试教程/Cyber RT实践/Cyber RT入门/Cyber RT 实践之 Hello Apollo.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ https://apollo.baidu.com/community/course/19
3030

3131
1. 在终端中,执行 DreamView+ 启动指令,执行成功后,点击菜单栏 dreamview+ 按钮,进入 dreamview+ 界面。
3232

33-
```bash
34-
aem bootstrap start --plus
35-
```
33+
```bash
34+
aem bootstrap start --plus
35+
```
3636

37-
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_1563a05.png)
37+
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_1563a05.png)
3838

39-
当出现如下,即表示 dreamview+ 启动成功了。
39+
当出现如下,即表示 dreamview+ 启动成功了。
4040

41-
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_023df8d.png)
41+
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_023df8d.png)
4242

4343
2. 点击左下角 **个人中心** > **设置** > **通用设置** ,可以选择界面语言类型。
4444

@@ -76,31 +76,31 @@ https://apollo.baidu.com/community/course/19
7676

7777
1. 打开新的终端窗口,输入配置参数同步指令,系统将自动将 planning 模块的 Traffic_light 配置参数复制到 profile 的 default 目录中:
7878

79-
```bash
80-
buildtool profile config init --package planning-traffic-rules-traffic-light --profile=default
81-
```
79+
```bash
80+
buildtool profile config init --package planning-traffic-rules-traffic-light --profile=default
81+
```
8282

83-
使用 default 目录这份配置:
83+
使用 default 目录这份配置:
8484

85-
```bash
85+
```bash
8686
# 使用名字叫default的这份配置
8787
aem profile use default
88-
```
88+
```
8989

90-
查看 profile 插件目录结构:
90+
查看 profile 插件目录结构:
9191

92-
```bash
93-
tree profiles/default/modules/planning/traffic_rules/
94-
```
92+
```bash
93+
tree profiles/default/modules/planning/traffic_rules/
94+
```
9595

96-
目录结构:
96+
目录结构:
9797

98-
```bash
99-
profiles/default/modules/planning/traffic_rules/
100-
`-- traffic_light
98+
```bash
99+
profiles/default/modules/planning/traffic_rules/
100+
`-- traffic_light
101101
`-- conf
102102
`-- default_conf.pb.txt
103-
```
103+
```
104104

105105
### 调整交通灯场景停止距离
106106

@@ -112,11 +112,11 @@ https://apollo.baidu.com/community/course/19
112112

113113
2. 在 apollo_workspace 工作目录找到`profiles/default/modules/planning/traffic_rules/traffic_light/conf/default_conf.pb.txt`配置文件,调整红绿灯场景停止配置参数,达到我们期望停车效果。
114114

115-
```bash
116-
#原始
117-
stop_distance: 1.0
118-
#修改后
119-
stop_distance: 2.2
115+
```
116+
#原始
117+
stop_distance: 1.0
118+
#修改后
119+
stop_distance: 2.2
120120
```
121121
122122
3. 保存修改后,回到 dreamview+,在 Modules 中重启 Planning 模块(让系统重新加载 Planing 参数),重新选择红绿灯场景场景,观察主车遇到红灯场景时调整前后停车距离的变化。

docs/应用实践/开发调试教程/Cyber RT实践/Cyber RT组件机制/Cyber RT 之 Component 实践.md

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ https://apollo.baidu.com/community/course/42
2020

2121
1. 使用以下命令解压 TimerCoponent 源码压缩文件
2222

23-
```bash
24-
tar -zxvf component.tar.gz
25-
```
23+
```bash
24+
tar -zxvf component.tar.gz
25+
```
2626

27-
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_58eeec9.png)
27+
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_58eeec9.png)
2828

2929
2. 使用以下命令编译解压的 TimerComponent 实验源码:
3030

31-
```bash
32-
buildtool build -p component/timer_component_sensor/
33-
```
31+
```bash
32+
buildtool build -p component/timer_component_sensor/
33+
```
3434

35-
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_d222781.png)
35+
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_d222781.png)
3636

37-
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_8c56f76.png)
37+
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_8c56f76.png)
3838

3939
3. 修改`timer_component_sensor`配置文件,产生一路新的消息:
4040

@@ -51,7 +51,7 @@ sensor_topic:"/sensor/second"
5151

5252
2)新增`timer_component_sensor_second.dag`文件。复制`timer_component_sensor.dag`文件,并重命名为`timer_component_sensor_second.dag`,修改该文件内的配置项。
5353

54-
```bash
54+
```proto
5555
module_config {
5656
module_library : "component/timer_component_sensor/libtimer_component_sensor_component.so"
5757
timer_components {
@@ -76,7 +76,7 @@ module_config {
7676

7777
3)新增`timer_component_sensor_second.launch`文件,复制`timer_component_sensor.launch`文件,并重命名为`timer_component_sensor_second.launch`,修改该文件内的配置项。
7878

79-
```bash
79+
```xml
8080
<cyber>
8181
<module>
8282
<name>timer_component_sensor</name>
@@ -92,44 +92,44 @@ module_config {
9292

9393
4. 使用以下命令,运行`timer_component_sensor_second.launch`文件。
9494

95-
```bash
96-
cyber_launch start component/timer_component_sensor/launch/timer_component_sensor_second.launch
97-
```
95+
```bash
96+
cyber_launch start component/timer_component_sensor/launch/timer_component_sensor_second.launch
97+
```
9898

99-
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_2e0d265.png)
99+
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_2e0d265.png)
100100

101101
5. 使用 cyber_monitor 工具验证,配置是否生效。
102102

103-
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_bf22ba3.png)
103+
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_bf22ba3.png)
104104

105-
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_d2cf9b1.png)
105+
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_d2cf9b1.png)
106106

107-
若 /sensor/second channel 有数据、数据帧率为 1.25、且数据内容与配置的一致,表示配置成功。
107+
若 /sensor/second channel 有数据、数据帧率为 1.25、且数据内容与配置的一致,表示配置成功。
108108

109109
6. 最后,在终端中,使用 **Ctrl+C** 组合键,结束程序运行。
110110

111111
### 2. 创建Component模板实例
112112

113113
1. 在终端中,执行以下指令,在 component 文件夹下生成 component_fusion_message 模板实例(功能包)。
114114

115-
```bash
116-
buildtool create --template component component/component_fusion_message
117-
```
115+
```bash
116+
buildtool create --template component component/component_fusion_message
117+
```
118118

119-
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_d97f121.png)
119+
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_d97f121.png)
120120

121121
2. 切换目录到生成的`component_fusion_message`目录下,使用 tree 命令查看生成的 component 功能包的目录结构。
122122

123-
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_e5320f8.png)
123+
![image.png](https://bce.bdstatic.com/doc/Apollo-Homepage-Document/Apollo_Beta_Doc/image_e5320f8.png)
124124

125-
其中,`BUILD``component_fusion_message.cc``component_fusion_message.h`三个文件分别为 component_fusion_message 功能包的源码编译规则文件、源文件和头文件;conf 目录下,`component_fusion_message.conf`为全局变量配置文件,`component_fusion_message.pb.txt`为用户在`protobuffer`文件中定义的可配置项的配置文件;`cyberfile.xml``component_fusion_message`功能包的描述文件;dag 目录下的`component_fusion_message.dag`文件中描述了`component_fusion_message`功能包的依赖关系;launch 文件夹下的`component_fusion_message.launch``component_fusion_message`功能包的 launch 启动文件;proto 文件夹下的 BUILD 为用户在 proto 文件夹下定义的`protobuffer`文件的编译规则文件,`component_fusion_message.proto`文件中用户可以定义自己的消息结构。
125+
其中,`BUILD``component_fusion_message.cc``component_fusion_message.h`三个文件分别为 component_fusion_message 功能包的源码编译规则文件、源文件和头文件;conf 目录下,`component_fusion_message.conf`为全局变量配置文件,`component_fusion_message.pb.txt`为用户在`protobuffer`文件中定义的可配置项的配置文件;`cyberfile.xml``component_fusion_message`功能包的描述文件;dag 目录下的`component_fusion_message.dag`文件中描述了`component_fusion_message`功能包的依赖关系;launch 文件夹下的`component_fusion_message.launch``component_fusion_message`功能包的 launch 启动文件;proto 文件夹下的 BUILD 为用户在 proto 文件夹下定义的`protobuffer`文件的编译规则文件,`component_fusion_message.proto`文件中用户可以定义自己的消息结构。
126126

127127
### 3. 定义Component消息结构
128128

129129
1. 在`component_fusion_message.proto`中,添加以下消息数据结构。
130130

131-
```bash
132-
syntax = "proto2";
131+
```bash
132+
syntax = "proto2";
133133
134134
package apollo;
135135
@@ -146,16 +146,16 @@ module_config {
146146
optional string name = 1;
147147
optional string fusion_topic = 2;
148148
};
149-
```
149+
```
150150

151-
`ComponentFusionMessageMsg`中添加 fusion_content、fusion_msg_id 和 timestamp 3 项,分别表示消息内容,消息编号和消息发出时的时间戳。
151+
`ComponentFusionMessageMsg`中添加 fusion_content、fusion_msg_id 和 timestamp 3 项,分别表示消息内容,消息编号和消息发出时的时间戳。
152152

153-
`ComponentFusionMessageConfig`中添加可配置项 name 和 fusion_topic ,用来配置 `ComponentFusionMessageConfig`的名称标识和输出数据的 channel。
153+
`ComponentFusionMessageConfig`中添加可配置项 name 和 fusion_topic ,用来配置 `ComponentFusionMessageConfig`的名称标识和输出数据的 channel。
154154

155155
2. 在 proto 文件夹下的 BUILD 文件中,添加`protobuffer`文件的编译规则。
156156

157-
```bash
158-
load("//tools:apollo_package.bzl", "apollo_package")
157+
```bash
158+
load("//tools:apollo_package.bzl", "apollo_package")
159159
load("//tools/proto:proto.bzl", "proto_library")
160160
load("//tools:cpplint.bzl", "cpplint")
161161
@@ -169,9 +169,9 @@ module_config {
169169
apollo_package()
170170
171171
cpplint()
172-
```
172+
```
173173

174-
由于没有新增`protobuffer`文件,这里无需修改 BUILD 文件,如若新增`protobuffer`文件,可参考 BUILD 文件中已有的配置规则,添加对应`protobuffer`的编译规则。
174+
由于没有新增`protobuffer`文件,这里无需修改 BUILD 文件,如若新增`protobuffer`文件,可参考 BUILD 文件中已有的配置规则,添加对应`protobuffer`的编译规则。
175175

176176
### 4. 配置Component的配置文件
177177

@@ -188,8 +188,8 @@ fusion_topic: "/fusion/message"
188188

189189
1. 修改`component_fusion_message.h`文件。
190190

191-
```bash
192-
#pragma once
191+
```cpp
192+
#pragma once
193193
#include <memory>
194194
195195
#include "cyber/cyber.h"
@@ -216,22 +216,22 @@ fusion_topic: "/fusion/message"
216216
CYBER_REGISTER_COMPONENT(ComponentFusionMessage)
217217
218218
} // namespace apollo
219-
```
219+
```
220220

221-
由于 component 要融合的消息类型是`TimerComponentSensorMsg`,这里需要包含(include)定义`TimerComponentSensorMsg`的头文件(timer_component_sensor.pb.h)。
221+
由于 component 要融合的消息类型是`TimerComponentSensorMsg`,这里需要包含(include)定义`TimerComponentSensorMsg`的头文件(timer_component_sensor.pb.h)。
222222

223-
使用 **using** 引入将 **apollo::cyber** 命名空间下的 **Time****Write** 注入当前作用域中;
223+
使用 **using** 引入将 **apollo::cyber** 命名空间下的 **Time****Write** 注入当前作用域中;
224224

225-
修改类继承 component 的模板参数;将模板参数改为要融合的消息类型,两个参数。
225+
修改类继承 component 的模板参数;将模板参数改为要融合的消息类型,两个参数。
226226

227-
修改 Proc 函数的输入参数;将 Proc 函数的输入参数修改为 **TimerComponentSensorMsg** 的指针。
227+
修改 Proc 函数的输入参数;将 Proc 函数的输入参数修改为 **TimerComponentSensorMsg** 的指针。
228228

229-
ComponentFusionMessage 类增加私有成员 fusion*writer*,fusion*writer* 是智能指针,指向 Writer 对象,Writer 对象可以写出`ComponentFusionMessageMsg`数据。
229+
ComponentFusionMessage 类增加私有成员 fusion*writer*,fusion*writer* 是智能指针,指向 Writer 对象,Writer 对象可以写出`ComponentFusionMessageMsg`数据。
230230

231231
2. 修改`component_fusion_message.cc`文件。
232232

233-
```bash
234-
#include "component/component_fusion_message/component_fusion_message_component.h"
233+
```cpp
234+
#include "component/component_fusion_message/component_fusion_message_component.h"
235235
236236
namespace apollo {
237237
@@ -266,17 +266,17 @@ fusion_topic: "/fusion/message"
266266
}
267267
268268
} // namespace apollo
269-
```
269+
```
270270
271-
在 Init 函数中增加智能指针 fusion*write* 的初始化;
271+
在 Init 函数中增加智能指针 fusion*write* 的初始化;
272272
273-
修改 Proc 函数的输入参数与头文件中的定义一致;
273+
修改 Proc 函数的输入参数与头文件中的定义一致;
274274
275-
在 Proc 函数中创建`ComponentFusionMessageMsg`消息,并通过 fusion*writer* 发出消息到对应的 channel。
275+
在 Proc 函数中创建`ComponentFusionMessageMsg`消息,并通过 fusion*writer* 发出消息到对应的 channel。
276276
277277
3. 修改`BUILD`文件。
278278
279-
```bash
279+
```bash
280280
load("//tools:apollo_package.bzl", "apollo_cc_library", "apollo_cc_binary", "apollo_package", "apollo_component")
281281
load("//tools:cpplint.bzl", "cpplint")
282282
@@ -311,7 +311,7 @@ fusion_topic: "/fusion/message"
311311
apollo_package()
312312
313313
cpplint()
314-
```
314+
```
315315
316316
由于源文件中由于包含了`timer_component_sensor.pb.h`,需要在编译的依赖项中添加对应的依赖项。
317317
@@ -333,7 +333,7 @@ buildtool build -p component/component_fusion_message/
333333
334334
`component_fusion_message.dag`文件中,将第一个 readers 相中的 channel 值改为 component 中融合的主 channel, 在主 channel readers下面添加需要融合的其它 readers 配置,并配置正确的 channel。
335335
336-
```bash
336+
```proto
337337
module_config {
338338
module_library : "component/component_fusion_message/libcomponent_fusion_message_component.so"
339339
components {
@@ -357,7 +357,7 @@ module_config {
357357
358358
### 8. 修改Component的launch文件
359359
360-
```bash
360+
```xml
361361
<cyber>
362362
<module>
363363
<name>component_fusion_message</name>
@@ -405,7 +405,7 @@ module_config {
405405
406406
复制`component_fusion_message.launch`文件,并重命名为`component_fusion_message_all.launch`,将`timer_component_sensor.launch`文件和`timer_component_sensor_second.launch`文件中的 <module> 标签内容拷贝到`component_fusion_message_all.launch`中的 <cyber> 标签内。这样,就可以只启动此`component_fusion_message_all.launch`文件即可一次启动 3 个 component 了。
407407
408-
```bash
408+
```xml
409409
<cyber>
410410
<module>
411411
<name>timer_component_sensor</name>

0 commit comments

Comments
 (0)