Skip to content

keane-k/diffdrive_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Differential Drive Robot

This project documents my ongoing effort to learn and understand mobile robot simulation using ROS2. It revolves around simulating a simple, custom differential drive robot that primarily exists in a virtual environment using GazeboSim & RViz.
The repository is intended as a beginner-friendly reference, capturing both working configurations and the lessons learned while setting up robot descriptions, simulation workflows and sensor integration in ROS2.

TL;DR
This project focuses on simulating a simple differential drive robot using ROS2, GazeboSim & RViz. It is beginner-oriented, serving as a living document of my learning and thought process, as well as discoveries while working with ROS2 simulation tools.

System Requirements

  • Virtual Machine: VMware Workstation Player 25H2
  • Ubuntu: Ubuntu Noble 24.04.3 LTS
  • ROS2: Kilted
  • Gazebo: Ionic

Overview

Control Plugins:

User may toggle between gazebo_control or ros2_control via use_ros2_control found in launch_sim.launch.py

  • Gazebo DiffDrive plugin (gazebo_control) -----> Set use_ros2_control to false
  • ros2_control -----> Set use_ros2_control to true

Using teleop_twist_keyboard

image


Simulated Sensors:

LiDAR (Light Detection and Ranging)

image


Camera

image


Depth Camera (w/ PointCloud visualization)

image image


SLAM & Navigation

2D SLAM using slam_toolbox

The robot performs 2D SLAM in simulation using slam_toolbox, using Grid SLAM approach, it builds an occupancy grid map in real-time based on LiDAR data while localizing itself within the environment.

image

At the time of this writing, the author is currently working on using AMCL for localization in conjunction with the map generated by slam_toolbox.

Local and Global costmap generation

Assigns a cost to different areas of the environment, currently based on a static map generated by SLAM.

image

At the time of this writing, author is working on using Nav2 for autonomous path planning. Terminal output seems to end on Creating bond timer..., hinting towards nav2_stack not fully initializing. A concern could be attributed to demanding computational power that a Virtual Machine might struggle with. Root cause of issue pending further investigation.


Ball Tracking using OpenCV

Tuning of Detection

Ball is an asset (RoboCup SPL Ball) provided by OpenRobotics. Tuning parameters can be found in the params file ball_tracker_params.yaml.

image

Ball Tracking

Using trigonometry, a 3D position-estimate of the ball can be calculated and visualised in RViz.

image

Usage

Setup

Step 1. Build the Workspace

cd ~/diffdrive_ws
colcon build --symlink-install

Step 2. Source the Workspace

source install/setup.bash

Launch Gazebo and RViz2

Step 1. Launch Gazebo, spawning Robot and simulating World

In a new terminal:

ros2 launch diffdrive_bot launch_sim.launch.py

Step 2. Launch RViz2 with a specific configuration tailored for ball tracking feature

In another terminal:

rviz2 -d src/diffdrive_bot/config/balltracking.rviz

Running Ball Tracking Feature

Step 1. To enable ball tracking, launch the following launch file

In a new terminal:

ros2 launch diffdrive_bot ball_tracker.launch.py sim_mode:=true

Credits

This project is inspired by the work of joshnewans and his Articulated Robotics blog and tutorial. The code in this repository is written and maintained for ROS 2 Kilted and Gazebo Ionic.

Releases

No releases published

Packages

 
 
 

Contributors

Generated from joshnewans/my_bot