-
Notifications
You must be signed in to change notification settings - Fork 11
/
ros-native
executable file
·50 lines (38 loc) · 1.23 KB
/
ros-native
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
#setup master
echo "===ROS-SETUP==="
if [ -z "$1" ]; then
echo "- Not updating ROS_MASTER_URI";
else
#Update Master
MASTER_HOST=$(gethostip -d "$1")
MASTER_PORT="11311"
export ROS_MASTER_URI="http://$MASTER_HOST:$MASTER_PORT"
echo "- ROS_MASTER_URI: $ROS_MASTER_URI ($1)"
#update RPi
# Do we have a setupfile?
if [ ! -f ~/ros/rossetup-rpi ]; then
cp ~/rpicross_notes/ros/rossetup-rpi ~/ros/rossetup-rpi
fi
# Set ROS_MASTER_URI
sed -i "s|.*ROS_MASTER_URI=.*|export\ ROS_MASTER_URI=$ROS_MASTER_URI|g" ~/ros/rossetup-rpi
# Update on rpi
if [ -z "$2" ]; then
echo "- Not updating RPi"
else
echo "- Updating RPi ($2)"
scp -o StrictHostKeyChecking=no ~/ros/rossetup-rpi $2:~/ros/
fi
fi
#source ROS-settings
echo "- Searching ROS setup.bash"
files=$(find ~/build/ros -name "devel*" -type d -exec echo {}/setup.bash \; 2>/dev/null)
echo "- Found:"
n=$'\n'
echo "/opt/ros/kinetic/setup.bash$n$files"
echo "- Sourcing.."
source /opt/ros/kinetic/setup.bash
source $files 2>/dev/null
echo "================"
#get rpi-hostname from ssh-config
#RPI_ADDR=$(ssh -v $RPI_SSH -o BatchMode=yes -o ConnectionAttempts=1 -o StrictHostKeyChecking=no true ' ' 2>&1 | grep 'Authenticated to' | cut -d' ' -f3)