Jetson/FRC Setup

=Introduction= The Jetson platform has a number of applications within FIRST Robotics Competition Robots. The purpose of this guide is to provide a step-by-step walkthrough to teams, perhaps with less experience working with Linux, that allows them to utilize the capabilities of the Jetson TK1/TX1/TX2 to improve their robots. This guide explains setting up the Jetson itself, as well as configuring it for use in FRC, and using programs that would prove beneficial for FRC teams.

=Step 1: Setting up tools=
 * In order to flash the Jetson, you must use the Nvidia Jetpack utility. Jetpack must be installed on an Ubuntu machine.  In order to facilitate this installation for teams who don’t have a dedicated Ubuntu computer, the first step in this guide is to Install and configure a virtual machine.


 * The software we have chosen to use is Virtualbox, due to the fact that it is the same product regardless of host machine. To download Virtualbox, go to https://www.virtualbox.org/wiki/Downloads and select the appropriate version for the platform it will be installed on.


 * After downloading Virtualbox, download an Ubuntu .iso. Note: Jetpack requires Ubuntu 15.04 or 16.04.  It will NOT work on Ubuntu 17.04.  Ubuntu can be found at https://www.ubuntu.com/download/desktop.


 * Once it has been downloaded, you must install Virtualbox. There are different installation procedures for different host platforms, but the installers are easy to understand.  Follow the instructions for a standard installation.


 * After Virtualbox has been installed, it is time to create the virtual machine. In order to make sure there is enough space for Jetpack and any other utilities, we recommend setting the virtual hard disk size to 40GB.  It is also recommended that at least 4GB of RAM is dedicated to the VM.


 * After initially setting up the VM settings, additional modifications must be done to the VM. Go into settings for the VM, and enable USB passthrough.  This is most easily done by going into the VM Settings and adding a blank filter in the USB section.  This will cause all USB devices connected while the VM is running to be passed through to the VM.  Note: In order to avoid issues with mice, keyboards, etc. that are needed by the host machine, do NOT detach and reattach peripherals while inside the VM.  Additionally, network settings for the VM must also be changed.  The adapter type should be changed from NAT to Bridged. This will allow the VM to communicate on the local network.






 * Install Ubuntu. When prompted for an .iso, select the Ubuntu .iso downloaded previously.  Follow the standard steps for an Ubuntu installation, downloading all updates but not downloading all add-ons.

=Step 2: Using Jetpack= Now that there is an environment in which to set up the Jetson, we must download and install Jetpack (On the Ubuntu VM).
 * To download Jetpack, go to https://developer.nvidia.com/embedded/jetpack, and follow the instructions to create an account and get the file. It is suggested that you download the file into a custom directory, created by running   in a terminal.




 * In order to install the Jetpack utility on Ubuntu, you must modify the permission on the downloaded file to make it executable. To do this, run:   After adding the executable permission to the Jetpack file, run the file by typing in:




 * Select the correct package for the device you are configuring. Accept all license agreements, and continue on with the installer.  Ensure that the installer is set to do a full installation and to NOT automatically resolve dependencies.  Allow Jetpack to download and install all of the packages.




 * The next step will involve the Nvidia Jetson board itself. A black terminal window will open inside the VM, prompting you to restart the Jetson in force recovery mode.  Follow the on-screen instructions.  Run   in a separate terminal window in order to determine whether or not the Jetson is visible to the VM; an "NVidia" device should appear in the   results.  If it is not, verify first that host machine can see the Jetson; if it cannot, carefully follow the instructions to put it in force recovery mode once again.  If it can, check the VM USB settings and try again.




 * Press enter. The utility will not move forward in the process by itself, so you must move it forward once the Jetson can be seen by the VM.


 * Once the utility is done with the initial movement of files to the Jetson, a prompt will appear asking about the way the Jetson is connected to the network. Connect the Ethernet port on the Jetson to the same router as the host machine, and select the corresponding option.




 * Jetpack may then ask for the IP address of the Jetson. Obtain this via the   command in a terminal on the VM.  Input this IP address, along with the username “ubuntu” and password “ubuntu” into the utility window.


 * Allow the utility to finish, the Jetson will restart, and move on to actual setup on the Jetson itself.

=Step 3: Configuring Jetpack Networking=
 * Connect a keyboard, mouse, and screen to the Jetson. This will allow us to work directly on the Jetson while we Configure network settings.


 * This tutorial assumes that you will be setting the Jetson up on a network configured for static IP addresses. First, install resolvconf in order to be able to resolve IP addresses via DNS after reconfiguring your network settings.  Run the following commands to do this:.


 * Once resolvconf is installed, find the NetworkManager configuration file located at  so that the line:   is present, and no other entry exists for rc-manager.

auto enx00044b669328 iface enx00044b669328 inet static address (regular IP address) netmask (network netmask) gateway (normal gateway) network (normal network) broadcast (normal broadcast) dns-nameservers 8.8.8.8 8.8.8.4 dns-search google.com
 * Create three new interface files:,  , and   at  .  They should look as follows:

