(10 intermediate revisions by the same user not shown)
Line 9: Line 9:
<br />
<br />
==== Figuring out the JetPack Version ====
==== Figuring out the JetPack Version ====
After logging in to the Jetson via terminal, type
You need to figure out the version of JetPack from the version of L4T.
On Jetpack 4.2.1 and later, type
<pre class="terminal">
dpkg-query --show nvidia-l4t-core
</pre>
which prints the L4T version and build number.
<br />
<br />
On older releases, type
<pre class="terminal">
<pre class="terminal">
cat /etc/nv_tegra_release | head -n 1
cat /etc/nv_tegra_release | head -n 1
</pre>
</pre>
which will display the system major version and the revision version of the L4T. For example, if the line starts with "R32" and is followed by "REVISION: 1.0", the version is "32.1".
which prints a line in which the L4T minor version is referred to as "revision". For example, if the line starts with "R32" and is followed by "REVISION: 1.0", the version is "32.1".
<br />
<br />
<br />
<br />
{|
! style="width:6em; font-weight:bold" | L4T
! style="width:6em; font-weight:bold" | JetPack
! release date
|-
| 32.4.2 || 4.4.0 DP || 2020-04-21
|-
| 32.3.1 || 4.3.0 || 2019-12-18
|-
| 32.2.3 || 4.2.3 || 2019-11-19
|-
| 32.2.0 || 4.2.1 || 2019-07-16
|}
<br />
=== Assigning a Fixed Ethernet IP Address ===
=== Assigning a Fixed Ethernet IP Address ===
You can either use the old ''ifconfig'' tool
You can either use the old ''ifconfig'' tool
Line 66: Line 89:
The developer kit features HDMI and DisplayPort outputs for connecting to a display. In a robot, the control interface for the Jetson Nano will be a terminal session via SSH. To set up the SSH service on the Nano first make sure that the ssh package is installed:
The developer kit features HDMI and DisplayPort outputs for connecting to a display. In a robot, the control interface for the Jetson Nano will be a terminal session via SSH. To set up the SSH service on the Nano first make sure that the ssh package is installed:
<pre class="terminal">
<pre class="terminal">
sudo apt install ssh openssh-server
sudo apt install openssh-client openssh-server
</pre>
</pre>
<br />
<br />
Line 91: Line 114:
</pre>
</pre>
<br />
<br />
=== SSH Login Over WiFi Connection ===
=== SSH Login Over WiFi Connection ===
The Jetson Nano and the Jetson Xavier developer kit boards come without WiFi connectivity. You can use a USB WiFi adaptor stick (e.g., Edimax ) to add WiFi connectivity. On Ubuntu, you will need to give permission to the system to make the WiFi connection available to all other users, which includes the SSH daemon, in order to enable remote logins over WiFi without requiring an active local login session (via connected peripherals or Ethernet connection).
The Jetson Nano and the Jetson Xavier developer kit boards come without WiFi connectivity. You can use a USB WiFi adaptor stick (e.g., Edimax ) to add WiFi connectivity. On Ubuntu, you will need to give permission to the system to make the WiFi connection available to all other users, which includes the SSH daemon, in order to enable remote logins over WiFi without requiring an active local login session (via connected peripherals or Ethernet connection).
Line 160: Line 184:
To stream the camera images over the network via UDP, run the following script on the Jetson
To stream the camera images over the network via UDP, run the following script on the Jetson
<pre class="code">
<pre class="code">
#!/bin/bash
STREAM_RECEIVER_ADDRESS=$1
STREAM_RECEIVER_PORT=$2
GST_LAUNCH="gst-launch-1.0 -v"
GST_LAUNCH="gst-launch-1.0 -v"
GST_DEBUG="--gst-debug=3"
GST_DEBUG="--gst-debug=3"
Line 170: Line 197:
VIEW_OUTPUT="nvegltransform ! nveglglessink -e"
VIEW_OUTPUT="nvegltransform ! nveglglessink -e"


