Skip to content

Setting up the Jetson

Riley Bridges edited this page Feb 14, 2024 · 24 revisions

Networking Setup

Please refer to the following: https://github.com/umrover/mrover-ros/wiki/Setting-up-static-IPs

Deprecated:

To set up networking on the Jetson, run source scripts/networking_setup_jetson on the Jetson.

To set up networking on the base station, run source scripts/networking_setup_basestation on the base station.

This will set up the environment variables needed for the ROS nodes to connect.

The IP of the Jetson should be set to 10.0.0.2 by default.

The IP of the base station should be manually set to include both 10.0.0.7/8 and 10.1.0.7/8. The base station needs 10.0.0.7/8 to be on the same network as the Jetson. The base station also needs 10.1.0.7/8 to be on the same network as the radios we use (which are 10.1.0.{3/4/5/6}).

To add an IP, one can run sudo ip address {add/del} {insert_ip} dev {insert_ethernet_interface}. One can find the ethernet interface by running ip addr. It is recommended to add 10.0.0.7/8 before adding 10.1.0.7/8.

For example, one might run sudo ip address add 10.0.0.7/8 dev enp44s0.

USB Dev Rules

Pretty sure you should run the following:

roscd mrover
sudo cp scripts/99-usb-serial.rules /etc/udev/rules.d/

You will need to reboot for this to take place.

Our system's custom usb dev rules are located in scripts/99-usb-serial.rules. To add a new one plug in your usb device and type:

sudo lsusb -v | grep 'idVendor\|idProduct\|iProduct\|iSerial'

Find your device and it's idVendor, idProduct, iProduct and iSerial numbers/tags (it is ok if your device doesn't have all that information). Go into the /etc/udev/rules.d/99-usb-serial.rules file on the Jetson and add a new line in this format:

SUBSYSTEM=="< your subsystem, normally tty for sub >", ATTRS{idVendor}=="< idVendor >", ATTRS{idProduct}=="< idProduct >", ATTRS{iProduct}=="< iProduct >", ATTRS{serial}=="< serial >", SYMLINK+="< name >"

The name can be anything. You may have to remove the ‘iProductand/orserialattribute sections if they aren’t provided inlsusb` or if the device doesn’t appear at the end of this procedure. Once done, save the file and run the following command to restart udev:

sudo udevadm control --reload-rules && sudo service udev restart && sudo udevadm trigger

You should now be able to access your serial device as /dev/<name>.

This is useful since we use USB Dev Rules to set up /dev/gps and /dev/imu.

Here are some useful links:

Camera Setup

Do the following: Clone jetson-utils on the Jetson in home directory.

We use Python 3.8, so one should change the CMakeLists.txt insdie the jetson-utils/python/ folder and delete the if statement to force 3.8 to be used.

Then cd into the jetson-utils folder, then make a build folder, cd into that and run cmake .. then make.

git clone https://github.com/dusty-nv/jetson-utils
cd jetson-utils
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig

Download NVIDIA SDKManager on Host Computer

Download the proper version for your system here: https://developer.nvidia.com/nvidia-sdk-manager

You may have to make a NVIDIA developer account prior to this

I used Ubuntu 20.04.5 LTS so I installed the .deb version, for that run sudo apt install ./sdkmanager_*.deb

Make sure tlp is not installed on your system!!! For some reason it breaks the flashing.

Boot the Jetson in recovery mode

First power off the Jetson completely. Use a jumper cable to connect pins 9 and 10 (see this video for help: https://youtu.be/s1QDsa6SzuQ). There should be two free pins on the right after hooking it up.

Plug in power to boot up.

Connect to the Micro USB port on the Jetson with the other side of the cable going into your host computer.

Run sdkmanager in terminal to open the flasher.

Install Jetpack

Install the latest version of Jetpack. As of writing this it was 5.0.2

Building OpenCV for the Jetson

The default OpenCV that ships with the Jetson does not have the libopencv-contrib-dev package installable for some reason. So I cloned https://salsa.debian.org/science-team/opencv and ran debuild -uc -us -b in the root directory to generate .deb pacakges. I then transfered them to the Jetson and installed them.

Enabling USART (/dev/ttyTHS0) and adding to dialout group

Permissions must be given to /dev/ttyTHS0 to use that port for the science node since that uses USART.

The USART on the Jetson Xavier NX is mapped to /dev/ttyTHS0 usually. Another service (nvgetty) may automatically be using that port, so disable it by running sudo systemctl disable nvgetty.service.

To enable a particular device (e.g. /dev/ttyTHS0), first run ls -l /dev/ttyTHS0. If it says something like "root tty", then that means that it is currently in the tty group and you need to add it to the dialout group. Do this by running sudo usermod -a -G tty $USER.

For both of the above to take place, you must reboot the Jetson.

Raman Forwarding Via Socat

Install socat by running sudo apt install socat

Run the following:

roscd mrover
sudo cp system_services/rover-jetson-raman.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable rover-jetson-raman.service

You may also need to run the following:

sudo systemctl daemon-reload
sudo systemctl start rover-jetson-raman.service
sudo systemctl restart rover-jetson-raman.service
Clone this wiki locally