Skip to content

Instantly share code, notes, and snippets.

@mchwalisz
Last active August 29, 2015 13:56
Show Gist options
  • Save mchwalisz/8916142 to your computer and use it in GitHub Desktop.
Save mchwalisz/8916142 to your computer and use it in GitHub Desktop.
Personalized ROS startup script
#!/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
ROS_PACKAGE_PATH_COPY=$ROS_PACKAGE_PATH
# 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_COPY
# 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"
@mstaflex
Copy link

+1 for this helpful little tool! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment