# How to Automate Navigation?

**URL:** <https://forum.hello-robot.com/t/how-to-automate-navigation/1091>\
**Category:** Ask\
**Created:** [August 23, 2024, 12:29pm UTC](https://forum.hello-robot.com/t/how-to-automate-navigation/1091 "2024-08-23T12:29:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yash](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/yash/32/868_2.png) [@Yash](https://forum.hello-robot.com/u/Yash)\
**Post date:** [August 23, 2024, 12:29pm UTC](https://forum.hello-robot.com/t/how-to-automate-navigation/1091/1 "2024-08-23T12:29:01Z")

</div>

Hi,

I am using Stretch 3 for a project. The aim is to collect image data through a DSLR that will be mounted on stretch.

Can i automate the navigation using the RTABMAP?

How do i do that?

The first stage would be manually making the robot go around the environment and map the room. Once i get the map, how can i make the robot navigate in there autonomously through a python script?

I would also be needing the robot to stop at particular intervals and capture images. Image capture code would be different. How do i automate the navigate and automate the image capture?

---

<div class="post-metadata">

**Author:** ![bshah](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/bshah/32/55_2.png) [@bshah](https://forum.hello-robot.com/u/bshah)\
**Post date:** [September 3, 2024, 4:59pm UTC](https://forum.hello-robot.com/t/how-to-automate-navigation/1091/2 "2024-09-03T16:59:55Z")

</div>

Hi @Yash, good question. I’d recommend starting with Nav2, the 2D version of RTABMAP. We have a tutorial that covers mapping a room and getting the robot to navigate autonomously within it. Link: [Demo 1 - Mapping & Navigation - Stretch Docs](https://docs.hello-robot.com/0.3/getting_started/demos_mapping_and_navigation/#nav2-overview)

---

<div class="post-metadata">

**Author:** ![Yash](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/yash/32/868_2.png) [@Yash](https://forum.hello-robot.com/u/Yash)\
**Post date:** [September 3, 2024, 5:06pm UTC](https://forum.hello-robot.com/t/how-to-automate-navigation/1091/3 "2024-09-03T17:06:49Z")

</div>

Thank you for the reply.

I have tried mapping a room using the Nav2. I did get some results.  
However, when i tried to run the Nav2 after homing, it did not map. It was showing that map node was not being published.

I then freed the robot from the processes and ran the code again, this time, it was working and the room was being mapped.

However, the after freeing the processes, the xbox controller too got freed. When i tried running stretch\_xbox\_controller\_teleop.py in other terminal while the Nav2 was running, it was showing an error that i need to free the process and try again.

I am not sure what i am missing here.

---

<div class="post-metadata">

**Author:** ![bshah](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/bshah/32/55_2.png) [@bshah](https://forum.hello-robot.com/u/bshah)\
**Post date:** [September 3, 2024, 7:08pm UTC](https://forum.hello-robot.com/t/how-to-automate-navigation/1091/4 "2024-09-03T19:08:09Z")

</div>

The map gets saved to `~/stretch_user/maps`. When you launch navigation.launch.py, you’ll need to tell Nav2 where to find the map. It’s a ROS2 argument: `map:=${HELLO_FLEET_PATH}/maps/nav2_demo_map.yaml`

You shouldn’t need free the robot process if you’ve [turned off the startup application](https://docs.hello-robot.com/0.3/getting_started/stretch_hardware_overview/#turning-off-gamepad-teleoperation).
