Last active
August 29, 2015 13:56
-
-
Save mchwalisz/8916142 to your computer and use it in GitHub Desktop.
Personalized ROS startup script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
+1 for this helpful little tool! :)