Tuesday, December 20, 2011

ROS - Robot Operating Systems

You can find my notes in installation of ROS in a mac and the tutorials that are available on their website

ROS - meta operating system for your robot. It provides hardware abstraction, low level device control, implementation of commonly used functionality, message passing between processes and package management.

Ot provides tools and libraries for obtaining, building, writing and running code across multiple computers. 

Communication in ROS - several different sytles of communication
1. synchronous RPC style communication over services
2. asynchronous streaming of data over topics
3. storage of data on a peremeter server.

ROS is not realtime framework though it is possible to integrate

ROS file system level -
1. Packages - are used to organize software. packages contain runtime processes (nodes), ROS dependent library, datasets config files
2. Manifests - contain metadata about packages
3. stack - aggregation of packages to perform a function. ex navigation stack
4. Stack Manifest - metadata about stacks.
5. Message types : data structures for messages sent in ROS.
6. Service types - request and response data structures for services.

ROS Computation Graph Level -
Computation Graph - a peer to peer network of ROS processes that are processing data together. The concepts of computation graph are

1. nodes - processes that perform computation. It is an executable file within an ROS package. It uses a ROS client library to communicate with other nodes. Nodes can publish or subscribe to a topic. It can also provide or use a service

2. master - ROS master provides name registration and lookup to the rest of the computation graph. The master enables the nodes to find each other, exchange messages or invoke services

3. parameter server - allows data to be stored by key in a central location. Part of master.

4. messages - similar to c structs. used to communicate between the nodes

5. services - Request/Reply - 2 data structures, one for request the other for reply. A node offers a service under a name. A client uses the service by sending a request to the node and waiting for a response. This is presented to the programmer as a remote procedure call.

6. topics - messages routed via the publish/subscribe semantics. A node publishes a message under a topic. A node interested in certain kind of data will subscribe to that topic. There may be multiple concurrent publishers and subscribers in a topic.  publishers and subscribers do not know each other. this is done to decouple the production and consumption of information.

7. bags - format for saving and playing back ROS message data. used to store data like sensor data that can be difficult to collect.

1. ROS master stores topics, services and registration information of all nodes
2. nodes communicate with the master to provide registration information
3. nodes make connections with other nodes using information present in the ROS master
4. Master callbacks nodes when registration information changes.

nodes connect to other nodes directly.  The commonly used protocol is TCPROS. The master acts like a DNS server. TCPROS uses TCP/IP sockets

Command line remapping of names - A compiled program can be recompiled at runtime to operate in a different computation graph topology. This is done using the names. 

Graph Resource Names - provide encapsulation in ROS. Each resource in defined within a namespace which may share other resources. Resources can create resources within their namespace and they can access resources within or above their namespace. connections can be made between resources in different namespaces but this is achieved by integrating the code above both namespaces.

valid names
1. first character should be alpha character or tilde  or forward slash /
2. subsequent characters can be alphanumeric underscore forward slashes

4 types of graph resource names in ROS
1. base    - base
2. relative    - relative/name
3. global     - /global/name
4. private     -˜private/name

Client libraries
Collection of code that is used for programming. lets us create ROS nodes, publish and subscribe to topics, write and call services and use the parameter server.
C++ and Python support
rospy, roscpp

Installation of ROS in MAC

Error 1
When installing ROS in MAC, there comes a point where a number of tools are required to be installed. The installer automatically generates the scripts required to install the tools. It asks for your password. But the terminal sort of crashed and did not accept even if my password was correct.

The solution to this is we need to manually install the tools before installing ROS.

Dependencies in MAC -
sudo port install py26-pil
sudo port install py26-numpy
sudo port install google-test
sudo port install log4cxx
sudo port install boost
sudo port install py26-paramiko

run the ROS installer command from http://www.ros.org/wiki/electric/Installation/OSX

Error 2:
rosinstall command not found.
roslocate command not found

export PATH=$PATH:/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin

Assume ROS is installed in ros_sw folder
The file system is found inside the ros_sw. It is composed of
1. packages - contains libraries, tools etc. lowest level of ROS software organization
2. package manifests - description of a package, defines dependencies between packages
3. stack - collection of packages to form a higher level library
4. stack manifests - information on stack

File system tools.
rospack suite -
To get information about packages and stacks
rospack find [package name]
rosstack find [stack name]

rosbash suite -
1. change directory to a package or stack  - roscd [locationname[/subdir]]
2. list - rosld [locationname[/subdir]]

Tutorial - Creating a ROS package
roscreate-pkg - create package
rospack - list package dependencies

1. roscreate-pkg [package_name] [depend1][depend2][depend3]

2. rospack
rospack profile - to make changes to the path so that new directories are found
rospack find [package]

roscreate-pkg = ros+create-pkg : generates all the files needed to create a ROS package
rospack = ros+pack(age) : provides information related to ROS packages
rosstack = ros+stack : provides information related to ROS stacks

If rospack fails, that implies that your workspace is not listed in the ROS_PACKAGE_PATH. Open .bashrc and add this at the end. (after sourcing setup.bash line)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/Location/to/workspace

1. rosdep install [package] _ install system dependencies required by ROS packages
2. rosmake [package] - to build a package we created
3. rosmake [package1] [package2] [package3]

Client Libraries
1. rospy - python client library
2. roscpp - C++ client libraries

3. roscore - first thing you should run when using ROS
4. rosnode  list - shows a list of all running  nodes
5. rosnode info [node] - shows more information about a node
6. rosrun [package_name] [node_name] - Run a particular node from a package 

rosmake rxtools
Running rxgraph gives the following error 
Error - ImportError: No module named gobject

The problem here is the symbolic link to python.
make sure the link to python in /usr/bin points to /opt/local/bin/python2.6
sudo mv /usr/bin/python /usr/bin/python_old
sudo ln -fsv /opt/local/bin/python2.6 /usr/bin/python

rosdep install rxtools
rosdep install rxgraph

Make sure all the following dependencies are met
sudo port install graphviz
sudo port install py26-cairo py26-gobject py26-gtk py26-wxpython
sudo port install py26-gtk

rosdep satisfy [package_name]


1 comment:

  1. can u tell me how to run multipl pr2s in ros ?