]> git.rmz.io Git - dotfiles.git/blob - zsh/functions/rosinit
zsh: rosinit now supports multiple distros + default to indigo
[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")
7
8 local ROS_DISTRO=$1
9 if [[ -z "$ROS_DISTRO" ]]; then
10 for d in "${ROS_DISTROS[@]}"; do
11 [[ -f "/opt/ros/$d/setup.zsh" ]] && ROS_DISTRO=$d
12 done
13 fi
14 if [[ -f "/opt/ros/$ROS_DISTRO/setup.zsh" ]]; then
15 export ROS_OS_OVERRIDE=arch
16 source /opt/ros/$ROS_DISTRO/setup.zsh
17 source $WORKSPACE/devel/setup.zsh
18 export ROS_WORKSPACE=$WORKSPACE
19 roscd
20 else
21 echo "ROS $ROS_DISTRO doesn't seem to be installed." >&2
22 fi
23 }