Skip to content

Commit 2d12971

Browse files
Merge pull request #2 from JetsonHacksNano/dev
Update GPG Key
2 parents ac585ca + f4bf7b3 commit 2d12971

File tree

3 files changed

+148
-57
lines changed

3 files changed

+148
-57
lines changed

README.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# installROS
2-
Install Robot Operating System (ROS) on NVIDIA Jetson Nano Developer Kit
2+
Install Robot Operating System (ROS) Melodic on NVIDIA Jetson Developer Kits
33

4-
These scripts will install Robot Operating System (ROS) on the NVIDIA Jetson Nano Developer Kit.
4+
These scripts will install Robot Operating System (ROS) Melodic on the NVIDIA Jetson Developer Kits.
5+
6+
Jetson Nano, Jetson AGX Xavier, Jetson Xavier NX, Jetson TX2, Jetson TX1
57

68
The script is based on the Ubuntu ARM install of ROS Melodic: http://wiki.ros.org/melodic/Installation/Ubuntu
79

@@ -24,35 +26,40 @@ Default is ros-melodic-ros-base if no packages are specified.
2426

2527
Example Usage:
2628

27-
$ ./installROS.sh -p ros-melodic-desktop -p ros-melodic-rgbd-launch
29+
`$ ./installROS.sh -p ros-melodic-desktop -p ros-melodic-rgbd-launch`
2830

2931
This script installs a baseline ROS environment. There are several tasks:
3032

31-
<ul>
32-
<li>Enable repositories universe, multiverse, and restricted</li>
33-
<li>Adds the ROS sources list</li>
34-
<li>Sets the needed keys</li>
35-
<li>Loads specified ROS packages, defaults to ros-melodic-base-ros if none specified</li>
36-
<li>Initializes rosdep</li>
37-
</ul>
33+
* Enable repositories universe, multiverse, and restricted
34+
* Adds the ROS sources list
35+
* Sets the needed keys
36+
* Loads specified ROS packages, defaults to ros-melodic-base-ros if none specified
37+
* Initializes rosdep
38+
* Sets up `ROS_MASTER_URI` and `ROS_IP` in the `~/.bashrc` file
39+
40+
_**Note:** You will need to check your `~/.bashrc` file to make sure the ROS_MASTER_URI and ROS_IP are setup correctly for your environment. During configuration, a best guess is made which should be considered a placeholder._
3841

3942
You can edit this file to add the ROS packages for your application.
4043

41-
<strong>setupCatkinWorkspace.sh</strong>
44+
**setupCatkinWorkspace.sh**
4245
Usage:
4346

44-
$ ./setupCatkinWorkspace.sh [optionalWorkspaceName]
47+
`$ ./setupCatkinWorkspace.sh [_optionalWorkspaceName_]`
4548

46-
where optionalWorkspaceName is the name of the workspace to be used. The default workspace name is catkin_ws. This script also sets up some ROS environment variables. Refer to the script for details.
47-
48-
<em><b>Note:</b> On June 7, 2019 the GPG key for ROS was changed due to security issues. If you have ROS installed on your system before this, you should delete the GPG key:</em>
49-
50-
<pre>
51-
$ sudo apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116
52-
</pre>
49+
where _optionalWorkspaceName_ is the name and path of the workspace to be used. The default workspace name is `~/catkin_ws`.
5350

5451

5552
## Release Notes
53+
54+
### September, 2021
55+
* v1.1
56+
* Tested on L4T 32.6.1 (JetPack 4.6)
57+
* Update ROS GPG Key
58+
* Setup ROS_IP more intelligently
59+
* Setup ROS_MASTER_URI and ROS_IP in installROS script instead of setupCatkinWorkspace
60+
* Script wrangling and cleanup
61+
* Should be the same as JetsonHacks/installROS
62+
5663
<strong>October 2019</strong>
5764
* vL4T32.2.1
5865
* L4T 32.2.1 (JetPack 4.2.2)
@@ -74,7 +81,7 @@ $ sudo apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116
7481
## License
7582
MIT License
7683

77-
Copyright (c) 2017-2019 JetsonHacks
84+
Copyright (c) 2017-2021 JetsonHacks
7885

7986
Permission is hereby granted, free of charge, to any person obtaining a copy
8087
of this software and associated documentation files (the "Software"), to deal

installROS.sh

