Skip to content

Cartographer SLAM

AnaBatinovic edited this page Mar 19, 2021 · 6 revisions

Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.

Table Of Contents

Installation

sudo apt-get install -y  clang  git google-mock libboost-all-dev libcairo2-dev libcurl4-openssl-dev libeigen3-dev libgflags-dev libgoogle-glog-dev liblua5.2-dev libsuitesparse-dev libceres-dev 

Cartographer SLAM depents on following repositories: cartographer and cartographer_ros. Simply clone both packages into your ROS workspace and build them.

git clone https://github.com/larics/cartographer.git && cd cartographer/
git checkout erl 
git checkout 140965958c40afa5509fa0141768c3f170db9507 && cd ..
git clone https://github.com/larics/cartographer_ros.git && cd cartographer_ros/
git checkout erl 
git checkout ce416688011d7862351cd44b8ce8ff79f7fa1ef7 && cd ..
catkin build cartographer_rviz

Building cartographer_rviz ensures building cartographer_ros_msgs, cartographer, as well as carographer_ros.

Running 3D SLAM

We provide launch and config files in the uav_frontier_exploration_3d.

Before we run SLAM, we set appropriate frames in the .lua file: map_frame, tracking_frame, published_frame and odom_frame. We remapped imu, points2 and fix topics. You can check all these things in the cartographer.launch file in the uav_ros_general package, previously installed from uav_ros_simulation.

Visualization

By default the UAV_NAMESPACE is set to "red". In RViz, you can set /red/map/map as fixed frame and visualize /red/map as a Map display type that shows a nav_msgs/OccupancyGrid message. You can also visualize /red/base_link as Axes to check the robot position in the map.

The topic /red/submap_cloud generated by Cartographer is sensor_msgs/PointCloud2.

We provide file cartographer_and_frontier.rviz in the package uav_frontier_exploration_3d as an example.