Skip to content

Commit

Permalink
Docs: move links in howto docs to relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
changsh726 authored and storypku committed Sep 24, 2020
1 parent 79febda commit 78fd3e7
Show file tree
Hide file tree
Showing 25 changed files with 203 additions and 203 deletions.
46 changes: 23 additions & 23 deletions docs/howto/how_to_add_a_new_lidar_driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ modules/drivers/velodyne/proto/velodyne.proto
```
modules/drivers/proto/pointcloud.proto
```


3. [Compensator](https://github.com/ApolloAuto/apollo/tree/master/modules/drivers/velodyne/compensator): Compensator takes pointcloud data and pose data as inputs. Based on the corresponding pose information for each cloud point, it converts each cloud point information aligned with the latest time in the current lidar scan frame, minimizing the motion error due the movement of the vehicle. Thus, each cloud point needs carry its own timestamp information.

## Steps to add a new Lidar driver

#### 1. Get familiar with Apollo Cyber RT framework.
#### 1. Get familiar with Apollo Cyber RT framework.

Please refer to the [manuals of Apollo Cyber RT](../cyber/README.md).

Please refer to the [manuals of Apollo Cyber RT](https://github.com/ApolloAuto/apollo/tree/master/docs/cyber).


#### 2. Define message for raw data

Apollo already define the format of pointcloud. For new lidar, you only need to define the protobuf message for the raw scannning data. Those raw data will be used for archive and offline development. Compared to processed pointcloud data, raw data saves a lot of storage spaces for long term. The new message of the scan data can be define as below:
Expand All @@ -45,14 +45,14 @@ message ScanData {
}
```

In velodyne driver, the scan data message is define as [VelodyneScan](https://github.com/ApolloAuto/apollo/blob/master/modules/drivers/velodyne/proto/velodyne.proto#L29).

In velodyne driver, the scan data message is define as [VelodyneScan](../../modules/drivers/velodyne/proto/velodyne.proto#L29).

#### 3. Access the raw data

Each seconds, Lidar will generate a lot of data, so it relied on UDP to efficiently transport the raw data. You need to create a DriverComponent class, which inherits the Component withotu any parameter. In its Init function, you need to start a async polling thread, whic will receive Lidar data from the specific port. Then depending on the Lidar's frequency, the DriverComponent needs to package all the packets in a fix period into a frame of ScanData. Eventually, the writer will send the ScanData through a corresponding channel.

```c++
// Inherit component with no template parameters,
// Inherit component with no template parameters,
// do not receive message from any channel
class DriverComponent : public Component<> {
public:
Expand All @@ -62,8 +62,8 @@ class DriverComponent : public Component<> {
this->Poll();
}));
}
private:

private:
void Poll() {
while (apollo::cyber::Ok()) {
// poll data from port xxx
Expand All @@ -74,11 +74,11 @@ class DriverComponent : public Component<> {
writer_.write(scan);
}
}

std::shared_ptr<std::thread> poll_thread_;
std::shared_ptr<apollo::cyber::Writer<ScanData>> writer_;
};