eval $GST_LAUNCH $INPUT ! $STREAM_OUTPUT
if [ $# == 0 ]; then
    eval $GST_LAUNCH $INPUT ! $VIEW_OUTPUT
elif [ $# == 2 ]; then
    eval $GST_LAUNCH $INPUT ! $STREAM_OUTPUT
fi
</pre>
</pre>
where ''<host address>'' and ''<port number>'' need to be replaced with the IP address and port of the receiving application.
where the client IP address and the client port number need to be supplied as arguments 1 and 2, respectively.
<br/>
<br/>
<br/>
<br/>
Line 183: Line 214:
eval $GST_UDPSRC ! $UNPACK_RTP_H264_PAYLOAD ! $VIDEO_SINK
eval $GST_UDPSRC ! $UNPACK_RTP_H264_PAYLOAD ! $VIDEO_SINK
</pre>
</pre>
where you need to replace ''<port number>'' with the same port number used by the sender. '''Check the receiver's firewall settings''' to make sure the port is not blocked!
where you need to replace ''<port number>'' with the same port number used by the sender. '''Check the receiver's firewall settings''' to make sure the port is not blocked! On macOS you can do so by opening the Firewall settings and first add ''Terminal'' to the list of applications for which incoming connections are allowed. Upon launching the script, you will be prompted to allow incoming connections for ''gst-launch-1.0'' as well.
<br />
<br />
<br />
<br />
Line 193: Line 224:
<br />
<br />


=== Message of the Day ===
=== GPIO Programming ===
The Jetson is usually used in a hardware setup without a connected display and therefore accessed through a terminal session. To help the user mentally keep terminal sessions apart, you can set a message of the day (MOTD) that is shown each time a user logs in. To set a simple MOTD, just edit the file '''/etc/motd'''. For setting a dynamic message text have a look at the files in '''/etc/update-motd.d/''' or search for information on the Internet.
<pre class="terminal">
<br />
sudo cat /sys/kernel/debug/tegra_gpio
<br />
The MOTD is sometimes embellished with ASCII art to draw more attention. Here is an ASCII art example for the robo.fish logo:
<pre class="code">
                                      .';cldxxkkkxxdolc;,..
                                  .;oOXWWMMMMMMMMMMMMMMWWXKOxo:,.
                                'o0WMMMMMMMMMMMMMMMMMMMMMMMMMMMWX0xl:'.
                              .;xXMMMMMMMMMMMMMMMMMMMMMMMMMWWWNNXXKKK0kd:.
                            .:ONMMMMMMMMMMMMMMMMMMWXKOxdoc:;;,'..........
.                        'o0WMMMMMMMMMMMMMMWN0xl:,..
Xx:.                  .:kXWMMMMMMMMMMMMMN0d:'.
MMWKxc'.          .'cxXWMMMMMMMMMMMMNOo:,.
MMMMMMN0xc,.  .,cd0NWMMMMMMMMMMMMN0o,.
MMMMMMWWNX0d:;ckKNWMMMMMMMMMMWN0xl,.
lllcc:;,'..    ..,;:clloollc:,..
</pre>
</pre>
<br />
<br />
<br />
 
=== Jetson Model Specifics ===
=== Jetson Model Specifics ===
==== Jetson Nano ====
==== Jetson Nano ====

Revision as of 2020-05-05T00:17:54

The Jetson Family

Nvidia's Jetson family of products are compact Tegra computers, which feature a large number of parallel computation units that are suitable for hardware-accelerated machine learning applications. The various models differ in their computational performance.

JetPack

JetPack is Nvidia's name for a software bundle that contains development software and a modified version of Ubuntu Linux with a custom kernel for the Tegra hardware, called Linux For Tegra or L4T.


Figuring out the JetPack Version

You need to figure out the version of JetPack from the version of L4T. On Jetpack 4.2.1 and later, type

dpkg-query --show nvidia-l4t-core

which prints the L4T version and build number.

On older releases, type

cat /etc/nv_tegra_release | head -n 1

which prints a line in which the L4T minor version is referred to as "revision". For example, if the line starts with "R32" and is followed by "REVISION: 1.0", the version is "32.1".

L4T JetPack release date
32.4.2 4.4.0 DP 2020-04-21
32.3.1 4.3.0 2019-12-18
32.2.3 4.2.3 2019-11-19
32.2.0 4.2.1 2019-07-16


Assigning a Fixed Ethernet IP Address

You can either use the old ifconfig tool

ifconfig eth0 192.168.0.10 netmask 255.255.255.0 up

or the newer ip tool (the example below is incomplete)

ip addr show
ip link set eth0 up


To make the IP address permanent, the easy way is to open the System Settings window from the Ubuntu GUI. Then

  • open the Network settings,
  • select the wired connection from the left hand list,
  • click on the "Options..." button in the bottom right corner,
  • open the "IPv4 Settings" tab,
  • change the value of the "Method:" field to "Manual",
  • enter the desired address (192.168.0.10) into the "Addresses" list.


Setting up WiFi

First, make sure that the WLAN hardware (maybe a USB stick) is operational. Check the availability of the wlan0 interface among all network interfaces:

ifconfig


Also, make sure that wpasupplicant is installed.

sudo apt-get install wpasupplicant

Now edit the file /etc/wpa_supplicant.conf to replace the "ssid" and "psk" values in the network example that starts with the line # Simple case: WPA-PSK:

network={
    ssid="ssid_name"
    psk="password"
    priority=5
}

where ssid_name and password need to be replaced with the WiFi name (SSID) and the password of your router, respectively.
Finally, connect to the router:

sudo killall wpa_supplicant
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf -D wext
sudo dhclient wlan0


Setting up SSH

The developer kit features HDMI and DisplayPort outputs for connecting to a display. In a robot, the control interface for the Jetson Nano will be a terminal session via SSH. To set up the SSH service on the Nano first make sure that the ssh package is installed:

sudo apt install openssh-client openssh-server


You can now start the SSH service like this:

sudo service ssh start

and stop it like this:

sudo service ssh stop


To make the SSH service start automatically at each boot, type

sudo systemctl enable ssh
sudo systemctl enable ssh.service
sudo systemctl start ssh

To prevent the system from starting the SSH service at each boot, type

sudo systemctl stop ssh
sudo systemctl disable ssh
sudo systemctl disable ssh.service


SSH Login Over WiFi Connection

The Jetson Nano and the Jetson Xavier developer kit boards come without WiFi connectivity. You can use a USB WiFi adaptor stick (e.g., Edimax ) to add WiFi connectivity. On Ubuntu, you will need to give permission to the system to make the WiFi connection available to all other users, which includes the SSH daemon, in order to enable remote logins over WiFi without requiring an active local login session (via connected peripherals or Ethernet connection).
To give permission,

  • open the "System Settings" application,
  • go to "Network",
  • make sure "Wireless" is selected on the left panel,
  • on the right side panel, next to the SSID of the WLAN server, click on the arrow icon,
  • click on the "Settings..." button on the bottom right corner,
  • in the window that opens, go to the tab "General",
  • check the "All users may connect to this network" option


Preventing the Graphical User Interface From Being Loaded

Ubuntu uses systemd to control whether the graphical user interface is loaded and shown. To turn off the graphical desktop immediately enter

sudo systemctl isolate multi-user.target

To prevent the GUI from being loaded during the system startup, type

sudo systemctl set-default multi-user.target

To return to the graphical desktop, type

sudo systemctl isolate graphical.target

and to make the graphical desktop the default again, type

sudo systemctl set-default graphical.target


Power Modes

Use the nvpmodel command line tool for selecting or configuring the performance level of a Jetson device. You can query the current mode via

sudo nvpmodel -q --verbose

and switch between modes with the "-m" option like this

sudo nvpmodel -m 1


Create your custom power mode by editing "/etc/nvpmodel.conf"

sudo vim /etc/nvpmodel.conf


Camera

Cameras can be connected to Jetson Nano over USB or over the CSI connector. In case of a CSI camera, the image sensor must be a Sony IMX219, such as the Raspberry Pi Camera v2.
Use the Video For Linux utilityv4l2-ctl to list all video inputs that are available to the system and what type of image frames they provide.

sudo apt install v4l-utils
v4l2-ctl --list-devices
v4l2-ctl --list-formats


You can view the video stream from the CSI camera using GStreamer

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1920, height=1080, framerate=30/1' ! nvvidconv flip-method=0 ! nvegltransform ! nveglglessink -e

where nvarguscamerasrc is a Gstreamer plugin for Nvidia's proprietary Argus Camera API for Linux on Tegra devices, and nveglglessink is a better-performing OpenGL sink than glimagesink. Curiously, nvarguscamerasrc will show up in the GStreamer element list when searching for elements of type video but not when searching for source/video.

gst-inspect-1.0 -t video


Streaming Images Over The Network

To stream the camera images over the network via UDP, run the following script on the Jetson

#!/bin/bash
STREAM_RECEIVER_ADDRESS=$1
STREAM_RECEIVER_PORT=$2
GST_LAUNCH="gst-launch-1.0 -v"
GST_DEBUG="--gst-debug=3"
INPUT="nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720,framerate=30/1,format=(string)NV12' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=(string)I420'"

# Stream via RTP over UDP
STREAM_OUTPUT="omxh264enc bitrate=8000000 ! 'video/x-h264, stream-format=byte-stream' ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink host=<host address> port=<port number>"

# Show in local GL window
VIEW_OUTPUT="nvegltransform ! nveglglessink -e"

if [ $# == 0 ]; then
    eval $GST_LAUNCH $INPUT ! $VIEW_OUTPUT
elif [ $# == 2 ]; then
    eval $GST_LAUNCH $INPUT ! $STREAM_OUTPUT
fi

where the client IP address and the client port number need to be supplied as arguments 1 and 2, respectively.

Run the following script on the client machine to receive and display the video stream in a GStreamer pipeline.

UNPACK_RTP_H264_PAYLOAD="'application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=H264, payload=96' ! rtph264depay ! avdec_h264"
GST_UDPSRC="gst-launch-1.0 -v --gst-debug=3 udpsrc port=<port number>"
VIDEO_SINK="videoconvert ! autovideosink"

eval $GST_UDPSRC ! $UNPACK_RTP_H264_PAYLOAD ! $VIDEO_SINK

where you need to replace <port number> with the same port number used by the sender. Check the receiver's firewall settings to make sure the port is not blocked! On macOS you can do so by opening the Firewall settings and first add Terminal to the list of applications for which incoming connections are allowed. Upon launching the script, you will be prompted to allow incoming connections for gst-launch-1.0 as well.

The order in which the Gstreamer pipelines are launched is irrelevant because of the connectionless data transmission via UDP. The receiver will be continuously waiting for incoming UDP packets, and the sender will be sending out packets even if there is no receiver.

Resources


GPIO Programming

sudo cat /sys/kernel/debug/tegra_gpio


Jetson Model Specifics

Jetson Nano

The Nano is the Jetson with the smallest footprint and lowest performance. It features 128 compute units based on the Maxwell architecture. The developer kit comes with host circuit board that provides connection ports like USB, Ethernet, HDMI and DisplayPort.


Power Supply and OS Installation

The Nano Developer Kit requires a power supply that can deliver 5 V and at least 2 A, either over the micro USB port, or via a standard 5.5/2.1mm barrel power jack, which requires bridging the J48 header pins with a jumper. When operated via the power jack, the micro USB port can be used to install the Nano operating system from an external computer. Otherwise, the OS image needs to be written to a micro-SD card that is inserted into the card slot of the developer kit.

Preconfigured Power Modes
  • MAXN (mode #0): the default mode with maximum performance
  • 5W (mode #1): low-power mode where only two out of four CPU core are working and the GPU clock frequency is constrained.



Debug data: