X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/6edb558f9c43fa934e4e418294bc652f5a34cf28..a84890a5afc05bd4cb52faa11f887e1fe48776df:/zsh/functions/rosinit diff --git a/zsh/functions/rosinit b/zsh/functions/rosinit index 245cd3f..ac985a8 100644 --- a/zsh/functions/rosinit +++ b/zsh/functions/rosinit @@ -1,13 +1,24 @@ #!/bin/zsh function rosinit() { - local ROS_DISTRO=hydro local WORKSPACE=~/src/ros + local -a ROS_DISTROS + ROS_DISTROS=("hydro" "indigo") + + local ROS_DISTRO=$1 + if [[ -z "$ROS_DISTRO" ]]; then + for d in "${ROS_DISTROS[@]}"; do + [[ -f "/opt/ros/$d/setup.zsh" ]] && ROS_DISTRO=$d + done + fi if [[ -f "/opt/ros/$ROS_DISTRO/setup.zsh" ]]; then export ROS_OS_OVERRIDE=arch source /opt/ros/$ROS_DISTRO/setup.zsh source $WORKSPACE/devel/setup.zsh export ROS_WORKSPACE=$WORKSPACE + export ROS_HOME=$XDG_CACHE_HOME/ros + export ROS_LOG_DIR=$XDG_CACHE_HOME/ros/log + # export ROS_TEST_RESULTS_DIR=$HOME/.ros roscd else echo "ROS $ROS_DISTRO doesn't seem to be installed." >&2