Setup Jetson Xavier NX

Recommended Versions for Jetson Xavier NX (as of 2025)

Best Choice: JetPack 5.1.4

  • JetPack: 5.1.4 (Latest stable for Xavier NX)
  • L4T: 35.6.0
  • CUDA: 11.4
  • TensorRT: 8.5.2
  • cuDNN: 8.6.0
  • Ubuntu: 20.04 LTS

Where to Find Official NVIDIA Resources

1. Main Starting Points

2. Direct Navigation Path

NVIDIA Developer → Embedded Computing → Jetson → JetPack SDK
                                         ↓
                               Select your device (Xavier NX)
                                         ↓
                               Download SD Card Image or SDK Manager

3. Essential Tools

For SD Card Setup (Easiest)

For Advanced Setup

  • NVIDIA SDK Manager: For full control over installation
  • L4T BSP: For custom configurations

Step-by-Step Guide to Find Resources

Step 1: Check Your Current Version

# Check JetPack version
sudo apt show nvidia-jetpack

# Check L4T version
cat /etc/nv_tegra_release

# Check CUDA version
nvcc --version

Step 2: Find Compatible Software

Official NVIDIA Resources

  1. JetPack Archive: https://developer.nvidia.com/embedded/jetpack-archive
  2. Jetson Linux Archive: https://developer.nvidia.com/embedded/linux-tegra-archive
  3. CUDA Zone: https://developer.nvidia.com/cuda-zone

Documentation

Step 3: Download Checklist

For Fresh Installation

  1. SD Card Image (easiest method)
    • Size: ~6-7GB compressed
    • Filename pattern: jetson-xavier-nx-jp514-sd-card-image.zip
  2. SDK Manager (for custom installation)
    • Requires Ubuntu 18.04/20.04 host PC
    • Can install specific components

For Development

# After installation, get development tools
sudo apt update
sudo apt install nvidia-jetpack-dev

# For AI/ML development
sudo apt install python3-pip
pip3 install numpy tensorflow torch torchvision

Version Compatibility Matrix

Component JetPack 5.1.4 JetPack 5.0.2 JetPack 4.6.x
L4T 35.6.0 35.1 32.7.x
CUDA 11.4 11.4 10.2
Ubuntu 20.04 20.04 18.04
Python 3.8 3.8 3.6
GCC 9.4.0 9.4.0 7.5.0

Important Notes

⚠️ Version Warnings

  • Never use JetPack 6.x – It’s ONLY for Orin series
  • Stick with JetPack 5.1.x for best Xavier NX support
  • JetPack 4.6.x – Still supported but older Ubuntu 18.04

💡 Best Practices

  1. Always verify image checksums when available
  2. Use quality SD cards (SanDisk Extreme, Samsung EVO)
  3. Keep backups of working configurations
  4. Document your setup process

🔧 Troubleshooting Resources

Quick Setup Commands After Fresh Install

# Update system
sudo apt update && sudo apt upgrade

# Install JetPack components
sudo apt install nvidia-jetpack

# Check installation
sudo jetson_clocks --show
sudo tegrastats

# Install useful tools
sudo apt install htop jtop nano git build-essential

Complete ORB-SLAM3 Setup Guide for Jetson Xavier NX with RealSense D455

System Requirements

  • Hardware: NVIDIA Jetson Xavier NX (8GB RAM, 32GB storage)
  • OS: Ubuntu 20.04.6 LTS
  • Camera: Intel RealSense D455

Table of Contents

  1. System Preparation
  2. ROS2 Foxy Installation
  3. RealSense SDK Installation
  4. ORB-SLAM3 Dependencies
  5. Pangolin Installation
  6. ORB-SLAM3 Installation
  7. Testing and Demo
  8. Troubleshooting Guide

1. System Preparation

Update System

sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget git cmake build-essential pkg-config

Check Available Space

df -h
# Ensure you have at least 5GB free space

Optimize Jetson Performance

# Set maximum performance mode
sudo nvpmodel -m 0
sudo jetson_clocks

# Create optimization script
cat > ~/optimize_jetson.sh << 'EOF'
#!/bin/bash
echo "Optimizing Jetson Xavier NX..."
sudo nvpmodel -m 0
sudo jetson_clocks
echo 3 | sudo tee /proc/sys/vm/drop_caches
echo "Optimization complete!"
EOF

chmod +x ~/optimize_jetson.sh

2. ROS2 Foxy Installation

Add ROS2 Repository

# Install required packages
sudo apt install -y software-properties-common
sudo add-apt-repository universe

# Add ROS2 GPG key
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

# Add repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

Install ROS2 Foxy

