Difference between revisions of "ROS"
(→ROS misbehaving after a fresh install/upgrade)
|Line 18:||Line 18:|
== rosmake Compilation errors ==
== rosmake Compilation errors ==
Revision as of 17:53, 28 November 2009
- ROS homepage.
- Tutorials for using ROS in Python.
- List of ROS tutorials.
- ROS specific environment variables.
- Often incorrect environment variables is the cause of ROS trouble.
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
Copying ROS from a different user
Although not recommended, sometimes, 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
- 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:
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.
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!
- rospack_add_executable does not like .c files. If things don't link, try renaming .c files to .cpp
- remember to add genmsg and/or gensrv to compile the messages.
- 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.
- rosdep satify rviz > a.sh
- bash a.sh
- sudo apt-get install libwxbase2.8-dev libwxgtk2.8-dev
- rosmake rviz