> For the complete documentation index, see [llms.txt](https://kairosiann.gitbook.io/r1mini/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kairosiann.gitbook.io/r1mini/running-r1-mini/slam-melodic-1.md).

# SLAM \[Melodic]

## SLAM (Simultaneous Localization and Mapping)

#### Running SLAM

![YDLIDAR X4. Image courtesy of YDLIDAR.](/files/-MdX7ghOT-N_alHTrEtA)

To perform simultaneous localization and mapping (SLAM), run the below line in the terminal shell.

```
$ roslaunch omo_r1mini_slam omo_r1mini_slam.launch
```

Running the above command, your terminal should output data like the image below.

![](/files/-Mea_KeGGZUHxK5JNkbc)

To get see SLAM in action on rviz, run the below line in the terminal shell.

```
$ roslaunch omo_r1mini_slam omo_r1mini_slam_rviz.launch
```

![](/files/-MdYkgqZv6d3fdxi9i8J)

Running the above command, an rviz GUI like above should appear. In the center, you should be able to see your robot. The black outline indicates where the lidar detects obstacles, and the light grey indicates areas that the lidar is actively scanning.

#### Completing the map

As you can see above, the SLAM map is incomplete since the area is grey scanned area is not fully enclosed by thick black lines indicating the sensing of a wall.&#x20;

To complete the map, use teleop to move your robot around the scan space. Remember this can be done by running the below command in a new terminal shell.

```
$ roslaunch omo_r1mini_teleop omo_r1mini_teleop_key.launch
```

Next, use the A, W, S, and D key to complete the map using rviz as guidance.

Once your map is complete, run the below command to save the map.

```
$ rosrun map_server map_saver -f map
```

Then, kill all the terminals (including roscore) by pressing Control + C.

After that, run the below command to copy the map.pgm and map.yaml files to  omo\_r1mini\_navigation/maps.

```
$ sudo cp map.pgm map.yaml catkin_ws/src/omo_r1mini/omo_r1mini_navigation/map
```

####

## Video Demonstration

To see a video demonstration for this page, watch the attached video here: <https://www.youtube.com/watch?v=lOkVKbT4eWY>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kairosiann.gitbook.io/r1mini/running-r1-mini/slam-melodic-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
