This project implements an autonomous navigation system using ROS2 and Nav2. The TurtleBot robot is configured to move in a simulated environment (and potentially real) following specific goals and saving navigation data for analysis.
Download and watch the robot simulation in action
- TurtleBot Navigation System
- Simulation
- Download Simulation Video
- Table of Contents
- Commands to Execute Visualization
- Introduction
- Prerequisites
- ROS2 Configuration
- Installation of necessary packages Nav2
- Project Import
- Launching the simulation
- Node Structure
- Launching the nodes
- Data Visualization
- Map Configuration
- Simulation Phases
- Future Developments
- Authors and Contacts
The project combines robotics and mobility support to assist patients in a rehabilitation context. It includes the configuration of ROS2, Nav2, RViz, and Gazebo for TurtleBot simulation.
- Ubuntu 22.04 with ROS2 Humble installed.
WSL2(if on Windows).- Necessary Python packages installed (see requirements.txt).
- Enable WSL:
wsl --install
- Install Ubuntu Jellyfish:
wsl --install -d Ubuntu-22.04
- Configure the environment:
wsl -d Ubuntu-22.04
- Configure UTF-8:
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
- Make sure Ubuntu Universal Repository is enabled
sudo apt install software-properties-common sudo add-apt-repository universe
- Add ROS2 GPG key
sudo apt update && sudo apt install curl -y sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg - Add the repository to the source list:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
- Before starting the installation, check all packages:
sudo apt update sudo apt upgrade
- Install ROS2 and additional packages:
sudo apt install ros-humble-desktop sudo apt install ros-dev-tools
- Run this command to configure the ROS 2 environment in your current shell
source /opt/ros/humble/setup.bash
- Install Nav2 packages:
sudo apt install ros-humble-navigation2 ros-humble-nav2-bringup
- Install TurtleBot packages for Gazebo:
sudo apt install ros-humble-turtlebot3-gazebo
To allow proper startup, launch the base project for safety
source /opt/ros/humble/setup.bash
export TURTLEBOT3_MODEL=waffle
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/humble/share/turtlebot3_gazebo/models
source /usr/share/gazebo/setup.bash
ros2 launch nav2_bringup tb3_simulation_launch.pyIf it doesn't work, restart the platform you are working on.
- Clone the GitHub repository:
git clone https://github.com/tetano02/turtlebot_workspace.git
- Export files to Nav2 directories:
sudo mkdir /opt/ros/humble/share/turtlebot3_gazebo/models/planimetria_santanna sudo cp -r ~/turtlebot_workspace/src/turtlebot_controller/models/planimetria_santanna/* /opt/ros/humble/share/turtlebot3_gazebo/models/planimetria_santanna
- Replace the Gazebo texture file:
sudo rm /usr/share/gazebo-11/media/materials/scripts/gazebo.material sudo cp ~/turtlebot_workspace/src/turtlebot_controller/gazebo.material /usr/share/gazebo-11/media/materials/scripts/ - For the correct functioning of the project, also execute the following commands
If the last command doesn't work, use the following command.
pip install pandas pip upgrade matplotlib
pip install --upgrade matplotlib
- Prepare the environment:
If it doesn't work, also add this command
source /opt/ros/humble/setup.bash export TURTLEBOT3_MODEL=waffle export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/humble/share/turtlebot3_gazebo/models
source /usr/share/gazebo/setup.bash - Build the workspace:
cd turtlebot_workspace colcon build source install/setup.bash
- Launch the simulation:
ros2 launch turtlebot_controller tb3_santanna_launch.py
- Manages autonomous navigation from point A to point B.
- Estimates the initial position and sends goals via the Action Client.
turtle_distance_publisher: Calculates and publishes the distance traveled.turtle_csv_handler: Saves navigation data in CSV format.
To launch the nodes follow these commands
- Open a new tab from terminal.
- Build the workspace:
cd turtlebot_workspace colcon build source install/setup.bash
- Launch the node that publishes the distance:
Node that publishes the distance:
ros2 run turtlebot_controller turtle_distance_publisher
- Execute steps 1 and 2 again
- Launch the node that creates csv files with robot data:
Node that creates csv:
ros2 run turtlebot_controller turtle_csv_handler
- Execute steps 1 and 2 again
- Node that allows the robot to move:
ros2 run turtlebot_controller move_turtle_AB
After launching the simulation and the nodes, to visualize the simulation data it is necessary to execute the following commands.
cd ~/turtlebot_workspace/src/turtlebot_controller/script_python
python3 elaborate_data.py- The floor plan was converted to
.pgmformat and parameters set in the.yamlfile. - Gazebo was configured with reference files and by adding downloaded models.
- Movement to destination: The robot moves towards the bed, saving data.
- Return to base: By pressing a simulated button, the robot returns to the initial position.
- Implementation on real hardware with:
- Walker configuration.
- Testing in real hospital environments.
- Improvements to the user interface and navigation system reliability.
For information or bug reports, contact the development team:
