[ros-users] ros alias

Thibault Kruse kruset at in.tum.de
Tue Nov 1 19:15:35 UTC 2011

Hi all,

I had another idea that I have implemented, not sure how useful it will be.

With rosalias you can create alias files to use in your shell.
The command generates aliases for all executables it finds in the ROS 
packages or stacks you give to it in the form of
alias PrefixPackageName-Filename=rosrun PackageName Filename
When PackageName == Filename it just creates
alias PrefixFilename=...
e.g. think rviz, gazebo, map_server, ...
It looks in the directories bin, nodes, scripts, launch and 
sub-directories of launch.
Similarly it will also alias .launch files in any of those directories, 
using roslaunch.

$ rosrun rosalias rosalias simulator_gazebo
alias r-gazebo_tools-gazebo_model="rosrun gazebo_tools gazebo_model"
alias r-gazebo_worlds-cups.launch="roslaunch gazebo_worlds cups.launch"
alias r-gazebo_worlds-desk1.launch="roslaunch gazebo_worlds desk1.launch"
alias r-gazebo_worlds-gdbrun="rosrun gazebo_worlds gdbrun"
alias r-gazebo-urdf2model="rosrun gazebo urdf2model"
alias r-gazebo="rosrun gazebo gazebo"
alias r-gazebo-set_model_pose="rosrun gazebo set_model_pose"
alias r-gazebo-spawn_model="rosrun gazebo spawn_model"

The benefits I see are:
- No need to remember whether it was roslaunch or rosrun you wanted co call
- Tab completion showing contents of stacks or other namespaces, e.g. 
consider the "gazebo" namespace above.
- Less keystrokes (e.g. "r-rviz" instead of "rosrun rviz rviz", and you 
may even get rid of the "r-" prefix )

The drawbacks I see are:
- personalized commands not working when you work on other environment
- users don't understand what happens behind the scenes, start using 
aliases in scripts, ...
- code completion for ROS executables would depends on alias name
- so many aliases gives me the shivers

Is this a very bad or a very good idea for other reasons i don't yet see?


More information about the ros-users mailing list