Robot Operating System: Difference between revisions

From air
Jump to navigation Jump to search
No edit summary
 
(102 intermediate revisions by 3 users not shown)
Line 1: Line 1:
ROS (a.k.a Robot Operating System or Robot OS), can be seen as a kind of Robotic Framework. Because it can't be installed directly on robotic equipment (ROS needs a computer and works above its OS), it can't be considered as a pure operating system. In addition to providing a complete development and execution environment, ROS includes numerous simulation tools. However, it does not guarantee runtime properties, services or event processing in deterministic time spots (i.e. [http://en.wikipedia.org/wiki/Real-time_computing realtime processing]), though it is possible to integrate ROS with realtime code ([http://opencv.org/ openCV] is supported).<br/> ROS is released under the terms of the BSD license, and is open source software. It is free for commercial and research use.[[File:Ros-groovy.jpg | right | frame | Groovy is the last version of ROS]]
[http://www.ros.org ROS] est un environnement de developpement et d'exécution et de simulation pour la robotique développé initialement au MIT. '''ROS n'est pas un système d'exploitation et ROS n'offre pas de propriétés d'exécution en temps déterministe des taches, services, traitement des événements, ... (ie [[Temps Réel]]).


Originally developed in 2007 by the Stanford Artificial Intelligence Laboratory ([http://stair.stanford.edu/ see Stair Project]), ROS is now widely used by the robotic ecosystem thanks to the open source community and [http://www.willowgarage.com/ Willow Garage] (a robotics research institute/incubator, which produce the famous [http://www.willowgarage.com/pages/pr2/overview PR2] or [http://www.willowgarage.com/turtlebot TurtleBot] and is currently making the main development).<br/> Many robots are supported: [http://www.wifibot.com/ WifiBot], [[Lego Mindstorm NXT]], [http://personalrobotics.ri.cmu.edu/ HERB] (see http://www.ros.org/wiki/Robots for a full list).<br/>
Il supporte des robots comme le [[Wifibot]], le [[TurtleBot]], le [[Lego Mindstorm NXT]] via un hôte Linux, des [[Bras Robotique Handicap| bras robotiques Lynx Motion]] .... ([http://www.ros.org/wiki/Robots voir la liste presque complète]).


A ROS application is organized into "nodes" which are Unix competitors processes. The nodes interact by sending events via "topics" in a publisher-subscriber model. The implementation of internal functions can be achieved in C++ or Python language. Many robotic equipments have their dedicated ROS nodes developped (Lidar, Kinect, ...).
ROS est porté sur plusieurs OS cependant seule la version Ubuntu est rapidement utilisables.


ROS is available on a [http://www.ros.org/wiki/ROS/Installation wide range of OS], but the Ubuntu version, for compatibility reasons and rapid implementation, is the best choice.
De nombreux pilotes d'équipements robotiques (contrôleur moteurs, lidar, télémètre, kinect ...) ont été développés.


In this short page, we propose to you a short ROS start guide, with the most frequent errors you can encounter during your development.
Les 2 principaux langages utilisés sont C++ et Python. Il existe des bindings pour Java et Javascript ([[Node.js]]).
Une application ROS est organisée en ''nodes'' qui sont des processus (Unix) concurrents. Les ''nodes'' interagissent par envoi d'évenements via des ''topics'' en mode [[publish-subscribe]] et bien par invocation d'opérations de service.


Il inclut des démonstrations de vision avec la [[XBox Kinect]] et OpenCV

ROS Industrial (http://rosindustrial.org/) est une version de ROS destinée aux robots industriels. ''a free, open-source, BSD-licensed software library, extends the advanced capabilities of the Robot Operating System (ROS) software to new industrial applications''.


== Installation ==
== Installation ==
''Note: we choose to present to you the latest ROS development environment available (in March 2013): Ubuntu 12.10 and ROS v7 (called Groovy Galapagos). We also work with Ubuntu 13.04 without facing major problems. With its last release, Willow Garage introduced a new ROS build system: catkin. Given the huge amount of packages out there build with rosbuild, and the impossibility to migrate simply from one system to the other, we will continue to use rosbuild. Most of the robotic equipment works with the couple (Ubuntu 12.10 / ROS Groovy), however check before if there is not incompatibility issues (for example: Kinect works better with Ubuntu 12.04 / ROS Fuerte). If you just want to test ROS, a virtual machine archive (.ova) is available (see others section).''

=== Setup sources.list ===
=== Setup sources.list ===
On ubuntu, type on console:
In a terminal, type the following line:
{| class="wikitable centre" width="80%"
{| class="wikitable centre" width="80%"
|-
|-
| align=left | <code><nowiki>sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu <distribution> main" > /etc/apt/sources.list.d/ros-latest.list'</nowiki></code>
| align=left | <code><nowiki></nowiki>
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu <distribution> main" > /etc/apt/sources.list.d/ros-latest.list'
<nowiki></nowiki></code>
|}
|}
where <distribution> is your Ubuntu ditsribution name (e.g. "precise", "quantal", "raring", ...)
where <distribution> is your Ubuntu ditsribution name (e.g. "precise", "quantal", "raring", ...)
This will add ROS repositories to your distribution.


=== Setup your keys ===
=== Setup your keys ===
{| class="wikitable centre" width="80%"
{| class="wikitable centre" width="80%"
|-
|-
| align=left | <code><nowiki>wget http://packages.ros.org/ros.key -O - | sudo apt-key add -</nowiki></code>
| align=left | <code><nowiki></nowiki>
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
<nowiki></nowiki></code>
|}
|}
Now, you are able to download the latest updates from ROS.


=== Installation ===
=== Installation ===
Line 34: Line 36:
{| class="wikitable centre" width="80%"
{| class="wikitable centre" width="80%"
|-
|-
| align=left | <code><nowiki>sudo apt-get update</nowiki></code>
| align=left | <code><nowiki></nowiki>
sudo apt-get update
<nowiki></nowiki></code>
|}
|}


Line 40: Line 44:
{| class="wikitable centre" width="80%"
{| class="wikitable centre" width="80%"
|-
|-
| align=left | <code><nowiki>sudo apt-get install ros-groovy-desktop-full</nowiki></code>
| align=left | <code><nowiki></nowiki>
sudo apt-get install ros-groovy-desktop-full
<nowiki></nowiki></code>
|}
|}
It will install ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception
It will install ROS, rqt, [http://www.ros.org/wiki/rviz rviz], robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception.


Initialize rosdep:
Initialize rosdep:
{| class="wikitable centre" width="80%"
{| class="wikitable centre" width="80%"
|-
|-
| align=left | <code><nowiki>sudo rosdep init
| align=left | <code><nowiki></nowiki>
<br />rosdep update</nowiki></code>
sudo rosdep init<br/>
rosdep update
<nowiki></nowiki></code>
|}
|}
This tool is used to install system dependencies required by ROS packages.


ROS is now installed but in order to run it, some environment variables must be assigned.
Setup the environment:
This can be automatically done at the launch of the session:
{| class="wikitable centre" width="80%"
{| class="wikitable centre" width="80%"
|-
|-
| align=left | <code><nowiki>echo "source /opt/ros/groovy/setup.bash" >> ~/.bashrc
| align=left | <code><nowiki></nowiki>
echo "source /opt/ros/groovy/setup.bash" >> ~/.bashrc
source ~/.bashrc</nowiki></code>
<nowiki></nowiki></code>
|}
|}



Install python tools:
Install python tools:
{| class="wikitable centre" width="80%"
{| class="wikitable centre" width="80%"
|-
|-
| align=left | <code><nowiki>sudo apt-get install python-rosinstall python-rosdep</nowiki></code>
| align=left | <code><nowiki></nowiki>
sudo apt-get install python-rosinstall python-rosdep
<nowiki></nowiki></code>
|}
|}
ROS is now installed but in order to run it, some environment variables must be set assigned.


Finally, execute the script:
==Modules et Outils==
{| class="wikitable centre" width="80%"
* ros : ???
|-
* rosviz : ???
| align=left | <code><nowiki></nowiki>
* rospack : recherche de packages ROS
. ~/.bashrc
<nowiki></nowiki></code>
|}

== Configuration ==

Create a ROS workspace:
{| class="wikitable centre" width="80%"
|-
| align=left | <code><nowiki></nowiki>
rosws init ~/groovy_workspace /opt/ros/groovy<br/>
mkdir ~/groovy_workspace/sandbox<br/>
cd ~/groovy_workspace/sandbox<br/>
rosws set sandbox/
<nowiki></nowiki></code>
|}

Every time you modify or add entries in your workspace, re-source ~/groovy_workspace/setup.bash:
{| class="wikitable centre" width="80%"
|-
| align=left | <code><nowiki></nowiki>
source ~/groovy_workspace/setup.bash
<nowiki></nowiki></code>
|}

== Use ROS ==

=== Principles ===
* Packages
ROS is organized in packages. They include, among other, ROS nodes. They allows developers to easily reuse pieces of software. You can create a package by hand or with the command: <code>roscreate-pkg <package-name></code>. Actually, a ROS package is nothing but a directory descended from ROS_PACKAGE_PATH that has a manifest.xml file in it. A package may include the following contents: <br/>
<code>msg/</code>: message types<br/>
<code>srv/</code>: service types<br/>
<code>scripts/</code>: executable scripts (Pyhton sources for example)<br/>
<code>CMakeLists.txt/</code>: CMake build file (ROS package are build with [CMake], this [http://www.ros.org/wiki/rosbuild/CMakeLists file] describes how to do it)<br/>
<code>manifest.xml/</code>: minimal specification about the package: describes metadata and dependancies (see an [http://www.ros.org/wiki/Manifest#Example example]).<br/>
To build a package, type <code>[http://www.ros.org/wiki/rosmake rosmake] <package-name></code>
* Nodes
ROS nodes are processes, that reside in the same or different machines. Usually, there are many nodes to control a robot (e.g. one for a motor, another one for a sensor, etc.) The nodes are combined together and communicate with topics or services. They get to know each other via a particular node, rosmaster. A node has a name and a type. During an execution, type <code>[http://www.ros.org/wiki/rosnode rosnode] list</code> to list the currently running nodes.
* Topics
A topic is a bus over which nodes communicate data, thanks to the publisher/subscriber model (communication many-to-many). Communication over a topic is unidirectional and asynchronous. Type <code>[http://www.ros.org/wiki/rostopic rostopic] list</code> to list the current topics.
* Services
Services allows nodes to make remote procedure calls (communication one-to-one). Communication over a service is synchronous.
* Launch files
[http://www.ros.org/wiki/roslaunch/XML Launch files] are XML files that specify a list of nodes, topics, services, parameter values and eventually the machines for distributed applications.

=== Useful commandline tools ===
* <code>roscd [package-name]</code>: change directory directly to a package (indepently from your current directory)
* <code>rosls [package-name]</code>: list directory contents directly
* <code>rosnode list</code>: lists the currently running nodes
* <code>rostopic list</code>: lists the current topics
* <code>rosmake [package-name]</code>: build a package

== Graphical tools ==
* [http://www.ros.org/wiki/rviz <code>rviz</code>]: a 3D visualization tool
* [http://www.ros.org/wiki/rxgraph <code>rxgraph</code>] display a graph of the currently running nodes and the topics

== Troubleshooting ==

* Error messages:
** "No ROS_WORKSPACE set": check if your environment variable ROS_WORKSPACE is assigned (<code>echo $ROS_WORKSPACE</code>). If not, update your .bashrc file (<code>echo "export ROS_WORKSPACE=/home/<username>/groovy_workspace" >> ~/.bashrc</code>).
** "No ROS_PACKAGE_PATH set": check if your environment variable ROS_PACKAGE_PATH is assigned (<code>echo $ROS_PACKAGE_PATH</code>). If not, update your .bashrc file (<code>echo "export ROS_PACKAGE_PATH=/home/<username>/groovy_workspace/sandbox/" >> ~/.bashrc</code>).
** "roscd: No such package/stack '<package_name>': check if the package exists and is included in your ROS_PACKAGE_PATH.


== Polytech' Projects which use ROS ==

[[RobAIR2013]]<br/>
[[Armind]]<br/>
[[EA2012_Langages_et_Canevas_pour_la_robotique_de_service]]<br/>
[[RobAIR2013-RICM5-Suivi|RobAIR2013-RICM5]]: XMPP tunneling between ROS nodes, using [[GStreamer]]<br/>
[[Robot d'inspection géotechnique]]


==API==
==API==
===Javascript===
===Javascript===
[http://baalexander.github.com/rosnodejs/ rosnodejs] Programming robots with [[Javascript]] & [[Node.js]]
[http://baalexander.github.com/rosnodejs/ rosnodejs] Programming robots with [[Javascript]] in ROS using [[Node.js]]

===[[Node-RED]]===
[https://www.npmjs.com/package/node-red-contrib-ros node-red-contrib-ros]

==[[Docker]]==
https://hub.docker.com/_/ros/

== Others ==
For industrial robots, a dedicated ROS version exists: [http://rosindustrial.org/ ROS industrial].<br/>
A useful ROS Cheat Sheet:[[File:ROScheatsheet.pdf]]<br/>
A ROS virtual machine with [http://nootrix.com/downloads/ ROS Groovy] or [http://nootrix.com/downloads/ ROS Fuerte] pre-installed (Runs with VirtualBox, VmWare, Parallels…)<br/>
[http://www.ros.org/wiki/Courses Courses] about ROS (read for example this [http://mediawiki.isr.ist.utl.pt/images/3/3d/Intro_to_ros.pdf presentation], and [http://ias.cs.tum.edu/_media/teaching/ss2012/techcogsys/ros-intro.pdf this one]).


==Projets AIR==
== References ==
* [http://www.ros.org/wiki/ ROS official website]
* [[RobAIR2013-RICM5-Suivi|RobAIR2013-RICM5]] tunnelling XMPP entre des nodes ROS. [[GStreamer]]
* [http://barraq.github.io/fOSSa2012/slides.html fOSSa presentation]
* [[Armind]]
* [http://grenoble.labo-robotique.com/installation-et-configuration-de-ros-fuerte/ French guide] (install ROS Fuerte and use NXT)
* [[Robot d'inspection géotechnique]]

Latest revision as of 10:14, 8 December 2017

ROS (a.k.a Robot Operating System or Robot OS), can be seen as a kind of Robotic Framework. Because it can't be installed directly on robotic equipment (ROS needs a computer and works above its OS), it can't be considered as a pure operating system. In addition to providing a complete development and execution environment, ROS includes numerous simulation tools. However, it does not guarantee runtime properties, services or event processing in deterministic time spots (i.e. realtime processing), though it is possible to integrate ROS with realtime code (openCV is supported).
ROS is released under the terms of the BSD license, and is open source software. It is free for commercial and research use.

Groovy is the last version of ROS

Originally developed in 2007 by the Stanford Artificial Intelligence Laboratory (see Stair Project), ROS is now widely used by the robotic ecosystem thanks to the open source community and Willow Garage (a robotics research institute/incubator, which produce the famous PR2 or TurtleBot and is currently making the main development).
Many robots are supported: WifiBot, Lego Mindstorm NXT, HERB (see http://www.ros.org/wiki/Robots for a full list).

A ROS application is organized into "nodes" which are Unix competitors processes. The nodes interact by sending events via "topics" in a publisher-subscriber model. The implementation of internal functions can be achieved in C++ or Python language. Many robotic equipments have their dedicated ROS nodes developped (Lidar, Kinect, ...).

ROS is available on a wide range of OS, but the Ubuntu version, for compatibility reasons and rapid implementation, is the best choice.

In this short page, we propose to you a short ROS start guide, with the most frequent errors you can encounter during your development.


Installation

Note: we choose to present to you the latest ROS development environment available (in March 2013): Ubuntu 12.10 and ROS v7 (called Groovy Galapagos). We also work with Ubuntu 13.04 without facing major problems. With its last release, Willow Garage introduced a new ROS build system: catkin. Given the huge amount of packages out there build with rosbuild, and the impossibility to migrate simply from one system to the other, we will continue to use rosbuild. Most of the robotic equipment works with the couple (Ubuntu 12.10 / ROS Groovy), however check before if there is not incompatibility issues (for example: Kinect works better with Ubuntu 12.04 / ROS Fuerte). If you just want to test ROS, a virtual machine archive (.ova) is available (see others section).

Setup sources.list

In a terminal, type the following line:

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu <distribution> main" > /etc/apt/sources.list.d/ros-latest.list'

where <distribution> is your Ubuntu ditsribution name (e.g. "precise", "quantal", "raring", ...) This will add ROS repositories to your distribution.

Setup your keys

wget http://packages.ros.org/ros.key -O - | sudo apt-key add -

Now, you are able to download the latest updates from ROS.

Installation

Update the Debian packages:

sudo apt-get update

Install the full Groovy configuration:

sudo apt-get install ros-groovy-desktop-full

It will install ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception.

Initialize rosdep:

sudo rosdep init
rosdep update

This tool is used to install system dependencies required by ROS packages.

ROS is now installed but in order to run it, some environment variables must be assigned. This can be automatically done at the launch of the session:

echo "source /opt/ros/groovy/setup.bash" >> ~/.bashrc


Install python tools:

sudo apt-get install python-rosinstall python-rosdep

Finally, execute the script:

. ~/.bashrc

Configuration

Create a ROS workspace:

rosws init ~/groovy_workspace /opt/ros/groovy
mkdir ~/groovy_workspace/sandbox
cd ~/groovy_workspace/sandbox
rosws set sandbox/

Every time you modify or add entries in your workspace, re-source ~/groovy_workspace/setup.bash:

source ~/groovy_workspace/setup.bash

Use ROS

Principles

  • Packages

ROS is organized in packages. They include, among other, ROS nodes. They allows developers to easily reuse pieces of software. You can create a package by hand or with the command: roscreate-pkg <package-name>. Actually, a ROS package is nothing but a directory descended from ROS_PACKAGE_PATH that has a manifest.xml file in it. A package may include the following contents:
msg/: message types
srv/: service types
scripts/: executable scripts (Pyhton sources for example)
CMakeLists.txt/: CMake build file (ROS package are build with [CMake], this file describes how to do it)
manifest.xml/: minimal specification about the package: describes metadata and dependancies (see an example).
To build a package, type rosmake <package-name>

  • Nodes

ROS nodes are processes, that reside in the same or different machines. Usually, there are many nodes to control a robot (e.g. one for a motor, another one for a sensor, etc.) The nodes are combined together and communicate with topics or services. They get to know each other via a particular node, rosmaster. A node has a name and a type. During an execution, type rosnode list to list the currently running nodes.

  • Topics

A topic is a bus over which nodes communicate data, thanks to the publisher/subscriber model (communication many-to-many). Communication over a topic is unidirectional and asynchronous. Type rostopic list to list the current topics.

  • Services

Services allows nodes to make remote procedure calls (communication one-to-one). Communication over a service is synchronous.

  • Launch files

Launch files are XML files that specify a list of nodes, topics, services, parameter values and eventually the machines for distributed applications.

Useful commandline tools

  • roscd [package-name]: change directory directly to a package (indepently from your current directory)
  • rosls [package-name]: list directory contents directly
  • rosnode list: lists the currently running nodes
  • rostopic list: lists the current topics
  • rosmake [package-name]: build a package

Graphical tools

  • rviz: a 3D visualization tool
  • rxgraph display a graph of the currently running nodes and the topics

Troubleshooting

  • Error messages:
    • "No ROS_WORKSPACE set": check if your environment variable ROS_WORKSPACE is assigned (echo $ROS_WORKSPACE). If not, update your .bashrc file (echo "export ROS_WORKSPACE=/home/<username>/groovy_workspace" >> ~/.bashrc).
    • "No ROS_PACKAGE_PATH set": check if your environment variable ROS_PACKAGE_PATH is assigned (echo $ROS_PACKAGE_PATH). If not, update your .bashrc file (echo "export ROS_PACKAGE_PATH=/home/<username>/groovy_workspace/sandbox/" >> ~/.bashrc).
    • "roscd: No such package/stack '<package_name>': check if the package exists and is included in your ROS_PACKAGE_PATH.


Polytech' Projects which use ROS

RobAIR2013
Armind
EA2012_Langages_et_Canevas_pour_la_robotique_de_service
RobAIR2013-RICM5: XMPP tunneling between ROS nodes, using GStreamer
Robot d'inspection géotechnique

API

Javascript

rosnodejs Programming robots with Javascript in ROS using Node.js

Node-RED

node-red-contrib-ros

Docker

https://hub.docker.com/_/ros/

Others

For industrial robots, a dedicated ROS version exists: ROS industrial.
A useful ROS Cheat Sheet:File:ROScheatsheet.pdf
A ROS virtual machine with ROS Groovy or ROS Fuerte pre-installed (Runs with VirtualBox, VmWare, Parallels…)
Courses about ROS (read for example this presentation, and this one).

References