Learning How To Simulate Robots With ROS2

Get New Articles by Email

It’s funny how a flame throwing robot dog led to me learning about Robot Operating System (ROS). Now, I’m building bots out of code rather than spending money on hardware that sits around most of the time.

By working with ROS, I’m gaining real world experience with a robotics industry standard development kit!

ROS is relied upon throughout the robotics industry. It’s the norm for teaching robotics. It’s the basis for most robotics research, from single-student projects to multi-institution collaborations and large-scale competitions. And it’s inside robots that are running in production all around the world today. In the autonomous mobile robot (AMR) alone, ROS has helped to create billions of dollars in value.

ROS.org

I’ve also learned how ROS isn’t limited to just robotics! The most basic examples demonstrate a pub/sub architecture with “talkers” and “listeners”, which is useful in tons of use cases.

Packages are where ROS really shines. You can leverage code others have created and shared, so you don’t have to reinvent the wheel.

Another thing I’ve come to love about ROS is how they handle their different distributions. I generally avoid writing step-by-step tutorials because details constantly change. With ROS, you can specify what distribution you want to work in, regardless how old it is, and everything just works!

Articulated Robotic’s Tutorials

Josh Newans has some great ROS tutorials on his site articulatedrobotics.xyz, which is helped me get up and running with my first simulated robot.

I personally did things in a slightly different order than he has on his site, by starting with Docker For Robotics.

Once I had Docker working with the ROS Foxy distribution, I jumped to Build a Mobile Robot with ROS, skipping the hardware section. That’s where I learned how to describe a robot in XML using URDF.

From there, I was able to move into creating a Gazebo simulation, which was super fun!

Here’s a video of what I ended up with:

In the top right, you can see the Gazebo simulation, which represents the robot in the real world.

The bottom right has RVIZ, which is a visual representation of how ROS calculates the transformation details about the robot and each of it’s components. It even tracks the robot’s position in relation to the “world”, which you define. Notice how the inner wheel turns slower than the outer wheel!

The left side has VS Code with the XML definition at the top, and the ROS2 keyboard controller running in the lower left terminal (where I’m driving the bot), while displaying the various transformation calculations on the lower right terminal.

You can access my first bot repo on GitHub if you’d like to give this a spin.

What’s cool is that Josh provides details on building your own physical version of this robot that runs on the exact same code!

Next Steps

With this understanding, I’m now able to design more complex robots and simulate them using my first bot repo as a template. I almost bought a Raspberry Pi powered Puppy Pi to learn ROS with, now I can make any virtual robot I want to learn with without spending a dime!

I’m really excited to see how robotics ties all the technology I’ve studied together!

I’ve seen robot simulations rendered in Unity that were powered by ROS, which I’m interested in exploring. I’m also working on a plan to integrate robotics components into my smart home. I have a couple of Robomaster TT Tello Talent Drones that I could have autonomously fly through the house with a simple voice command, thanks to everything I’ve learned about ROS.

The sky’s the limit on what you can do!

Be sure to subscribe if you’re interested in following where I’ll go from here.

Vlog

This is one of my first YouTube Videos! I’ll be writing about the experience soon.

Get New Articles by Email

Leave a Reply

Verified by MonsterInsights