# Enable 2D Lidar SLAM with `cartographer_node` and `cartographer_occupancy_grid_node` The 2D lidar SLAM sample application builds on Cartographer, which is capable of completing indoor map construction and localization based on 2D lidar sensors. It's suitable for indoor navigation of robots. ## Pipeline flow for 2D lidar SLAM The figure shows the pipeline flow for 2D lidar SLAM. **2D lidar SLAM pipeline** ## ROS nodes used in the 2D lidar SLAM pipeline ROS nodes used in the 2D lidar SLAM pipeline | Node name | Function | | --- | --- | | `cartographer_node` | Receives `/scan` and `/odom` topics, runs mapping, localization, and saves the map or queries the relocation status. The node is based on the ROS service `qrb_slam_command`. | | `cartographer_occupancy_grid_node` | Receives map-related topics sent by the `cartographer_node` and publishes a ROS standard map (`/map`). | ## ROS topics used in the 2D lidar SLAM pipeline ROS topics used in the 2D lidar SLAM pipeline | ROS Topic | Type | Description | | --- | --- | --- | | `/scan` | `sensor_msgs.msg.LaserScan` | Receives lidar scan data. | | `/odom` | `nav_msgs.msg.Odometry2` | Receives odometry data. | | `/tracked_pose` | `geometry_msgs.msg.PoseStamped` | Publishes the current tracked robot pose. | | `/scan_matched_points2` | `sensor_msgs.msg.PointCloud2` | Publishes scan-matched point cloud for debugging and visualization. | | `/tf` | `tf2_msgs.msg.TFMessage` | Publishes coordinate transform information for multi-frame conversions. | | `/submap_list` | `cartographer_ros_msgs.msg.SubmapList` | Publishes submap list for map stitching and visualization. | | `/map` | `nav_msgs.msg.OccupancyGrid` | Publishes the occupancy grid map. | ## ROS services used in the 2D lidar SLAM pipeline ROS services used in the 2D lidar SLAM pipeline | ROS service | Type | Description | | --- | --- | --- | | `/qrb_slam_command` | `qrb_ros_slam_msgs.srv.SlamCommand` | Provides SLAM control services, such as start, stop, and save map. See [qrb_ros_slam_msgs](https://github.com/qualcomm-qrb-ros/qrb_ros_interfaces/tree/main/qrb_ros_slam_msgs) on GitHub. | ## Prerequisites You have set up the device, installed ROS2 Jazzy and QIR SDK on the device according to [Install the QIR SDK](https://docs.qualcomm.com/doc/80-90441-2/topic/2-install-the-qir-sdk.html#install-qir-sdk). ## Run out-of-the-box 2D lidar SLAM **Steps** 1. Install the 2D Lidar SLAM packages. sudo apt install ros-jazzy-qcom-cartographer ros-jazzy-qrb-ros-slam-msgs ros-jazzy-qcom-cartographer-ros Copy to clipboard 2. Set up the robot base. - If you have a Qualcomm’s robot base, set it up. - If you are using a custom or third-party robot base, apply configurations appropriate to your own robot base. Ensure the robot base can publish odometry data of the type nav\_msgs.msg.Odometry2 on the topic /odom. 3. Set up the 2D Lidar according to Enable basic RPLIDAR handling with `rplidar-ros2`. source /opt/ros/jazzy/setup.bash export ROS_DOMAIN_ID=124 ros2 launch rplidar_ros rplidar_a3_launch.py Copy to clipboard 4. Run the 2D lidar SLAM. source /opt/ros/jazzy/setup.bash export ROS_DOMAIN_ID=124 ros2 launch cartographer_ros qrb_2d_lidar_slam.launch.py Copy to clipboard 5. Run the `qrb_slam_service_request` script. #Env set up source /opt/ros/jazzy/setup.bash export ROS_DOMAIN_ID=124 sh /opt/ros/jazzy/share/cartographer_ros/scripts/qrb_slam_service_request.sh Copy to clipboard Last Published: Sep 07, 2026 [Previous Topic Experience remote assistant in the simulator with simulation\_remote\_assistant](https://docs.qualcomm.com/bundle/publicresource/80-90441-2/topics/experience-remote-assistant-in-the-simulator-with-simulation_remote_assistant.md) [Next Topic Test follow-path with the qrb\_ros\_follow\_path service](https://docs.qualcomm.com/bundle/publicresource/80-90441-2/topics/test-follow-path-with-the-qrb_ros_follow_path-service.md)