Skip to content

Commit 96820ab

Browse files
authored
Merge pull request #6 from jetsonhacks/dev
Update ROS GPG Key
2 parents 36a6e64 + ef39de8 commit 96820ab

File tree

2 files changed

+112
-31
lines changed

2 files changed

+112
-31
lines changed

installROS.sh

Lines changed: 76 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,34 @@
11
#!/bin/bash
2+
# Install ROS on NVIDIA Jetson Developer Kits
3+
# Copyright (c) JetsonHacks, 2019-2021
4+
5+
# MIT License
6+
# Maintainer of ARM builds for ROS is http://answers.ros.org/users/1034/ahendrix/
7+
# Information from:
8+
# http://wiki.ros.org/melodic/Installation/UbuntuARM
9+
10+
# Get code name of distribution
11+
# lsb_release gets the Ubuntu Description Release and Code name
12+
DISTRIBUTION_CODE_NAME=$( lsb_release -sc )
13+
14+
case $DISTRIBUTION_CODE_NAME in
15+
"xenial" )
16+
echo "This Ubuntu distribution is Ubuntu Xenial (16.04)"
17+
echo "This install is not the ROS recommended version for Ubuntu Xenial."
18+
echo "ROS Bionic is the recommended version."
19+
echo "This script installs ROS Melodic. You will need to modify it for your purposes."
20+
exit 0
21+
;;
22+
"bionic")
23+
echo "This Ubuntu distribution is Ubuntu Bionic (18.04)"
24+
echo "Installing ROS Melodic"
25+
;;
26+
*)
27+
echo "This distribution is $DISTRIBUTION_CODE_NAME"
28+
echo "This script will only work with Ubuntu Xenial (16.04) or Bionic (18.04)"
29+
exit 0
30+
esac
31+
232
# Install Robot Operating System (ROS) on NVIDIA Jetson Developer Kit
333
# Maintainer of ARM builds for ROS is http://answers.ros.org/users/1034/ahendrix/
434
# Information from:
@@ -8,7 +38,7 @@
838
# Green is 2
939
# Reset is sgr0
1040

11-
function usage
41+
usage ()
1242
{
1343
echo "Usage: ./installROS.sh [[-p package] | [-h]]"
1444
echo "Install ROS Melodic"
@@ -22,7 +52,7 @@ function usage
2252
echo "-h | --help This message"
2353
}
2454

