alias roscd 'cd `rospack find \!*; if ($status) rosstack find \!*;`'
alias rcd roscd
alias rosls 'ls `rospack find \!*`'
#alias rosd 'echo "unimplemented"'
#alias rospd 'echo "unimplemented"'
#alias rosed 'echo "unimplemented"'
#alias roscat 'echo "unimplemented"'
#alias roscmd 'echo "unimplemented"'
#alias roscp 'echo "unimplemented"'

complete roscd 'p/1/`rospack list-names && rosstack list-names`/' 
complete rosmake 'p/*/`rospack list-names && rosstack list-names`/' 
complete rosupdate 'p/1/`rospack list-names && rosstack list-names`/' 
complete rosdeb 'p/*/`rospack list-names && rosstack list-names`/' 

complete rosdep \
   'p/1/(help generate_bash install depdb what_needs check satisfy)/' \
   'n/{generate_bash,install,depdb,check,satisfy}/`rospack list-names`/' 

complete rospack \
   'p/1/(help find list list-names langs deps deps-manifests deps1 deps-indent rosdeps rosdeps0 vcs vcs0 depends-on)/' \
   'n/{find,deps,deps-manifests,deps1,deps-indent,rosdeps,rosdeps0,vcs,vcs0,depends-on,depends-on1,export,cflags-only-I,cflags-only-other,libs-only-L,libs-only-l,libs-only-other}/`rospack list-names`/' 

complete rosstack \
   'p/1/(help find list list-names langs deps deps-manifests deps1 deps-indent rosdeps rosdeps0 vcs vcs0 depends-on)/' \
   'n/{find,deps,deps-manifests,deps1,deps-indent,rosdeps,rosdeps0,vcs,vcs0,depends-on,depends-on1,export,cflags-only-I,cflags-only-other,libs-only-L,libs-only-l,libs-only-other}/`rosstack list-names`/' 

complete rostopic \
   'p/1/(hz echo type list)/' \
   'n/{echo,hz,type}/`rostopic list | sort -u`/' 

complete rosmsg \
   'p/1/(show users package packages)/' \
   'n@{show,users}@`rostopic list -v | grep " \* " | cut -f 4 -d " " | grep -v unknown | sed -e "s/[\d93\d91]//g"`@' \
   'n/{package,packages}/`rospack list-names`/'

complete rossrv \
   'p/1/(show users package packages)/' \
   'n@{show,users}@`rostopic list -v | grep " \* " | cut -f 4 -d " +" | grep -v unknown | sed -e "s/[\d93\d91]//g"`@' \
   'n/{package,packages}/`rospack list-names`/'

complete rosrun \
   'p/1/`rospack list-names`/' \
   'p@2@`rospack find $:1 | xargs -I 1 find 1 -perm /a+x -type f -printf "%f\n"`@'

complete roslaunch \
   'p/1/`rospack list-names && find . -maxdepth 3 -regex ".*[xl][am][ul]n*c*h*" -printf "%P\n" `/' \
   'p@2@`rospack find $:1 | xargs -I 1 find 1 -maxdepth 3 -regex ".*[xl][am][ul]n*c*h*" -type f -printf "%f\n"`@'

