ROS

From Healthcare Robotics Wiki
Revision as of 22:18, 20 November 2009 by Haidai (Talk | contribs)

Jump to: navigation, search

Documentation

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):
unset PYTHONPATH
export PATH=/usr/bin:/bin:/usr/local/bin:/usr/sbin:/usr/local/sbin:/sbin:/usr/games
source ~/.bashrc.ros
source /home/advait/.bashrc.hrl

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:
./set_gt-ros-pkg_paths.sh
~/.bashrc 
  • Add a description of your package name to our Google code Wiki. Note that the package names are in alphabetical order.

http://code.google.com/p/gt-ros-pkg/wiki/hrl_content_summary

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!

cmake

  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.

rviz

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