Static Mapping is a full lidar slam system using lidar (required) and gps (optional), imu (optional), odom (optional). More detail about the inner process refer to flow figure.
More evalution on kitti datasets : kitti_evaluation
For now, It is recommended to build this repo in your host device but not in docker, due to that the docker image is not enough tested.
Using host device
Requirements
Ros should be installed in the first place, You can refer to http://wiki.ros.org/kinetic/Installation/Ubuntu for more information for installing ROS kinetic or higher version. This repo has been tested in kinetic and melodic.
## basic depencencies
sudo apt -y install cmake \
libboost-dev \
libeigen3-dev \
libpng-dev \
libgoogle-glog-dev \
libatlas-base-dev \
libsuitesparse-dev \
imagemagick \
libtbb-dev
## install pcl
## tested in pcl-1.7 (ubuntu16.04) and pcl-1.8 (ubuntu18.04)
sudo apt -y install libpcl-dev
cd your_own_workspace
## like /home/user/3rd_parties
## or you can just go to "third_parties" in this repo
## GeoGraphic
./path_of_StaticMapping/setup/install_geographiclib.sh
## GTSAM(4.0 or higher is needed)
./path_of_StaticMapping/setup/install_gtsam.sh
## libnabo
./path_of_StaticMapping/setup/install_libnabo.sh
## libpointmatcher
./path_of_StaticMapping/setup/install_libpointmatcher.sh
mkdir build && cd build
cmake -DENABLE_TEST=ON ..
make -j8
make check # optional, only if you want to check the code with unit tests.
If yours host device is with UBUNTU 18.04, it is highly recommended to build and run this project in a docker because the docker is FROM ros:melodic-ros-core-bionic
. Otherwise, you can also build your envrionment directly on your device refering to Using host device section below.
ps: there is something wrong with ros message sent from ros-kinetic to ros-melodic, so, it your host deice is not with Ubuntu 18.04, you can not use this docker, and the docker for ros-kinetic will come soon.
## If your host device in with ubuntu 18.04, then the docker with tag `bionic` is prefered
docker pull edwardliuyc/static_mapping:bionic
## If your host device in with ubuntu 20.04, then the docker with tag `focal` is prefered
docker pull edwardliuyc/static_mapping:focal
In this part we use edwardliuyc/static_mapping:bionic
as an example, you can use edwardliuyc/static_mapping:focal
instead.
## get code
git clone https://github.com/EdwardLiuyc/StaticMapping.git
cd StaticMapping
## start the docker container
docker run -it --rm -v /mnt:/mnt -v pwd:/home/docker/src/StaticMapping edwardliuyc/static_mapping:bionic /bin/bash
## in the container
mkdir -p build && cd build
cmake ..
make -j8
perhaps you would meet some error like conflicting declaration ‘typedef struct LZ4_stream_t LZ4_stream_t’
, just refer to this tricky solution
There are very essential explanations in wiki page. Read them first. For Now, mapping with gps or odom would not be a good choice since that I have not run enough test on them.
./mapping_lidar_only.sh
before that, you should know what is in the script:
## usally, you can leave this config file just like this, it will work fine
CONFIG_PATH=./config/static_mapping_default.xml
## the follow 2 items must be set!!!
## the topic name of your pointcloud msg (ros)
POINT_CLOUD_TOPIC=/fused_point_cloud
## the frame id of your pointcloud msg (ros)
POINT_CLOUD_FRAME_ID=base_link
## the following items are optional
## if you do not have a imu or gps or odom
## just remove the line started with
## imu: -imu -imu_frame_id
## odom: -odom -odom_frame_id
## gps: -gps -gps_frame_id
## and If you got one of these topics
## you MUST provide the tf connection between the one to pointcloud frame
IMU_TOPIC=/imu/data
IMU_FRAME_ID=novatel_imu
ODOM_TOPIC=/navsat/odom
ODOM_FRAME_ID=novatel_odom
GPS_TOPIC=/navsat/fix
GPS_FRAME_ID=novatel_imu
./build/static_mapping_node \
-cfg ${CONFIG_PATH} \
-pc ${POINT_CLOUD_TOPIC} \
-pc_frame_id ${POINT_CLOUD_FRAME_ID} \
-imu ${IMU_TOPIC} \
-imu_frame_id ${IMU_FRAME_ID} \
-odom ${ODOM_TOPIC} \
-odom_frame_id ${ODOM_FRAME_ID} \
-gps ${GPS_TOPIC} \
-gps_frame_id ${GPS_FRAME_ID}
exit 0
play bag that includes pointcloud msgs or run the lidar driver
when finished, just press 'CTRL+C' to terminate the mapping process. NOTICE that the mapping process will not end right after you 'CTRL+C', it has many more calculations to do, so just wait.
Finally, you will get a static map like this:
part of it:
You can use doxygen Doxyfile
to generate your docs, they are in the doc
folder.
By me a cup of coffee if you like this project.