Project Overview
Building and Simulating a Robot With ROS 2 Jazzy Jalisco and Gazebo Harmonic
Introduction
My journey into robotics began in grade 5 when I joined my school’s robotics club. Over the years, my passion for robotics has only grown. When I started college, my mentors introduced me to the World Robot Olympiad's Future Engineers category. Thanks to their support, I received resources, including sensors, a robot kit, and access to ROS 2—a platform I’d never heard of before.
As I dove into learning ROS 2, I became captivated by its powerful simulation capabilities using Gazebo. This inspired me to switch to Linux, leaving Windows behind, and start experimenting with building robots.
Now, I’m rebuilding one of my first projects from scratch—a simple differential drive robot—and documenting every step to share with you. Together, we’ll learn how to build and simulate a robot with ROS 2 Jazzy Jalisco and Gazebo Harmonic.
Goals:
Our robot will:
Be controlled via keyboard and later a joystick (teleoperation).
Use LiDAR and SLAM to map a room and navigate autonomously.
Leverage OpenCV with a camera to detect and follow objects.
Getting Started
Let's start by creating package and a workspace on our computer. We’ll be creating the package from GitHub, so you don’t need ROS installed for that step. However, you’ll need ROS for setting up the workspace.
Creating a package
What's a package?
The software powering this project is called ROS. If you’re not familiar with ROS or don’t know how to install it, don’t worry—I’ll share links. For now, all you need to know is that when working on a project in ROS, all your code, files, and resources are organized into something called a package. A package is essentially a regular folder, but it includes a few special files that help ROS understand how to use it.
ROS comes with a tool for making a package, but we're going to do it different way.
Using the template
I’ve made a template of a package on my GitHub. Start by heading to the repository, and if you don't already have a GitHub account, go ahead and make one and log in. Once on that page, click on the green button that says "Use this template".
This will take the template and make you a new copy that you have full control over to do whatever you want. The first thing to do is to put in a name. If you use diffbot
like the template did, which I highly encourage, you will save yourself a lot of work other than changing the name. I'll be calling mine diffbot_tut
, so for the rest of the tutorials wherever you see diffbot_tut
you should substitute your own package name.
If you changed the package name…
If you left the package name as diffbot
then you can skip this step, but if you did change the name then you'll need to make sure you change all the references to it. To do this we can open up the GitHub built-in editor using the full-stop key (.
).
Hit Ctrl-Shift-F
to open a search tab or click the magnifying lens to you far left, we want to replace every instance of diffbot
with the new name, in my case diffbot_tut
.
Then, to commit our change, click on the Source Control panel (next one down), type a useful commit message (e.g. "Change all instances of project name") and click "Commit & Push". If you go back to the main repo page and look at the files you should see your changes have been committed.
Remember to fill in the fields of package.xml
with your name, email address, etc.
Creating a workspace
For this step, we will prepare the workspace on our computer. For this step you'll need to have ROS installed, so go ahead and do that if you haven't already.
My computer runs Ubuntu 24.04 and ROS 2 Jazzy Jalisco.
Follow these steps to create your workspace:
Open a terminal (should be in the home directory by default)
Create a directory called
ros2_ws
to use as a ROS workspaceGo into that and create a directory called
src
to put the packages intoClone your GitHub repository into the
src
folder:git clone <repo_url>
.Navigate back to the workspace root (
cd ..
) and build it withcolcon build —packages-select diffbot_tut —symlink-install
Conclusion
Once you've copied the template and built your workspace (and installed ROS if you hadn't already),we are good to go!
Check these out:
In the next article, we’ll explore the robot’s design and bring it to life in a Gazebo simulation. Stay tuned!