Skip to content

Commit 2983559

Browse files
committed
open source commit
1 parent 6411880 commit 2983559

File tree

872 files changed

+96549
-20
lines changed

Some content is hidden

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

872 files changed

+96549
-20
lines changed

Dockerfile

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
FROM osrf/ros:melodic-desktop-full
2+
3+
ARG user_home=/root
4+
ARG ck_dir=$user_home/catkin_ws
5+
ARG ck_src_dir=$ck_dir/src
6+
7+
COPY ros_entrypoint.sh /
8+
9+
RUN true \
10+
&& echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc \
11+
&& echo "source $ck_dir/devel_isolated/setup.bash" >> ~/.bashrc \
12+
&& mkdir -p $ck_dir
13+
14+
# install cartographer according to the page(https://google-cartographer-ros.readthedocs.io/en/latest/compilation.html)
15+
RUN apt-get update \
16+
&& apt-get install -y ninja-build stow vim ros-melodic-map-server
17+
18+
19+
WORKDIR $ck_dir
20+
#-----
21+
#RUN wstool init src \
22+
# && wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall \
23+
# && wstool update -t src
24+
#-----
25+
# Instead of directly cloning using modified vecrsion
26+
RUN apt-get update && \
27+
apt-get upgrade -y && \
28+
apt-get install -y git
29+
30+
ADD cartographer_git $ck_dir
31+
#-----
32+
33+
RUN sudo rosdep fix-permissions \
34+
&& rosdep update \
35+
&& rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
36+
RUN ./src/cartographer/scripts/install_abseil.sh \
37+
&& . /opt/ros/melodic/setup.sh \
38+
&& catkin_make_isolated --install --use-ninja
39+
40+
ADD cartographer_ros $ck_dir/src/cartographer_ros/cartographer_ros
41+
42+
# Prepare ENV and start running
43+
WORKDIR $ck_dir
44+
ENV CATKIN_WS $ck_dir
45+
ENV NVIDIA_VISIBLE_DEVICES \
46+
${NVIDIA_VISIBLE_DEVICES:-all}
47+
ENV NVIDIA_DRIVER_CAPABILITIES \
48+
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
49+
50+
# add package gmcl
51+
52+
RUN cd src \
53+
&& git clone https://github.com/adler-1994/gmcl.git \
54+
&& git clone --branch melodic-devel https://github.com/ros-planning/navigation.git
55+
56+
ADD gmcl $ck_dir/src/gmcl
57+
ADD amcl $ck_dir/src/navigation/amcl
58+
RUN . /opt/ros/melodic/setup.sh \
59+
&& apt-get update && apt-get install -y ros-melodic-costmap-2d \
60+
&& mv src/navigation/amcl src \
61+
&& rm -rf src/navigation \
62+
&& catkin_make_isolated --install --use-ninja
63+
64+
RUN apt-get install python-pip -y && pip install evo --upgrade --no-binary evo
65+
66+
# Add package ogm2pgbm
67+
RUN apt-get update && apt-get install -y python-tk ros-melodic-slam-toolbox bc && pip install scikit-image
68+
ADD ogm2pgbm $ck_dir/src/ogm2pgbm
69+
ADD ogm2pgbm/demobag /root/.ros/
70+
RUN . /opt/ros/melodic/setup.sh && catkin_make_isolated --install --use-ninja --pkg ogm2pgbm
71+
72+
# Add package slam_toolbox
73+
ADD slam_toolbox /opt/ros/melodic/share/slam_toolbox/
74+
ADD slam_toolbox/basemap /root/.ros/
75+
COPY slam_toolbox/preprocessing/bag.py /opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py
76+
77+
# Add package evo and pdflatex engine
78+
RUN apt-get update && apt-get install -y texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra
79+
#ADD evo /usr/local/lib/python2.7/dist-packages/evo # not available in repoo
80+
RUN apt-get install -y libnotify-bin dvipng && pip install ruamel.yaml==0.15.1 \
81+
&& git clone https://github.com/uzh-rpg/rpg_trajectory_evaluation.git ~/catkin_ws/src/rpg_trajectory_evaluation \
82+
&& git clone https://github.com/catkin/catkin_simple.git ~/catkin_ws/src/catkin_simple
83+
84+
# Add package gmcl_carto and post processing scripts
85+
ADD gmcl_carto $ck_dir/src/gmcl_carto
86+
#ADD post_processing $ck_dir/src/post_processing # not available in repo
87+
88+
RUN chmod -R 777 ~/catkin_ws/src/ogm2pgbm/scripts
89+
RUN chmod -R 777 ~/catkin_ws/install_isolated/share/ogm2pgbm/scripts
90+
91+
RUN /bin/bash -c 'source /opt/ros/melodic/setup.bash'
92+
93+
CMD ["/bin/bash" "-c" "/bin/bash"]

