The Robotic Operating System at a Glance
Introduction, Showcases, Demonstration and Perspectives.
![Robotic Operating System](media/ROS.png)
![](media/inria_logo.jpg)
![](media/cnrs_logo.jpg)
![](media/lig_logo.jpg)
<HTML5> presentation realized with deck.js and hosted on github
this is an HTML5 presentation realized with the open source framework deck.js and deck.ext.js
this presentation is hosted on Github at https://github.com/barraq/fOSSa2012
this presentation is served by Github at http://barraq.github.com/fOSSa2012/slides.html
![](media/Barraquand.png)
![](media/Negre.jpg)
Presentation Overview
- Introduction to ROS
- Motivation for ROS
- What is (not) ROS
- ROS Concept
- ROS Tools
- Getting Started with ROS
- C++
- Python
- Java
- Show Cases
- Personally Assisted Living
- Perception for on road vehicle
- Robot Prototyping
- Conclusion and Perspectives
- Live Demonstration
![](media/overview_path.jpg)
What are the motivations for a common robotic infrastructure?
Introduction to ROS
Motivation for ROS
A Robot is a composition of different components
- Hardware components
- Computational Units (FPGA, PC, Microcontroller, …)
- Actuators (Motor, …)
- Sensors (Camera, IR, LIDAR, …)
- Software components
- Hardware drivers
- Robot servoing
- Perception
![](media/bioloid_robot_parts.jpg)
![](media/bioloid_robot_humanoid.jpg)
A Robotic application is an interconnection of components
- Heterogenous components
- Cross-language
- Cross-platform
- Distributed components
- Multi-robots
- Multi-PC
- Multi-network
- Dynamic components
- Appear, Disappear (mobility)
- Crash, Evolve
Both Robots and a Robotic Applications are an assemblage of many other people's components
⇒ Need for a common Robotic Operating System
![Robotic Operating System](media/ROS.png)
What is ROS?
What is (not) ROS
ROS is a 'Meta' Operating System for Robotics Applications
- An open source robotics framework
- Maintained by Willow Garage (PR2, TurtleBot, ROS, OpenCV, PCL, …)
- Cross-platform (Ubuntu, OSx, Windows, Android, …)
- Cross-language (C/C++, Python, Java, …)
- An architecture for distributed inter-process/inter-machine communication and configuration
- Object like message wrapping/unwrapping
- Message passing (Publisher/Subscriber, RPC)
- Graph node communication with master node
- Centralized configuration
- A collection of tools
- packaging, dependency/build management, shell introspection, …
- runtime tools, data analysis, graphic user interfaces, …
- A Large community with thousand (and counting) existing modules
What ROS is not?
- Not an operating system, instead runs on
- Ubuntu (official)
- Windows, OS X, Fedora, Android (experimental)
- Not a programming language
- C++, Python (official)
- Java+Android, Octave, … (experimental)
- Not a programming environment but a programming toolkit
- Not a hard real time architecture
- Not designed for embedded systems (refer to rosserial)
ROS Concepts
ROS Concepts
A ROS application is a graph of nodes
- Node = a process that used the ROS framework
- Different Nodes may reside in the same or different machines transparently
- Nodes get to know one another via rosmaster
![](media/graph_node.png)
Nodes in this graph communicate using two protocols
- Topics
- asynchronous,
- data flow, message passing,
- typed by a Ros Message (message.msg);
- Services
- synchronous,
- remote procedure call (Request --- Answer messages),
- typed by a Ros Service (service.srv);
Messages & Services are statically defined
$ rosmsg show knx_control/KNXDataPoint
string name
string address
string dptID
string priority
bool stateBased
int32 mainNumber
$ rossrv show knx_control/SetDataPoint
string address
string value
---
string value
![Topics protocol](media/topic_protocol.png)
- Directory used for topics discovery : ROS Master;
- Multiple concurrent publishers / subscribers for a single topic;
- Publish / subscribe order irrelevant.
![Service protocol](media/service_protocol.png)
- Directory used for service discovery : ROS Master;
- Multiple simultaneous clients.
Roscore = rosmaster + parameter server + log aggregator
Rosmaster
- directory for publisher / subscribers / services,
- XMLRPC API,
- not a central communication node.
Parameter server
- centralized parameter repository,
- provides parameter access to all nodes,
- XMLRPC data type.
Log aggregator
- subscribes to /out topic,
- store output on filesystem.
Automate startup of complex ROS applications.
Launch files are XML files specifying :
- list of nodes,
- with topics / service remapping,
- parameter values,
- machines for distributed applications.
<launch>
<include file="$(find ikio)/launch/ikio.launch"/>
<node pkg="tf" type="static_transform_publisher"
name="base_link_to_cam"
args="1 0 1.3 3.14 0 0 base_link camera_link 10" />
<arg name="marker_size" default="8" />
<node name="ar_track_alvar" pkg="ar_track_alvar" type="individualMarkers" respawn="false" output="screen" args="$(arg marker_size) " />
<node name="ar_to_pose" pkg="ikio" type="ar_to_pose" output="screen"/>
</launch>
Ros code is grouped at two different levels
Packages
- atomic unit of building,
- can contain anything : nodes, messages, tools, launch files, etc.
- in their most basic form :
- package_name
- package_name/Makefile
- package_name/CMakeLists.txt
- package_name/manifest.xml
Stacks
- atomic unit of "releasing",
- collection of packages for distribution,
- in their most basic form :
- stack_name
- stack_name/package_name_1
- stack_name/package_name_n
- stack_name/stack.xml
ROS Tools
ROS Tools
- rosnode list nodes and interconnections,
- rxgraph display connection graph
![rxgraph](media/rxgraph.png)
- rostopic list topics, print message information, echo messages
- rosservice list services, call services, print service information
- different verbosity levels (info, debug, error, etc.),
- published on an unique topic /rosout,
- rxconsole for online inspection,
- automatic dumping to file system for offline analysis.
![rxconsole](media/rxconsole.png)
- full 3D visualization,
- display almost all standard sensor messages and frames,
- plugin system to handle build-in messages.
![rviz](media/rviz.png)
- rosbag record : generic subscriber,
- container : bagfile,
- rosbag play : generic publisher,
- rxbag : graphic interface.
![rxbag](media/rxbag.png)
Robot
- set of rigit bodies linked together;
- each sensor obtain measurements in its local reference.
In ROS
- set of Transformation Frames,
- linked by transformations,
- organized in a directed tree,
- published on a single topic /tf,
- each sensor data is associated to a frame.
![frames](media/frames2.png)
- sensors : almost all common used robotics sensors,
- robots : depends on constructors.
- SLAM (localization and mapping),
- navigation,
- 3D perception,
- simulation;
... and see a lot more during the demo session!
Getting Started with ROS
- Introduction to ROS
- Getting Started with ROS
- Create a New Package
- Create a New Message Type
- Publisher/Subscriber in C++
- Publisher/Subscriber in Python
- Publisher/Subscriber in Java
- Showcases
- Personally Assisted Living Application
- On Road Vehicle Application
- Prototyping Robots
- Conclusion and Perspectives
- Live Demonstration
![](media/overview_path.jpg)
Create a New Package
Create a New Package
- Head to your ROS workspace
$ roscd
- Create an empty package :
$ roscreate-pkg pkg_name
- Edit pkg_name/manifest.xml :
<package> <description brief="pkg_name"> My package description </description> <author>Mr Bob</author> <license>BSD</license> <review status="unreviewed" notes=""/> <url>http://ros.org/wiki/pkg_name</url> <depend package="geometry_msgs/Twist" /> </package>
Create a New Message Type
Create a New Message Type
In ROS msg and srv types definition are stored respectively in pkg_name/msg and pkg_name/srv
- Create the msg/Custom.msg file
# this is some custom message string someText uint8 someNumber geometry_msgs/Twist[] someTwistArray
Basic data types are:
- int{8,16,32,64}
- float{32,64}
- string
- time
- duration
- array[]
Packages type:
- pkg_name/type_name
- pkg_name/type_name[]
Publisher/Subscriber in C++
Publisher/Subscriber in C++
ROS uses CMake and provides a rosmake command utility
- Add roscpp dependency in the manifest.xml :
<depend package="roscpp" />
- Edit pkg_name/CMakeLists.txt
#uncomment if you have defined messages rosbuild_genmsg() #uncomment if you have defined services #rosbuild_gensrv() #common commands for building c++ executables and libraries rosbuild_add_executable(my_publisher src/my_publisher.cpp) rosbuild_add_executable(my_subscriber src/my_subscriber.cpp)
#include "ros/ros.h"
#include "pkg_name/Custom.h"
int main(int argc, char **argv) {
ros::init(argc, argv, "my_publisher"); // init ROS
ros::NodeHandle n; // handle to create publisher, subscriber, services, etc.
ros::Publisher pub = n.advertise("my/custom/topic", 1000); // create publisher
pkg_name::Custom custom_msg; // Message to be sent
ros::Rate loop_rate(10); // synchronization rate (set at 10 Hz)
while (ros::ok()){
custom_msg.someText="some text";
point_pub.publish(custom_msg); // send the message
ros::spinOnce(); // manage ros events
loop_rate.sleep();
}
return 0;
}
#include "ros/ros.h"
#include "pkg_name/Custom.h"
void msgCallback(const pkg_name::Custom::ConstPtr& msg) {
ROS_INFO("My custom text : %s", msg->someText.c_str() );
}
int main(int argc, char **argv) {
ros::init(argc, argv, "my_subscriber"); // init ROS
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("my/custom/topic", 1000, msgCallback);
ros::spin(); // ROS spin loop
return 0;
}
- Build the package
$ rosmake pkg_name
- Run roscore
$ roscore&
- Run publisher
$ rosrun pkg_name my_publisher
- Run subscriber
$ rosrun pkg_name my_subscriber [ INFO] [1354267632.389733464]: My custom text : some text [ INFO] [1354267632.489738852]: My custom text : some text
Publisher/Subscriber in Python
Publisher/Subscriber in Python
- Create a directory in pkg_name to put your nodes in e.g. pkg_name/nodes
- Create the nodes/publisher.py file
#!/usr/bin/env python import rospy; roslib; roslib.load_manifest('pkg_name') from pkg_name.msg import Custom def publisher(): pub = rospy.Publisher('my/custom/topic', Custom) rospy.init_node('publisher') while not rospy.is_shutdown(): m = Custom(someText = "some text") pub.publish(m) rospy.sleep(1.0) if __name__ == '__main__': try: publisher() except rospy.ROSInterruptException: pass
- Create the nodes/subscriber.py file
#!/usr/bin/env python import rospy; roslib; roslib.load_manifest('pkg_name') from pkg_name.msg import Custom def callback(data): rospy.loginfo(rospy.get_name() + ": I heard %s" % data.someText) def subscriber(): rospy.init_node('listener', anonymous=True) rospy.Subscriber("my/custom/topic", Custom, callback) rospy.spin() if __name__ == '__main__': subscriber()
- Make both nodes executable
$ chmod +x nodes/*.py
- Build the package (only for the msgs)
$ rosmake pkg_name
- Run roscore
$ roscore
- Run the nodes
$ rosrun pkg_name publisher.py
$ rosrun pkg_name listener.py
Publisher/Subscriber in Java
Publisher/Subscriber in Java
ROS for Java is not yet officially supported
- Old JNI API http://www.ros.org/wiki/rosjava_jni (deprecated)
- New Java only implementation http://rosjava.googlecode.com
Developed at Google in cooperation with Willow Garage
ROS for Java is slightly different
- Uses an alternative build system Gradle
- Revisited API (take benefit of Java language, asynchronous)
- More threads, fewer processes (Java Node ≡ C++ Nodelets)
ROS for Java is android friendly
- Uses the same API
- Provides additional classes (ROSActivity, Views, …)
- … but still in an alpha mode
- Create a build.gradle file (see build.gradle example) in pkg_name directory
- Add a custom task in build.gradle for better integration with rosrun
... // create a standard binary in /bin for rosrun task deployApp(dependsOn: 'installApp') << { File binDir = new File(project.projectDir, '/bin') if (!binDir.isDirectory()) { println "Creating $binDir directory" binDir.mkdirs() } File link = new File(binDir,"execute") File target = new File(project.projectDir, "build/install/$project.name/bin/$project.name") println "Creating symlink from $link.absolutePath to $target.absolutePath" ant.symlink(link: link.absolutePath, resource: target.absolutePath) } ...
- Put your your Java sources in src/main/java and your tests in src/test/java
- Implement a Node
import org.ros.namespace.GraphName; import org.ros.node.Node; import org.ros.node.NodeMain; public class MyNode implements NodeMain { public GraphName getDefaultNodeName() { return new GraphName("my_node"); } public void onStart(ConnectedNode node) {} public void onShutdown(Node node) {} public void onShutdownComplete(Node node) {} public void onError(Node node, Throwable throwable) {} }
public class Publisher extends AbstractNodeMain {
public GraphName getDefaultNodeName() {
return new GraphName("publisher");
}
public void onStart(final ConnectedNode connectedNode) {
final Publisher<pkg_name.Custom> publisher = connectedNode.newPublisher(
"my/custom/topic", pkg_name.Custom._TYPE);
connectedNode.executeCancellableLoop(new CancellableLoop() {
protected void setup() {}
protected void loop() throws InterruptedException {
pkg_name.Custom msg = publisher.newMessage();
msg.setSomeText("Hello world!");
publisher.publish(msg);
Thread.sleep(1000);
}
});
}
}
public class Subscriber extends AbstractNodeMain {
public GraphName getDefaultNodeName() {
return new GraphName("listener");
}
public void onStart(ConnectedNode connectedNode) {
final Log log = connectedNode.getLog();
Subscriber<pkg_name.Custom> subscriber = connectedNode.newSubscriber(
"my/custom/topic", pkg_name.Custom._TYPE);
subscriber.addMessageListener(new MessageListener<pkg_name.Custom>() {
public void onNewMessage(pkg_name.Custom message) {
log.info("I heard: \"" + message.getSomeText() + "\"");
}
});
}
}
- Rebuild and redeploy rosjava (to build java classes/interfaces for msgs and srvs)
$ roscd rosjava_core $ ./gradlew install
- Head back to you package and build it
$ roscd pkg_name
$ rosmake pkg_name
$ gradle build - Run roscore
$ roscore
- Run the nodes
$ rosrun pkg_name execute your.package.path.Publisher $ rosrun pkg_name execute your.package.path.Subscriber
Showcases
- Introduction to ROS
- Getting Started with ROS
- Showcases
- Using ROS for Personally Assisted Living Application
- Using ROS for On Road Vehicle Application
- Using ROS for Prototyping Robots
- Conclusion and Perspectives
- Live Demonstration
![](media/overview_path.jpg)
Using ROS for Personally Assisted Living Applications
Personally Assisted Living Application
focusing on the INRIA Large Scale Initiative Action on Personally Assisted Living (http://pal.inria.fr)
Development of technologies that can provide services for improving the quality of life for elderly and fragile persons, as well as their immediate family, caregivers and social groups
- Heterogenous, distributed and mobile platforms and technologies
- Multi-site (medical team, families, caregivers, …);
- Smart spaces (Sensors/Actuators, KNX, Zigbee, Bluetooth, Wireless, …)
- Medical and healthcare devices (diagnostic, mobility, assistance, …)
- Personal and assistance robots (social interaction, physical and cognitive entertainment)
- Realtime and distributed processing
- Dynamic and constantly evolving technologies
- Recording Terabytes of data for medical and scientific experimentations/diagnostics
- Collaborative initiative
- Experimental infrastructure
![](media/pal_context1.jpg)
![](media/pal_context2.jpg)
Each team/partner is an ecosystem characterized by
- its knowledge e.g. "software culture"
- its resources and tools e.g. engineers, experimental platforms, etc…
- its competences and approaches e.g. fields/themes for research, etc…
- its habits Windows/Linux, Java/C++, etc…
- its needs and constraints e.g. Real Time, Reliability, Mobility, Heterogeneity, etc…
Find an ecologic and a pragmatic solution
- easy to use e.g. minimum configuration, use friendly API, …
- non intrusive e.g. few lines of code, …
- cross platforms/language
- reliable, efficient and maintained
- widely accepted e.g. used by each partners, with exiting community …
- target for PAL i.e. not more not less
A Gate is a concept
- is an ecologic and hermetic interface between different ecosystems
- is a view of an ecosystem
- is characterized by a set of functionalities
- is provided/deployed by each partners
- publishes/subscribes information to/from other gates
- propagates information to/from its ecosystem
- provides types and means used for its communication
![](media/solution.jpg)
PALGate is an implementation of gate for PAL based on ROS
- is a ROS Stack
- provides a set of conventions (stack organization, package/node/topic/service names, namespaces, …)
- composed of Gate's types ROS package
- provides dedicated command line utilities
- provides dedicated web interface
a Gate in PALGate
- provides a msg package
- provides a srv package
- starts ROS nodes which subscribe/publish to ROS topics, register/provide ROS services in a normalized namespace
![](media/palgate_example.png)
![](media/palgate_web.png)
![](media/wheelchair_2.png)
![](media/knx_1.png)
![](media/knx_2.png)
![](media/default_demo_img.png)
Using ROS for On Road Vehicle Applications
On Road Vehicle Application
Development of perception algorithms to improve car safety
- Platform with lot of sensors (stereo-camera, LIDAR, IMU, GPS, Can, etc.)
- Real Time Processing
- Visualization for demonstration and for analysis
- Recording Terabytes of data for off line experimentations
![](media/Lexus1.jpg)
![](media/Lexus2.jpg)
![](media/arosdyn.png)
Using ROS for Prototyping Robots
Prototyping Robots
iKio is a sociable device and is fully open source
![](media/iKio.png)
iKio v0.1 was prototyped out of Bioloids
![](media/bioloid_robot_parts.jpg)
iKio v0.1 was prototyped out of Bioloids
![](media/ikio_prototype_1.jpg)
![](media/ikio_prototype_2.jpg)
low level control of iKio v0.1 motors is based on BrBrain
![](media/ikio_controller.jpg)
![](media/ikio_control_graph.png)
iKio v0.1 kinematic model was expressed using URDF
![](media/modeliKio1.png)
![](media/modeliKio2.png)
![](media/modeliKio4.png)
iKio v0.1 early expressions were sketched
![](media/ikio_animation_kinetag.png)
![](media/ikio_animation_concept.png)
iKio v0.1 early expressions were sketched
openni_camera + ar_track_alvar + tf + ik + (rviz) + ikio_motor_controler
![](media/ikio_animation.png)
Conclusion and Perspectives
- Introduction to ROS
- Getting Started with ROS
- Showcases
- Conclusion and Perspectives
- Live Demonstration
![](media/overview_path.jpg)
Presentation Wrap up
The objectives of this presentation were
- Introduce you to ROS
- Node, rosmaster, roscore
- Topic, Service
- rostopic, rosmsg, rosservice, rossrv, rospack, rosstack, ...
- rosbag, rxgraph, rviz, tf
- Get you started
- create package and messages
- write publisher/subscriber in c++/python/java
- Illustrate different usages of ROS
- Personally Assisted Living Application http://pal.inria.fr
- On Road Vehicle Application
- Quick prototyping of robot: iKio
- Interact (ask questions, ask for live actions) through a live demo
- be patient...!
Quick Conclusion & Perspectives
ROS is great but ROS community makes it awesome
- ROS provides a powerful infrastructure for developping {robotics} applications
- ROS community provides huge variety of modules (stacks, packages)
ROS is great but can be better
- "ROS is kind of the DOS of component/service oriented middleware"
- Not a state of the art middleware
- Fuzzy concepts (ROS service vs. SOA service? ROS service vs. ROS action, ...)
- Missing dynamic discovery/introspection (dnssd)
- Dynamic/distributed master (maybe no need of master)
- Dynamic discovery of topics, services
- Dynamic introspection/filtering of topics, services
- Dynamic notification/handler
- Not fully cross-platform (please contribute)
- ROS is growing really fast => challenges??
ROS is about YOU, so get ROS and get dirty!
Useful Links
Demonstration
- Introduction to ROS
- Getting Started with ROS
- Showcases
- Conclusion and Perspectives
- Live Demonstration
![](media/overview_path.jpg)
Thank you
Rémi Barraquand & Amaury Negre | fOSSa 2012, ROS Framework | Dec 4, 2012 / |