ROS Notes: URDF vs. Gazebo SDF

SDFormatOne of the higher-level mysteries to this ROS beginner is why Gazebo, a sibling product, has a separate XML-based description format SDF instead of using the same URDF files of ROS. The answer came in this particular page in Gazebo’s collection of tutorials. “Tutorial: Using a URDF in Gazebo” explains why a different format was invented, but it also outlines Gazebo features to bridge the two worlds. By adding Gazebo-specific tags to URDF files, authors can specify all the information necessary for Gazebo to convert it to a SDF for internal use.

My understanding can be boiled down to this: URDF specifies a robot, but SDF also specifies a world for the robot to live in, which is a much larger set of things. Based on this premise, SDF is designed to represent a superset of everything that can be represented in URDF.

Which leads to the obvious next question: if SDF is a proper superset, why not standardize on SDF across the board? The best answer I could find is the idea being floated (and shot down?) as something to do for ROS2. I can understand the perspective that ROS really only cares about the robot and doesn’t need all the extra features of specifying a simulation world.

And while reading that discussion thread, I also learned Gazebo isn’t the only one unhappy with URDF. There’s also a SRDF file format for describing things not in a URDF, and I have even less of an idea how SRDF relates to SDF. Fortunately, there is an enlighening comment block in the generic example on that page:

This does not replace URDF, and is not an extension of URDF.

So whatever SRDF may be, it’s not yet another way to specify a robot, which is a relief.

Summary of my current understanding:

  • URDF is the established format for describing robot structure in ROS, and it is not going away anytime soon.
  • URDF could not specify information necessary for other robotics domains.
    • SDF was devised by Gazebo to meet simulation needs, but Gazebo can consume URDF when it is augmented by information within <gazebo> tags.
    • SRDF was devised to meet needs of MoveIt! Motion Planning Framework and does not replace URDF.

Given the above, as a beginner I should be safe to start with URDF when I start defining my own physical robots (like Sawppy) for ROS. But that’s a ways down the road, for now it’s back to tutorials.

ROS Notes: Robot Simulation with Gazebo

GazeboNumber one on the list of suggested “What Next” at the end of ROS tutorial is an invitation to run a virtual robot in a simulation environment. Two robots were linked – first the very capable and expensive Willows Garage PR2 research platform, and the second a much more accessible TurtleBot platform. Either way, the virtual world for these simulated robots is a product called Gazebo.

The big red notification at the top of the PR2 Gazebo tutorial tells us that particular page is out of date. It implied Gazebo used to be part of ROS but has been spun off as a standalone project. This is different from the story at the bottom of Gazebo’s own front page, which implied Gazebo has always been standalone and ROS just happens to interface with it. Either way, a little poking around found that Gazebo is a peer of ROS both under the umbrella of Open Source Robotics Foundation.

The good news is that Gazebo provides tutorials to help people learn Gazebo. The bad news is… well, there is A LOT of it. The tutorial section front page has about 35 links to other pages, which seemed fine until I realized each of the links under “Categorized” leads to a page with several tutorials in that category. This drastically increases the number of tutorial pages, many of which seemed to be aimed at people who might be new to that category of Gazebo but are familiar with Gazebo in general.

I’m definitely not yet familiar with Gazebo in general.

As far as this beginner can determine so far, Gazebo provides a virtual simulation environment for robotic software, but that software need not be written with ROS. Gazebo simulation behavior is controlled by assembling multiple plugins, each written to control some aspect of the simulation world. Plugins are assembled alongside other assets in a SDF file to be loaded into a Gazebo simulation.

I haven’t yet figured out how Gazebo plugins relate to ROS nodes, or how the SDF files relate to ROS URDF files. I know the advertising pitch is to write high level robot intelligence that can be easily swapped between running on physical hardware and running in Gazebo. As of right now, it is still a mystery where that physical/virtual swap layer lives.