# How to launch the Nav2 stack

In this article, we will demonstrate how to launch the Nav2 with default setup. To launch the stack, we have the following prerequisites:

* a map: This map is used to construct the static layer of the cost map. We can build and save a map with slam\_toolbox package. Note that slam\_toolbox support different map format but nav2 uses the yaml file.
* a nav2 parameter file: This is the configuration file of the nav2 stack. It might be overwhelming to create a configuration file from scratch as it contains many parameters. Instead, we can use [this file](https://github.com/ros-planning/navigation2/blob/humble/nav2_bringup/params/nav2_params.yaml) in the navigation2 package as the blueprint.

| Param Name       | Default Value                                             | Description                                                                 |
| ---------------- | --------------------------------------------------------- | --------------------------------------------------------------------------- |
| namespace        | (empty)                                                   | Top-level namespace                                                         |
| use\_sim\_time   | false                                                     | Use simulation (Gazebo) clock if true                                       |
| params\_file     | os.path.join(bringup\_dir, 'params', 'nav2\_params.yaml') | Full path to the ROS2 parameters file to use for all launched nodes         |
| autostart        | true                                                      | Automatically startup the nav2 stack                                        |
| use\_composition | False                                                     | Use composed bringup if True                                                |
| container\_name  | nav2\_container                                           | The name of container that nodes will load in if use composition            |
| use\_respawn     | False                                                     | Whether to respawn if a node crashes. Applied when composition is disabled. |
| log\_level       | info                                                      | Log level                                                                   |

Let's edit the nav2 stack configuration (knowns as params file). Each section in the file corresponds to a component in the nav2 stack. The details of those parameters can be found in  the [Nav2 Configuration Guide](https://navigation.ros.org/configuration/index.html).

We will put some emphasis on the namespae.

The end goal is to have

* topic with proper namespace
* frame with proper namespace
* node with proper namespace
* service with proper namespace


---

# Agent Instructions: 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:

```
GET https://www.learnros2.com/ros/how-to-launch-the-nav2-stack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
