]> git.rmz.io Git - dotfiles.git/blobdiff - zsh/functions/rosinit
zsh: move ros initialisation to its own function
[dotfiles.git] / zsh / functions / rosinit
diff --git a/zsh/functions/rosinit b/zsh/functions/rosinit
new file mode 100644 (file)
index 0000000..245cd3f
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/zsh
+
+function rosinit() {
+    local ROS_DISTRO=hydro
+    local WORKSPACE=~/src/ros
+    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
+        roscd
+    else
+        echo "ROS $ROS_DISTRO doesn't seem to be installed." >&2
+    fi
+}