sudo apt update
sudo apt install -y ros-foxy-desktop python3-argcomplete

# Install additional tools
sudo apt install -y \
  python3-colcon-common-extensions \
  python3-rosdep \
  python3-vcstool

# Initialize rosdep
sudo rosdep init
rosdep update

# Add to bashrc
echo "source /opt/ros/foxy/setup.bash" >> ~/.bashrc
source ~/.bashrc

Install ROS2 Development Tools

sudo apt install -y \
  ros-foxy-cv-bridge \
  ros-foxy-image-transport \
  ros-foxy-diagnostic-updater \
  ros-foxy-diagnostic-msgs \
  ros-foxy-tf2-ros \
  ros-foxy-tf2-tools \
  ros-foxy-tf2-sensor-msgs \
  ros-foxy-xacro \
  ros-foxy-joint-state-publisher \
  ros-foxy-robot-state-publisher

3. RealSense SDK Installation

Build from Source (Required for ARM64)

# Install dependencies
sudo apt-get install -y git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
sudo apt-get install -y libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev

# Clone librealsense
cd ~
git clone https://github.com/IntelRealSense/librealsense.git
cd librealsense

# Setup udev rules
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger

# Build with CUDA support
mkdir build && cd build
cmake .. \
    -DBUILD_EXAMPLES=true \
    -DCMAKE_BUILD_TYPE=Release \
    -DFORCE_RSUSB_BACKEND=true \
    -DBUILD_WITH_CUDA=true \
    -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc

make -j2
sudo make install
sudo ldconfig

Install ROS2 RealSense Wrapper

# Create workspace
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src

# Clone RealSense ROS2 wrapper
git clone https://github.com/IntelRealSense/realsense-ros.git -b 4.51.1

# Build
cd ~/ros2_ws
source /opt/ros/foxy/setup.bash
colcon build --symlink-install

# Source workspace
source install/setup.bash
echo "source ~/ros2_ws/install/setup.bash" >> ~/.bashrc

4. ORB-SLAM3 Dependencies

Install System Dependencies

sudo apt install -y \
  libgtk2.0-dev \
  libavcodec-dev libavformat-dev libswscale-dev \
  libtbb2 libtbb-dev \
  libjpeg-dev libpng-dev libtiff-dev \
  libglew-dev libboost-all-dev libssl-dev \
  libeigen3-dev \
  libgl1-mesa-dev libegl1-mesa-dev libwayland-dev \
  libopencv-dev \
  python3-dev python3-numpy python3-pip

5. Pangolin Installation

Install Pangolin with C++14 Support

cd ~
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build && cd build

# Configure with warnings disabled
cmake .. \
  -DCMAKE_BUILD_TYPE=Release \
  -DBUILD_TOOLS=OFF \
  -DBUILD_EXAMPLES=OFF \
  -DBUILD_TESTS=OFF \
  -DBUILD_PANGOLIN_PYTHON=OFF \
  -DCMAKE_CXX_FLAGS="-w -Wno-error" \
  -DCMAKE_C_FLAGS="-w -Wno-error"

make -j2
sudo make install
sudo ldconfig

Note: If you encounter OpenEXR errors, the -w flag disables all warnings and allows compilation to proceed.


6. ORB-SLAM3 Installation

Clone and Prepare ORB-SLAM3

cd ~
git clone https://github.com/UZ-SLAMLab/ORB_SLAM3.git
cd ORB_SLAM3

# Fix Eigen paths for ARM architecture
chmod +x build.sh
sed -i 's/Eigen\//eigen3\/Eigen\//g' $(find . -type f -name "*.h" -o -name "*.cc" -o -name "*.cpp")

# Fix incorrect unsupported Eigen path
find . -type f \( -name "*.cc" -o -name "*.cpp" -o -name "*.h" \) -exec sed -i 's|unsupported/eigen3/Eigen|unsupported/Eigen|g' {} \;

Build Third-party Libraries

# Build DBoW2
cd Thirdparty/DBoW2
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j2
cd ../../..

# Build g2o
cd Thirdparty/g2o
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j2
cd ../../..

# Build Sophus (optional, skip if errors)
if [ -d "Thirdparty/Sophus" ]; then
    cd Thirdparty/Sophus
    mkdir build && cd build
    cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF
    make -j2 || echo "Sophus build failed, continuing without it"
    cd ../../..
fi

Extract Vocabulary and Build ORB-SLAM3

# Extract vocabulary
cd Vocabulary
tar -xf ORBvoc.txt.tar.gz
cd ..

# Build ORB_SLAM3 with C++14 support
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=14
make -j2

