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 filearrow-up-right 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 Guidearrow-up-right.

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

Last updated