Difference between revisions of "ROS"

From Healthcare Robotics Wiki
Jump to: navigation, search
(Copying ROS from a different user)
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Documentation ==
== Documentation ==
* [http://ros.org ROS homepage].
* [http://ros.org ROS homepage].
* [http://devel.iri.upc.edu/docs/roswiki/Mirrors.html List of ros.org mirrors]
* Tutorials for using [http://www.ros.org/wiki/rospy/Tutorials ROS in Python].
* Tutorials for using [http://www.ros.org/wiki/rospy/Tutorials ROS in Python].
* List of [http://www.ros.org/wiki/ROS/Tutorials ROS tutorials].
* List of [http://www.ros.org/wiki/ROS/Tutorials ROS tutorials].
* ROS specific [http://www.ros.org/wiki/ROS/EnvironmentVariables environment variables].
* ROS specific [http://www.ros.org/wiki/ROS/EnvironmentVariables environment variables].
** Often incorrect environment variables is the cause of ROS trouble.
** Often incorrect environment variables is the cause of ROS trouble.
* As of December 2009, gt-ros-pkg documentation also shows up on ros.org [http://www.ros.org/wiki/gt-ros-pkg here]
** Some links to help documenting your packages:
*** http://www.ros.org/wiki/foote-ros-pkg
*** http://www.ros.org/wiki/PackageDocumentation
*** http://www.ros.org/wiki/WritingTutorials
** Wiki Style Guide: http://www.ros.org/wiki/StyleGuide
== ROS misbehaving after a fresh install/upgrade ==
== ROS misbehaving after a fresh install/upgrade ==

Latest revision as of 16:37, 29 February 2012


ROS misbehaving after a fresh install/upgrade

A very high chance is because of strangeness in your .bashrc, .bashrc.ros and .bashrc.hrl

  • .bashrc.ros : generated by Willow's install script.
  • .bashrc.hrl : hrl specific bash aliases and paths.
  • these two must be sourced in the correct order in your .bashrc
  • The set_bashrc_paths script will work for a fresh install and probably not for anything else.
  • open ~/.bashrc in a text editor by typing: gedit ~/.bashrc
  • Please manually ensure that the last four lines of ~/.bashrc are (Advait. October 24, 2009):
export PATH=/usr/bin:/bin:/usr/local/bin:/usr/sbin:/usr/local/sbin:/sbin:/usr/games
source ~/.bashrc.ros
source /home/advait/.bashrc.hrl

Copying ROS from a different user

Although not recommended, if you want to be paranoid about having the same ROS version, you might try to copy someone else's ROS repository. Some things that might help (Advait hasn't verified all these):

  • Use scp instead of cp
  • before running make in $ROS_ROOT, clean CMakeCache.txt: rm -f `find . -name CMakeCache.txt`
  • make ros.
  • Initially, use rosmake with the --pre-clean option:
    • rosmake --pre-clean hrl_lib
    • Alternately, if you get errors about CMakeCache.txt pointing to someone else's directory, run rosmake with the --pre-clean option.

rosmake Compilation errors

  1. If you try to rosmake [package name] and you get compilation errors, you probably have to run rosdep install [package name] first in order to install the package's dependencies. Then go ahead and try rosmake [package name] again.

ROS Packaging Tutorial

See Willow Garage's page about ROS for more comprehensive information.

  • Go to your GT-ROS repository and copy the sample package folder. Below, replace "my_package" with your package name:
cd ~/svn/gt-ros-pkg/hrl
cp -r sample_pkg/ my_package
  • In the src/ directory of the folder you just created, create a new folder with the SAME name as your package:
cd my_package/src
mkdir my_package

Note: The directory listing should look like: ~/svn/gt-ros-pkg/hrl/my_package/src/my_package. The reason for this format is so that if your package happens to contain files of the same name as someone else's, python won't get confused as to which one you want to use. Thus, we want to stick all the source files into the last folder we just created.

  • Now, copy all the source files that you want in the package into ~/svn/gt-ros-pkg/hrl/my_package/src/my_package. (use the "cp" command)
  • If you do not have a file called "__init__.py", perform this:
touch __init__.py

Note: This creates an empty, dummy file with that name. Python will not run unless it sees this file.

  • In EACH of your python files, you MUST copy and paste our software license at the top. It is just a bunch of text with "#" characters to comment it out. Copy this text from any of the files other lab members have committed. Or, you can also find this in: ~/svn/gt-ros-pkg/hrl/LICENSE.txt

At the end of the license, add a commented line that reads:

# \author myfirstname mylastname (Healthcare Robotics Lab, Georgia Tech.) 

Add additional authors as needed.

  • If any of your python files are executable, add #!/usr/bin/python to the top line of your file. Then do this:
cd ~/svn/gt-ros-pkg/hrl/my_package/
mkdir bin
cd bin
ln -s src/my_package/my_executable.py my_executable.py   //this simply creates a shortcut to your executable in bin/
  • Now you are ready to create your ROS node(s).
  • First, figure out what the inputs and outputs of your package will be. Then, select (or create new) a file.msg that contains declarations of the data types that best characterize your data to be passed. These files containing the declarations are part of the ICP or messages in ROS.

[insert more instructions here]

cd ~/svn/gt-ros-pkg/hrl/my_package/src/my_package
vim xxx_node.py     
add !/usr/bin/python to the top line of your file and also make sure to add the license header! (see above)
  • Add your package name to the Python path setup script:
vim /svn/robot1/scripts/helper_scripts/set_gt-ros-pkg_paths.sh (or the editor of your choosing :p)

Go to the variable called "PACKAGE_LIST" and add the name of your package, taking care to leave a space in between the names.

  • Run the script and update:
  • Add a description of your package name to our Google code Wiki. Note that the package names are in alphabetical order.


Special Cases

If your package depends on something located in ~/svn/robot1/src/libraries, then you will need to move that function to ~/svn/gt-ros-pkg/hrl/hrl_lib. But DON'T do it yet! Ask Hai or Advait first!


  1. rospack_add_executable does not like .c files. If things don't link, try renaming .c files to .cpp
  2. remember to add genmsg and/or gensrv to compile the messages.
  3. if you copy CMakelists.txt from another package - it has a line rospack(<package name>). Be sure to change this to the current package's name or else the dependencies will not get loaded and things won't compile.


  1. rosdep satify rviz > a.sh
  2. bash a.sh
  3. sudo apt-get install libwxbase2.8-dev libwxgtk2.8-dev
  4. rosmake rviz