Code Reuse in Robotics

by Brian Gerkey

While Steve Cousins and I were visiting the University of Sherbrooke, I noticed that they have a Hokuyo UTM on a robot, and I mentioned that we have code in ROS to control it.  One of the students in the lab said, "Of course, that's what we're using.  It's a nice, self-contained library." They were able to find the code for the driver library, pull it out, and use it without using the rest of ROS.

We put a lot of thought into how to offer an integrated framework with lots of components, without requiring users of a component to use the framework.  Taking inspiration from projects like CARMEN and Gearbox,our approach is to create a standalone library for each component, and then build a ROS wrapper that incorporates the library.  The library can be used with or without ROS.  With ROS, it immediately plays with all the other ROS nodes, and can take advantage of the ROS frameworks (e.g. for testing, system configuration, etc.). Without ROS, it's simply a library with a clean API that provides some basic robotics functionality.  In the long run, as the standalone libraries stabilize, we may contribute them to a project like Gearbox, which is becoming a clearinghouse for robotics libraries.

We haven't advertised this aspect of our software architecture, or encouraged people to use ROS or its component libraries yet, but it feels great that this approach to system architecture seems to achieve our goal of code reuse by others.