Skip to content

4. Learning ROS through Simulation

Brandon Rice edited this page Sep 11, 2021 · 8 revisions

4. Learning ROS through Simulation with Turtlebot3 and Gazebo

Turtlebot + Gazebo

Author: Brandon Rice

The full, original tutorial can be found here.

Preface: Robots are expensive, and it's difficult to test code when the bot is in the lab and you're at home...

I wrote this tutorial (or rather adapted an existing tutorial) on July 31, 2021. COVID-19 had physically removed our team from using our lab for over one full year. One full year of trying to figure out how a team could write software for a robot that was locked away in an nearly inaccessible room. No more "let's meet next week and test the code (physically on the rover)."

As SDRC's software team lead, one leadership role was particularly tricky: how can I get new members up to speed and teach them ROS (already a difficult task under normal circumstances) without actually running code on a physical device?

It was a problem I didn't know how to solve. Instead of gaining new members interested in software throughout the 2020-21 academic year, we lost nearly our entire team. Such an avoidable mistake if only I or anyone else on our team had experience in simulation-based software development and testing, what I now know and what you too can learn from this tutorial. Don't let working remotely halt your productivity!

Wait, so we don't actually need a robot to write and test software? 😮

No!!! Everything* software related can be virtually simulated on your computer.

I put an asterisk (*) on "everything" because simulations are not real, meaning:

  1. No simulation is 100% accurate because of how complex and random the universe is,
  2. A realistically modeled (i.e. correct dimensions, material properties, and joints) CAD model of the assembly you are wanting to simulate is needed for accurate results, and
  3. You'll want to eventually test your code on a physical robot to confirm that your code works, the simulation is close, and you can celebrate a job well done!

Luckily, in this tutorial, everything (including the model of the robot) is provided in the install of the software package we will use!

Enough talk, let's jump into it!

We will use a model of a robot called Turtlebot and a prebuilt simulator called Gazebo that ships with the Desktop-Full Install of ROS.

The Turtlebot family.

The (real) Turtlebot family.

The Turtlebot2 and Turtlebot3 models released with a full ROS library, including the properly defined 3D models of the robots. Because we are using ROS Melodic Morenia, we will use Turtlebot3.

Part 1

Installation

Setup

Launching your first Gazebo world

Driving the Turtlebot around the house world

SLAM: Creating a Map

SLAM: Autonomous Navigation

Part 2

Viewing the world through Turtlebot's simulated camera

Using our map to autonomously drive wherever we want

Conclusion

Clone this wiki locally