25-
function shouldInstallPackages
55+
shouldInstallPackages ()
2656
{
2757
tput setaf 1
2858
echo "Your package list did not include a recommended base package"
@@ -87,9 +117,9 @@ sudo apt-add-repository restricted
87117
# Setup sources.lst
88118
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
89119
# Setup keys
90-
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
91-
# If you experience issues connecting to the keyserver, you can try substituting hkp://pgp.mit.edu:80 or hkp://keyserver.ubuntu.com:80 in the previous command.
92-
# Installation
120+
sudo apt install curl
121+
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
122+
93123
tput setaf 2
94124
echo "Updating apt-get"
95125
tput sgr0
@@ -120,24 +150,61 @@ tput setaf 2
120150
echo "Installing rosdep"
121151
tput sgr0
122152
sudo apt-get install python-rosdep -y
123-
# Certificates are messed up on earlier version Jetson for some reason
124-
# sudo c_rehash /etc/ssl/certs
125153
# Initialize rosdep
126154
tput setaf 2
127155
echo "Initializaing rosdep"
128156
tput sgr0
129157
sudo rosdep init
130158
# To find available packages, use:
131159
rosdep update
132-
# Environment Setup - Don't add /opt/ros/melodic/setup.bash if it's already in bashrc
160+
# Environment Setup - source melodic setup.bash
161+
# Don't add /opt/ros/melodic/setup.bash if it's already in bashrc
133162
grep -q -F 'source /opt/ros/melodic/setup.bash' ~/.bashrc || echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
134163
source ~/.bashrc
135164
# Install rosinstall
136165
tput setaf 2
137166
echo "Installing rosinstall tools"
138167
tput sgr0
139-
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential -y
168+
169+
# Install useful ROS dev tools
170+
sudo apt-get install -y python-rosinstall \
171+
python-rosinstall-generator \
172+
python-wstool \
173+
build-essential
174+
175+
# Use ip to get the current IP addresses of eth0 and wlan0; parse into form xx.xx.xx.xx
176+
ETH0_IPADDRESS=$(ip -4 -o addr show eth0 | awk '{print $4}' | cut -d "/" -f 1)
177+
WLAN_IPADDRESS=$(ip -4 -o addr show wlan0 | awk '{print $4}' | cut -d "/" -f 1)
178+
179+
if [ -z "$ETH0_IPADDRESS" ] ; then
180+
echo "Ethernet (eth0) is not available"
181+
else
182+
echo "Ethernet (eth0) is $ETH0_IPADDRESS"
183+
fi
184+
if [ -z "$WLAN_IPADDRESS" ] ; then
185+
echo "Wireless (wlan0) is not available"
186+
else
187+
echo "Wireless (wlan0) ip address is $WLAN_IPADDRESS"
188+
fi
189+
190+
# Default to eth0 if available; wlan0 next
191+
ROS_IP_ADDRESS=""
192+
if [ ! -z "$ETH0_IPADDRESS" ] ; then
193+
ROS_IP_ADDRESS=$ETH0_IPADDRESS
194+
else
195+
ROS_IP_ADDRESS=$WLAN_IPADDRESS
196+
fi
197+
if [ ! -z "$ROS_IP_ADDRESS" ] ; then
198+
echo "Setting ROS_IP in ${HOME}/.bashrc to: $ROS_IP_ADDRESS"
199+
else
200+
echo "Setting ROS_IP to empty. Please change ROS_IP in the ${HOME}/.bashrc file"
201+
fi
202+
203+
#setup ROS environment variables
204+
grep -q -F ' ROS_MASTER_URI' ~/.bashrc || echo 'export ROS_MASTER_URI=http://localhost:11311' | tee -a ~/.bashrc
205+
grep -q -F ' ROS_IP' ~/.bashrc || echo "export ROS_IP=${ROS_IP_ADDRESS}" | tee -a ~/.bashrc
140206
tput setaf 2
207+
141208
echo "Installation complete!"
142209
echo "Please setup your Catkin Workspace"
143210
tput sgr0

setupCatkinWorkspace.sh

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,47 @@
11
#!/bin/bash
2-
# Create a Catkin Workspace and setup ROS environment variables
3-
# Usage setupCatkinWorkspace.sh dirName
2+
# Create a Catkin Workspace
3+
# Copyright (c) JetsonHacks, 2019-2021
4+
5+
# MIT License
6+
# Maintainer of ARM builds for ROS is http://answers.ros.org/users/1034/ahendrix/
7+
# Information from:
8+
# http://wiki.ros.org/melodic/Installation/UbuntuARM
9+
#
410

511
source /opt/ros/melodic/setup.bash
6-
DEFAULTDIR=~/catkin_ws
7-
CLDIR="$1"
8-
if [ ! -z "$CLDIR" ]; then
9-
DEFAULTDIR=~/"$CLDIR"
10-
fi
11-
if [ -e "$DEFAULTDIR" ] ; then
12-
echo "$DEFAULTDIR already exists; no action taken"
12+
13+
# Usage setupCatkinWorkspace.sh dirName
14+
help_usage ()
15+
{
16+
echo "Usage: ./setupCatkinWorkspac.sh <path>"
17+
echo " Setup a Catkin Workspace at the path indicated"
18+
echo " Default path is ~/catkin_ws"
19+
echo " -h | --help This message"
20+
exit 0
21+
}
22+
23+
CATKIN_DIR=""
24+
case $1 in
25+
-h | --help) help_usage ;;
26+
*) CATKIN_DIR="$1" ;;
27+
esac
28+
29+
30+
CATKIN_DIR=${CATKIN_DIR:="${HOME}/catkin_ws"}
31+
32+
if [ -e "$CATKIN_DIR" ] ; then
33+
echo "$CATKIN_DIR already exists; no action taken"
1334
exit 1
1435
else
15-
echo "Creating Catkin Workspace: $DEFAULTDIR"
36+
echo "Creating Catkin Workspace: $CATKIN_DIR"
1637
fi
17-
echo "$DEFAULTDIR"/src
18-
mkdir -p "$DEFAULTDIR"/src
19-
cd "$DEFAULTDIR"/src
38+
echo "$CATKIN_DIR"/src
39+
mkdir -p "$CATKIN_DIR"/src
40+
cd "$CATKIN_DIR"/src
2041
catkin_init_workspace
21-
cd "$DEFAULTDIR"
42+
cd ..
2243
catkin_make
2344

2445

25-
#setup ROS environment variables
26-
grep -q -F ' ROS_MASTER_URI' ~/.bashrc || echo 'export ROS_MASTER_URI=http://localhost:11311' | tee -a ~/.bashrc
27-
grep -q -F ' ROS_IP' ~/.bashrc || echo "export ROS_IP=$(hostname -I)" | tee -a ~/.bashrc
28-
echo "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
29-
30-
echo "The Catkin Workspace has been created"
31-
echo "Please modify the placeholders for ROS_MASTER_URI and ROS_IP placed into the file ${HOME}/.bashrc"
32-
echo "to suit your environment."
46+
echo "Catkin workspace: $CATKIN_DIR created"
3347

0 commit comments

Comments
 (0)