Skip to content

Instantly share code, notes, and snippets.

@mstaflex
Forked from mchwalisz/ros.bash
Created February 10, 2014 13:55
Show Gist options
  • Save mstaflex/8916372 to your computer and use it in GitHub Desktop.
Save mstaflex/8916372 to your computer and use it in GitHub Desktop.
#!/bin/bash
RP_BASEDIR=~/Code/ros
export TURTLEBOT_BASE=kobuki
export TURTLEBOT_STACKS=hexagons
export TURTLEBOT_3D_SENSOR=kinect
# source /opt/ros/groovy/setup.bash
source /home/opt/ros-hydro-ws/install_isolated/setup.bash
# Check where should ros master be (first argument of the script)
if [ "$#" -eq 1 ] ; then
if [[ "$1" == [0-9][0-9] ]] ; then
export ROS_MASTER_URI=http://tbot-unit$1:11311
else
export ROS_MASTER_URI=http://$1:11311
fi
else
export ROS_MASTER_URI=http://localhost:11311
fi
# Export extended package path
export ROS_PACKAGE_PATH=$RP_BASEDIR/twistbot_robot:$RP_BASEDIR/twistbot_core:$RP_BASEDIR/twist_helper:$RP_BASEDIR/omf_ros_bridge:$RP_BASEDIR/twist_vis:$ROS_PACKAGE_PATH
# Check VPN connection.
# DNS resolution will not work in that case
TUNIP=`ip -f inet -o addr show tun0 2>/dev/null | awk '{print $4}'`
if [ ! -z "$TUNIP" ]; then
export ROS_HOSTNAME=$TUNIP
echo "Detected VPN connection."
echo "ROS_HOSTNAME=$ROS_HOSTNAME"
fi
echo "ROS_MASTER_URI=$ROS_MASTER_URI"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment