aalbaali / ros2_navigation

Implementing navigation algorithms in ROS2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

In this repo

This repository is used as a playground to learn ROS2 and the tools needed for it. Specifically, it is used to learn using the Nav2 ROS2 toolbox.

Objectives

This project is quite large, so there are multiple objectives. They are summarized as follows:

  • Setting up the development environments (e.g., using Github, Dockerfiles, webhooks, linters, etc.)
  • Familiarization with ROS2.
  • Running a full navigation pipeline in simulation using ROS2.
  • Customizing the existing code for better performance (e.g., using g2o's factor graphs)
  • Implementing the software on a real physical robot.

Building Nav2 from source

The Nav2 repo is listed in the src/ros2.repos file.

  1. Clone the repository by runnnign the VSC task import from workspace file.
  2. Install necessary dependencies by running the VSC task install dependencies.
  3. Build packages by running the VSC task build.
  4. Open a new terminal (it'll automatically source the workspace) and have fun!

To test, run

ros2 launch nav2_bringup tb3_simulation_launch.py

Sourcing workspaces

It's possible to source multiple workspaces on the same system. For example, it's possible to have a workspace at ~/nav2_ws/ and another at ~/dev_ws.

Sourcing the underlay

Some packages can be installed using apt package managers. For example, it's possible to install turtlesim by running

sudo apt install ros-foxy-turtlesim

To use these packages, they must be sourced using

source /opt/ros/foxy/setup.bash

But what if we want to modify the source files? Do we have to keep track of the original and the modified versions? Well that's where sourcing different workspaces comes into play, which is discussed in the following section.

Sourcing an overlay

A specific workspace (e.g., ~/nav2_ws/) could be sourced by going into the workspace and then sourcing the (local) local_setup.bash script. For example,

cd ~/nav2_ws
source install/local_setup.bash
# Or 
# source install/setup.bash

Running source install/local_setup.bash sources the current workspace only, whereas install/setup.bash sources install/local_setup.bash then sources the underlay /opt/ros/foxy/setup.bash. Sourcing the overlay overrides sourcing the underlay. Thus, sourcing ~/nav2_ws would run the turtlesim version stored in the Nav2 workspace.

Key commands

  • Checking dependencies
# cd to workspace root (e.g., ~/nav2_ws)
rosdep install -i --from-path src --rosdistro foxy -y

EMPTY_DIR files

Git does not support uploading empty directories, but some of these directories are needed for a successful test. As such, empty directories that are required to be uploaded to Github are populated with an empty file named EMPTY_DIR.

Resources

About

Implementing navigation algorithms in ROS2


Languages

Language:Python 90.8%Language:Dockerfile 5.8%Language:CMake 3.2%Language:Shell 0.1%