Skip to content

Commit

Permalink
[jsk_tools/env-hooks/99.jsk_tools.sh] use ip for rossetip instead of …
Browse files Browse the repository at this point in the history
…ifconfig
  • Loading branch information
furushchev committed Aug 8, 2016
1 parent 509512e commit a25e9ba
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions jsk_tools/env-hooks/99.jsk_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ rossetmaster() {
fi
echo -e "\e[1;31mset ROS_MASTER_URI to $ROS_MASTER_URI\e[m"
}

rossetrobot() {
echo -e "\e[1;31m *** rossetrobot is obsoleted, use rossetmaster ***\e[m"
rossetmaster $@
Expand All @@ -78,12 +79,8 @@ rossetlocal() {
}

rossetip_dev() {
local device=${1-"(eth0|eth1|eth2|eth3|eth4|wlan0|wlan1|wlan2|wlan3|wlan4|en0|en1|en2|en3|lo0)"}
if [ "$(uname -s)" = "Darwin" ]; then
export ROS_IP=`PATH=$PATH:/sbin LANGUAGE=en LANG=C ifconfig | egrep -A1 "${device}"| grep inet\ | grep -v 127.0.0.1 | sed 's/.*inet \([0-9\.]*\).*/\1/' | head -1`
else
export ROS_IP=`PATH=$PATH:/sbin LANGUAGE=en LANG=C ifconfig | egrep -A1 "${device}"| grep inet\ | grep -v 127.0.0.1 | sed 's/.*inet addr:\([0-9\.]*\).*/\1/' | head -1`
fi
local device=${1-'(eth|wlan|en|lo)[0-9]*'}
export ROS_IP=`LANG=C ip -o -4 a | grep -E $device | sed -e 's@^.*inet *\([0-9\.]*\).*$@\1@g'`
export ROS_HOSTNAME=$ROS_IP
}

Expand All @@ -108,7 +105,7 @@ rossetip_addr() {
}

rossetip() {
local device=${1-"(eth0|eth1|eth2|eth3|eth4|wlan0|wlan1|wlan2|wlan3|wlan4|en0|en1|en2|en3|lo0)"}
local device=${1-'(eth|wlan|en|lo)[0-9]*'}
if [[ $device =~ [0-9]+.[0-9]+.[0-9]+.[0-9]+ ]]; then
export ROS_IP="$device"
else
Expand Down Expand Up @@ -148,6 +145,7 @@ rosn() {
fi
fi
}

rost() {
if [ "$1" = "" ]; then
select=$(rostopic list | percol | xargs -n 1 rostopic info | percol)
Expand Down

0 comments on commit a25e9ba

Please sign in to comment.