Skip to content

Commit cac6f32

Browse files
author
yanni.luo
committed
initial commit
0 parents  commit cac6f32

File tree

845 files changed

+96300
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

845 files changed

+96300
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build/
2+
devel/
3+
build_isolated/
4+
devel_isolated/
5+
install_isolated/

README.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# cartographer 超详细注释代码
2+
3+
## 1 开源项目简介
4+
本项目对cartographer进行了逐行的注释,代码是基于2021.04.20日在cartographer官方github上下载的master的代码
5+
6+
共做了如下工作
7+
- 在代码中进行了规范, 超详细的注释, 帮助大家更好的理解源码
8+
- 对cartographer中的关键概念进行了解释与说明
9+
- 对cartographer中使用的**c++11新标准**语法进行了标注与说明
10+
- 编写了编译, 保存地图相关的脚本
11+
- 对2d建图, 3d建图, 纯定位模式进行了launch与lua文件的的配置
12+
- 对3d的cartographer添加了实时显示三维点云地图与保存地图的功能
13+
- **配套了逐行讲解源码的视频课程**
14+
15+
## 2 推荐编译环境
16+
- ubuntu 16.04/18.04 版本
17+
- ROS Kinetic/Melodic 版本
18+
- vscode
19+
20+
vscode中推荐的插件有:
21+
- C/C++
22+
- C++ Intellisense
23+
- Doxygen Documentation Generator
24+
- Msg Language Support
25+
- XML Tools
26+
- Todo Tree: 注释的高亮显示
27+
28+
29+
## 3 运行相关命令
30+
31+
其中的bag文件可以在我的公众号: 从零开始搭SLAM 里找到,在底部菜单栏的数据集链接里
32+
33+
### 2d建图指令
34+
`roslaunch cartographer_ros lx_rs16_2d_outdoor.launch`
35+
36+
### 保存2d轨迹,并生成ros格式的地图
37+
`./finish_slam_2d.sh`
38+
39+
### 纯定位模式
40+
`roslaunch cartographer_ros lx_rs16_2d_outdoor_localization.launch`
41+
42+
### 3d建图指令
43+
`roslaunch cartographer_ros lx_rs16_3d.launch`
44+
45+
### 保存3d轨迹
46+
`./finish_slam_3d.sh`
47+
48+
### 使用asset生成ros格式的2d栅格地图
49+
`roslaunch cartographer_ros assets_writer_2d.launch`
50+
51+
### 使用asset生成3d点云地图
52+
`roslaunch cartographer_ros assets_writer_3d.launch`
53+
54+
### landmark使用示例
55+
`roslaunch cartographer_ros landmark_mir_100.launch`
56+
57+
58+
## 4 实时显示三维点云地图与保存地图的功能简述
59+
显示三维点云地图需要是在建3d轨迹的情况下才可以显示, 点云地图默认发布在 `/point_cloud_map` 话题中.
60+
61+
默认关闭了保存pcd格式点云的功能, 如需要这个功能, 需要将node.cc文件的第1029行的 `constexpr bool save_pcd = false;` 改成true.
62+
63+
编译之后在建图结束后通过调用 `/write_state` 服务, 会在生成pbstream文件的同时也对pcd文件进行保存, 保存目录与pbstream文件同一个文件夹.
64+
65+
个人水平有限, 如果改完的代码有问题请您联系我进行改正.
66+
67+
![pcd_map](src/cartographer/docs/pcd_map.png)
68+
69+
## 5 逐行讲解源码的视频课程简介
70+
71+
### 课程介绍
72+
Cartographer的代码庞大,逻辑复杂,包含大量的工程细节,对于初学者不太友好,学习理解代码十分困难,需要花费大量时间仍不得要领。
73+
74+
而企业对激光SLAM从业者的要求越来越高,只会调包调参的人找工作越来越难,只有深入理解激光SLAM原理与代码实现,才具有核心竞争力。
75+
76+
因此,计算机视觉life推出了源码解析课程《激光SLAM之Cartographer源码解析》,这是目前唯一一个逐行讲解Cartographer源码的课程!
77+
78+
### 课程大纲
79+
![大纲](src/cartographer/docs/outline.jpg)
80+
81+
如果图片刷不出来, 可以点击下方的链接去看更详细的介绍
82+
83+
[课程的更加详细的介绍请点这里](https://mp.weixin.qq.com/s?__biz=MzIxOTczOTM4NA==&mid=2247536585&idx=1&sn=58c6c3ec4e2fc1a8d88117be7564ae34&chksm=97d4aa5ea0a32348716c3234ce490eff86f37d1b6008280bbf22a30299729e1a43c7a3733946&mpshare=1&scene=1&srcid=01120cyJyNtBlZP9wC3tUoq5&sharer_sharetime=1641970495681&sharer_shareid=e0bf4e1cc54f09628a44697dfe50325e&exportkey=AWd55O3LN11%2Fsc56%2B2CRwCY%3D&acctmode=0&pass_ticket=uLujlwBtSAwv8dNpZkb4fWl9VRpVMyKGcuwTIOQOo5VUyboRc5Dav30xVPim0Esf&wx_header=0#rd)
84+
85+
86+
### 课程咨询
87+
如果对这个课程感兴趣的同学可以扫描下方的名片进行课程咨询, 加的时候备注下 carto课程咨询
88+
89+
![咨询](src/cartographer/docs/zixun.jpg)
90+
91+
92+
by lixiang

catkin_make.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
catkin_make_isolated --install --use-ninja
4+
5+
#catkin_make_isolated --install --use-ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=Yes
6+
7+
8+
source install_isolated/setup.bash

finish_slam_2d.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
source install_isolated/setup.bash
4+
5+
map_dir="${HOME}/carto_ws/map"
6+
map_name="2d-1"
7+
8+
# 检查文件夹是否存在, 如果不存在就创建文件夹
9+
if [ ! -d "$map_dir" ];then
10+
echo "文件夹不存在, 正在创建文件夹"
11+
mkdir -p $map_dir
12+
fi
13+
14+
15+
# finish slam
16+
rosservice call /finish_trajectory 0
17+
18+
# make pbstream
19+
rosservice call /write_state "{filename: '$map_dir/$map_name.pbstream'}"
20+
21+
# pbstream to map
22+
rosrun cartographer_ros cartographer_pbstream_to_ros_map \
23+
-pbstream_filename=$map_dir/$map_name.pbstream \
24+
-map_filestem=$map_dir/$map_name

finish_slam_3d.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
source install_isolated/setup.bash
4+
5+
map_dir="${HOME}/carto_ws/map"
6+
map_name="3d-1"
7+
8+
# 检查文件夹是否存在, 如果不存在就创建文件夹
9+
if [ ! -d "$map_dir" ];then
10+
echo "文件夹不存在, 正在创建文件夹"
11+
mkdir -p $map_dir
12+
fi
13+
14+
# finish slam
15+
rosservice call /finish_trajectory 0
16+
17+
# make pbstream
18+
rosservice call /write_state "{filename: '$map_dir/$map_name.pbstream'}"

rm_build.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
rm -rf build_isolated devel_isolated install_isolated
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
platforms:
3+
ubuntu1604:
4+
build_targets:
5+
- "..."
6+
test_targets:
7+
- "..."

src/cartographer/.bazelrc

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2018 The Cartographer Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Do an optimized build by default, or otherwise Cartographer cannot run
16+
# real-time and certain tests will timeout.
17+
build -c opt
18+
19+
# By default, an optimized C++ build with Bazel will build each library twice,
20+
# with and without -fPIC. --force_pic avoids the unnecessary actions and
21+
# reduces build time.
22+
build --force_pic
23+

src/cartographer/.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/Dockerfile*
2+
**/.dockerignore
3+
**/.git
4+
**/.travis.yml

src/cartographer/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
bazel-*

src/cartographer/.travis.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright 2016 The Cartographer Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
sudo: required
16+
services: docker
17+
18+
# Cache intermediate Docker layers. For a description of how this works, see:
19+
# https://giorgos.sealabs.net/docker-cache-on-travis-and-docker-112.html
20+
cache:
21+
directories:
22+
- /home/travis/docker/
23+
24+
env:
25+
- LSB_RELEASE=xenial DOCKER_CACHE_FILE=/home/travis/docker/xenial-cache.tar.gz CC=gcc CXX=g++
26+
- LSB_RELEASE=bionic DOCKER_CACHE_FILE=/home/travis/docker/bionic-cache.tar.gz CC=gcc CXX=g++
27+
- LSB_RELEASE=focal DOCKER_CACHE_FILE=/home/travis/docker/focal-cache.tar.gz CC=gcc CXX=g++
28+
- LSB_RELEASE=stretch DOCKER_CACHE_FILE=/home/travis/docker/stretch-cache.tar.gz CC=gcc CXX=g++
29+
- LSB_RELEASE=buster DOCKER_CACHE_FILE=/home/travis/docker/buster-cache.tar.gz CC=gcc CXX=g++
30+
31+
before_install: scripts/load_docker_cache.sh
32+
33+
install: true
34+
script:
35+
- docker build ${TRAVIS_BUILD_DIR} -t cartographer:${LSB_RELEASE} -f Dockerfile.${LSB_RELEASE}
36+
--build-arg cc=$CC --build-arg cxx=$CXX
37+
- scripts/save_docker_cache.sh

src/cartographer/AUTHORS

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This is the list of Cartographer authors for copyright purposes.
2+
#
3+
# This does not necessarily list everyone who has contributed code, since in
4+
# some cases, their employer may be the copyright holder. To see the full list
5+
# of contributors, see the revision history in source control.
6+
Google Inc.
7+
and other contributors

src/cartographer/BUILD.bazel

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2018 The Cartographer Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Cartographer is a system that provides real-time simultaneous localization
16+
# and mapping (SLAM) in 2D and 3D across multiple platforms and sensor
17+
# configurations.
18+
19+
licenses(["notice"]) # Apache 2.0
20+
21+
package(default_visibility = ["//visibility:public"])
22+
23+
exports_files(["LICENSE"])
24+
25+
filegroup(
26+
name = "configuration_files",
27+
srcs = glob([
28+
"configuration_files/*.lua",
29+
]),
30+
)

src/cartographer/CHANGELOG.rst

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2+
Changelog for package cartographer
3+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
5+
2.0.0 (2021-03-09)
6+
------------------
7+
https://github.com/cartographer-project/cartographer/compare/1.0.0...2.0.0
8+
9+
1.0.0 (2018-06-01)
10+
------------------
11+
https://github.com/googlecartographer/cartographer/compare/0.3.0...1.0.0
12+
13+
0.3.0 (2017-11-23)
14+
------------------
15+
https://github.com/googlecartographer/cartographer/compare/0.2.0...0.3.0
16+
17+
0.2.0 (2017-06-19)
18+
------------------
19+
https://github.com/googlecartographer/cartographer/compare/0.1.0...0.2.0
20+
21+
0.1.0 (2017-05-18)
22+
------------------
23+
* First unstable development release

0 commit comments

Comments
 (0)