auto enx00044b669328 iface enx00044b669328 inet static address (regular IP address) netmask (network netmask) gateway (normal gateway) network (normal network) broadcast (normal broadcast) dns-nameservers 8.8.8.8 8.8.8.4 dns-search google.com

auto enx00044b669328 iface enx00044b669328 inet static address 10.xx.yy.12 netmask 255.0.0.0 gateway 10.xx.yy.1 network 10.0.0.0 broadcast 10.xx.yy.255 dns-nameservers 8.8.8.8 8.8.8.4


 * Where xx.yy is refers to the team number (e.g. 34.19)


 * Reboot the Jetson.

=Step 4: Setting up Samba=
 * In order to facilitate easier development, create a directory directly above root. For this guide, we will assume that the directory name will be / . Run   in order to gain full permissions for that directory.


 * Samba will be installed in order to allow remote systems to mount that directory as an external drive. This makes it easier to develop for the Jetson.  To install samba, run the following command:.


 * To configure Samba, run  to se the password for the user. A prompt will then appear asking for the password.  This should be the same password that you will later set for the user on the Jetson itself.


 * Made a copy of the Samba configuration file as a backup with

[ ] path = / valid users = ubuntu read only = no
 * Open the smb.conf file and add the following lines to the end:
 * Then restart Samba by running

=Step 5: Building Network Tables (without Java)=
 * You can now mount the Jetson’s / directory as an external drive on any development machine on the network.


 * NetworkTables is an important tool for passing data around the FRC Control System. In order to use NetworkTables on the Jetson, we will build it from source.


 * Get the source code from Github. To do this, navigate to the teamfolder created in the step above. Then run  .  This will create a new directory located at / /ntcore.  Inside this directory are a number of files used to build ntcore.


 * Open the file “CMakeLists.txt” and add:  to the TOP of the file in order to build ntcore without Java bindings.  Note that this method of building ntcore does NOT use gradle.


 * Run  and  . This will build the ntcore libraries as well as a set of tests.


 * In order to use NetworkTables in projects, the directory must be added to the shared library loader path. To do this, open   and add the following line to the bottom:

LIB_PATH=/ /ntcore/ NT_INCLUDE_PATH=/ /ntcore/include/ WPI_INCLUDE_PATH=/ /ntcore/wpiutil/include/ FILENAME=client.cpp OUTNAME=nt_client all: clean g++ -std=c++11 -g -Wall -L$(LIB_PATH) -I$(NT_INCLUDE_PATH) -I$(WPI_INCLUDE_PATH) $(FILENAME) -lntcore -lwpiutil -lpthread -o $(OUTNAME) clean: -rm ${OUTNAME} run: all ./${OUTNAME} =Step 6: Installing GStreamer=
 * Reboot the Jetson. Now, the ntcore libraries will work properly as long as project build options are correct.  The following is a sample makefile that demonstrates the correct way to link the libraries when compiling with g++.
 * The Jetson can be used to provide a high-quality, low-latency video stream by compressing camera output using the H264 video compression codec. Gstreamer can be used to stream that video to another computer on the network


 * Install gstreamer-1.0 with


 * Gstreamer's functions can be accessed from the command line using gst-launch-1.0


 * 'Test gstreamer by displaying a test image using .  This command should display test image on the screen if you have a monitor plugged into your Jetson. If the command does not work, try.


 * Understanding the command
 * gst-launch-1.0 is the command line interface with gstreamer.
 * To stream camera footage without image processing in opencv, the example command is what you should use.
 * GStreamer works by creating an image pipeline, elements of which are separated by “!”.
 * The first element in the pipeline is the image source, in the first example this is a gstreamer test image and in the second it is your camera.
 * The next element sets properties or “caps” of the image; in this case we are requesting a raw image as opposed to a jpeg or some other compressed format, and asking for dimensions 1280x720. Other options such as the framerate and image format can be set here as well.
 * The last element in the pipeline is the image sink, or where the image will go; autovideosink attempts to display the image on your hardware, and ximagesink will attempt to display specifically using xwindows.


 * Test gstreamer. Make sure that the camera is connected to the Jetson with .  The camera should be among the listed devices.  Determine which video input the camera is on by running  .  The result of that command is the path to the camera.  Generally this should be   or   to test your camera with gstreamer.
 * Again, if this command does not work try replacing autovideosink with ximagesink. Also, make sure that the device is the same one as the result of running.
 * This command is almost identical to the first except the source is a camera instead of a test image.


 * Test gstreamer over a network. In order to see the camera’s image on your laptop, you will have to install gstreamer there and run a gstreamer pipeline on both the Jetson and your laptop. The pipeline on the jetson will send an image over udp to a port on your laptop, and your laptop will use that sent image as its source and display it.


 * More info on using gstreamer on a Jetson can be found here