ROS2 Navigation#

Support Limitations

  • ROS 2 Navigation with Isaac Sim is fully supported on Linux. On Windows, ROS 2 Navigation with Isaac Sim is partially supported and could potentially produce errors.

Learning Objectives#

This ROS2 sample demonstrates NVIDIA Isaac Sim integrated with ROS2 Nav2.

Getting Started#

Prerequisite

  • You must source your ROS 2 installation from the terminal before running Isaac Sim.

  • The Nav2 project is required to run this sample. To install Nav2 refer to the Nav2 installation page.

  • Enable the isaacsim.ros2.bridge Extension in the Extension Manager window by navigating to Window > Extensions.

  • This tutorial requires carter_navigation, iw_hub_navigation, and isaac_ros_navigation_goal ROS2 packages, which are provided as part of your NVIDIA Isaac Sim download. These ROS2 packages are located inside the appropriate ros2_ws (humble_ws). They contain the required launch file, navigation parameters, and robot model. Complete ROS 2 Installation, make sure the ROS 2 workspace environment is setup correctly.

Note

In Windows 10 or 11, depending on your machine’s configuration, RViz2 may not open properly.

Running Nav2#

Installing the Nova Carter Description Package#

Note

This section is only supported in Linux ROS 2.

The Nova Carter description package contains the robot geometry including meshes that can be used to visualize the robot in RViz2. Follow the steps below to configure this description package for Isaac Sim workflows:

  1. Open a new ROS-sourced terminal. Setup the locale:

    locale  # check for UTF-8
    
    sudo apt update && sudo apt install locales
    sudo locale-gen en_US en_US.UTF-8
    sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
    export LANG=en_US.UTF-8
    
    locale  # verify settings
    
  2. Install the required dependencies.

    sudo apt update && sudo apt install gnupg wget
    sudo apt install software-properties-common
    sudo add-apt-repository universe
    
  3. Register NVIDIA’s GPG Key and Repository.

    wget -qO - https://isaac.download.nvidia.com/isaac-ros/repos.key | sudo apt-key add -
    grep -qxF "deb https://isaac.download.nvidia.com/isaac-ros/release-3 $(lsb_release -cs) release-3.0" /etc/apt/sources.list || \
    echo "deb https://isaac.download.nvidia.com/isaac-ros/release-3 $(lsb_release -cs) release-3.0" | sudo tee -a /etc/apt/sources.list
    sudo apt-get update
    
    wget -qO - https://isaac.download.nvidia.cn/isaac-ros/repos.key | sudo apt-key add -
    grep -qxF "deb https://isaac.download.nvidia.cn/isaac-ros/release-3 $(lsb_release -cs) release-3.0" /etc/apt/sources.list || \
    echo "deb https://isaac.download.nvidia.cn/isaac-ros/release-3 $(lsb_release -cs) release-3.0" | sudo tee -a /etc/apt/sources.list
    sudo apt-get update
    
  4. Install the nova_carter_description package

    sudo apt install ros-humble-nova-carter-description
    

Sending Goals Programmatically#

Note

The isaac_ros_navigation_goal package is fully supported on Linux. On Windows, running this package might produce errors.

The isaac_ros_navigation_goal ROS2 package can be used to set goal poses for the robot using a Python node. It is able to randomly generate and send goal poses to Nav2. It is also able to send user-defined goal poses if needed.

  1. Make any changes to the parameters defined in the launch file found under isaac_ros_navigation_goal/launch as required. Make sure to re-build and source the package and workspace after modifying its contents.

    The parameters are described below:

    • goal_generator_type: Type of the goal generator. Use RandomGoalGenerator to randomly generate goals or use GoalReader for sending user-defined goals in a specific order.

    • map_yaml_path: The path to the occupancy map parameters YAML file. An example file is present at isaac_ros_navigation_goal/assets/carter_warehouse_navigation.yaml. The map image is being used to identify the obstacles in the vicinity of a generated pose. Required if the goal generator type is set as RandomGoalGenerator.

    • iteration_count: Number of times goal is to be set.

    • action_server_name: Name of the action server.

    • obstacle_search_distance_in_meters: Distance in meters in which a generated pose is free from obstacles of any kind.

    • goal_text_file_path: The path to the text file which contains user-defined static goals. Each line in the file has a single goal pose in the following format: pose.x pose.y orientation.x orientation.y orientation.z orientation.w. A sample file is present at: isaac_ros_navigation_goal/assets/goals.txt. Required if goal generator type is set as GoalReader.

    • initial_pose: If initial_pose is set, it will be published to the /initialpose topic and goal poses will be sent to action server after that. Format is [pose.x, pose.y, pose.z, orientation.x, orientation.y, orientation.z, orientation.w].

  2. Go to Window > Examples > Robotics Examples, and then click on the Robotics Examples tab and expand the sections on the left hand side and open the example: ROS2 > Navigation > Nova Carter to load the warehouse scenario.

  3. Click on Play to begin simulation.

  4. In a new terminal, run the ROS2 launch file to begin Nav2.

    ros2 launch carter_navigation carter_navigation.launch.py
    

    RViz2 opens and begins loading the occupancy map. If a map does not appear, repeat the previous step.

  5. Run the isaac_ros_navigation_goal launch file, to start sending goals automatically:

    ros2 launch isaac_ros_navigation_goal isaac_ros_navigation_goal.launch.py
    