Create D455 Configuration File

mkdir -p ~/ORB_SLAM3/Examples/RGB-D
cat > ~/ORB_SLAM3/Examples/RGB-D/D455.yaml << 'EOF'
%YAML:1.0

# Camera Parameters
Camera.type: "PinHole"

# Camera calibration parameters
Camera.fx: 382.613
Camera.fy: 382.613
Camera.cx: 320.183
Camera.cy: 236.455

Camera.k1: 0.0
Camera.k2: 0.0
Camera.p1: 0.0
Camera.p2: 0.0

Camera.width: 640
Camera.height: 480
Camera.fps: 30.0

# IR projector baseline times fx
Camera.bf: 40.0

# Color order (0: BGR, 1: RGB)
Camera.RGB: 1

# Depth threshold
ThDepth: 40.0
DepthMapFactor: 1000.0

# ORB Parameters
ORBextractor.nFeatures: 1000
ORBextractor.scaleFactor: 1.2
ORBextractor.nLevels: 8
ORBextractor.iniThFAST: 20
ORBextractor.minThFAST: 7

# Viewer Parameters
Viewer.KeyFrameSize: 0.05
Viewer.KeyFrameLineWidth: 1
Viewer.GraphLineWidth: 0.9
Viewer.PointSize: 2
Viewer.CameraSize: 0.08
Viewer.CameraLineWidth: 3
Viewer.ViewpointX: 0
Viewer.ViewpointY: -0.7
Viewer.ViewpointZ: -1.8
Viewer.ViewpointF: 500
EOF

7. Testing and Demo

Test with Sample Dataset

cd ~/ORB_SLAM3

# Download TUM dataset
wget https://vision.in.tum.de/rgbd/dataset/freiburg1/rgbd_dataset_freiburg1_desk.tgz
tar -xzf rgbd_dataset_freiburg1_desk.tgz

# Run RGB-D example
./Examples/RGB-D/rgbd_tum \
  Vocabulary/ORBvoc.txt \
  Examples/RGB-D/TUM1.yaml \
  rgbd_dataset_freiburg1_desk \
  Examples/RGB-D/associations/fr1_desk.txt

Test with RealSense D455

# Terminal 1: Launch RealSense
source ~/ros2_ws/install/setup.bash
ros2 launch realsense2_camera rs_launch.py \
  depth_module.profile:=640x480x30 \
  rgb_camera.profile:=640x480x30 \
  align_depth.enable:=true

# Terminal 2: Verify camera is working
ros2 topic list
ros2 topic echo /camera/color/image_raw --no-arr

8. Troubleshooting Guide

Error 1: No Space on Device

Symptom: fallocate: fallocate failed: No space left on device

Solution: Clean up disk space

sudo apt-get clean
sudo apt-get autoremove -y
sudo journalctl --vacuum-time=2d
df -h  # Check available space

Error 2: RealSense Package Not Found

Symptom: E: Unable to locate package librealsense2-dkms

Solution: The -dkms package is not available for ARM64. Build from source instead (see Section 3).

Error 3: OpenEXR Compilation Errors

Symptom: Multiple warnings about deprecated functions in Pangolin build

Solution: Disable warnings in CMake

cmake .. -DCMAKE_CXX_FLAGS="-w -Wno-error" -DCMAKE_C_FLAGS="-w -Wno-error"

Error 4: Eigen Path Errors

Symptom: fatal error: unsupported/eigen3/Eigen/MatrixFunctions: No such file or directory

Solution: Fix Eigen paths

find . -type f \( -name "*.cc" -o -name "*.cpp" -o -name "*.h" \) -exec sed -i 's|unsupported/eigen3/Eigen|unsupported/Eigen|g' {} \;

Error 5: C++14 Features Required

Symptom: Errors about std::enable_if_t and other C++14 features

Solution: Build with C++14 support

cmake .. -DCMAKE_CXX_STANDARD=14

Error 6: Memory Issues During Compilation

Symptom: Compilation freezes or crashes

Solution: Use fewer parallel jobs

make -j1  # or make -j2 maximum

Final Verification

After successful installation, you should be able to:

  1. Run realsense-viewer and see your D455 camera
  2. Run the TUM dataset example and see the 3D reconstruction
  3. Launch ROS2 nodes without errors

Important Notes:

  • Always run ~/optimize_jetson.sh before intensive SLAM operations
  • Move the camera slowly for best tracking results
  • Ensure good lighting and textured environments for robust tracking

This guide has been tested on Jetson Xavier NX with Ubuntu 20.04.6 LTS and successfully builds ORB-SLAM3 with RealSense D455 support.