Lines changed: 85 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
#!/bin/bash
2-
# Install Robot Operating System (ROS) on NVIDIA Jetson Nano Developer Kit
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+
32+
# 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:
535
# http://wiki.ros.org/melodic/Installation/UbuntuARM
@@ -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"
@@ -83,17 +113,22 @@ tput sgr0
83113
sudo apt-add-repository universe
84114
sudo apt-add-repository multiverse
85115
sudo apt-add-repository restricted
116+
tput setaf 2
117+
echo "Updating apt list"
118+
tput sgr0
119+
sudo apt update
86120

87121
# Setup sources.lst
88122
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
89123
# 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
124+
sudo apt install curl
125+
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
126+
93127
tput setaf 2
94-
echo "Updating apt-get"
128+
echo "Updating apt list"
95129
tput sgr0
96-
sudo apt-get update
130+
sudo apt update
131+
97132
tput setaf 2
98133
echo "Installing ROS"
99134
tput sgr0
@@ -120,25 +155,61 @@ tput setaf 2
120155
echo "Installing rosdep"
121156
tput sgr0
122157
sudo apt-get install python-rosdep -y
123-
# Certificates are messed up on earlier version Jetson for some reason
124-
# Do not know if it is an issue with the Nano, test by commenting out
125-
# sudo c_rehash /etc/ssl/certs
126158
# Initialize rosdep
127159
tput setaf 2
128160
echo "Initializaing rosdep"
129161
tput sgr0
130162
sudo rosdep init
131163
# To find available packages, use:
132164
rosdep update
133-
# Environment Setup - Don't add /opt/ros/melodic/setup.bash if it's already in bashrc
165+
# Environment Setup - source melodic setup.bash
166+
# Don't add /opt/ros/melodic/setup.bash if it's already in bashrc
134167
grep -q -F 'source /opt/ros/melodic/setup.bash' ~/.bashrc || echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
135168
source ~/.bashrc
136169
# Install rosinstall
137170
tput setaf 2
138171
echo "Installing rosinstall tools"
139172
tput sgr0
140-
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential -y
173+
174+
# Install useful ROS dev tools
175+
sudo apt-get install -y python-rosinstall \
176+
python-rosinstall-generator \
177+
python-wstool \
178+
build-essential
179+
180+
# Use ip to get the current IP addresses of eth0 and wlan0; parse into form xx.xx.xx.xx
181+
ETH0_IPADDRESS=$(ip -4 -o addr show eth0 | awk '{print $4}' | cut -d "/" -f 1)
182+
WLAN_IPADDRESS=$(ip -4 -o addr show wlan0 | awk '{print $4}' | cut -d "/" -f 1)
183+
184+
if [ -z "$ETH0_IPADDRESS" ] ; then
185+
echo "Ethernet (eth0) is not available"
186+
else
187+
echo "Ethernet (eth0) is $ETH0_IPADDRESS"
188+
fi
189+
if [ -z "$WLAN_IPADDRESS" ] ; then
190+
echo "Wireless (wlan0) is not available"
191+
else
192+
echo "Wireless (wlan0) ip address is $WLAN_IPADDRESS"
193+
fi
194+
195+
# Default to eth0 if available; wlan0 next
196+
ROS_IP_ADDRESS=""
197+
if [ ! -z "$ETH0_IPADDRESS" ] ; then
198+
ROS_IP_ADDRESS=$ETH0_IPADDRESS
199+
else
200+
ROS_IP_ADDRESS=$WLAN_IPADDRESS
201+
fi
202+
if [ ! -z "$ROS_IP_ADDRESS" ] ; then
203+
echo "Setting ROS_IP in ${HOME}/.bashrc to: $ROS_IP_ADDRESS"
204+
else
205+
echo "Setting ROS_IP to empty. Please change ROS_IP in the ${HOME}/.bashrc file"
206+
fi
207+
208+
#setup ROS environment variables
209+
grep -q -F ' ROS_MASTER_URI' ~/.bashrc || echo 'export ROS_MASTER_URI=http://localhost:11311' | tee -a ~/.bashrc
210+
grep -q -F ' ROS_IP' ~/.bashrc || echo "export ROS_IP=${ROS_IP_ADDRESS}" | tee -a ~/.bashrc
141211
tput setaf 2
212+
142213
echo "Installation complete!"
214+
echo "Please setup your Catkin Workspace and ~/.bashrc file"
143215
tput sgr0
144-

setupCatkinWorkspace.sh

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,46 @@
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."
33-
46+
echo "Catkin workspace: $CATKIN_DIR created"

0 commit comments

Comments
 (0)