CYBER_REGISTER_COMPONENT(DriverComponent)
```
Expand All @@ -87,7 +87,7 @@ CYBER_REGISTER_COMPONENT(DriverComponent)
If the new lidar driver already provides the pointcloud data in Cartesian coordinates system, then you just need to store those data in the protobuf format defined in Apollo.
The Parser converts the lidar raw data to the pointcloud format in Cartesian coordinates system. Parser takes ScanData as input. For each cloud point, it will parse the timestamp, x/y/z coordinates and intensity, then packages all the cloudpoint information into a frame of pointcloud. Each cloud point transformed into the FLU (Front: x, Left: y, Up: z)coordinates with Lidar as the origin point.
```c++
message PointXYZIT {
optional float x = 1 [default = nan];
Expand All @@ -97,7 +97,7 @@ message PointXYZIT {
optional uint64 timestamp = 5 [default = 0];
}
```

Then you need to create a new ParserComponent,which inherits Components templates with ScanData. ParserComponent takes ScanData as input, then generates pointcloud message and sents it out.

```c++
Expand All @@ -107,26 +107,26 @@ class ParserComponent : public Component<ScanData> {
bool Init() override {
...
}

bool Proc(const std::shared_ptr<ScanData>& scan_msg) override {
// get a pointcloud object from objects pool
auto point_cloud_out = point_cloud_pool_->GetObject();
auto point_cloud_out = point_cloud_pool_->GetObject();
// clear befor using
point_cloud_out->clear();
point_cloud_out->clear();
// parse scan data and generate pointcloud
parser_->parse(scan_msg, point_cloud_out);
// write pointcloud to a specific channel
writer_->write(point_cloud);
}

private:
std::shared_ptr<Writer<PointCloud>> writer_;
std::unique_ptr<Parser> parser_ = nullptr;
std::shared_ptr<CCObjectPool<PointCloud>> point_cloud_pool_ = nullptr;

std::shared_ptr<CCObjectPool<PointCloud>> point_cloud_pool_ = nullptr;
int pool_size_ = 8;
};

CYBER_REGISTER_COMPONENT(ParserComponent)
```
Expand All @@ -137,7 +137,7 @@ Motion compensation is optional depends on lidar hardware design. E.g. if the th
#### 6. Configure the dag file
After done with each component, you just need to configure the DAG config file to add each component into the data processing pipeline. E.g. lidar_driver.dag:
```python
# Define all coms in DAG streaming.
module_config {
Expand All @@ -150,7 +150,7 @@ module_config {
}
}
}
module_config {
module_library : "/apollo/bazel-bin/modules/drivers/xxx/parser/libxxx_parser_component.so"
components {
Expand All @@ -162,7 +162,7 @@ module_config {
}
}
}
module_config {
module_library : "/apollo/bazel-bin/modules/drivers/xxx/compensator/libxxx_compensator_component.so"
components {
Expand Down
44 changes: 22 additions & 22 deletions docs/howto/how_to_add_a_new_lidar_driver_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Lidar是一种常用的环境感知传感器,利用脉冲激光来照射目标
cyber框架下系统中每一个功能单元都可以抽象为一个component,通过channel相互间进行通信,然后根据dag(有向无环图)配置文件,构建成相应的pipeline,实现数据的流式处理。

#### 2. 消息定义

apollo已经预定义了点云的消息格式,所以只需要为新lidar定义一个存储原始扫描数据的proto消息,用于数据的存档和离线开发调试,相比于点云数据,存档原始数据可以大量节省存储空间。一个新的扫描数据消息可以类似如下定义:

```c++
Expand All @@ -32,14 +32,14 @@ apollo已经预定义了点云的消息格式,所以只需要为新lidar定义
repeated bytes raw_data = 5; // raw scan data
}
```
在velodyne驱动中,其扫描数据消息定义为[VelodyneScan](https://github.com/ApolloAuto/apollo/blob/master/modules/drivers/velodyne/proto/velodyne.proto#L29).
在velodyne驱动中,其扫描数据消息定义为[VelodyneScan](../../modules/drivers/velodyne/proto/velodyne.proto#L29).

#### 3. 读取原始数据

lidar每秒会产生大量数据,一般通过UDP协议来进行数据的高效传输。编写一个DriverComponent类,继承于无模版参数Component类;在Init函数中启动一个异步poll线程,不断从相应的端口读取lidar数据;然后根据需求如将一段时间内的数据打包为一帧ScanData,如扫描一圈为一帧;最后通过writer将ScanData写至相应的channel发送出去。

```c++
// Inherit component with no template parameters,
// Inherit component with no template parameters,
// do not receive message from any channel
class DriverComponent : public Component<> {
public:
Expand All @@ -49,8 +49,8 @@ class DriverComponent : public Component<> {
this->Poll();
}));
}
private:

private:
void Poll() {
while (apollo::cyber::Ok()) {
// poll data from port xxx
Expand All @@ -61,18 +61,18 @@ class DriverComponent : public Component<> {
writer_.write(scan);
}
}

std::shared_ptr<std::thread> poll_thread_;
std::shared_ptr<apollo::cyber::Writer<ScanData>> writer_;
};

CYBER_REGISTER_COMPONENT(DriverComponent)
```
#### 4. 解析扫描数据,生成点云。
编写一个Parser类,输入为一帧ScanData,根据lidar自己的数据协议,解析出每一个点的时间戳,x/y/z三维坐标,以及反射强度,并组合成一帧点云。每个点都位于以lidar为原点的FLU(Front: x, Left: y, Up: z)坐标系下。
```c++
message PointXYZIT {
optional float x = 1 [default = nan];
Expand All @@ -82,7 +82,7 @@ message PointXYZIT {
optional uint64 timestamp = 5 [default = 0];
}
```

然后定义一个ParserComponent,继承于ScanData实例的Component模板类。接收ScanData消息,生成点云消息,发送点云消息。

```c++
Expand All @@ -92,36 +92,36 @@ class ParserComponent : public Component<ScanData> {
bool Init() override {
...
}

bool Proc(const std::shared_ptr<ScanData>& scan_msg) override {
// get a pointcloud object from objects pool
auto point_cloud_out = point_cloud_pool_->GetObject();
auto point_cloud_out = point_cloud_pool_->GetObject();
// clear befor using
point_cloud_out->clear();
point_cloud_out->clear();
// parse scan data and generate pointcloud
parser_->parse(scan_msg, point_cloud_out);
// write pointcloud to a specific channel
writer_->write(point_cloud);
}

private:
std::shared_ptr<Writer<PointCloud>> writer_;
std::unique_ptr<Parser> parser_ = nullptr;
std::shared_ptr<CCObjectPool<PointCloud>> point_cloud_pool_ = nullptr;

std::shared_ptr<CCObjectPool<PointCloud>> point_cloud_pool_ = nullptr;
int pool_size_ = 8;
};

CYBER_REGISTER_COMPONENT(ParserComponent)
```
#### 5. 对点云进行运行补偿
运动补偿是一个通用的点云处理过程,可以直接复用velodyne driver中compensator模块的算法逻辑。
#### 6. 配置dag文件
将各个数据处理环节定义为component后,需要将各个component组成一个lidar数据处理pipeline,如下配置lidar_driver.dag:
```python
# Define all coms in DAG streaming.
module_config {
Expand All @@ -134,7 +134,7 @@ module_config {
}
}
}
module_config {
module_library : "/apollo/bazel-bin/modules/drivers/xxx/parser/libxxx_parser_component.so"
components {
Expand All @@ -146,7 +146,7 @@ module_config {
}
}
}
module_config {
module_library : "/apollo/bazel-bin/modules/drivers/xxx/compensator/libxxx_compensator_component.so"
components {
Expand Down
12 changes: 6 additions & 6 deletions docs/howto/how_to_add_an_external_dependency.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# How to Add a New External Dependency

The bazel files about third-party dependencies are all in the folder
[third_party](https://github.com/ApolloAuto/apollo/blob/master/third_party)
[third_party](../../third_party)
which has a structure as following.

```shell
Expand Down Expand Up @@ -68,7 +68,7 @@ def repo():

It's pretty common to do so. But it needs very solid knowledge with bazel.

[workspace.bzl](https://github.com/ApolloAuto/apollo/blob/master/third_party/yaml_cpp/workspace.bzl):
[workspace.bzl](../../third_party/yaml_cpp/workspace.bzl):

```python
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Expand All @@ -88,7 +88,7 @@ def repo():
)
```

[yaml.BUILD](https://github.com/ApolloAuto/apollo/blob/master/third_party/yaml_cpp/yaml.BUILD):
[yaml.BUILD](../../third_party/yaml_cpp/yaml.BUILD):

```python
load("@rules_cc//cc:defs.bzl", "cc_library")
Expand Down Expand Up @@ -123,7 +123,7 @@ For example,

- [Poco](https://github.com/pocoproject/poco)

[workspace.bzl](https://github.com/ApolloAuto/apollo/blob/master/third_party/poco/workspace.bzl):
[workspace.bzl](../../third_party/poco/workspace.bzl):

```python
def clean_dep(dep):
Expand All @@ -137,7 +137,7 @@ def repo():
)
```

[poco.BUILD](https://github.com/ApolloAuto/apollo/blob/master/third_party/poco/poco.BUILD):
[poco.BUILD](../../third_party/poco/poco.BUILD):

```python
load("@rules_cc//cc:defs.bzl", "cc_library")
Expand All @@ -164,7 +164,7 @@ as they are in the system path.

For all of the above types of external dependencies, we also need to add them
into
[tools/workspace.bzl](https://github.com/ApolloAuto/apollo/blob/master/tools/workspace.bzl)
[tools/workspace.bzl](../../tools/workspace.bzl)

## References

Expand Down
4 changes: 2 additions & 2 deletions docs/howto/how_to_build_and_run_python_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ py_test(
```

Above is a BUILD file template, you can also use the
[BUILD](https://github.com/ApolloAuto/apollo/blob/master/cyber/python/BUILD) and
[BUILD](https://github.com/ApolloAuto/apollo/blob/master/cyber/python/examples/BUILD)
[BUILD](../../cyber/python/BUILD) and
[BUILD](../../cyber/python/cyber_py3/examples/BUILD)
file as examples.

## Build, Test and Run commands
Expand Down
2 changes: 1 addition & 1 deletion docs/howto/how_to_build_your_own_kernel.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ cd apollo-kernel
2. Add the ESD CAN driver source code according to [ESDCAN-README.md](https://github.com/ApolloAuto/apollo-kernel/blob/master/linux/ESDCAN-README.md).
3. Build the kernel with the following command:
```bash build.sh```
4. Install the kernel the same way as using a pre-built [Apollo Kernel](https://github.com/ApolloAuto/apollo/blob/master/docs/howto/how_to_install_apollo_kernel.md).
4. Install the kernel the same way as using a pre-built [Apollo Kernel](how_to_install_apollo_kernel.md).
2 changes: 1 addition & 1 deletion docs/howto/how_to_debug_dreamview_start_problem.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ in_dev_docker:/apollo$ ./apollo.sh build_no_perception dbg
```
2. Compile pcl and copy the pcl library files to `/usr/local/lib`:

See [/apollo/WORKSPACE.in](https://github.com/ApolloAuto/apollo/blob/master/WORKSPACE.in) to identify your pcl library version:
See [/apollo/WORKSPACE.in](../../WORKSPACE.in) to identify your pcl library version:
- Prior to Apollo 5.0 (inclusive): pcl-1.7
- After Apollo 5.0: pcl-1.9

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Prerequisites
- Download source code of Apollo from [GitHub](https://github.com/ApolloAuto/apollo)
- Follow the tutorial to set up [docker environment](https://github.com/ApolloAuto/apollo/blob/master/docs/howto/how_to_build_and_release.md).
- Follow the tutorial to set up [docker environment](../quickstart/apollo_software_installation_guide.md).
- ~~Download localization data from the [Multi-Sensor Fusion Localization Data](http://data.apollo.auto/help?name=sensor%20data&data_key=multisensor&data_type=1&locale=en-us&lang=en)(US only).~~
- Download localization dataset: please contact Yao Zhou, [email protected], to request the dataset. Requests need contain the following: (1) Email address and affiliation (business or school); (2) Application purpose.

Expand Down Expand Up @@ -34,4 +34,4 @@ After the script is finished, you can find the produced localization map named *

The scripts also stores the visualization of each generated map node in the map's subfolder named `image`. The visualization of a map node filled with LiDAR data looks like this:

![1](images/msf_localization/map_node_image.png)
![1](images/msf_localization/map_node_image.png)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## 1. 事先准备
-[GitHub网站](https://github.com/ApolloAuto/apollo)下载Apollo源代码
- 按照[教程](https://github.com/ApolloAuto/apollo/blob/master/README.md)设置Docker环境
- 按照[教程](../quickstart/apollo_software_installation_guide.md)设置Docker环境
- ~~[Apollo数据平台](http://data.apollo.auto/?name=sensor%20data&data_key=multisensor&data_type=1&locale=en-us&lang=en)的“多传感器融合定位数据”栏目下载多传感器融合定位demo数据包(仅限美国地区)。~~
- 下载数据集: 请发邮件至*[email protected]*来申请数据。邮件中需要包含以下内容:(1) 你所在的机构名称和邮件地址; (2)数据集使用目的。

Expand Down
2 changes: 1 addition & 1 deletion docs/howto/how_to_launch_and_run_apollo.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ different due to frontend code changes.)
### Congrats!

You have successfully built Apollo! Now you can revisit
[Apollo Readme](https://github.com/ApolloAuto/apollo/blob/master/README.md) for
[Apollo Readme](../../README.md) for
additional guidelines on the neccessary hardware setup.
Loading

0 comments on commit 78fd3e7

Please sign in to comment.