Note

After any of the following conditions are met, the package stops processing (setting goals):

  1. Number of goals published till now >= iteration_count.

  2. If the GoalReader parameter is used and if all the goals from the config file are published.

  3. A goal is rejected by the action server.

  4. In rare cases, a very dense map may cause RandomGoalGenerator to generate invalid poses. The package will stop processing if the number of invalid poses generated by RandomGoalGenerator exceeds the maximum number of iteration.

To automatically launch Isaac Sim and Nav2, while programmatically sending navigation goals from a single launch process, refer to Launch Isaac Sim with Nav2.

To learn more about programmatically sending navigation goals to multiple robots simultaneously see Sending Goals Programmatically for Multiple Robots.

Sending Goals Using ActionGraph#

Important

Make sure Nav2 is installed and source your ROS2 installation from the terminal before running Isaac Sim. Currently, the following section will not work with internal libraries.

  1. Go to Window > Examples > Robotics Examples to open Robotics Examples tab.

  2. Go to Robotics Examples > ROS2 > Navigation > Nova Carter and click on Load Sample Scene button to load the warehouse scenario with the Nova Carter robot.

  3. Go to Robotics Examples > ROS2 > Navigation > Add Waypoint Follower to open the waypoint follower parameter window.

  4. Make changes to the waypoint follower parameters as required.

    Occupancy Map Properties UI Window

    The parameters are described below:

    • Graph Path: Specify the path within the stage.

    • Frame ID: Specify the reference frame for navigation tasks.

    • Navigation Modes:
      1. Waypoint Mode: Creates a single waypoint to send as a navigation goal. The robot will navigate towards this waypoint.

      2. Patrolling Mode: Creates multiple waypoints (between 2 to 50 inclusive) for continuous patrolling. The robot will navigate between these predefined waypoints continuously.

    • Waypoint Count: Number of waypoints to generate for Patrolling.

  5. Click on Load Waypoint Follower ActionGraph to create waypoints and add the actiongraph at Graph Path in stage pane.

  6. Click on Play to begin simulation.

  7. In a new terminal, run the ROS2 launch file to begin Nav2.

    ros2 launch carter_navigation carter_navigation.launch.py
    

    RViz2 opens and begins loading the occupancy map. If a map does not appear, repeat the previous step.

  8. Because the position of the robot is defined in the parameter file carter_navigation_params.yaml, verify that the robot is properly localized. If required, the 2D Pose Estimate button can be used to re-set the position of the robot.

  9. Running navigation modes:

    1. Waypoint:
      1. Adjust the waypoint (/World/Waypoints/waypoint_1) in xy plane of the scene to set the desired goal location.

      2. Open the ROS_Nav2_Waypoint_Follower graph from the stage and click on Send Impulse in the OnImpulseEvent node.

      3. Verify that the robot starts navigating towards the specified goal.

      4. Repeat these steps after each goal is completed to set new waypoint.

    2. Patrolling:
      1. Adjust the waypoints (/World/Waypoints/waypoint_n) in xy plane of the scene to define the patrol path.

      2. Open the ROS_Nav2_Waypoint_Follower graph from the stage and click on Send Impulse in the OnImpulseEvent node.

      3. Verify that the robot starts patrolling along the set waypoints.

Note

  • This tutorial uses the AMCL localizer and the action graph is fully supported for this localizer.

  • If you notice errors as shown below after deleting the graph, you can disregard them because they are harmless. To prevent these logs you can click the “reload node” button to clean up the script nodes before deleting the graph.

    2024-12-03 13:55:27 [4,715,030ms] [Error] [omni.graph] Error executing python callback omni.graph.scriptnode.ScriptNode.release_instance
    2024-12-03 13:55:27 [4,715,030ms] [Error] [omni.graph] Error executing python callback omni.graph.scriptnode.ScriptNode.release
    

Summary#

In this tutorial, you covered:

  1. Occupancy map.

  2. Running Isaac Sim with Nav2.

  3. Running the Isaac ROS2 Navigation Goal package to send nav goals programmatically.

  4. Running Waypoint Follower ActionGraph to send navigation goals.

Next Steps#

Continue on to the next tutorial in our ROS2 Tutorials series, Multiple Robot ROS2 Navigation to move multiple navigating robots with ROS2.

Further Learning#