README.md

+52-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Robust BIM-based 2D-LiDAR Localization for Lifelong Indoor Navigation in Changing and Dynamic Environments
1+
# TODO
2+
- [ ] Add video tutorial.
23

3-
Code will be available after publication ~Oct 2022.
4+
# OGM2PGBM: Occupancy Grid Map to Pose Graph-based Map
45

56
Table of Contents
67
=================
@@ -14,44 +15,55 @@ Table of Contents
1415
* [Note](#note-1)
1516
* [GMCL_CARTO](#gmcl_carto)
1617

17-
1818
# Intro
19-
This repo contains the packages `amcl`, `gmcl`, `cartographer` and `slamtoolbox`, so that they can be used and compared with a bagfile located in the mounted directory `~/workspace` easily.
2019

21-
Apart from the open source packages, it includes the following self-developed applications and scripts:
20+
This repo contains the following application:
21+
22+
- `OGM2PGBM`: generate pose graph-based maps on 2D occupancy grid maps (which can be created from an TLS Point cloud or a BIM/CAD model.
23+
This pose graph-based maps can be used for accurate localization in changing and dynamic environments as demostrated in our [paper.]{https://publications.cms.bgu.tum.de/2022_ECPPM_Vega.pdf}
24+
25+
The following figure shows an overview of the proposed open source method.
26+
![MethodSummary](./docs/MethodSummary.png)
2227

23-
- `OGM2PGBM`: generate sensor data based on a 2D BIM map and publish them to respective topics directly (pgm->bag->pbstream)
2428
- `GMCL_CARTO`: conbine the fast global localization feature of GMCL with the more accurate pose tracking performance of Cartographer
2529

30+
Additionally, it includes the packages `amcl`, `gmcl`, `cartographer` and `slam_toolbox`, so that they can be used and compared with a bagfile that should be located in the mounted directory `~/workspace` easily.
31+
2632

2733
# OGM2PGBM
2834

2935
## Principle
3036

3137
The workflow of OGM2PGBM is as follows, see the function `new_map_callback(self, grid_map)` for details:
3238

33-
1. **subsribe** map from the map topic
34-
2. **skeletonize** the map and get its voronoi waypoint (see `self.skeletonize()`)
35-
3. perform a **coverage path planning** on it (see `self.CPP()`)
36-
- extract the farest endpoint pair first as the start and goal point
37-
- then **dilate** it with a 2x2 kernel to bold the centerline
38-
- do CPP wavefront algorithm and get the sorted waypoint
39-
4. do a raytracer algorithm on the waypoint one by one, and publish the `/laserscan` topic (see `self.raytracer()`)
39+
1. **Subscribe** map from the map topic
40+
2. **Skeletonize** the map and get its voronoi waypoint (see `self.skeletonize()`)
41+
3. Perform a **coverage path planning** on it (see `self.CPP()`)
42+
- Extract the farest endpoint pair first as the start and goal point
43+
- Then **dilate** it with a 2x2 kernel to bold the centerline
44+
- Do CPP wavefront algorithm and get the sorted waypoint
45+
4. Do a raytracing on the waypoints one by one, and publish the `/laserscan` topic (see `self.raytracer()`)
4046

4147
It produces `/tf`, `/clock`, `/odom`, `/scan` topics with frame `robot_map`, `robot_odom` and `robot_base_link`.
4248

43-
As we need to publish `/tf`, we use `python2.7` in this script.
49+
Since `/tf` is needed, `python2.7` is used in this script.
4450

4551
## Usage
4652
### Args
47-
This package is now a standard ros package and can be launched with roslaunch command.
53+
This package is a standard ros package and can be launched with roslaunch command.
4854

4955
args:
5056
- `map_file`: default value is `/root/workspace/map/OGM_empty.pgm.yaml`
5157
- `record`: default value is `false`, the recorded bag can be found at `/root/.ros/ogm2pgbm_sensordata.bag`
5258

5359
### Step by step
54-
With the launch file, we only need three steps to generate our base pbstream
60+
0. First clone the repository.
61+
62+
```shell
63+
git clone https://github.com/MigVega/Ogm2Pgbm.git
64+
cd Ogm2Pgbm
65+
```
66+
With the launch file, we only need three steps to generate the base pbstream/posegraph based-map.
5567
1. run into the docker
5668
```shell
5769
bash autorun.sh
@@ -62,11 +74,13 @@ roslaunch ogm2pgbm ogm2pgbm.launch map_file:=/root/workspace/map/OGM_empty.pgm.y
6274
```
6375
The target bag file will be stored under `/root/.ros/ogm2pgbm_sensordata.bag`. By default, the demo bag will also be copied into this place. So you can also skip the second step if you want.
6476

65-
3. After generating bagfiles, use cartographer to generate pbstream (offline mode, which will generate pbstream quite fast)
77+
3. After generating bagfiles, use Cartographer to generate pbstream or SLAM toolbox to generate posegraph maps.
78+
With the following command **Cartographer** will run in offline mode, which will generate pbstream quite fast, but without any visual output in rviz.
79+
6680
```
6781
roslaunch cartographer_ros ogm2pgbm_my_robot.launch bag_filename:=/root/.ros/ogm2pgbm_sensordata.bag
6882
```
69-
You can also launch slam_toolbox. (There will be some error report in the terminal, just ignore them and wait for some seconds.)
83+
You can also launch **Slam_toolbox**. (There will be some error report in the terminal, just ignore them and wait for some seconds.)
7084
```shell
7185
roslaunch slam_toolbox ogm2pgbm.launch bag_filename:=/root/.ros/ogm2pgbm_sensordata.bag
7286
```
@@ -84,12 +98,30 @@ For slam_toolbox, you also need to click on the serialization button on the rviz
8498
```
8599
2. All the node will be closed when the rviz is closed, including the rosbag node
86100
3. The parameters of cartographer when using OGM2PGBM scripts to generate pbstream are as follows (see `cartographer_ros/configuration_files/ogm2pgbm_my_robot.lua`)
87-
- `use_pose_extrapolator` and `use_odometry` enabled(The reason is that, we do not have accurate timestamp and speed/imu data, so we'd better provide an accurate odom to do pose extrapolation.)
88101
- remap `/scan` or `/odom` in launch file if needed
89102

103+
104+
# Citation
105+
```
106+
@inproceedings{ vega:2022:2DLidarLocalization,
107+
author = {Vega, M. and Braun, A. and Borrmann, A.},
108+
title = {Occupancy Grid Map to Pose Graph-based Map: Robust BIM-based 2D- LiDAR Localization for Lifelong Indoor Navigation in Changing and Dynamic Environments},
109+
booktitle = {Proc. of European Conference on Product and Process Modeling 2022},
110+
year = {2022},
111+
month = {Sep},
112+
url = {https://publications.cms.bgu.tum.de/2022_ECPPM_Vega.pdf},
113+
}
114+
```
90115
# GMCL_CARTO
91-
This project try to combines the pros of the two algorithms.
116+
This project combines the pros of the two algorithms, using the fast global localization feature of GMCL and the accurate pose tracking performance of Cartographer.
92117

93118
- First, change the bagname in the line 11 of the file `~/catkin_ws/src/gmcl_carto/gmcl_carto.py`,
94119
- Then, make sure the bagfile is located in the directory `/root/workspace`
95120
- At last, run the script directly `python ~/catkin_ws/src/gmcl_carto/gmcl_carto.py`
121+
122+
# Reference Projects
123+
- [AMCL]{http://wiki.ros.org/amcl}
124+
- [GMCL]{http://wiki.ros.org/gmcl}
125+
- [SLAM_Toolbox]{https://github.com/SteveMacenski/slam_toolbox}
126+
- [Cartographer]{https://github.com/cartographer-project/cartographer}
127+

amcl/examples/amcl.launch

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0"?>
2+
<launch>
3+
<param name="/use_sim_time" value="false" />
4+
<arg name="prefix" default="robot_"/>
5+
6+
<arg name="x_init_pose" default="0"/>
7+
<arg name="y_init_pose" default="0"/>
8+
<arg name="z_init_pose" default="0"/>
9+
<arg name="scan_topic" default="/robot/front_laser/scan"/>
10+
<arg name="map_topic" default="map"/>
11+
<arg name="global_frame" default="$(arg prefix)map"/>
12+
<arg name="odom_frame" default="$(arg prefix)odom"/>
13+
<arg name="base_frame" default="$(arg prefix)base_footprint"/>
14+
<arg name="odom_model_type" default="omni"/> <!-- omni -->
15+
16+
<arg name="map_file"/>
17+
<node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" >
18+
<param name="frame_id" value="robot_map" />
19+
</node>
20+
21+
<node name="rviz" pkg="rviz" type="rviz" required="true"
22+
args="-d $(find amcl)/examples/amcl.rviz" />
23+
24+
<node pkg="amcl" type="amcl" name="amcl" output="screen">
25+
<remap from="scan" to="$(arg scan_topic)"/>
26+
<remap from="map" to="$(arg map_topic)"/>
27+
28+
<rosparam command="load" file="$(find amcl)/examples/amcl.yaml" subst_value="true"/>
29+
30+
</node>
31+
32+
<node name="playbag" pkg="rosbag" type="play"
33+
args="$(arg bag_filename)" />
34+
35+
<node pkg="rosservice" type="rosservice" name="global_loc" args="call --wait /global_localization" launch-prefix="bash -c 'sleep 1; $0 $@' " />
36+
37+
</launch>

0 commit comments

Comments
 (0)