# Enable 2D lidar SLAM in the simulator with `cartographer_ros`
`simulation_2d_lidar_slam` is a simulated sample application that demonstrates how to run 2D lidar SLAM on Qualcomm robotics platform within the simulator.
The [QRB ROS Simulation](https://github.com/qualcomm-qrb-ros/qrb_ros_simulation) package provides the simulation environment. It allows you to control the movement of QRB AMRs and get the scanning data of lidar through a ROS topic.
Note
For more information, see [simulation_2d_lidar_slam](https://github.com/qualcomm-qrb-ros/qrb_ros_samples/tree/main/robotics/simulation_2d_lidar_slam) on GitHub.

## Pipeline flow for `simulation_2d_lidar_slam`
## ROS nodes used in the `simulation_2d_lidar_slam` pipeline
| ROS node | Description |
| --- | --- |
| `cartographer_node` | This node receives `/scan` and `/odom` topics, executes 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` | This node receives map-related topics sent by the `cartographer_node` and publishes a ROS standard map (`/static_map`). |
| `qrb_ros_simulation` | `qrb ros simulation` is a ROS package that sets up the Qualcomm robotic simulation environment. For details, see [QRB ROS Simulation](https://github.com/qualcomm-qrb-ros/qrb_ros_simulation). |
## ROS topics used in the `simulation_2d_lidar_slam` pipeline
| ROS topic | Type | Published by |
| --- | --- | --- |
| `/tracked_pose` | `geometry_msgs.msg.PoseStamped` | `cartographer_node` |
| `/tf` | `tf2_msgs.msg.TFMessage` | `cartographer_node` |
| `/submap_list` | `cartographer_ros_msgs.msg.SubmapList` | `cartographer_node` |
| `/scan_matched_points2` | `sensor_msgs.msg.PointCloud2` | `cartographer_node` |
| `/map` | `nav_msgs.msg.OccupancyGrid` | `cartographer_occupancy_grid_node` |
## Prerequisites
You have completed the following settings in [Set up the environment for running sample applications](https://docs.qualcomm.com/doc/80-70030-265/topic/quick_start.html#setup-demo-qs) (Skip the settings of **Set up host docker**).
- Set up the device
- Set up the host computer
Note
Ensure that the board is connected to the simulation host using an Ethernet cable. Otherwise, the sample's performance may degrade due to data transmission issues.
### Set up the simulation environment
1. On your host computer, complete the following actions to build the Qualcomm robotic simulation environment according to the **README** of [QRB ROS Simulation](https://github.com/qualcomm-qrb-ros/qrb_ros_simulation). Ensure that the device and the host are in the same local network and can communicate with each other through ROS communication.
1. Set up development environment on Ubuntu24.04 host.
2. Build from source.
2. Run the QRB Robot Base AMR on the host.
# Set the ROS_DOMAIN_ID
export ROS_DOMAIN_ID=123
ros2 launch qrb_ros_sim_gazebo gazebo_robot_base.launch.py world_model:=ionic
Copy to clipboard
## Run out-of-the-box 2d lidar SLAM in the simulator
**Steps**
1. Run the 2D lidar SLAM in a new terminal.
source /usr/share/qirp-setup.sh
export ROS_DOMAIN_ID=123
mount -o remount rw, /usr
ros2 launch cartographer_ros qrb_2d_lidar_slam_gazebo_sim.launch.py
Copy to clipboard
2. Run the `qrb_slam_service_request` script in a new terminal.
ssh root@[IP address]
source /usr/share/qirp-setup.sh
export ROS_DOMAIN_ID=123
chmod 777 /usr/share/cartographer_ros/scripts/qrb_slam_service_request.sh
bash /usr/share/cartographer_ros/scripts/qrb_slam_service_request.sh
Copy to clipboard
3. Use the keyboard to send control commands, such as 0: start mapping.

Last Published: Jul 23, 2026
[Previous Topic
Experience remote assistant in the simulator with simulation\_remote\_assistant](https://docs.qualcomm.com/bundle/publicresource/80-70030-265/topics/simulation_remote_assistant.md) [Next Topic
Enable navigation in the simulator with navigation2](https://docs.qualcomm.com/bundle/publicresource/80-70030-265/topics/simulation_amr_navigation.md)