4.8 Using ROS
4.8.1 What is ROS?
ROS (Robot Operating System) is a framework for robot software development, providing operating system-like functionality on top of a heterogenous computer cluster. ROS was originally developed in 2007 by the Stanford Artificial Intelligence Laboratory. As of 2008, development continues primarily at Willow Garage.
ROS provides standard operating system services such as hardware abstraction, low-level device control, implementation of commonly-used functionality, message-passing between processes, and package management. It is based on a graph architecture where processing takes place in nodes that may receive, post and multiplex sensor, control, state, planning, actuator and other messages. The library is geared towards a Unix-like system and is supported under Linux, experimental on Mac OS X and has partial functionality under Windows.
ROS has two basic "sides": The operating system side, ros, as described above and ros-pkg, a suite of user contributed packages (organized into sets called stacks) that implement functionality such as simultaneous localization and mapping, planning, perception, simulation etc.
ROS is released under the terms of the BSD license, and is open source software. It is free for commercial and research use. The ros-pkg contributed packages are licensed under a variety of open source licenses.
4.8.2 ROS for Webots
ROS can be used with Webots by implementing Webots controllers as ROS nodes that can receive messages from other ROS nodes (to send motor commands to simulated robots) and send messages to other ROS nodes (to read sensor data). A Webots controller ROS node therefore behaves very similarly to a real device ROS node (running on a real robot).
Such a ROS node can be easily implemented in Python by importing both ROS libraries (roslib, rospy) and Webots libraries (controller) in a Webots robot controller (or supervisor controller).
It is also possible to implement such a ROS node in C++ using the roscpp library. However, in this case, you need to setup a build configuration to handle both the catkin_make from ROS and the Makefile from Webots to have the resulting binary linked both against the Webots libController and the roscpp library. An example of such an implementation is included in the Webots distribution (see below).
4.8.3 Using ROS with Webots
A sample C++ ROS node running as a Webots controller is provided in the Webots distribution for Linux. It is located in the Webots projects/languages/ros folder and contains a world file named joystick.wbt and a controller named joystick which allows the user to drive a simulated robot using a joystick through the ROS joy node. This controller is a very simple example of a ROS node running as a Webots controller. It could be used as a starting point to develop more complex interfaces between Webots and ROS. The controller directory includes all the Makefile machinery to call the build tools used by ROS and Webots to produce the controller binary. The ros folder also includes a README.txt file with detailed installation and usage instructions.