Robot Operating System (ROS)

The Robot Operating System (ROS) is an open source collection of packages built around an architecture of publishing messages that is geared towards robotics and embedded systems. At the moment, it is built to run on Ubuntu, with some limited experimental support for other operating systems: http://www.ros.org/wiki/ROS/Installation. I chose to stick with Ubuntu to avoid any problems down the road that choosing an experimental OS might bring.

Installation

A great installation guide for ROS can be found here: http://www.ros.org/wiki/electric/Installation/Ubuntu. Personally, I am running the Natty (11.04) version of Ubuntu, but running on other versions should be all right.

Architecture

ROS works with nodes (essentially processes within the ROS framework) and nodes communicate to one another through topics (or data streams). To facilitate the distribution of topics amongst nodes on different machines (via Internet connection), a Master machine is designated by the user. The Master receives all data from all nodes and intelligently distributes data between the nodes that require it.

There are three ways nodes interface/communicate: publishersubscriber, services and actions. The bread and butter of ROS is its producer-consumer framework, or known correspondingly in ROS as publishersubscriber. A node will publish a topic with a given message (or msg), and another node will subscribe to that topic, receiving data in the form as defined by a msg. A msg is a text file that describes a data type, and resembles a C structure. For example, the Point.msg from the package geometry_msgs is

float64 x
float64 y
float64 z

Publisher / Subscriber model in ROS.

Services resemble a client-server architecture. A node will advertise/provide a service wherein another node will give some input and the node will return some output. This is defined by a service type, which consists of two parts: input messages and output messages. Here is an arbitrary example to better illustrate:

float32 input1
string input2

int16 output1
bool output2

Here a node (client) will send a float32 and string as input for a service topic and expect to receive an int16 and bool back.

Service / Client model in ROS.

Actions are similar to services, but are built towards functionality that requires a long response time (i.e. more than second). Examples of this are usually performing a physical task such as docking a robot, opening a gripper or moving an arm.

Custom messages and services can be created for your own purposes and are built upon basic message types, just like in C. For more information, I recommend reading http://www.ros.org/wiki/ROS/Tutorials/CreatingMsgAndSrv.

A neat function of ROS is that because of its architecture it pretty simple to see how all components in a system are connected. The command line executable rxgraph will build a flow chart of all components currently running. For example, when running rxgraph on my CSC578C project:

An example flow chart produced by rxgraph.

Conclusion

ROS is a great tool for building straightforward and modular components for robotics. This post serves as more of an overview of the fundamentals of what ROS is and why I like it. I highly recommend reading the well written tutorials for ROS to get started learning it.

Pros Cons
Takes care of a lot of infrastructure Can be a bit bulky when compared to pure embedded implementation (“Using a bulldozer to build a sandcastle”)
Large community to call on for support The effectiveness/completeness of some stacks/packages can be a bit misleading
Built around modular design Can take up a lot of bandwidth — leads to slow performance (at least on my University’s wireless network)
Supports Arduino through rosserial For distributed projects, requires Internet as well as devices capable of running ROS (i.e. netbook)

Example

To demonstrate a simple and interesting use for ROS, take a look at the joystick package I created for ROS (when I get around to writing a post about it). The package is built around the pygame package, specifically its joystick library.

Advertisements

2 thoughts on “Robot Operating System (ROS)

  1. hi sir i am doing arm navigation as my final year project … now my goal is to move the arm by teleoprating method using rosserial … i have ros publisher program as well as subscriber program but in that subscriber program i am using geometry_msgs while compling its showing error is

    servo_rani.cpp: In function ‘void servo_cb(const geometry_msgs::PoseStamped&)’:
    servo_rani.cpp:62:28: error: ‘const class geometry_msgs::PoseStamped’ has no member named ‘position’
    if any one can knows reason of this fault please post it….

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s