Skip to content

Cartographer

GitHub code build GitHub last commit

DockerHub image Docker image arch Docker image version Docker image size

🐳 Start Container

Make sure your system meets the system requirements and have followed the setup instructions before using this workspace.

Run the following commands in a Ubuntu desktop environment. If you are using a remote server, make sure you're using a terminal within a remote desktop session (e.g., VNC) instead of SSH (i.e., don't use ssh -X or ssh -Y).

cd ~/ros2-essentials/cartographer_ws/docker
docker compose build
xhost +local:docker
docker compose up -d
# The initial build will take a while, please wait patiently.

If your user's UID is 1000, you may replace the docker compose build command with docker compose pull.

The commands in the following sections assume that you are inside the Docker container:

# in a new terminal
docker exec -it ros2-cartographer-ws bash

If the initial build somehow failed, run:

rm -r build install
colcon build --symlink-install

Once you have finished testing, you can stop and remove the container with:

docker compose down

Simple Test With Turtlebot3

  • Attach to the container

    docker attach ros2-cartographer-ws
    cd /home/ros2-essentials/cartographer_ws
    
    - Open the turtlebot simulation in tmux

    export TURTLEBOT3_MODEL=burger
    ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
    
    - Run the SLAM node in new window of tmux

    ros2 launch turtlebot3_cartographer cartographer.launch.py is_sim:=True
    
    - Run the control tool in new window of tmux

    rqt_robot_steering
    

Building Packages

cd /home/ros2-essentials/cartographer_ws
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro humble -y
colcon build

After the build process, make sure to source the install/setup.bash file.
Otherwise, ROS2 will not locate the executable files. You can open a new terminal to accomplish this.

Multi LiDAR - Single Robot SLAM test

Simulation

  • multi_lidar_desp package: Description of a robot with multiple LiDARs.
  • multi_lidar_gazebo package: Gazebo simulation of the robot with robot state publisher.

    ros2 launch multi_lidar_gazebo multi_lidar_gazebo.launch.py
    

Run the SLAM node

  • Run the cartographer SLAM node in new window of tmux
    ros2 launch cartographer_demo cartographer_demo.launch.py is_sim:=True
    
  • Run the control tool in new window of tmux
    rqt_robot_steering
    

References