Skip to content

Project #6: Autonomous Turtlebot3 SLAM BOT

Muhammad Luqman edited this page Jul 25, 2023 · 8 revisions

Issue link #6

Installing Dependencies

  • sudo apt install ros-humble-gazebo-ros-pkgs
  • sudo apt-get install ros-humble-turtlebot3-gazebo
  • sudo apt-get install ros-humble-turtlebot3-navigation2
  • sudo apt-get install ros-humble-slam-toolbox
  • sudo apt install python3-opencv

Project Overview

This project focuses on the mapping and navigation of a maze by a Turtlebot3 robot in a simulated environment. The project tasks are carried out using ROS2 (Robot Operating System 2) for inter-node communication. The project leverages the SLAM (Simultaneous Localization and Mapping) toolbox for mapping, and the Navigation2 stack for autonomous navigation.

Running the Project

  • Clone the repository into your ROS2 workspace (if not done already) using:
    git clone -b running_projects https://github.com/Robotisim/mobile_robotics_ROS2.git
    
  • Build your workspace and source it by running the following command (assuming you are in the workspace root directory):
    colcon build && source install/setup.bash
    
  • Export turtlebot3 model for each terminal
    export TURTLEBOT3_MODEL=waffle_pi
    
  • Perform Mapping of Maze Enviornment
    ros2 launch drive_tb3 p6_a_maze_mapping.launch.py
    
  • Perform Manual Maze Navigation ( Initial pose estimate and goals through Rviz )
    ros2 launch drive_tb3 p6_b_maze_navigation.launch.py
    
  • Perform Auto Maze Navigation ( Initial pose estimate and goals through Node)
    source install/setup.bash && ros2 run drive_tb3 p6_c_commander_api_go_to_pose.py
    

Nodes

This project includes two nodes for map creation and entity spawning.

  • p6_a_occupancy_grid.cpp : This node, named OccupancyGridPub, publishes an occupancy grid that represents the map of the environment. It creates a simple 3x3 grid with different occupancy values for demonstration.

  • p6_b_sdf_spawner.cpp : This node, named Spawning_Node, is responsible for spawning an entity (like a robot or an obstacle) in the Gazebo simulation environment. It reads the entity's SDF (Simulation Description Format) file and sends a request to the /spawn_entity service provided by the Gazebo ROS package.

  • p6_c_commander_api_go_to_pose.py : Node that sends robot to inspect stocks by navigating through specified waypoints in a warehouse or store. It uses the ROS2 framework and the BasicNavigator class for navigation. During the journey, it prints the current waypoint's ID periodically, and after visiting all waypoints, it returns the robot to the initial pose.

Launch Files

  • p6_a_maze_mapping.launch.py : This launch file starts up a Gazebo simulation environment with a maze and a robot. The robot is equipped with the SLAM toolbox for mapping. The environment includes a maze and the robot is capable of mapping the maze using the SLAM toolbox.

  • p6_b_maze_navigation.launch.py : This launch file starts up a Gazebo simulation environment with a maze and a robot. It includes the Navigation2 stack for autonomous navigation. The robot is capable of navigating through the maze autonomously using the map created in the mapping phase.

Learning Outcomes

  • Processing Occupancy Grid for Map Creation
  • Spawning Entities in Gazebo Environment
  • Using SLAM for Map Creation
  • Autonomous Navigation Using Navigation2 Stack
  • Integration of Mapping and Navigation Tasks