]> git.rmz.io Git - dotfiles.git/blob - zsh/functions/rosinit
vim: stage cpp_highlight and replacewithregister
[dotfiles.git] / zsh / functions / rosinit
1 #!/bin/zsh
2
3 function rosinit() {
4 local WORKSPACE=~/src/ros
5 local -a ROS_DISTROS
6 ROS_DISTROS=("hydro" "indigo" "jade")
7
8 local distro=$1
9 if [[ -z "$distro" ]]; then
10 for d in "${ROS_DISTROS[@]}"; do
11 [[ -f "/opt/ros/$d/setup.zsh" ]] && distro=$d
12 done
13 fi
14 if [[ -f "/opt/ros/$distro/setup.zsh" ]]; then
15 export ROS_DISTRO=$distro
16 export ROS_OS_OVERRIDE=arch
17 source /opt/ros/$ROS_DISTRO/setup.zsh
18 source $WORKSPACE/devel/setup.zsh
19 export ROS_WORKSPACE=$WORKSPACE
20 export ROS_HOME=$XDG_CACHE_HOME/ros
21 export ROS_LOG_DIR=$XDG_CACHE_HOME/ros/log
22 # export ROS_TEST_RESULTS_DIR=$HOME/.ros
23 roscd
24 else
25 echo "ROS $distro doesn't seem to be installed." >&2
26 fi
27 }