forked from uf-mil/NaviGator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·693 lines (558 loc) · 19.9 KB
/
install.sh
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
#!/bin/bash
NOCOLOR='\033[0m'
LOGCOLOR='\033[1;36m'
PASSCOLOR='\033[1;32m'
WARNCOLOR='\033[1;31m'
LOGPREFIX="${LOGCOLOR}INSTALLER:"
WARNPREFIX="${WARNCOLOR}ERROR:"
PASSTEXT="${PASSCOLOR}PASS"
FAILTEXT="${WARNCOLOR}FAIL"
instlog() {
printf "$LOGPREFIX $@ $NOCOLOR\n"
}
instwarn() {
printf "$WARNPREFIX $@ $NOCOLOR\n"
}
instpass() {
printf "$PASSTEXT $NOCOLOR"
}
instfail() {
printf "$FAILTEXT $NOCOLOR"
}
check_host() {
# Attempts to ping a host to make sure it is reachable
HOST="$1"
HOST_PING=$(ping -c 2 $HOST 2>&1 | grep "% packet" | cut -d" " -f 6 | tr -d "%")
if ! [ -z "${HOST_PING}" ]; then
# Uses packet loss percentage to determine if the connection is strong
if [ $HOST_PING -lt 25 ]; then
# Will return true if ping was successful and packet loss was below 25%
return `true`
fi
fi
return `false`
}
ros_git_get() {
# Uasge example: ros_git_get [email protected]:jpanikulam/ROS-Boat.git
NEEDS_INSTALL=true;
INSTALL_URL=$1;
builtin cd $CATKIN_DIR/src
# Check if it already exists
for folder in $CATKIN_DIR/src/*; do
if ! [ -d $folder ]; then
continue;
fi
builtin cd $folder
if ! [ -d .git ]; then
continue;
fi
LOCAL_BRANCH=`git name-rev --name-only HEAD`
TRACKING_BRANCH=`git config branch.$LOCAL_BRANCH.merge`
TRACKING_REMOTE=`git config branch.$LOCAL_BRANCH.remote`
# Automatically checks if HTTPS is available
REMOTE_URL=`git config remote.$TRACKING_REMOTE.url`
if python -c "import re; _, have_url = re.split('https://github.com|[email protected]:', '$REMOTE_URL');_, want_url = re.split('https://github.com|[email protected]:', '$INSTALL_URL'); exit(have_url != want_url)"; then
instlog "Already have package at url $INSTALL_URL"
NEEDS_INSTALL=false;
break;
fi
builtin cd $CATKIN_DIR/src
done
if $NEEDS_INSTALL; then
instlog "Installing $INSTALL_URL in $CATKIN_DIR/src"
git clone -q $INSTALL_URL --depth=1
fi
}
#======================#
# Script Configuration #
#======================#
# Sane installation defaults for no argument cases
REQUIRED_OS="trusty"
CATKIN_DIR=~/mil_ws
INSTALL_ALL=false
INSTALL_SUB=false
INSTALL_NAV=false
# Retrievs information about the location of the script
SCRIPT_PATH="`readlink -f ${BASH_SOURCE[0]}`"
SCRIPT_DIR="`dirname $SCRIPT_PATH`"
# Convert script arguments to variables
while [ "$#" -gt 0 ]; do
case $1 in
-h) printf "\nUsage: $0\n"
printf "\n [-c] catkin_workspace (Recommend: ~/mil_ws)\n"
printf "\n [-a] Installs everything needed for all MIL projects\n"
printf "\n [-s] Installs everything needed for SubjuGator 8\n"
printf "\n [-n] Installs everything needed for Navigator\n"
printf "\n example: ./install.sh -c ~/mil_ws\n"
printf "\n"
exit 0
;;
-c) CATKIN_DIR="$2"
shift 2
;;
-a) INSTALL_ALL=true
shift 1
;;
-s) INSTALL_SUB=true
shift 1
;;
-n) INSTALL_NAV=true
shift 1
;;
-?) instwarn "Option $1 is not implemented"
exit 1
;;
esac
done
if !($INSTALL_ALL || $INSTALL_SUB || $INSTALL_NAV); then
echo "A MIL project must be selected for install"
echo "Run ./install.sh -h for more information"
exit 1
elif ($INSTALL_ALL); then
INSTALL_SUB=true
INSTALL_NAV=true
elif ($INSTALL_NAV); then
# Navigator currently depends on the Sub8 repository
# This may change soon, but this will install Sub8 for now
INSTALL_SUB=true
fi
# The path to the user's bash configuration file
BASHRC_FILE=~/.bashrc
# Creates a temporary file for building the new bashrc file
TMP_BASHRC=$(mktemp /tmp/update-bashrc.XXXXXX)
# Finds the line number of the block header if it exists in the file
MIL_LINE=`cat $BASHRC_FILE | grep "# Bash configurations for MIL" -n | cut -d ':' -f 1`
# Preserves all of the users other bash configurations (ones above the MIL header)
if [ -s $BASHRC_FILE ]; then
# If there is no MIL block, copies the old bashrc file to the new bashrc file
if [ -z "$MIL_LINE" ]; then
USERS_BASHRC="`cat $BASHRC_FILE`"
echo "$USERS_BASHRC" >> $TMP_BASHRC
echo "" >> $TMP_BASHRC
# If there is a MIL block, only copies the configurations above it
elif [ $(($MIL_LINE - 2)) -gt 0 ]; then
USERS_BASHRC="`head -$(($MIL_LINE - 2)) $BASHRC_FILE`"
echo "$USERS_BASHRC" >> $TMP_BASHRC
echo "" >> $TMP_BASHRC
fi
fi
#==================#
# Pre-Flight Check #
#==================#
instlog "Starting the pre-flight system check to ensure installation was done properly"
# The lsb-release package is critical to check the OS version
# It may not be on bare-bones systems, so it is installed here if necessary
sudo apt-get update -qq
sudo apt-get install -qq lsb-release
# Ensure that the correct OS is installed
DTETCTED_OS="`lsb_release -sc`"
if [ $DTETCTED_OS = $REQUIRED_OS ]; then
OS_CHECK=true
echo -n "[ " && instpass && echo -n "] "
else
OS_CHECK=false
echo -n "[ " && instfail && echo -n "] "
fi
echo "OS distribution and version check"
# Prevent the script from being run as root
if [ $USER != "root" ]; then
ROOT_CHECK=true
echo -n "[ " && instpass && echo -n "] "
else
ROOT_CHECK=false
echo -n "[ " && instfail && echo -n "] "
fi
echo "Running user check"
# Check whether or not github.com is reachable
# This also makes sure that the user is connected to the internet
if (check_host "github.com"); then
NET_CHECK=true
echo -n "[ " && instpass && echo -n "] "
else
NET_CHECK=false
echo -n "[ " && instfail && echo -n "] "
fi
echo "Internet connectivity check"
if !($OS_CHECK); then
# The script will not allow the user to install on an unsupported OS
instwarn "Terminating installation due to incorrect OS (detected $DTETCTED_OS)"
instwarn "MIL projects require Ubuntu 14.04 (trusty)"
exit 1
fi
if !($ROOT_CHECK); then
# The script will not allow the user to install as root
instwarn "Terminating installation due to forbidden user"
instwarn "The install script should not be run as root"
exit 1
fi
if !($NET_CHECK); then
# The script will not allow the user to install without internet
instwarn "Terminating installation due to the lack of an internet connection"
instwarn "The install script needs to be able to connect to GitHub and other sites"
exit 1
fi
#===================================================#
# Repository and Set Up and Main Stack Installation #
#===================================================#
# Make sure script dependencies are installed on bare bones installations
instlog "Installing install script dependencies"
sudo apt-get install -qq wget curl aptitude fakeroot ssh git
# Add software repositories for ROS and Gazebo
instlog "Adding ROS and Gazebo PPAs to software sources"
sudo sh -c "echo \"deb http://packages.ros.org/ros/ubuntu trusty main\" > /etc/apt/sources.list.d/ros-latest.list"
sudo sh -c "echo \"deb http://packages.osrfoundation.org/gazebo/ubuntu trusty main\" > /etc/apt/sources.list.d/gazebo-latest.list"
# Get the GPG signing keys for the above repositories
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116
# Add software repository for Git-LFS
instlog "Adding the Git-LFS packagecloud repository to software sources"
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
# Install ROS and other project dependencies
instlog "Installing ROS Indigo base packages"
sudo apt-get update -qq
sudo apt-get install -qq python-catkin-pkg python-rosdep
if (env | grep SEMAPHORE | grep --quiet -oe '[^=]*$'); then
sudo apt-get install -qq ros-indigo-desktop
else
sudo apt-get install -qq ros-indigo-desktop-full
fi
# Break the ROS Indigo metapackage and install an updated version of Gazebo
instlog "Installing the latest version of Gazebo"
sudo aptitude unmarkauto -q '?reverse-depends(ros-indigo-desktop-full) | ?reverse-recommends(ros-indigo-desktop-full)'
sudo apt-get purge -qq ros-indigo-gazebo*
sudo apt-get install -qq gazebo7
sudo apt-get install -qq ros-indigo-gazebo7-msgs ros-indigo-gazebo7-ros ros-indigo-gazebo7-plugins ros-indigo-gazebo7-ros-control
# Source ROS configurations for bash on this user account
source /opt/ros/indigo/setup.bash
if !(cat $TMP_BASHRC | grep --quiet "source /opt/ros"); then
echo "" >> $TMP_BASHRC
echo "# Sets up the shell environment for ROS" >> $TMP_BASHRC
echo "source /opt/ros/indigo/setup.bash" >> $TMP_BASHRC
fi
# Get information about ROS versions
instlog "Initializing ROS"
if !([ -f /etc/ros/rosdep/sources.list.d/20-default.list ]); then
sudo rosdep init > /dev/null 2>&1
fi
rosdep update
#=================================#
# Workspace and Repository Set Up #
#=================================#
# Set up catkin workspace directory
if !([ -f $CATKIN_DIR/src/CMakeLists.txt ]); then
instlog "Generating catkin workspace at $CATKIN_DIR"
mkdir -p "$CATKIN_DIR/src"
cd "$CATKIN_DIR/src"
catkin_init_workspace
catkin_make -C "$CATKIN_DIR"
else
instlog "Using existing catkin workspace at $CATKIN_DIR"
fi
# Move the cloned git repository to the catkin workspace in semaphore
if (env | grep SEMAPHORE | grep --quiet -oe '[^=]*$'); then
if [ -d ~/Navigator ]; then
mv ~/Navigator "$CATKIN_DIR/src"
elif [ -d ~/Sub8 ]; then
mv ~/Sub8 "$CATKIN_DIR/src"
fi
fi
# Source the workspace's configurations for bash on this user account
source "$CATKIN_DIR/devel/setup.bash"
if !(cat $TMP_BASHRC | grep --quiet "source $CATKIN_DIR/devel/setup.bash"); then
echo "source $CATKIN_DIR/devel/setup.bash" >> $TMP_BASHRC
fi
# Check if the Navigator repository is present; if it isn't, download it
if ($INSTALL_NAV) && !(ls "$CATKIN_DIR/src" | grep --quiet "Navigator"); then
instlog "Downloading the Navigator repository"
cd $CATKIN_DIR/src
git clone -q https://github.com/uf-mil/Navigator.git
cd $CATKIN_DIR/src/Navigator
git remote rename origin upstream
instlog "Make sure you change your git origin to point to your own fork! (git remote add origin your_forks_url)"
fi
# Check if the Sub8 repository is present; if it isn't, download it
if ($INSTALL_SUB) && !(ls "$CATKIN_DIR/src" | grep --quiet "Sub8"); then
instlog "Downloading the Sub8 repository"
cd $CATKIN_DIR/src
git clone -q https://github.com/uf-mil/Sub8.git
cd $CATKIN_DIR/src/Sub8
git remote rename origin upstream
instlog "Make sure you change your git origin to point to your own fork! (git remote add origin your_forks_url)"
fi
#================================#
# Common Dependency Installation #
#================================#
instlog "Installing common dependencies from the Ubuntu repositories"
# Utilities for building and package management
sudo apt-get install -qq cmake binutils-dev python-pip
# Common backend libraries
sudo apt-get install -qq libboost-all-dev
sudo apt-get install -qq python-dev python-scipy python-numpy python-serial
# Point clouds
sudo apt-get install -qq libpcl-1.7-all libpcl-1.7-all-dev
# Motion planning
sudo apt-get install -qq libompl-dev
# Visualization and graphical interfaces
sudo apt-get install -qq libvtk5-dev python-vtk
sudo apt-get install -qq python-qt4-dev python-qt4-gl
sudo apt-get install -qq python-opengl freeglut3-dev libassimp-dev
# Tools
sudo apt-get install -qq sshfs
sudo apt-get install -qq git-lfs gitk
git lfs install --skip-smudge
sudo apt-get install -qq tmux
# Libraries needed by txros
sudo apt-get install -qq python-twisted socat
# Libraries needed by the old simulator
sudo apt-get install -qq python-pygame
instlog "Installing common ROS dependencies"
# Hardware drivers
sudo apt-get install -qq ros-indigo-driver-base
# Cameras
sudo apt-get install -qq ros-indigo-camera-info-manager
sudo apt-get install -qq ros-indigo-camera1394
sudo apt-get install -qq ros-indigo-stereo-image-proc
# Image compression
sudo apt-get install -qq ros-indigo-rosbag-image-compressor ros-indigo-compressed-image-transport ros-indigo-compressed-depth-image-transport
# Point clouds
sudo apt-get install -qq ros-indigo-pcl-ros ros-indigo-pcl-conversions
# Lie Groups using Eigen
sudo apt-get install -qq ros-indigo-sophus
# Controller
sudo apt-get install -qq ros-indigo-control-toolbox ros-indigo-controller-manager
sudo apt-get install -qq ros-indigo-hardware-interface ros-indigo-transmission-interface ros-indigo-joint-limits-interface
instlog "Installing common dependencies from Python PIP"
# Package management
sudo pip install -q -U setuptools
# Service identity verification
sudo pip install -q -U service_identity
# Utilities
sudo pip install -q -U argcomplete
sudo pip install -q -U tqdm
sudo pip install -q -U pyasn1
sudo pip install -q -U characteristic
# Machine Learning
sudo pip install -q -U scikit-learn > /dev/null 2>&1
# Visualization
sudo pip install -q -U mayavi > /dev/null 2>&1
instlog "Cloning common Git repositories that need to be built"
ros_git_get https://github.com/txros/txros.git
ros_git_get https://github.com/uf-mil/rawgps-tools.git
ros_git_get https://github.com/ros-simulation/gazebo_ros_pkgs.git
#===================================#
# Navigator Dependency Installation #
#===================================#
if ($INSTALL_NAV); then
instlog "Installing Navigator ROS dependencies"
# Serial communications
sudo apt-get install -qq ros-indigo-rosserial ros-indigo-rosserial-python ros-indigo-rosserial-arduino
# Thruster driver
sudo apt-get install -qq ros-indigo-roboteq-driver
instlog "Installing Navigator dependencies from source"
# Open Dynamics Engine
rm -rf /tmp/pyode-build
mkdir -p /tmp/pyode-build
cd /tmp/pyode-build
sudo apt-get build-dep -qq python-pyode
sudo apt-get remove -qq python-pyode
apt-get source --compile -qq python-pyode
sudo dpkg -i python-pyode_*.deb
# Pulling large project files from Git-LFS
instlog "Pulling large files for Navigator"
cd $CATKIN_DIR/src/Navigator
git lfs pull
fi
#==============================#
# Sub8 Dependency Installation #
#==============================#
if ($INSTALL_SUB); then
instlog "Installing Sub8 dependencies from the Ubuntu repositories"
# Optical character recognition
sudo apt-get install -qq tesseract-ocr
# Hardware drivers
sudo apt-get install -qq libusb-1.0-0-dev
instlog "Installing Sub8 ROS dependencies"
# 3D Mouse
sudo apt-get install -qq ros-indigo-spacenav-node
instlog "Installing Sub8 dependencies from Python PIP"
# Libraries needed by the hydrophone board
sudo pip install -q -U crc16
fi
#=========================#
# Bashrc Alias Management #
#=========================#
BASHRC_STR="
# Bash configurations for MIL (any additions below this block will be deleted)
# These are the hostnames for all devices that run a remote roscore
SUB_HOST=mil-sub-sub8.ad.mil.ufl.edu
NAV_HOST=mil-nav-wamv.ad.mil.ufl.edu
SHT_HOST=mil-shuttle.ad.mil.ufl.edu
JN5_HOST=mil-johnny-five.ad.mil.ufl.edu
check_host() {
# Attempts to ping a host to make sure it is reachable
HOST=\"\$1\"
HOST_PING=\$(ping -w 1 -c 2 \$HOST 2>&1 | grep \"% packet\" | cut -d\" \" -f 6 | tr -d \"%\")
if ! [ -z \"\${HOST_PING}\" ]; then
# Uses packet loss percentage to determine if the connection is strong
if [ \$HOST_PING -lt 25 ]; then
# Will return true if ping was successful and packet loss was below 25%
return \`true\`
fi
fi
return \`false\`
}
check_connection() {
if (check_host \"\$SUB_HOST\"); then
SUB_CHECK=true
else
SUB_CHECK=false
fi
if (check_host \"\$NAV_HOST\"); then
NAV_CHECK=true
else
NAV_CHECK=false
fi
if (check_host \"\$SHT_HOST\"); then
SHT_CHECK=true
else
SHT_CHECK=false
fi
if (check_host \"\$JN5_HOST\"); then
JN5_CHECK=true
else
JN5_CHECK=false
fi
if ([ \"\$SUB_CHECK\" = \"false\" ] && [ \"\$NAV_CHECK\" == \"false\" ]&&\\
[ \"\$SHT_CHECK\" = \"false\" ] && [ \"\$JN5_CHECK\" == \"false\" ]); then
echo \"None of the MIL roscores are available on this network\"
else
if [ \"\$SUB_CHECK\" = \"true\" ]; then
echo \"SubjuGator is accessible on this network\"
fi
if [ \"\$NAV_CHECK\" = \"true\" ]; then
echo \"Navigator is accessible on this network\"
fi
if [ \"\$SHT_CHECK\" = \"true\" ]; then
echo \"Shuttle is accessible on this network\"
fi
if [ \"\$JN5_CHECK\" = \"true\" ]; then
echo \"Johnny Five is accessible on this network\"
fi
fi
}
set_ros_ip() {
LOCAL_IP=\"\`ip route get 1 | awk '{print \$NF; exit}'\`\"
# Unsets ROS_HOSTNAME and sets ROS_IP to the IP on this machine's main NIC
unset ROS_HOSTNAME
export ROS_IP=\$LOCAL_IP
}
unset_ros_ip() {
# Unsets ROS_IP and sets ROS_HOSTNAME to localhost
unset ROS_IP
export ROS_HOSTNAME=localhost
}
set_ros_master() {
# Sets ROS_MASTER_URI to the hostname of the correct MIL roscore
export ROS_MASTER_URI=\$REMOTE_ROSCORE_URI
echo \"The master roscore is set to \$REMOTE_ROSCORE_URI\"
}
unset_ros_master() {
# Sets ROS_MASTER_URI to point back to localhost
export ROS_MASTER_URI=http://localhost:11311
echo \"The master roscore is set to this machine\"
}
ros_connect() {
check_connection
# If none of the MIL roscores are accessible, use localhost as the default roscore
if ([ \"\$SUB_CHECK\" = \"false\" ] && [ \"\$NAV_CHECK\" == \"false\" ] &&\\
[ \"\$SHT_CHECK\" = \"false\" ] && [ \"\$JN5_CHECK\" == \"false\" ]); then
ros_disconnect
# If just one MIL roscore was accessible, connect directly to that roscore
elif ([ \"\$SUB_CHECK\" = \"true\" ] && [ \"\$NAV_CHECK\" == \"false\" ] &&\\
[ \"\$SHT_CHECK\" = \"false\" ] && [ \"\$JN5_CHECK\" == \"false\" ]); then
REMOTE_ROSCORE_URI=http://\$SUB_HOST:11311
set_ros_ip
set_ros_master
elif ([ \"\$SUB_CHECK\" = \"false\" ] && [ \"\$NAV_CHECK\" == \"true\" ] &&\\
[ \"\$SHT_CHECK\" = \"false\" ] && [ \"\$JN5_CHECK\" == \"false\" ]); then
REMOTE_ROSCORE_URI=http://\$NAV_HOST:11311
set_ros_ip
set_ros_master
elif ([ \"\$SUB_CHECK\" = \"false\" ] && [ \"\$NAV_CHECK\" == \"false\" ] &&\\
[ \"\$SHT_CHECK\" = \"true\" ] && [ \"\$JN5_CHECK\" == \"false\" ]); then
REMOTE_ROSCORE_URI=http://\$SHT_HOST:11311
set_ros_ip
set_ros_master
elif ([ \"\$SUB_CHECK\" = \"false\" ] && [ \"\$NAV_CHECK\" == \"false\" ] &&\\
[ \"\$SHT_CHECK\" = \"false\" ] && [ \"\$JN5_CHECK\" == \"true\" ]); then
REMOTE_ROSCORE_URI=http://\$JN5_HOST:11311
set_ros_ip
set_ros_master
# If multiple roscores were reachable, allow the user to select one
else
echo \"\"
echo \"Multiple MIL roscores were detected!\"
if ([ \"\$SUB_CHECK\" = \"true\" ]); then
echo \" 1. SubjuGator\"
fi
if ([ \"\$NAV_CHECK\" = \"true\" ]); then
echo \" 2. Navigator\"
fi
if ([ \"\$SHT_CHECK\" = \"true\" ]); then
echo \" 3. Shuttle\"
fi
if ([ \"\$JN5_CHECK\" = \"true\" ]); then
echo \" 4. Johnny Five\"
fi
echo \"\"
echo -n \"Select a roscore to connect to: \"
read SELECTION
if [ \"\$SELECTION\" = \"1\" ]; then
REMOTE_ROSCORE_URI=http://\$SUB_HOST:11311
set_ros_ip
set_ros_master
elif [ \"\$SELECTION\" = \"2\" ]; then
REMOTE_ROSCORE_URI=http://\$NAV_HOST:11311
set_ros_ip
set_ros_master
elif [ \"\$SELECTION\" = \"3\" ]; then
REMOTE_ROSCORE_URI=http://\$SHT_HOST:11311
set_ros_ip
set_ros_master
elif [ \"\$SELECTION\" = \"4\" ]; then
REMOTE_ROSCORE_URI=http://\$JN5_HOST:11311
set_ros_ip
set_ros_master
else
echo \"Invalid selection value, no roscore selected\"
fi
fi
}
ros_disconnect() {
# Disconnects from any remote roscore and connects to the local one
unset_ros_ip
unset_ros_master
}
# Prints debugging output for the master roscore that is currently selected
alias rosenv='echo \"ROS_IP=\$ROS_IP
ROS_HOSTNAME=\$ROS_HOSTNAME
ROS_MASTER_URI=\$ROS_MASTER_URI\"'"
# Writes the bashrc alias string to the new bashrc file
echo "$BASHRC_STR" >> $TMP_BASHRC
# Copies all entries in the new bashrc file to the machine's bashrc file
cat $TMP_BASHRC > $BASHRC_FILE
# Removes the temporary file used for building the new bashrc file
rm -rf $TMP_BASHRC
instlog "The bashrc file has been updated with the current aliases"
#==========================#
# Finalization an Clean Up #
#==========================#
# Attempt to build the Navigator stack on client machines
if !(env | grep SEMAPHORE | grep --quiet -oe '[^=]*$'); then
instlog "Building MIL's software stack with catkin_make"
catkin_make -C "$CATKIN_DIR" -j8
fi
# Remove the initial install script if it was not in the Navigator repository
if !(echo "$SCRIPT_DIR" | grep --quiet "src/Navigator"); then
rm -f "$SCRIPT_PATH"
fi