Agipix documentation · v1.1.0
The Agipix manual
Simulation, real hardware, autonomy and operator UI for the open sim-to-real aerial inspection platform.
- Paper
- AgiPIX: Bridging Simulation and Reality in Indoor Aerial Inspection, ICUAS 2026, pp. 844–852. DOI 10.1109/ICUAS69441.2026.11598625
- Generated
- · 21 guides · the online version is always the latest
Simulation · https://sasakuruppuarachchi.github.io/agipix/docs/sim/
Agipix (Simulation) — Quick Guide
Use this page to set up the AgiSIM digital twin workflow and run parity experiments before real flights.

Simulation Setup
- Host: Ubuntu 20.04/22.04 with NVIDIA GPU drivers.
- Install ROS 2 Humble and NVIDIA Isaac Sim.
- Enable ROS 2 bridge extension and configure PX4 SITL + DDS.
- Keep the same containerized stack used on hardware for sim-to-real parity.
Read: Docker Build and Simulation Setup
Run the Simulation
- Start Isaac Sim (first launch can take a while) and ensure the ROS 2 bridge is active.
- In the container/session, build and run the control stack; follow the provided tmux panes.
- Connect visualization via Foxglove at ws://localhost:8765 (see details in the setup doc).
Quadrotor Simulation of 3D mapping of cluttered environment in IsaacSIM using PX4 and ROS2 - Agipix
Next steps
- Continue to Autonomy Quick Guide
- Continue to UI Quick Guide
- Going to hardware: Real Robot Quick Guide
Simulation · https://sasakuruppuarachchi.github.io/agipix/docs/sim/1_docker_build.html
Setting Up the Agipix Simulation Environment
Prerequisites for host PC
- Ubuntu 20.04/22.04 Operating System
- NVIDIA GPU (RTX 2070 or higher)
- NVIDIA GPU Driver (recommended version 525.85)
Cuda and CUDnn
!! Importat: Always use the given liks to get the latest deb package links wt is statud here may be outdated.
Install cuda with the instructions here
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda-repo-ubuntu2204-12-8-local_12.8.0-570.86.10-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2204-12-8-local_12.8.0-570.86.10-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-12-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-8
Install Cudnn with the instructions here
wget https://developer.download.nvidia.com/compute/cudnn/9.18.1/local_installers/cudnn-local-repo-ubuntu2204-9.18.1_1.0-1_amd64.deb
sudo dpkg -i cudnn-local-repo-ubuntu2204-9.18.1_1.0-1_amd64.deb
sudo cp /var/cudnn-local-repo-ubuntu2204-9.18.1/cudnn-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cudnn
echo 'export PATH=/usr/local/cuda-12.8/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
Verify
nvcc -V
cd $HOME/workspace/raicam-ros/src/isaac_ros_common/verify
g++ verify_cuda_cudnn.cpp \
-I/usr/local/cuda-12.8/targets/x86_64-linux/include \
-L/usr/local/cuda-12.8/targets/x86_64-linux/lib \
-lcudart -lcudnn -o verify_cuda_cudnn
./verify_cuda_cudnn
Building Containerised Development platform
The containerised development platform is shared by both sim and real hardware. This improve the deployability from sim to real with minimal code change.
Curent release uses Nvidia Isaac Ros 3.2 as the basis for this platform
Prerequisities
- Finish Flasing Hadrware or setting up Sim host.
1) Install Docker + NVIDIA Container Toolkit + Git LFS
Install docker with
- Guide from JetsonHacks
cd hacks git clone https://github.com/jetsonhacks/install-docker.git cd install-docker bash ./install_nvidia_docker.sh bash ./configure_nvidia_docker.sh
Or use
- Docker: https://docs.docker.com/engine/install/ubuntu/
- NVIDIA Container Toolkit: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
Git LFS: https://git-lfs.com/
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
# Install Git LFS
sudo apt update
sudo apt install git-lfs -y
# Initialize Git LFS for your user
git lfs install
To verify CDI interfaces sudo nvidia-ctk cdi list should output
INFO[0000] Found 2 CDI devices
nvidia.com/pva=0
nvidia.com/pva=all
if no CDI devices are found
sudo apt-get install -y nvidia-container-toolkit sudo systemctl restart docker
2) Setup Workspace
cd $HOME
mkdir workspace && cd workspace
mkdir -p agipix_control/src dds lidar_ws/src raicam-ros/src ui/src logging/bags logging/flogs logging/crashreports
cd raicam-ros/src
git clone https://github.com/SasaKuruppuarachchi/isaac_ros_common.git # TODO
echo "export WORKSPACES_DIR="$HOME/workspace"" >> ~/.bashrc
echo "export ISAAC_ROS_DEV_DIR="$HOME/workspace/raicam-ros"" >> ~/.bashrc
echo "alias agidocker='cd $HOME/workspace/raicam-ros/src/isaac_ros_common/scripts/ && ./run_dev.sh --skip-registry-check'" >> ~/.bashrc
echo "alias killagidocker='docker container kill isaac_ros_dev-x86_64-container'" >> ~/.bashrc
source ~/.bashrc
3) Build Docker
In this step we pull source images and build the docker continer.
- To customise the docker configuration edit and append the additional docker configuration layers you need built
code ~/workspace/raicam-ros/src/isaac_ros_common/scripts/.isaac_ros_common-config - Change the ROS_DOMAIN_ID to 3 (To mactch the sim environment)
code ~/workspace/raicam-ros/src/isaac_ros_common/scripts/bashrc
Build the Docker
cd ~/workspace/raicam-ros/src/isaac_ros_common/scripts/ && ./run_dev.sh # this alias builds the container
The build will take more than an hour and if successfull you will see Running isaac_ros_dev-aarch64-container and the container will start running in the background.
Run agidocker to attach to the container interactively.
Verify Pytorch with cuda on dcker
agidocker
# Inside docker
python3 - << 'EOF'
import torch
print("CUDA:", torch.cuda.is_available())
print("Device:", torch.cuda.get_device_name(0))
EOF
(Optional) Installing Portainer CE
Portainer CE is an open-source GUI for creating and managing docker containers. Install it following these instructions
Simulation · https://sasakuruppuarachchi.github.io/agipix/docs/sim/2_setup_sim.html
Setting Up the Agipix Simulation Environment
Prerequisites for host PC
- Ubuntu 20.04/22.04 Operating System
- NVIDIA GPU (RTX 2070 or higher)
- NVIDIA GPU Driver (recommended version 525.85)
ROS2 Humble
Follow the latest instructions at the official page
tmux
sudo apt install tmux
cd && git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
if you are new to tmux or not already familiar wit tmux
wget https://raw.githubusercontent.com/SasaKuruppuarachchi/SasaKuruppuarachchi/main/.tmux.conf -P ~/
go to .tmux.conf and edit line 12 “set -g prefix `”. This charactor “`” depends on your keyboard layout.
IsaacSIM Installation
This documentation is tested for the current stable version 5.1.0. This will be updated as new stable release published
Quick install instructions: Official Documentation
mkdir isaac-sim
cd isaac-sim/
wget https://download.isaacsim.omniverse.nvidia.com/isaac-sim-standalone-5.1.0-linux-x86_64.zip
unzip "isaac-sim-standalone-5.1.0-linux-x86_64.zip" -d ~/isaacsim
rm isaac-sim-standalone-5.1.0-linux-x86_64.zip # optionally clean install artifacts
cd ~/isaacsim
./post_install.sh
Setup environemnt vars
cat <<'EOF' >> ~/.bashrc
# ---------------------------
# ISAAC SIM SETUP
# ---------------------------
# Isaac Sim root directory
export ISAACSIM_PATH="${HOME}/isaacsim"
# Isaac Sim python executable
export ISAACSIM_PYTHON="${ISAACSIM_PATH}/python.sh"
# Isaac Sim app
export ISAACSIM="${ISAACSIM_PATH}/isaac-sim.sh"
# Define an auxiliary function to launch Isaac Sim or run scripts with Isaac Sim's python
# This is done to avoid conflicts between ROS 2 and Isaac Sim's Python environment
isaac_run() {
# ------------------
# === VALIDATION ===
# ------------------
if [ ! -x "$ISAACSIM_PYTHON" ]; then
echo "❌ IsaacSim python.sh not found at: $ISAACSIM_PYTHON"
return 1
fi
if [ ! -x "$ISAACSIM" ]; then
echo "❌ IsaacSim launcher not found at: $ISAACSIM"
return 1
fi
# -------------------------
# === CLEAN ENVIRONMENT ===
# -------------------------
# Unset ROS 2 environment variables to avoid conflicts with Isaac's Python 3.11
unset ROS_VERSION ROS_PYTHON_VERSION ROS_DISTRO AMENT_PREFIX_PATH COLCON_PREFIX_PATH PYTHONPATH CMAKE_PREFIX_PATH
# Remove ROS 2 paths from LD_LIBRARY_PATH if present
local ros_paths=("/opt/ros/humble" "/opt/ros/jazzy" "/opt/ros/iron")
for ros_path in "${ros_paths[@]}"; do
export LD_LIBRARY_PATH=$(echo "$LD_LIBRARY_PATH" | tr ':' '\n' | grep -v "^${ros_path}" | paste -sd':' -)
done
# -----------------------------
# === UBUNTU VERSION CHECK ===
# -----------------------------
if [ -f /etc/os-release ]; then
UBUNTU_VERSION=$(grep "^VERSION_ID=" /etc/os-release | cut -d'"' -f2)
fi
# If Ubuntu 24.04 -> use the Isaac Sim internal ROS2 Jazzy (ROS2 Jazzy bridge)
if [[ "$UBUNTU_VERSION" == "24.04" ]]; then
export ROS_DISTRO=jazzy
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ISAACSIM_PATH}/exts/isaacsim.ros2.bridge/jazzy/lib"
echo "🧩 Detected Ubuntu 24.04 -> Using ROS_DISTRO=jazzy"
# If Ubuntu 22.04 -> use the Isaac Sim internal ROS2 Humble (ROS2 Humble bridge)
else
export ROS_DISTRO=humble
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ISAACSIM_PATH}/exts/isaacsim.ros2.bridge/humble/lib"
echo "🧩 Detected Ubuntu ${UBUNTU_VERSION:-unknown} -> Using ROS_DISTRO=humble"
fi
# ---------------------
# === RUN ISAAC SIM ===
# ---------------------
if [ $# -eq 0 ]; then
# No args → Launch full Isaac Sim GUI
echo "🧠 Launching Isaac Sim GUI..."
"${ISAACSIM}"
elif [[ "$1" == --* ]]; then
# Arguments start with "--" → pass them to Isaac Sim executable
echo "⚙️ Launching Isaac Sim with options: $*"
"${ISAACSIM}" "$@"
elif [ -f "$1" ]; then
# First argument is a Python file → run with Isaac Sim's Python
local SCRIPT_PATH="$1"
shift
echo "🚀 Running Python script with Isaac Sim: $SCRIPT_PATH"
"${ISAACSIM_PYTHON}" "$SCRIPT_PATH" "$@"
else
# Unrecognized input
echo "❌ Unknown argument or file not found: '$1'"
echo "Usage:"
echo " isaac_run → launch GUI"
echo " isaac_run my_script.py → run script with IsaacSim Python"
echo " isaac_run --headless ... → launch IsaacSim with CLI flags"
return 1
fi
}
alias agisim="cd ~/workspace/raicam-ros/src/isaac_ros_common/ && ./run_sim.sh"
export ROS_DOMAIN_ID=3
EOF
source ~/.bashrc
Running IsaacSIM
Nucleus Server
Depreciated
Download and install Omniverse Launcher and install Nucleus Server Go to the library and install ISAACSIM.
Enable ROS2 extension
Open IsaacSIM > Window > Extension > ROS2 bridge – enable (Autoload)
Installing Qgroundcontrol (for PX4 based implementations)
Follow the latest instructions at the official page
sudo usermod -aG dialout "$(id -un)"
(Optional) Disable ModemManager On some Ubuntu-based systems, ModemManager can claim serial ports that QGC needs. If you don’t use it elsewhere, mask or remove it.
# preferred: stop and mask the service
sudo systemctl mask --now ModemManager.service
# or, if you’d rather remove the package
sudo apt remove --purge modemmanager
On the command prompt, enter:
sudo apt install gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl -y
sudo apt install libfuse2 -y
sudo apt install libxcb-xinerama0 libxkbcommon-x11-0 libxcb-cursor-dev -y
To install QGroundControl:
-
Download QGroundControl-x86_64.AppImage.
-
Make the AppImage executable
chmod +x QGroundControl-x86_64.AppImage
./QGroundControl-x86_64.AppImage
PX4 firmware
# Linux packages
sudo apt install git make cmake python3-pip
# Python packages
pip install kconfiglib jinja2 empy jsonschema pyros-genmsg packaging toml numpy future
cd $HOME
git clone https://github.com/PX4/PX4-Autopilot.git -b v1.16.1 --recursive
cd PX4-Autopilot
make px4_sitl_default none
if PX4 launched properly you can exit out of it. For further information visit here
(Optional) If an externally-managed-environment Use an venv
sudo apt install python3-venv python3-pip python3-full
cd PX4-Autopilot
# setup and activate venv
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install empy jinja2 numpy toml pyyaml packaging
# install and fix python deps
pip install kconfiglib jinja2 empy jsonschema pyros-genmsg packaging toml numpy future
pip uninstall empy
pip install empy==3.3.4
# Build Px4
make clean
make px4_sitl_default none
To synchronise the time stamps with the simulator we need to set the parameter UXRCE_DDS_SYNCT to false. To do that,
- Open the rcS file at
/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/rcS - Paste the following line before ´#Autostart ID´
param set-default UXRCE_DDS_SYNCT 0 param set-default UXRCE_DDS_DOM_ID 3 - Rebuild the firmware
cd $HOME cd PX4-Autopilot make px4_sitl_default none - Make sure to set the parameter
use_sim_time(of each ROS2 node) totrue
Pegusus simulaotor
Cloning into the repo and the assets
cd $HOME
git clone https://github.com/SasaKuruppuarachchi/PegasusSimulator.git
cd PegasusSimulator/extensions/pegasus.simulator/pegasus/simulator/assets/Worlds
git clone https://github.com/SasaKuruppuarachchi/isaac_envs.git
Installing the extension as a library
cd ~/isaacsim
./python.sh -m pip install --editable /home/sasa/PegasusSimulator/extensions/pegasus.simulator
[!NOTE] For the first time, launching Isaac Sim takes a very long time. Isaac Sim must be fully launched to spawn the robot.
Enabling Pegasus Simulator in Isaacsim (First Operation)
-
Launch
isaac_runapplication. -
Open the Window->extensions on the top menubar inside Isaac Sim.

-
On the Extensions manager menu, we can enable or disable extensions. By pressing the settings button, we can add a path to the Pegasus-Simulator repository.

-
The path inserted should be the path to the repository followed by
/extensions.
-
After adding the path to the extension, we can enable the Pegasus Simulator extension on the third-party tab.

When enabling the extension for the first time, the python requirements should be install automatically for the build in
ISAACSIM_PYTHON , and after a few seconds, the Pegasus widget GUI should pop-up.
-
The Pegasus Simulator window should appear docked to the bottom-right section of the screen.

Post setups
Download assets
- Download assets from Official page and same them in
~/isaacsim/assets/ - then
mkdir ~/isaacsim/assets/Isaac/5.1/NVIDIA -
Open
~/isaacsim/exts/isaacsim.asset.browser/config/extension.tomland add the asset paths at[settings] # Root folder URLs to list and monitor. exts."isaacsim.asset.browser".folders = [ # asset paths here ] - Open
~isaacsim/exts/isaacsim.storage.native/config/extension.tomland replace persistent.isaac.asset_root.default withpersistent.isaac.asset_root.default = "/home/sasa/isaacsim/assets/Isaac/5.1"
Add Lidar definitions
To replicate Mid360 lidar in the Agipix we create this custom Lidar model in Isaacsim.
- Copy Mid360 usda file
cp ~/PegasusSimulator/assets/lidar/Mid_360.usda ~/isaacsim/assets/Isaac/5.1/Isaac/Sensors/NVIDIA/Mid_360.usda - Open
~/isaacsim/exts/isaacsim.sensors.rtx/isaacsim/sensors/rtx/impl/supported_lidar_configs.pyand add"/Isaac/Sensors/NVIDIA/Mid_360.usda": set(),under theSUPPORTED_LIDAR_CONFIGS
Running the Simulation
- Open a new terminal to launch the simulator
cd $ISAAC_ROS_DEV_DIR/src/isaac_ros_common/ && ./run_sim.sh # press ENTER after moving to the right pane to launch IsaacSim - In a new terminal run the docker container
runagi - Controlling the drone
Follow the instructions in the top right pane of docker tmux window
-
Opening the UI
- Open up a Foxglow account and bavigate to the dashboard
- Open connection with “ws://localhost:8765”
Now we are ready for autonomy setup. See Instructions to continue.
Real hardware · https://sasakuruppuarachchi.github.io/agipix/docs/real/
Agipix (Real Robot) — Quick Guide
Use this page to jump into the full real-platform bring-up flow, from mechanical assembly to preflight checks.
1) Hardware Assembly
- Refer to the Interactive 3D CAD Model on Autodesk A360 for an interactive 3d view of the assembly.
- Cut CF plates from the provided DXF patterns and post‑process as needed.
- Print TPU parts from the STL set (recommended: 0.2 mm layers, 40% infill; higher for bushings).
- Assemble frame, power, ESCs, motors, radio/telemetry, and flight controller.
- Complete low‑level checks and a brief manual flight validation.
- Mount compute (Jetson Orin NX + Hadron), antennas, wiring, and sensor cage (Livox Mid‑360, optional RGB/RGB‑D).

Read: Hardware Assembly
2) Flashing the Hardware
- Target: JetPack 6.x (Jetson Linux R36.3) on Orin NX/Nano with Connect Tech carriers.
- Prepare BSP_ROOT with NVIDIA BSP + sample rootfs; install CTI L4T BSP.
- Put the board in recovery, then flash via CTI menu script or manual NVMe script.
- On first boot: complete setup, join Wi‑Fi, SSH in; consider NoMachine, nvpmodel, Docker/NVIDIA toolkit.
- Keep handy: CTI docs/KB and NVIDIA references linked in the guide.
Read: Flashing Hardware
3) PX4 and Sensor Interfacing
- PX4 low-level control wiring and DDS interface setup.
- LiDAR, monocular camera, and optional RGB-D sensor integration.
Read: Interfacing Sensors
4) Container and Software Setup
- Runtime is containerized; follow isaac_ros_common Docker setup.
- Branches:
agipix-hard(hardware),agipix-sim(simulation). - For sim instructions, see the simulation docs; for autonomy, continue to perception stack.
Read: Docker Build and Software Setup
5) MANET Mesh Networking
- Work-in-progress extension using Wi-Fi HaLow for long-range resilient links.
Read: MANET Mesh Networking
6) Preflight Checklist
- Mission readiness checks for power, sensing, comms, and safety.
Read: Preflight Checklist
Appendix — Hadron/Env Notes
File: hadron_cfg.txt
- Workspace layout hints for control, DDS agent, LiDAR drivers, and vision.
- Useful bash aliases and Docker entry helper.
- Sample nmcli snippet for a static wired IP.
Next steps:
Real hardware · https://sasakuruppuarachchi.github.io/agipix/docs/real/1_hardware_assembly.html
Complete Guide for Building the Agipix Hardware Platform
Material checklist
Carbon fibre cuts
Use the supplied cutting patterns available at cad/Fab/CF and use a water-jet cutting method to cut.
| File name | Material |
|---|---|
| tocut_1_5mm_500x600.dxf | 500x600x1.5mm |
| tocut_1_5mm_500x600.dxf | 500x600x1.5mm |
| tocut_4mm_500x500.dxf | 500x500x4.0mm |
Postprocessing of parts
Some CF parts need extra processing to support lataral fitting.
Note: TODO: Detailed description with images
3D printed parts
Use the supplied 3D printable stl files available at cad/Fab/3D_prints and use followig settings to print them
- Filament: AmazonBasics TPU (preferred for durability);
- Nozzle: 0.4 mm
- Layer height: 0.2 mm
- Infill: 40% gyroid/cubic; 70% for bushings/adaptors
-
Temperatures: TPU 235–245°C nozzle
- Post-processing: deburr, ream holes, clean support interfaces
| File name | Quantity |
|---|---|
| battery_bush_x2.stl | 2 |
| D455_rubber_mount_Ll.stl | 1 |
| D455_rubber_mount_R.stl | 1 |
| F55A_bush_adaptor_in.stl | 1 |
| F55A_bush_adaptor.stl | 1 |
| front_cam_bush_x2.stl | 2 |
| front_left_x2.stl | 2 |
| front_right_x2.stl | 2 |
| landing damper.stl | 1 |
| landing_gear_bush.stl | 1 |
| nx_bush_x4.stl | 4 |
| px4_pad.stl | 1 |
| side_joint_lower.stl | 1 |
| side_joint_upper.stl | 1 |
| top_gurd_flexies_x4.stl | 1 |

Assembly
Low level assembly and test
In this step we setup following componenets before the low level test
- Frame
- Power, Bttery
- ESC
- Motors
- Radio reciever
- Telemetry radio
- Flight Controller
Finally we do a seris of manual flight tests to verify
Note: TODO: Detailed steps with images
High level Assembly
In this step we setup following componenets before attempting high level controls
- Top plate
- USB to TTL or RS323-USB converter
- Jetson Orin NX with Hadron carrier
- Wifi antenna
- Wiring and Complient frame stiffner
Note: TODO: Detailed steps with images
Now we are ready to Firmware setup. See Instructions to continue.
Sensor Assembly
In this step we setup following componenets before attempting high level controls
- Carbon Fibre Sensor Cage
- Livox Mid-360 Lidar
- (Optional) RGB camera
- (Optional) RGBD camera
Note: TODO: Detailed steps with images
High level Assembly
In this step we setup following componenets before attempting high level controls
- Top plate
- USB to TTL or RS323-USB converter
- Jetson Orin NX with Hadron carrier
- Wifi antenna
- Wiring
Note: TODO: Detailed steps with images
Now we are ready for software setup. See Instructions to continue.
Real hardware · https://sasakuruppuarachchi.github.io/agipix/docs/real/2_flashing_hardware.html
Flashing the NVIDIA Jetson (JetPack 6.x)
Refer to the Datasheets and install the Jetson Orin NX module, wiring and power to the Hadron carrier. Refer the Official Page For the download of the latest official BSP (Board Support Package) and release notes which contains the firmware install instructions.
Note: These steps target Jetson Orin NX/Nano on Connect Tech carriers (Hadron, etc.), Jetson Linux R36.3. Adjust versions as needed. Tested for CT Hadron NGX027 with the Jetpack 6.2.1 - L4T r36.4.4 (BSP Version: ORIN-NX-NANO-36.4.4 V002)
Prerequisities:
- x86/x64 based host machine running Ubuntu 20.04 or 22.04
- JetPack 6.2.1 / L4T 36.4.4 installed (Intstructions follows)
- Orin™ NX or Orin™ NX module
- Connect Tech Orin™ NX/Orin™ NX Carrier
- USB A - USB A Cable for flashing
Install Wifi and SSD
Install the wifi and ssd cards to the PCI mini E and M slots respectively.
Powering up the carrier
The 6S Lipo can be used to power up the board directly. Install a 60V capacitor between the terminals of the main power. Alternatively a AC DC adapter with min 40 W (10-60V) can be used. Get the board ready to be powered up for he flashing of firmware.

What you’ll do
- Prepare a host machine and download JetPack BSP + sample rootfs
- Install the CTI BSP on the host
- Put the Jetson in recovery mode and flash (auto or manual)
- Perform first boot steps and basic post-setup
1) Get JetPack (Driver Package + RootFS)
1) Create a working directory, referred to as BSP_ROOT below.
2) Open the Jetson Linux R36.4.4 downloads and notes:
- Driver page: https://developer.nvidia.com/embedded/jetson-linux-r3644
3) Download both for Orin (LT4):
- Driver Package (BSP): Jetson_Linux_R36.4.4_aarch64.tbz2
- Sample Root Filesystem: Tegra_Linux_Sample-Root-Filesystem_R36.4.4_aarch64.tbz2
4) Place both files under BSP_ROOT, then extract them:
cd <BSP_ROOT>
sudo tar -jxf Jetson_Linux_R36.4.4_aarch64.tbz2
sudo tar -C Linux_for_Tegra/rootfs/ -xjf Tegra_Linux_Sample-Root-Filesystem_R36.4.4_aarch64.tbz2
After extraction, you should have <BSP_ROOT>/Linux_for_Tegra populated.
2) Install the CTI BSP
If you used NVIDIA SDK Manager, BSP_ROOT is typically:
~/nvidia/nvidia_sdk/<JetPack_Version>_Linux_JETSON_NX_ORIN_TARGETS/- or
~/nvidia/nvidia_sdk/<JetPack_Version>_Linux_JETSON_NANO_ORIN_TARGETS/
If you manually downloaded from the Embedded Download Center, use the folder you created as BSP_ROOT.
Download the CTI BSP from CTI BSP Downloads.
For the firmware with real time kernel RT_PREEMPT download the JetPack 6.2.1 – L4T r36.4.4 (RealTime OS) package instead of the base package.
1) Copy the CTI package to Linux_for_Tegra:
cp CTI-L4T-ORIN-NX-NANO-RT-36.4.4-V005.tgz BSP_ROOT/Linux_for_Tegra
2) Extract it and run the installer:
cd <BSP_ROOT>/Linux_for_Tegra
sudo tar -xzf CTI-L4T-ORIN-NX-NANO-RT-36.4.4-V005.tgz
cd CTI-L4T
sudo ./install.sh
cd .. # back to Linux_for_Tegra
The CTI-L4T BSP is now installed on the host, and you can flash Orin NX/Nano.
3) Put the device in Recovery Mode
1) Connect the carrier to your host via USB per the carrier manual. 2) Ensure an NVMe M.2 SSD is installed. 3) Follow the carrier instructions to enter recovery (button/strap sequence).
For NGX027 to put the Jetson module into Force Recovery mode, install a jumper and then power on the platform. After 10 seconds remove the jumper shunt and the device will now be in Force Recovery mode.
Tip: You can verify via lsusb for an NVIDIA device in recovery.
Bus 001 Device 024: ID 0955:7323 NVIDIA Corp. APX
4) Flashing options
You can use either the CTI automated script or the manual NVMe flash script.
Option A: Automated (menu-driven)
cd <BSP_ROOT>/Linux_for_Tegra
sudo ./cti-flash.sh
Follow the menu to select your module and board configuration. Flashing will begin.
Vision Components IMX296camera option for Orin NX is recommended for direct connection to the board. This Lists all the commpatible cameras. This shows how to connect Allied vision cameras using adapter.
Option B: Manual NVMe flash
Do not include the .conf extension in <config>.
cd <BSP_ROOT>/Linux_for_Tegra
sudo ./cti-nvme-flash.sh cti/<module>/<boardname>/<config>
# <module> is one of: orin-nx | orin-nano
Examples:
./cti-nvme-flash.sh cti/orin-nx/boson/base
./cti-nvme-flash.sh cti/orin-nano/boson/base
SUPER_MODE=1 ./cti-nvme-flash.sh cti/orin-nx/hadron/base
When flashing completes, the device will reboot.
Flash is successful
Reboot device
Cleaning up...
Log is saved to
5.1) Troubleshoot Flashing
ISSUE1 : A USB timeout error may occur during flashing. The following error indicates that your flash host’s USB port is not enabled:
[ 0.1172 ] Sending bct_br
[ 0.1603 ] ERROR: might be timeout in USB write.
Error: Return value
1. First try changing the USB port:
-
Move to a different USB port, if available.
-
Remove any USB-C docks if connected
-
Power cycle the board and retry flashing.
2. If that doesn’t work, try disabling autosuspend:
To disable autosuspend on your host’s USB ports, run the following command.
sudo bash -c 'echo -1 > /sys/module/usbcore/parameters/autosuspend'
Power cycle the board and retry flashing.
ISSUE2 : Cnnot mount the NFS server
12:52:45.297 - Error: Flash failure.
12:52:45.300 - Error: Either the device cannot mount the NFS server on the host or a flash command has failed. Check your network setting (VPN, firewall,...) to make sure the device can mount NFS server. Debug log saved to /tmp/tmp.2HZma7rFSi. You can access the target's terminal through "sshpass -p root ssh root@fc00:1:1:0::2"
1. Disable VPN completely
CTI initrd flashing fails 100% if a VPN is on.
2. Restart NFS and RPC services
sudo systemctl stop rpcbind rpcbind.socket nfs-kernel-server
sudo systemctl start rpcbind rpcbind.socket nfs-kernel-server
Check status:
systemctl status nfs-kernel-server
3. Ensure firewall isn’t blocking NFS (especially IPv6)
Temporarily disable ufw (if running):
sudo ufw disable
5) First boot and basic setup
Connect via serial console (recommended)
- Connect to the Serial debug port of the Carrier using a TTL to USB adapter. (ex: FTDI)
- Guide: https://jetsonhacks.com/2019/04/19/jetson-nano-serial-console/
sudo minicom -D /dev/ttyUSB0 -b 115200 - Complete the initial setup prompts. You can skip network here and do it below.
System Configuration ┌────┤ License For Customer Use of NVIDIA Software ├─────┐ │ │ │ Welcome to Jetson Initial Configuration │ │ │ │ <Ok> │ │ │ └────────────────────────────────────────────────────────┘
Join Wi‑Fi via nmcli
sudo nmcli dev wifi rescan
sudo nmcli dev wifi connect <SSID> password <PASSWORD>
SSH in
ssh <user>@<device-ip>
6) Useful post-setup
Setup Git
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
Increase Swap
You may need to increase swap depending on he RAM of your Jetson module Follow This Guide to upgrade swap memeory.
free -h # Check current memory usage
df -h # Check current disk usage
# start from here to increase swap size to 16G
sudo fallocate -l 16G /swapfile # Allocate 16G of space for swap file
ls -lh /swapfile # Verify the swap file is created
sudo chmod 600 /swapfile # Set the correct permissions for the swap file
sudo mkswap /swapfile
sudo swapon /swapfile
free -h # Check current memory usage
# to make the change persistent across reboots, add the swap file to /etc/fstab:
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Install Jetpack extras and Jtop
sudo apt install nvidia-jetpack
# Setup jtop
sudo apt update && sudo apt upgrade -y
sudo apt install python3-pip -y && sudo apt install curl -y
sudo pip3 install -U jetson-stats
mkdir hacks && cd hacks
git clone https://github.com/jetsonhacks/jetson-jtop-patch.git
cd jetson-jtop-patch
chmod +x apply_jtop_fix.sh
./apply_jtop_fix.sh
Once pip installs the jetson-stats package, you will need to logout/login or reboot the Jetson.
After rebooting, to run jtop open a Terminal and execute: jtop
NoMachine (remote desktop)
To setup remote desktop to the headless system for debugging follow this guide
wget https://web9001.nomachine.com/download/9.4/Arm/nomachine_9.4.14_1_arm64.deb
sudo dpkg -i nomachine_9.4.14_1_arm64.deb
sudo systemctl disable gdm3 --now
sudo /usr/NX/bin/nxserver --restart
Change power mode
sudo nvpmodel -m <mode-number>
- Reference: https://forums.developer.nvidia.com/t/power-mode-in-terminal/287224
Install VSCode
cd hacks
git clone https://github.com/JetsonHacksNano/installVSCode.git
cd installVSCode
./installVSCodeWithPython.sh
Cuda and cudnn
If cuda packages are not installed. ls /usr/local | grep cuda returns nothing
sudo apt install cuda-toolkit-12-6
if cudnn not installed. dpkg -l | grep cudnn returns nothing, Get Cudnn
wget https://developer.download.nvidia.com/compute/cudnn/9.16.0/local_installers/cudnn-local-tegra-repo-ubuntu2204-9.16.0_1.0-1_arm64.deb
sudo dpkg -i cudnn-local-tegra-repo-ubuntu2204-9.16.0_1.0-1_arm64.deb
sudo cp /var/cudnn-local-tegra-repo-ubuntu2204-9.16.0/cudnn-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cudnn9-cuda-12
Setup .bashrc
Add following lines to your .bashrc to link important cuda libraries
export CUDA=12.6
export PATH=/usr/local/cuda-$CUDA/bin${PATH:+:${PATH}}
export CUDA_PATH=/usr/local/cuda-$CUDA
export CUDA_HOME=/usr/local/cuda-$CUDA
export LIBRARY_PATH=$CUDA_HOME/lib64:$LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/cuda-$CUDA/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
export NVCC=/usr/local/cuda-$CUDA/bin/nvcc
export CFLAGS="-I$CUDA_HOME/include $CFLAGS"
export LD_LIBRARY_PATH=/usr/local/cuda-$CUDA/targets/aarch64-linux/lib:$LD_LIBRARY_PATH
export CPATH=/usr/local/cuda-$CUDA/targets/aarch64-linux/include:$CPATH
Source your .bshrc
Verify Cuda and CUDNN
echo '#include <cuda_runtime.h>
#include <cudnn.h>
#include <iostream>
int main() {
int cudaVersion;
cudaRuntimeGetVersion(&cudaVersion);
std::cout << "CUDA runtime version: " << cudaVersion/1000 << "." << (cudaVersion%1000)/10 << std::endl;
std::cout << "cuDNN version: " << CUDNN_MAJOR << "." << CUDNN_MINOR << "." << CUDNN_PATCHLEVEL << std::endl;
return 0;
}' > verify_cuda_cudnn.cpp && \
g++ verify_cuda_cudnn.cpp \
-I/usr/local/cuda-12.6/targets/aarch64-linux/include \
-L/usr/local/cuda-12.6/targets/aarch64-linux/lib \
-lcudart -lcudnn -o verify_cuda_cudnn && \
./verify_cuda_cudnn
Fix Snap apps
If Snap apps like Chromium is not working, ref
snap download snapd --revision=24724
sudo snap ack snapd_24724.assert
sudo snap install snapd_24724.snap
sudo snap refresh --hold snapd
Mount a USB drive
- https://linuxconfig.org/howto-mount-usb-drive-in-linux
Wezterm and Superfile
Install wezterm
curl -fsSL https://apt.fury.io/wez/gpg.key | sudo gpg --yes --dearmor -o /usr/share/keyrings/wezterm-fury.gpg
echo 'deb [signed-by=/usr/share/keyrings/wezterm-fury.gpg] https://apt.fury.io/wez/ * *' | sudo tee /etc/apt/sources.list.d/wezterm.list
sudo chmod 644 /usr/share/keyrings/wezterm-fury.gpg
sudo apt update
sudo apt install wezterm
sudo update-alternatives --config x-terminal-emulator # set to wezterm
Install Superfile
bash -c "$(curl -sLo- https://superfile.dev/install.sh)"
References
1) Hadron carrier: https://connecttech.com/product/hadron-carrier-for-nvidia-jetson-orin-nx/ 2) CTI L4T release notes (36.3.0): https://connecttech.com/ftp/Drivers/L4T-Release-Notes/Jetson-Orin-NX-Orin-Nano/ORIN-NX-NANO-36.3.0.pdf 3) CTI knowledge base: https://connecttech.com/resource-center/kdb373/ 4) torchvision dev install: https://github.com/pytorch/vision/blob/main/CONTRIBUTING.md#development-installation
Continue
- ← Back: Hardware Assembly
- Next → Software Setup
Real hardware · https://sasakuruppuarachchi.github.io/agipix/docs/real/3_docker_build.html
Building Containerised Development platform
The containerised development platform is shared by both sim and real hardware. This improve the deployability from sim to real with minimal code change.
Curent release uses Nvidia Isaac Ros 3.2 as the basis for this platform
Prerequisities
- Finish Flasing Hadrware or setting up Sim host.
1) Install Docker + NVIDIA Container Toolkit + Git LFS
Install docker with
- Guide from JetsonHacks
cd hacks git clone https://github.com/jetsonhacks/install-docker.git cd install-docker bash ./install_nvidia_docker.sh bash ./configure_nvidia_docker.sh
Or use
- Docker: https://docs.docker.com/engine/install/ubuntu/
- NVIDIA Container Toolkit: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
Git LFS: https://git-lfs.com/
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
# Install Git LFS
sudo apt update
sudo apt install git-lfs -y
# Initialize Git LFS for your user
git lfs install
To verify CDI interfaces sudo nvidia-ctk cdi list should output
INFO[0000] Found 2 CDI devices
nvidia.com/pva=0
nvidia.com/pva=all
if no CDI devices are found
sudo apt-get install -y nvidia-container-toolkit sudo systemctl restart docker
2) Setup Workspace
cd $HOME
mkdir workspace && cd workspace
mkdir -p agipix_control/src dds lidar_ws/src raicam-ros/src logging/src logging/bags logging/flogs logging/crashreports
cd raicam-ros/src
git clone https://github.com/SasaKuruppuarachchi/isaac_ros_common.git # TODO
echo "export WORKSPACES_DIR="$HOME/workspace"" >> ~/.bashrc
echo "export ISAAC_ROS_DEV_DIR="$HOME/workspace/raicam-ros"" >> ~/.bashrc
echo "alias agidocker='cd $HOME/workspace/raicam-ros/src/isaac_ros_common/scripts/ && ./run_dev.sh --skip-registry-check'" >> ~/.bashrc
echo "alias killagidocker='docker container kill isaac_ros_dev-aarch64-container'" >> ~/.bashrc
source ~/.bashrc
3) Build Docker
In this step we pull source images and build the docker continer. To customise the docker configuration edit
code ~/workspace/raicam-ros/src/isaac_ros_common/scripts/.isaac_ros_common-config
# append the additional docker configuration layers you need built
cd ~/workspace/raicam-ros/src/isaac_ros_common/scripts/ && ./run_dev.sh # this alias builds the container
The build will take more than an hour and if successfull you will see Running isaac_ros_dev-aarch64-container and the container will start running in the background.
Run agidocker to attach to the container interactively.
Verify Pytorch with cuda on dcker
agidocker
# Inside docker
python3 - << 'EOF'
import torch
print("CUDA:", torch.cuda.is_available())
print("Device:", torch.cuda.get_device_name(0))
EOF
4) Post setup (Optional)
Build Opencv with cuda From source
Note! OpenCV =< 4.8 had an incompatability with Cuda 12.x
agidocker # Inside docker cd /worckspaces/isaac_ros-dev/src/isaac_ros_common sudo ./build_ocv_cuda.sh # This will build and install the OCV for this running container locally # but saves the build files on the mounted folder so we can use the Dockerfile.opencv layer later
Build torchvision from source (matches NVIDIA PyTorch)
export FORCE_CUDA=1
git clone -b v0.17.2 https://github.com/pytorch/vision.git
cd vision
sudo -E python setup.py develop # use 'install' if you don't need editable mode
5) Prune Docker cash (Optional)
Docker builder cash consumes lot of memory. You can clean manualy or schedule a clean as follows
docker system prune -a --volumes
Output will show the size of the volume freed up Total reclaimed space: 60.52GB
Optional not recommended: Prevent buildup with a scheduled cleanup (e.g., every week):
docker system prune -a --filter "until=168h" --volumes
sudo du -h --max-depth=1 /home/<user>/workspace | sort -hr
rm -rf ~/.cache/*
rm -rf ~/.local/share/Trash/*
rm -rf ~/.local/share/pip
rm -rf ~/.local/share/virtualenvs
Real hardware · https://sasakuruppuarachchi.github.io/agipix/docs/real/4_interfacing_sensors.html
Interfacing PX4 and Sensors
1) Wiring up PX4
Wire the Pixhawk up as shown in the diagram. Refer to the official guide

2) Connecting Px4
PX4 Parameter setup
Flash the Pixhawk with the latest stable branch branch using QGroundControl. Branch 1.16.0 is tested.
List of all the updated parmeters TODO
Hardware wiring
The Px4 serial runs TTL level logic and the connecttech Hadron carier runs Rs-232 level logic. We need to use RS-232 To TTL Conveter (MAX3232IDR) to establish connection.
The wiring should look like below.


Note: In each connection, wire TX -> RX and RX -> TX
Flash PX4 with custom bootloader
Install toolchain on host machine (Jetson)
# Linux packages
sudo apt install git make cmake python3-pip
# Python packages
pip install kconfiglib jinja2 empy jsonschema pyros-genmsg packaging toml numpy future
cd $HOME
git clone https://github.com/PX4/PX4-Autopilot.git -b v1.16.1 --recursive
cd PX4-Autopilot
# 1. Run the official PX4 Ubuntu setup script (it handles apt packages and toolchains)
cd ~/PX4-Autopilot
bash Tools/setup/ubuntu.sh
# 2. Restart your terminal session to apply the new path modifications
exec bash
Build the firmware
make cubepilot_cubeorangeplus_default
Flash the firmware
Manual Flashing via GUI: You want to generate the .px4 file on your machine but prefer to flash it manually using QGroundControl’s custom firmware option
- Generate firmware
make cubepilot_cubeorangeplus_default - Flash firmware using QGC
- Open QGC
- Go to Vehicle Setup > Firmware > scroll to the bottom > click Custom Firmware
- Select the generated .px4 file from your build directory (e.g., ~/PX4-Autopilot/build/cubeorangeplus_default/px4_firmware/nuttx-px4fmu-v3.bin).
- Start flashing
- Follow the on-screen instructions to complete the update
Auto upload: You want to generate and upload the firmware directly from the terminal
make cubepilot_cubeorangeplus_default upload
Verify connection
To verify hardware level connections use minicom. Set (Using the QgrundControl Parameter editer) and change port number and baudrates accordingly.
minicom -D /dev/ttyTHS2 -b 921600 -o -8
MicroXRCE DDS Primary link -> THS2
To verify primary control link to the Px4 Run this AFTER installing and launching agidocker
agidocker
# *** Inside agidocker
cd /workspaces/dds
git clone -b v2.4.3 https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
cd Micro-XRCE-DDS-Agent
According to the Fast RTPS documentation specify the ROS2 domain ID by adding the following to the participant profile into the agent.refs
<participant .....>
<rtps>
.....
<builtin>
<domainId>15</domainId>
</buitin>
</rtps>
</participan
# *** Inside agidocker
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig /usr/local/lib/
sudo MicroXRCEAgent serial --dev /dev/ttyTHS2 -b 921600
MavLink Secondary telemetry link -> THS1
This link is for routing the Mavlink Trafic to a Ground station in the local network or to internet
Install and follow Mavlink Anywhere guide
- Clone the repository:
# *** On the Host machine (not inside the container) cd ~/workspace/dds git clone https://github.com/alireza787b/mavlink-anywhere.git cd mavlink-anywhere - Run the installation script:
chmod +x install_mavlink_router.sh sudo ./install_mavlink_router.sh - Run the configuration script:
chmod +x configure_mavlink_router.sh sudo ./configure_mavlink_router.sh - Follow the prompts to set up UART device, baud rate, and UDP endpoints:
- If an existing configuration is found, the script will use these values as defaults and show them to you
- UART Device: Set this to
/dev/ttyTHS1. This is the serial port connected to the mavlink of PX4. - Baud Rate: Default is
57600. This is the communication speed between the companion computer and connected devices - UDP Endpoints: Input the ground station ip. Default is
0.0.0.0:14550. You can enter multiple endpoints separated by spaces (e.g.,100.110.200.3:14550 100.110.220.4:14550),14550is the default port QGC connets to.
- Connecting with QGroundControl Use QGroundControl to connect to your companion computer’s IP address on the configured UDP endpoints. For internet-based telemetry, make sure to follow the setup video to properly register your devices on your chosen VPN system or configure port forwarding on your router.
- Check the status of the service:
sudo systemctl status mavlink-router - View detailed logs:
sudo journalctl -u mavlink-router -f - Check uxrce_dds_client status
go into the MAVLink consol of QGC and
nsh> uxrce_dds_client status INFO [uxrce_dds_client] Running, connected INFO [uxrce_dds_client] Using transport: serial INFO [uxrce_dds_client] Payload tx: 65072 B/s INFO [uxrce_dds_client] Payload rx: 0 B/s INFO [uxrce_dds_client] timesync converged: true uxrce_dds_client: cycle: 49416 events, 174925511us elapsed, 3539.86us avg, min 136us max 1013110us 12206.498us rms uxrce_dds_client: cycle interval: 49424 events, 21668.49us avg, min 137us max 890938308us 4007537.750us rms
Troubleshoot : If
ros2 topic listdo not show the /fmu/.. topics, check if the domain id settings match between the ROS2 in the docker, uxrce_dds_client and the MicroXRCEAgent
Smart WiFi Manager Project
Implement this if you need safe switiching between wifi APs
cd ~/workspace/dds
git clone https://github.com/alireza787b/smart-wifi-manager.git
cd smart-wifi-manager
sudo bash install.sh
sudo systemctl status smart-wifi-manager.service
sudo ./configure_smart_wifi_manager.sh
NetBird VPN
NetBird can be used to
- SSH to the drone over internet
- Forward data links like Mavlink telemetry over the internet
- Forward lightweight UI over the internet
curl -fsSL https://pkgs.netbird.io/install.sh | sh
netbird up
# to add ssh keys to the remote host
ssh-copy-id sasa@<hostname>
# to reset key of ssh connections
ssh-keygen -f "/home/sasa/.ssh/known_hosts" -R "<hostname>"
# Reconfigure mavlink router to add the GS ip over netbird
cd ~/workspace/dds/smart-wifi-manager
sudo ./configure_mavlink_router.sh
3) Interfacing and Verifying sensor connection
Livox Lidar
Why Mid 360.
- 360 degree wide FOV
- Foarm Factor
- Active anti inference
- Const performace
Refer to the Datasheets and Wiki
Hardware connection

- The power can be supplied directly from the 6S battery with a 60V capacitor for safety
- The Original cable can be terminated to have only the required lenngth and connected with the Eth connector from the connecttech to save weight.
- THe sync wires should be kept in the processes for later step.
After the physical connection is made using the Lovix connecter to the Ethernet port of the Jetson a statis network has to be made with following command.
Note: We advice modifying the static IP of the Livox lidar from 192.168.1.1XX to 172.16.0.XX to avoid issues assessing the local(Wifi) network when connected.
Add the static wired connection using the GUI or CLI as follows, Following command assumes the ethernet interface is enP8p1s0 and lidar ip is 172.16.0.50.
sudo nmcli connection add type ethernet ifname enP8p1s0 con-name static-link ipv4.method manual ipv4.addresses 172.16.0.50/24 ipv4.gateway 172.16.0.1 ipv4.dns 8.8.8.8
sudo nmcli connection up static-link
After the hardware connection is made the livox_viewer2 can be used to verify connection and firmware Update.
SDK and ROS2 driver
This subsecton is recommended after setting up the docker.
Clone the Lovox-SDK2 and follow instructions to build. This custom SDK supports multi lidars. Set up the configuration with the device and host IPs.
For the fist time launch agidocker, Compile and install the Livox-SDK2:
agidocker
# Inside agidocker
cd /workspaces/lidar_ws/src
git clone https://github.com/atinfinity/Livox-SDK2.git
cd Livox-SDK2
touch COLCON_IGNORE
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release .. && make -j
sudo make install
sudo ldconfig
Clone the livox_ros_driver2 and follow the instructions.
agidocker
# Inside agidocker
cd /workspaces/lidar_ws/src
git clone https://github.com/SasaKuruppuarachchi/livox_ros_driver2.git
cd ..
rosdep update
rosdep install -y -i --from-paths src/livox_ros_driver2
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
Note:
- In
launch/msg_MID360_launch.pychange the point cloud modexfer_formatto 0 (1) Pointcloud2(PointXYZRTL) from the ROS2 driver if you are using DLIO.src/comm/pub_handler.cpphas been modified to Skip points inside the bounding box of the robot.- In
config/MID360_config.jsonupdated the sensor IP and the pitch to correlate to the 45 degree pitch of the Lidar
Verify
ros2 launch livox_ros_driver2 rviz_MID360_launch.py
DDS tuning to accomadate looseless pointcloud transfer (Optional)
1. Tune system-wide network settings
- For fast DDS Add the following to:
/etc/sysctl.d/10-fastdds.conf
- For Cyclone DDS Add the following to:
/etc/sysctl.d/10-cyclonedds.conf
Then reboot Ubuntu.
net.core.rmem_max=2147483647
net.core.rmem_default=2147483647
net.core.wmem_max=2147483647
net.core.wmem_default=2147483647
net.ipv4.ipfrag_time=3
net.ipv4.ipfrag_high_thresh=134217728
2. Make configuration of Fast DDS
Create a configuration file:
$HOME/fastdds.xml
Refer to the default configuration here: DEFAULT_FASTRTPS_PROFILES.xml
3. Enable custom configuration for Fast DDS
- Add the following description to
$HOME/.bashrc.
export FASTRTPS_DEFAULT_PROFILES_FILE=$HOME/fastdds.xml
export RMW_FASTRTPS_USE_QOS_FROM_XML=1
- Please reopen terminal.
Monocular Camera
Connect the camera to the USB interface and verify TODO
Realsense Cameras
Install libraries on the host side for realsense cameras. This also installs udev rules for the camera
# Ensure the directory exists
sudo mkdir -p /etc/apt/keyrings
# Download and dearmor
curl -sSf https://librealsense.realsenseai.com/Debian/librealsenseai.asc | \
gpg --dearmor | sudo tee /etc/apt/keyrings/librealsenseai.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/librealsenseai.gpg] https://librealsense.realsenseai.com/Debian/apt-repo `lsb_release -cs` main" | \
sudo tee /etc/apt/sources.list.d/librealsense.list
sudo apt-get update
sudo apt-get install librealsense2-utils
sudo apt-get install librealsense2-dev
Connect the camera to the USB interface and verify
agidocker
# Inside agidocker use this commnad
realsense-viewer
If the connection is stable you can move on to launching realsense2_camera ROS2 package
Depth AI setup for OAK-D cameras (Optional)
curl -fL https://docs.luxonis.com/install_dependencies.sh | bash
## later
cd isaac_ros_common/docker/
git clone https://github.com/luxonis/depthai-python.git
cd depthai-python/
git submodule update --init --recursive
Next step is Hardware Synchronisation
Real hardware · https://sasakuruppuarachchi.github.io/agipix/docs/real/5_hardware_synchronisation.html
Hardware Synchronisation with ESP32 TimerSync Bridge
The default timesync method for Livox Lidars are PTP. But unfortunatly Jetson NX does not support PTP. The alternative in the official documentation is to use PPS syncronisation with GPS. As indoor focused robots do not have GPS, we designed the following solution to provide GPRMC and PPS signals to the Livox LiDAR and Px4 via a ESP32.
The ESP32 generates three hardware-synchronised outputs and disciplines its clock to the PX4 flight controller via MAVLink over UART.
The ESP32 firmware code can be found at TimerSyncBridge
System Architecture
┌─────────────────────────────────────┐
│ DFRobot FireBeetle 2 ESP32-S3 │
│ │
PX4 Flight Controller │ ┌──────────────────────────────┐ │
(DDS time source) │ │ Clock Discipline Layer │ │
GPS2 UART ◄──────────►│ │ UNLOCKED → WARMING → LOCKED │ │
GPIO 38/3 │ │ Source: SYSTEM_TIME MAVLink │ │
57600 baud │ └──────────┬───────────────────┘ │
│ │ UTC epoch │
│ ┌──────────▼───────────────────┐ │
│ │ Output Generation │ │
│ │ • 10 Hz PWM GPIO 4 (LEDC) │ │
│ │ • 1 Hz PPS GPIO 5 (timer) │ │
│ │ • GPRMC GPIO 12 UART1 │ │
│ └──┬──────────┬────────────────┘ │
└─────┼──────────┼──────────────────┘
│ │
┌────────────────┘ └──────────────────────────┐
▼ ▼
┌────────────────────┐ ┌────────────────────────────┐
│ Hikrobot MVS │ │ Livox Mid-360 │
│ Camera │ │ LiDAR │
│ Line0 OPTO_IN │ │ Pin 8: PPS (Purple/white) │
│ 10 Hz trigger │ │ Pin 10: GPS/GPRMC │
│ → image timestamp │ │ (Gray/white, UART 9600) │
└────────────────────┘ │ → UTC LiDAR stamps │
└────────────────────────────┘
Signal timing relationship
1 Hz sync (GPIO 5) ───┐ ┌─── ┌───
└───────────┘ └───
▲ rising edge = UTC second boundary
│
10 Hz trigger (GPIO 4) ─┐─┐─┐─┐─┐ ←─ phase-reset here ─► ─┐─┐─┐─┐─┐
│ │ │ │ │ │ │ │ │ │
100ms period, 50% duty
GPRMC (GPIO 12 UART1) ──[HHMMSS.00,A,...]──────────────────[HH:MM:SS+1,A,...]──
▲ emitted on same rising edge
Every 1 Hz rising edge: LEDC timer reset (phase-aligns 10 Hz) → time increment → GPRMC emit.
Hardware
| Component | Part |
|---|---|
| Timing board | DFRobot FireBeetle 2 ESP32-S3 |
| LiDAR | Livox Mid-360 |
| Camera | Hikrobot MVS (TriggerSource=LINE0) |
| Flight controller | PX4 (time sourced from companion via DDS, no GPS) |
GPIO Pinout (as-built)
| Function | GPIO | Direction | Destination |
|---|---|---|---|
| 10 Hz camera trigger | 4 | OUT | MVS camera Line0 OPTO_IN |
| 1 Hz PPS sync | 5 | OUT | Mid-360 M12 PPS interface (Pin 8, purple/white) (direct TTL) |
| GPRMC UART1 TX | 12 | OUT | Mid-360 M12 GPS input (Pin 10, Gray/white, UART 9600) |
| GPRMC UART1 RX | 13 | IN | Reserved, unused |
| MAVLink UART2 TX | 38 | OUT | PX4 GPS2 RX |
| MAVLink UART2 RX | 3 | IN | PX4 GPS2 TX |
| Status LED | 2 | OUT | On-board LED (0.5 Hz blink when LOCKED) |
Px4 setup
Update Following parameters on PX4 to enable MAVLink time sync over UART2: for refrance the project uses GPS2 port on PX4, so the parameters are:
MAV_1_CONFIG=GPS2
SER_GPS2_BAUD=57600
SER_GPS2_PROTO=1 # MAVLink v2
SER_GPS2_OPTIONS=0 # No flow control, no 9-bit, etc
UXRCE_DDS_SYCT=1
Full Wiring Diagram
FireBeetle 2 ESP32-S3
┌─────────────────────────────────────────────────────┐
│ │
│ GPIO 4 ──────────────────────────────────────────►│ MVS Camera
│ (10 Hz PWM 50% duty) │ Line0 OPTO_IN PIN 2
│ │
│ GPIO 5 ──────────────────────────────────────────►│ Livox Mid-360
│ (1 Hz PPS TTL 50% duty) │ M12 PPS interface (Pin 8, Purple/white)*
│ │
│ GPIO 12 (UART1 TX) ──┐────────────────────────────►│ M12 GPS input (Pin 10, Gray/white, UART 9600)*
│ GPIO 13 (UART1 RX) ──┤ │
│ (9600 baud GPRMC) │ │
│ ▼ │
│ USB-Serial adapter │
│ │ │
│ ▼ │
│ Host /dev/ttyUSB0 │
│ (to debug) │
│ │
│ GPIO 38 (UART2 TX) ──────────────────────────────►│ PX4 GPS2 RX
│ GPIO 3 (UART2 RX) ◄──────────────────────────────│ PX4 GPS2 TX
│ (57600 baud MAVLink) │
│ GND ───────────────────────────────────────────────│ PX4 GND
│ │
│ USB-C (USB-CDC) ──────────────────────────────────►│ Host /dev/ttyACM0
│ (115200 baud console) │ pio device monitor
│ │
└─────────────────────────────────────────────────────┘
*(direct TTL for Mid-360 or when using the Livox converter 2.0, but RS485 is needed when using other LiDARs )
Mid-360 PPS note: The Mid-360 accepts direct TTL on its M12 PPS interface. No TTL-to-RS485 converter is required.
UART TX/RX crossing: GPIO 38 (TX) → PX4 GPS2 RX, GPIO 3 (RX) ← PX4 GPS2 TX. Cross the wires. Shared GND is mandatory.
Clock Discipline Flow
Power on
│
▼
UNLOCKED ──── no SYSTEM_TIME with valid epoch ────► UNLOCKED
│
│ SYSTEM_TIME.time_unix_usec > 1e15 µs (DDS converged)
▼
WARMING ──── 3 consecutive SYSTEM_TIME samples ────► seed epoch, step-correct each
│
│ 3 samples accumulated
▼
LOCKED ──── ongoing SYSTEM_TIME updates ───────────► slew ±500 µs/update (D6)
│ GPRMC emits disciplined UTC
│ DDS link lost
▼
DEGRADED ── DDS re-converges ──────────────────────► WARMING (re-seeds)
GPRMC output: LOCKED → disciplined UTC sentences
all other states → suppressed (no output)
1 Hz pulse and 10 Hz trigger: always running regardless of lock state
Build and Flash
Prerequisites
- PlatformIO CLI or VS Code PlatformIO extension
duracopter/MAVLink v2 C library@^2.0(already inplatformio.ini)
Flash
pio run -t upload
Monitor USB-CDC console
pio device monitor -b 115200
Verify LiDAR time sync
The GPRMC signal goes directly to the LiDAR (M12 pin 10). Verify sync in livox_ros_driver2 log — look for:
timestamp_type changed to 2
This confirms the LiDAR has accepted the GPRMC and switched to GPS/UART time sync mode.
Expected Console Output
Startup banner (Phase 4)
=== ESP32-S3 Phase 4 Timing Firmware ===
Board: DFRobot FireBeetle2 ESP32-S3
10Hz PWM trigger: GPIO 4 (LEDC low-speed timer0, 50% duty)
1Hz sync pulse: GPIO 5 (esp_timer 500ms toggle, 50% duty)
GPRMC UART1: TX GPIO 12, RX GPIO 13 @ 9600 baud
MAVLink UART2: TX GPIO 38, RX GPIO 3 @ 57600 baud
DDS sync gate: SYSTEM_TIME unix_us > 1e15 us (year >2001)
Clock discipline: UNLOCKED -> WARMING(3 samples) -> LOCKED
Max slew: 500 us/update (D6 monotonic invariant)
GPRMC output: disciplined UTC when LOCKED, suppressed otherwise
Invariant: on each 1Hz rising edge -> LEDC timer reset + monotonic time increment + GPRMC emit
Before DDS lock (UNLOCKED/WARMING)
[1Hz] free=00:00:01 - GPRMC SUPPRESSED (clk=UNLOCKED), 10Hz phase reset
[MAV] HEARTBEAT sysid=1 compid=1 type=2 autopilot=12 base_mode=0x1D state=0
[MAV] SYSTEM_TIME unix_us=1780491609038000 boot_ms=2498713 dds=CONVERGED
[MAV] *** PX4 DDS timesync: CONVERGED — clock is valid ***
[CLK] state=WARMING sample=1/3 seed_unix_us=1780491609038000
[1Hz] free=00:00:02 - GPRMC SUPPRESSED (clk=WARMING), 10Hz phase reset
[CLK] state=WARMING sample=2/3 offset=1711 us
[CLK] state=WARMING sample=3/3 offset=-15801 us
[CLK] *** state=LOCKED — disciplined clock valid ***
After LOCKED
[1Hz] disc=13:00:15 free=00:00:08 - GPRMC emitted (LOCKED), 10Hz phase reset
[CLK] state=LOCKED disc_utc=13:00:16 offset=-1178 us corr=-500 us total_corr=-500 us drift_trend=14623 us
[HB] uptime=10s free=00:00:10 disc_utc=13:00:17 clk=LOCKED px4_dds=CONVERGED
[MAV] TIMESYNC RTT=20639 us
GPRMC output (GPIO 12 → Mid-360 pin 10, 9600 baud, after LOCKED)
$GPRMC,130015.00,A,2237.496474,N,11356.089515,E,0.0,225.5,230520,2.3,W,A*2E
$GPRMC,130016.00,A,2237.496474,N,11356.089515,E,0.0,225.5,230520,2.3,W,A*2D
$GPRMC,130017.00,A,2237.496474,N,11356.089515,E,0.0,225.5,230520,2.3,W,A*2C
Time field reflects real UTC from PX4. Checksum is valid NMEA XOR. Status field is A (active).
livox_ros_driver2 Configuration
Time sync is configured in the Livox SDK JSON config used by livox_ros_driver2. The ESP32 acts as a GPS emulator — it provides both the 1 Hz PPS hardware edge (Mid-360 pin 8) and the GPRMC sentence (Mid-360 pin 10) directly. No host serial adapter is needed.
Reference: Livox time sync via UART
The driver validates: $GPRMC/$GNRMC prefix, status field A, and checksum. It does not validate position or that the UTC value is current.
Verification
After launching livox_ros_driver2, look for this log entry:
timestamp_type changed to 2
timestamp_type 2 = GPS/UART sync active. If it reads 0 or 1, the GPRMC signal is not reaching the LiDAR — check the GPIO 12 → pin 10 wire and GND continuity.
Project Status
| Phase | Description | Status |
|---|---|---|
| 1 | ESP32 board bring-up — LEDC 10 Hz, 1 Hz PPS, free-running GPRMC | ✅ COMPLETE |
| 2 | MAVLink link bring-up — HEARTBEAT, SYSTEM_TIME, TIMESYNC via UART2 | ✅ COMPLETE |
| 3 | Clock discipline — DDS-gated UNLOCKED→WARMING→LOCKED state machine | ✅ COMPLETE |
| 4 | Disciplined GPRMC — UTC time from PX4 drives GPRMC output | ✅ COMPLETE — 32 min soak verified (offset ±13 ms, zero DEGRADED, ~16 µs/min drift) |
| 5 | Full integration — Mid-360 + MVS camera end-to-end | ✅ COMPLETE — PPS sync active, timestamp_type changed to 2 confirmed |
Phase 4 Soak Results (32-minute pre-Phase-5 run)
Continuous run with PX4 DDS active, no sensor hardware connected yet.
| Metric | Observed | Pass threshold |
|---|---|---|
| Clock state | LOCKED throughout | no DEGRADED transitions |
| Uptime | 1931 s (32 min) | — |
| GPRMC gaps | 0 | 0 |
| LOCKED offset range | ±13 ms | < ±50 ms (UART jitter) |
| Accumulated drift correction | −31 ms over 32 min (~16 µs/min) | stable tracking |
| MAVLink RTT | 20.6 ms (stable) | < 100 ms |
| px4_dds status | CONVERGED throughout | CONVERGED |
Representative log extract (uptime 1931 s):
[HB] uptime=1931s free=00:32:12 disc_utc=13:32:19 clk=LOCKED px4_dds=CONVERGED
[CLK] state=LOCKED disc_utc=13:32:20 offset=-12605 us corr=-500 us total_corr=-32166 us
[MAV] TIMESYNC RTT=20636 us
Result: PASS. Clock discipline is stable over the soak window. Proceeding to Phase 5.
Phase 5 Integration Checklist
Connect the Mid-360 LiDAR and MVS camera to the ESP32 and run the full sensor stack.
Step 1 — Wiring
- GPIO 5 → Mid-360 M12 pin 8 (PPS, Purple/white, direct TTL 3.3V, no RS485)
- GPIO 12 UART1 TX → Mid-360 M12 pin 10 (GPS input, Gray/white, direct TTL 3.3V)
- GPIO 4 → MVS camera Line0 OPTO_IN
- Shared GND between ESP32 and Mid-360 M12 connector
Step 2 — Host config
- No serial adapter needed — GPRMC goes directly to LiDAR hardware
- Set camera:
TriggerMode=1,TriggerSource=LINE0,ExposureTime=5000
Step 3 — Launch
- Flash ESP32 (
pio run -t upload) - Wait for
[CLK] *** state=LOCKEDin console before starting ROS nodes - Launch
livox_ros_driverand MVS camera driver
Verification gate:
livox_ros_driver2log showstimestamp_type changed to 2on startup- LiDAR point cloud timestamps are UTC-anchored (
secmatches current UTC, not boot-relative) - MVS camera triggers at 10 Hz confirmed in ROS topic
- 30-minute continuous run — no DEGRADED transitions in ESP32 console log
- Rosbag captured for evidence
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
No [MAV] HEARTBEAT |
UART2 wiring wrong or baud mismatch | Check GPIO 38→PX4 RX, GPIO 3←PX4 TX, shared GND; verify SER_TELx_BAUD=57600 on PX4 |
clk=WARMING never advances |
PX4 DDS not converged | Check uxrce_dds_client status on PX4 NSH — need timesync converged: true |
| GPRMC suppressed indefinitely | Clock never reaches LOCKED | Usually DDS convergence issue; see above |
livox_ros_driver2 does not show timestamp_type changed to 2 |
GPRMC not reaching LiDAR | Check GPIO 12 → Mid-360 pin 10 wire and shared GND; confirm ESP32 is LOCKED before starting driver |
| 10 Hz or 1 Hz signal absent | GPIO conflict or wiring | Confirm scope on GPIO 4 and GPIO 5; check no strapping pin conflict |
| Large offset at LOCKED entry | Normal — WARMING step-corrects | Offset drops to <20 ms within a few SYSTEM_TIME updates after LOCKED |
Repository Layout
esp32_timersync-open/
├── src/
│ └── main.cpp # All firmware — Phase 1–4 complete
├── include/ # Headers (currently empty)
├── platformio.ini # Board: dfrobot_firebeetle2_esp32s3, lib: MAVLink v2
└── .copilot_instrcutions/ # Project knowledge base
├── SYSTEM_KNOWLEDGE.md # Hardware facts, signal specs, verified GPIO table
├── PLAN.md # Phase-gated implementation plan
└── DECISIONS.md # Resolved decisions and open questions
Documentaion Reference
Real hardware · https://sasakuruppuarachchi.github.io/agipix/docs/real/6_hw_optimisation.html
Jetson & PX4 Hardware & Communication Optimizations
This guide provides the complete step-by-step procedure to implement the two critical system fixes documented in the hardware time synchronization investigation:
- Linux Kernel UDP Buffer & Ethernet NIC Tuning (Prevents Livox Mid-360 UDP packet drops & frame jitter).
- PX4 Micro-XRCE-DDS Bridge & Jetson High-Speed Serial Tuning on
/dev/ttyTHS2(Eliminates IMU telemetry dropouts and DDS latency spikes).
JETSON COMPANION COMPUTER
┌───────────────────────────┐ ┌─────────────────────────────────────────────────────────┐
│ Livox Mid-360 LiDAR │ │ Kernel UDP Socket Buffer: 32 MB │
│ (10 Hz Cloud + 200Hz IMU│────►│ NIC RX Ring Buffer: 4096 Descriptors │
└───────────────────────────┘ UDP │ Network Backlog: 10,000 packets │
eth │ │
│ MicroXRCEAgent (Baud: 921600 / Low-Latency Mode) │
┌───────────────────────────┐ │ /dev/ttyTHS2 (Tegra High-Speed UART) │
│ PX4 Flight Controller │────►│ ▲ │
│ (TELEM2 / DDS Client) │UART │ │ │
└───────────────────────────┘ └──┴──────────────────────────────────────────────────────┘
Part 1: Livox UDP Kernel & NIC Ring Buffer Tuning
1.1 Problem Statement
The Livox Mid-360 streams dense point clouds and IMU data as unthrottled UDP packets. Linux default socket buffers (~212 KB) overflow during CPU spikes or thread preemption, resulting in dropped frames and distorted scan spans.
1.2 Permanent Kernel Sysctl Configuration
- Create a dedicated sysctl configuration file:
sudo nano /etc/sysctl.d/99-livox-udp.conf - Add the following parameters:
# Increase maximum and default socket receive buffer sizes to 32 MB net.core.rmem_max = 33554432 net.core.rmem_default = 33554432 # Increase maximum and default socket send buffer sizes to 16 MB net.core.wmem_max = 16777216 net.core.wmem_default = 16777216 # Increase maximum amount of backlogged packets on the network card input queue net.core.netdev_max_backlog = 10000 # Set minimum UDP receive buffer size to 16 KB net.ipv4.udp_rmem_min = 16384 - Apply changes immediately without rebooting:
sudo sysctl --system
1.3 Ethernet NIC Hardware RX Ring Buffer Expansion
Jetson onboard Ethernet controllers (e.g., eth0 or eth1) typically default to a ring buffer of 256 or 512 descriptors. Maximize this to 4096 to absorb micro-bursts from the LiDAR.
- Check current and maximum supported ring buffer sizes:
sudo ethtool -g eth0 - Expand the RX ring buffer to the hardware maximum (4096):
sudo ethtool -G eth0 rx 4096 - Make the NIC setting permanent across reboots by creating a systemd service:
sudo nano /etc/systemd/system/nic-ring-buffer.serviceAdd the following service definition:
[Unit] Description=Set Ethernet RX Ring Buffer to 4096 for Livox LiDAR After=network.target [Service] Type=oneshot ExecStart=/usr/sbin/ethtool -G eth0 rx 4096 RemainAfterExit=yes [Install] WantedBy=multi-user.target - Enable and start the service:
sudo systemctl daemon-reload sudo systemctl enable --now nic-ring-buffer.service
1.4 Verification (UDP Stream)
To verify that no packets are being dropped by the kernel:
# Check UDP receive buffer errors (RcvbufErrors should remain 0 while streaming LiDAR)
netstat -su | grep "buffer errors"
Part 2: PX4 Micro-XRCE-DDS Bridge & Jetson /dev/ttyTHS2 Tuning
2.1 Jetson High-Speed Serial (/dev/ttyTHS2) Optimizations
Jetson uses the Tegra High-Speed UART driver (ttyTHS*). By default, the serial driver buffers incoming bytes in a FIFO for a timeout window before delivering them to userspace. For real-time IMU streaming at 100–200 Hz, we configure low-latency mode and elevated process priority.
Step 1: Install setserial & Configure User Permissions
sudo apt-get update && sudo apt-get install -y setserial
# Add user to dialout and tty groups
sudo usermod -aG dialout,tty $USER
Step 2: Create a Udev Rule for /dev/ttyTHS2 Latency & Permissions
Create /etc/udev/rules.d/99-tegra-uart-latency.rules:
sudo nano /etc/udev/rules.d/99-tegra-uart-latency.rules
Add the following rule:
KERNEL=="ttyTHS2", MODE="0666", GROUP="dialout", RUN+="/bin/setserial /dev/ttyTHS2 low_latency"
Reload udev rules:
sudo udevadm control --reload-rules && sudo udevadm trigger
Step 3: Verify Low-Latency Mode on /dev/ttyTHS2
setserial -g /dev/ttyTHS2
# Output should include: Flags: ... low_latency
2.2 Micro-XRCE-DDS Agent Setup on Jetson
Run the Micro-XRCE-DDS Agent at 921600 baud (or up to 2,000,000 baud if PX4 hardware allows).
Run Interactively:
MicroXRCEAgent serial --dev /dev/ttyTHS2 -b 921600 -v 4
Make Micro-XRCE-DDS Agent a Persistent System Service:
- Create
/etc/systemd/system/micro-xrce-agent.service:sudo nano /etc/systemd/system/micro-xrce-agent.service - Add the configuration:
[Unit] Description=Micro-XRCE-DDS Agent on /dev/ttyTHS2 After=network.target [Service] Type=simple ExecStart=/usr/local/bin/MicroXRCEAgent serial --dev /dev/ttyTHS2 -b 921600 Restart=always RestartSec=2 CPUSchedulingPolicy=rr CPUSchedulingPriority=80 Nice=-20 [Install] WantedBy=multi-user.target[!TIP]
CPUSchedulingPolicy=rrwithCPUSchedulingPriority=80prevents Linux thread preemption from causing DDS transport drops when running heavy algorithms like LIO or mapping. - Enable and start:
sudo systemctl daemon-reload sudo systemctl enable --now micro-xrce-agent.service
2.3 PX4 Autopilot Configuration
Connect the PX4 port (typically TELEM2) to the Jetson /dev/ttyTHS2 RX/TX pins (Jetson Pin 8/10 on 40-pin header for UART2, with GND connected).
Parameter Configuration (via QGroundControl):
| Parameter | Value | Description |
|---|---|---|
UXRCE_DDS_CFG |
TELEM2 (or 102) |
Assigns uXRCE-DDS Client to TELEM2 serial port |
SER_TEL2_BAUD |
921600 8N1 |
Sets TELEM2 baud rate to 921,600 |
UXRCE_DDS_PRT |
0 (Default) |
Client Domain ID |
UXRCE_DDS_KEY |
0 (Default) |
Client Key |
[!IMPORTANT] Reboot PX4 after modifying
UXRCE_DDS_CFGandSER_TEL2_BAUDfor the port reassignment and baud rate to take effect.
2.4 Diagnostic & Verification Commands
1. On PX4 (via MAVLink NSH Console):
# Check DDS Client status, connection health, and packet counters
uxrce_dds_client status
Expected Output:
INFO [uxrce_dds_client] Running, Connected: yes
INFO [uxrce_dds_client] Device: /dev/ttyS3, Baudrate: 921600
INFO [uxrce_dds_client] Received: ... bytes, Sent: ... bytes
2. On Jetson (ROS 2 Humble):
# Check PX4 IMU publication rate and stability
ros2 topic hz /drone0/px4_imu
# Expected: steady rate (~100 Hz or configured rate) without gaps > 0.05s
# Check Livox Internal IMU publication rate
ros2 topic hz /drone0/livox/imu
# Expected: steady 200.0 Hz with 0 dropped frames
Part 3: Quick Setup Verification Checklist
/etc/sysctl.d/99-livox-udp.confcreated and applied (sysctl net.core.rmem_maxshows33554432).ethtool -g eth0shows RX ring buffer set to4096./dev/ttyTHS2haslow_latencyflag set via udev orsetserial.- Jetson user has access to
dialoutandttygroups. - PX4 parameters
UXRCE_DDS_CFGandSER_TEL2_BAUDset toTELEM2and921600. MicroXRCEAgentrunning at 921600 baud with real-time priority.- Zero packet errors reported in
netstat -suanduxrce_dds_client status.
Real hardware · https://sasakuruppuarachchi.github.io/agipix/docs/real/7_manet_mesh_networking.html
MANET mesh networking upgrade (WIP)
This is a work in progress upgarde to the agipix framework to use the long rage robust capabilities of the Wi-Fi HaLow mesh networking.
A MANET (Mobile Ad-Hoc Network) is a self-forming wireless mesh where each node connects directly without centralized infrastructure. This technology is especially useful in the civilian space for search and rescue, disaster response, airsoft events, and any disconnected communications scenario. Designed to be budget-friendly with excellent long-range performance. The build is designed to integrate with ATAK over multicast, but works equally well over standard IP and internet links.


Real hardware · https://sasakuruppuarachchi.github.io/agipix/docs/real/8_preflight_checklist.html
Preflight Checklist
# 1) Primary link test
sudo MicroXRCEAgent serial --dev /dev/ttyTHS2 -b 921600
# 2) Secondary link test
sudo systemctl status mavlink-router
sudo journalctl -u mavlink-router -f
Todos:
HW
- PPS Sync
- DDS tuning
- Realsense test
SW
- GLIM calib
- DLIO update verification
- DQ controller test on sim
-
Onboard detector test with realsense
- Test Global planner, local planner
- Test nav
Real hardware · https://sasakuruppuarachchi.github.io/agipix/docs/real/9_software_setup.html
Software Setup for Agipix
Prerequisit for this setup is setting up the Docker)
Setup PX4 interface software stack
This step is tested for the stable Branch 1.16.1 (stable)
mkdir -r ~/workspace/agipix_control/src
cd ~/workspace/agipix_control/src
# clone the px4 msgs and manually sync with the Autopilot version
git clone https://github.com/PX4/px4_msgs.git
git clone https://github.com/PX4/PX4-Autopilot.git -b v1.16.1
# Sync
rm -f px4_msgs/msg/*.msg
rm -f px4_msgs/srv/*.srv
cp PX4-Autopilot/msg/*.msg px4_msgs/msg/
cp PX4-Autopilot/srv/*.srv px4_msgs/srv/
cp PX4-Autopilot/msg/versioned/*.msg px4_msgs/msg/
touch px4_version_synced_v1_16_1
rm -rf PX4-Autopilot # optionally remove
# clone the interface lib
git clone https://github.com/Auterion/px4-ros2-interface-lib -b release/1.16
Verify versions
## to verify compatibility
cd ~/workspace/agipix_control/src/px4-ros2-interface-lib
./scripts/check-message-compatibility.py -v path/to/px4_msgs/ path/to/PX4-Autopilot/
build
agidocker
# *** Inside agidocker
cd /workspaces/agipix_control
colcon build --packages-select px4_msgs
colcon build --packages-select px4_ros2_cpp
Install Agi-Logger
cd ~/workspace/logging/src
git clone https://github.com/SasaKuruppuarachchi/agi_logger.git
agidocker
# *** Inside agidocker
cd /workspaces/logging/src/agi_logger
pip install -e .
Sim setup
See Instructions to continue.
Agipix Autonomy stack setup
Now we are ready for autonomy setup. See Instructions to continue.
Autonomy · https://sasakuruppuarachchi.github.io/agipix/docs/autonomy/
Agipix (Autonomy) — Quick Guide
Use this page to navigate the AgiAUTO stack used identically in simulation and real flights.

Perception
- LiDAR-inertial state estimation and mapping for GPS-denied indoor operation.
- Dynamic obstacle handling and occupancy map generation for planning.
- Designed for robust indoor inspection with onboard sensing.
Read: Perception
Planning & Control
- Local planner for dynamically feasible trajectories in clutter.
- On-manifold MPC tracking with PX4 setpoint streaming.
- Supports teleop, goal, navigation, and exploration control modes.
Read: Planning & Control
Data‑Driven Autonomy
- Integration path for learned navigation policies with zero-shot transfer tests.
- Includes deployment notes and experimental examples.
Read: Learning-Based Planning & Control
Next steps
- If runtime is not ready yet, start with Real Docker Build
- To test in simulation first: Simulation Quick Guide
- For operator workflows: UI Quick Guide
Autonomy · https://sasakuruppuarachchi.github.io/agipix/docs/autonomy/1_perception.html
Agipix Autonomy: Perception
There are currently preception algorithems validated on the platform
- GLIM
- DLIO
1. GLIM: 3D Range-Inertial Localization and Mapping with GPU-Accelerated Scan Matching Factors

GLIM is tested on Ubuntu 22.04 / 24.04 with CUDA 12.2 / 12.5 / 12.6, and NVIDIA Jetson Orin (JetPack 6.1). You can build and install GLIM from source code, or install pre-built binaries from PPA.
Install from source
Common dependencies
# Install dependencies
sudo apt install libomp-dev libboost-all-dev libmetis-dev \
libfmt-dev libspdlog-dev \
libglm-dev libglfw3-dev libpng-dev libjpeg-dev
# Install GTSAM
git clone https://github.com/borglab/gtsam
cd gtsam && git checkout 4.3a0
mkdir build && cd build
cmake .. -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \
-DGTSAM_BUILD_TESTS=OFF \
-DGTSAM_WITH_TBB=OFF \
-DGTSAM_USE_SYSTEM_EIGEN=ON \
-DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF
make -j$(nproc)
sudo make install
# Install Iridescence for visualization
# This is optional but highly recommended
git clone https://github.com/koide3/iridescence --recursive
mkdir iridescence/build && cd iridescence/build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
sudo make install
# Install gtsam_points
git clone https://github.com/koide3/gtsam_points
mkdir gtsam_points/build && cd gtsam_points/build
cmake .. -DBUILD_WITH_CUDA=ON
make -j$(nproc)
sudo make install
# Make shared libraries visible to the system
sudo ldconfig
Install GLIM for ROS2
cd ~/ros2_ws/src
git clone https://github.com/koide3/glim
git clone https://github.com/koide3/glim_ros2
cd ~/ros2_ws
colcon build
# cmake options
# colcon build --cmake-args \
# -DBUILD_WITH_CUDA=ON \
# -DBUILD_WITH_VIEWER=ON \
# -DBUILD_WITH_MARCH_NATIVE=OFF
!!! note
While AVX intrinsics can be enabled to speed up the mapping process by setting BUILD_WITH_MARCH_NATIVE=ON, it sometimes causes segfaults unless march=native is properly set for every involved library. We recommend keeping it disabled if you are not sure.
2. Direct LiDAR-Inertial Odometry: Lightweight LIO with Continuous-Time Motion Correction
Changelog
Below is a detailed changelog of the current working tree (branch agipix_sim), covering staged/unstaged changes.
Interface additions (odom.h)
- New diagnostics publishers:
alignment_good_pub,ekf_nis_pub. - New state for GICP health: thresholds, last alignment status, last pose covariance (ROS order), validity flag.
- EKF controls and noise settings: enable flags, use-cov flag, NIS threshold, measurement floors, continuous-time IMU noise stddevs, legacy process noise diagonals, EKF covariance
ekf_P_, last NIS. - EKF helper declarations:
ekfPredict,ekfUpdateFromLidar. - Option to ignore bad alignments.
Core logic changes (odom.cc)
- Diagnostics and publishers:
- Publish alignment health (
alignment_good) and EKF NIS (ekf_nis). - Optionally publish pose covariance into
nav_msgs/Odometry.pose.covariancewhen available.
- Publish alignment health (
- Parameter loading:
- Loads all new GICP failure, covariance publishing, bad-alignment ignore, and EKF parameters (including IMU noise and measurement floors).
- GICP alignment handling:
- If GICP does not converge, alignment is flagged bad and diagnostics are published.
- Hessian-based pose covariance is computed with symmetrization, damping on bad alignments, variance floor, and reordered to ROS [x y z r p y].
- Alignment health is evaluated via condition number, min eigenvalue, fitness per point, and inlier count; failures can cause the correction to be ignored (
gicp_ignore_bad_alignment).
- EKF integration:
- Predict step uses continuous-time error-state linearization with IMU noise parameters; runs on IMU callbacks when enabled.
- Update step fuses LiDAR pose with optional GICP-derived covariance plus floors, computes NIS with gating, and publishes NIS.
- Falls back to geometric observer when EKF is disabled or an update is rejected/ignored.
- IMU handling robustness:
- After calibration, IMU time base is reset.
- IMU
dtis clamped for non-monotonic/large jumps to avoid unstable propagation.
- Covariance stability:
- Innovation covariance in the EKF update is symmetrized; update aborts if LDLT fails.
- Minor: explicit
<limits>include.
Behavioral impacts
- Safer handling of bad/unstable GICP alignments to prevent corrupting state.
- Optional EKF fusion with statistical gating and measurement covariance from GICP.
- Pose covariance now available on odometry messages when enabled.
- IMU time/
dtrobustness reduces risk of large integration spikes.

[ IEEE ICRA ] [ arXiv ] [ Video ] [ Presentation ]
DLIO is a new lightweight LiDAR-inertial odometry algorithm with a novel coarse-to-fine approach in constructing continuous-time trajectories for precise motion correction. It features several algorithmic improvements over its predecessor, DLO, and was presented at the IEEE International Conference on Robotics and Automation (ICRA) in London, UK in 2023.
Instructions
Sensor Setup
DLIO has been extensively tested using a variety of sensor configurations and currently supports Ouster, Velodyne, and Hesai LiDARs. The point cloud should be of input type sensor_msgs::PointCloud2 and the 6-axis IMU input type of sensor_msgs::Imu.
For best performance, extrinsic calibration between the LiDAR/IMU sensors and the robot’s center-of-gravity should be inputted into cfg/dlio.yaml. If the exact values of these are unavailable, a rough LiDAR-to-IMU extrinsics can also be used (note however that performance will be degraded).
IMU intrinsics are also necessary for best performance, and there are several open-source calibration tools to get these values. These values should also go into cfg/dlio.yaml. In practice however, if you are just testing this work, using the default ideal values and performing the initial calibration procedure should be fine.
Also note that the LiDAR and IMU sensors need to be properly time-synchronized, otherwise DLIO will not work. We recommend using a LiDAR with an integrated IMU (such as an Ouster) for simplicity of extrinsics and synchronization.
Dependencies
The following has been verified to be compatible, although other configurations may work too:
- Ubuntu 22.04
- ROS Humble (
rclcpp,std_msgs,sensor_msgs,geometry_msgs,nav_msgs,pcl_ros) - C++ 14
- CMake >=
3.12.4 - OpenMP >=
4.5 - Point Cloud Library >=
1.10.0 - Eigen >=
3.3.7
sudo apt install libomp-dev libpcl-dev libeigen3-dev
DLIO currently supports ROS 1 and ROS 2!
Compiling
Compile using the catkin_tools package via:
mkdir ~/ros2_ws && cd ~/ros2_ws && mkdir src && cd src
git clone https://github.com/vectr-ucla/direct_lidar_inertial_odometry -b feature/ros2
cd ~/ros2_ws
colcon build --symlink-install --packages-select direct_lidar_inertial_odometry
Execution
After compiling, don't forget to source before ROS commands.
``` bash source ~/ros2_ws/install/setup.bash ```Execute via:
roslaunch direct_lidar_inertial_odometry dlio.launch \
rviz:={true, false} \
pointcloud_topic:=/robot/lidar \
imu_topic:=/robot/imu
Example command:
``` bash ros2 launch direct_lidar_inertial_odometry dlio.launch.py rviz:=true pointcloud_topic:=/lexus3/os_center/points imu_topic:=/lexus3/os_center/imu ```Be sure to change the topic names to your corresponding topics. Alternatively, edit the launch file directly if desired. If successful, you should see the following output in your terminal:
Services
To save DLIO’s generated map into .pcd format, call the following service:
ros2 service call /save_pcd direct_lidar_inertial_odometry/srv/SavePCD "{'leaf_size': 0.2, 'save_path': '~/map'}"
Test Data
For your convenience, we provide test data here (1.2GB, 1m 13s, Ouster OS1-32) of an aggressive motion to test our motion correction scheme, and here (16.5GB, 4m 21s, Ouster OSDome) of a longer trajectory outside with lots of trees. Try these two datasets with both deskewing on and off!
Run runtime Tests
- Build with symbols:
colcon build --symlink-install --packages-select direct_lidar_inertial_odometry --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo - Source the workspace:
source ~/ros2_ws/install/setup.bash - Run the launch under gdb (no breakpoints yet):
ros2 launch direct_lidar_inertial_odometry dlio.launch.py --launch-prefix 'gdb -ex run --args'- You’ll drop into gdb; use
run(auto-issued), thenbton crash. Quit withquit.
- You’ll drop into gdb; use
- To start stopped at
maininstead of auto-run:ros2 launch direct_lidar_inertial_odometry dlio.launch.py --launch-prefix 'gdb --args'Then inside gdb:
start,break <symbol>,continue. - Handy gdb extras:
set pagination off,set print pretty on,layout split(TUI). Add them via-ex "cmd":ros2 launch direct_lidar_inertial_odometry dlio.launch.py \ --launch-prefix 'gdb -ex "set pagination off" -ex "set print pretty on" --args' - If you prefer to attach instead: start normally, find PID (
ps -C dlio_odom_node -o pid,cmd), thengdb -p <pid>.
Citation
If you found this work useful, please cite our manuscript:
@article{chen2022dlio,
title={Direct LiDAR-Inertial Odometry: Lightweight LIO with Continuous-Time Motion Correction},
author={Chen, Kenny and Nemiroff, Ryan and Lopez, Brett T},
journal={2023 IEEE International Conference on Robotics and Automation (ICRA)},
year={2023},
pages={3983-3989},
doi={10.1109/ICRA48891.2023.10160508}
}
Acknowledgements
We thank the authors of the FastGICP and NanoFLANN open-source packages:
- Kenji Koide, Masashi Yokozuka, Shuji Oishi, and Atsuhiko Banno, “Voxelized GICP for Fast and Accurate 3D Point Cloud Registration,” in IEEE International Conference on Robotics and Automation (ICRA), IEEE, 2021, pp. 11 054–11 059.
- Jose Luis Blanco and Pranjal Kumar Rai, “NanoFLANN: a C++ Header-Only Fork of FLANN, A Library for Nearest Neighbor (NN) with KD-Trees,” https://github.com/jlblancoc/nanoflann, 2014.
We would also like to thank Helene Levy and David Thorne for their help with data collection.
License
This work is licensed under the terms of the MIT license.
Autonomy · https://sasakuruppuarachchi.github.io/agipix/docs/autonomy/2_planning_control.html
Agipix Autonomy: Planning and Control

AgiAUTO (ROS 2) — Agipix PX4 Autonomy Stack
This repository is the AgiAUTO autonomy module of Agipix for PX4-based UAV missions in ROS 2.
- HW and SIM Platform Repository: https://github.com/SasaKuruppuarachchi/agipix.git
- Platform docs: https://sasakuruppuarachchi.github.io/agipix/
- Publication: “AgiPIX: Bridging Simulation and Reality in Indoor Aerial Inspection”, International Conference on Unmanned Aircraft Systems (ICUAS) 2026, pp. 844–852. DOI: 10.1109/ICUAS69441.2026.11598625 · arXiv:2604.08009
System architecture (current)
Sensors
(depth / point cloud / RGB / lidar)
+ PX4 state topics
│
▼
onboard_detector
(dynamic obstacle detection + tracking)
│
▼
map_manager
(occupancy/dynamic map + collision/raycast)
│
┌───────────────────┴──────────────────────────┐
▼ ▼
global_planner (RRT/RRT*/DEP) trajectory_planner
(global waypoints / exploration path) (poly/PWL/B-spline)
└───────────────────┬──────────────────────────┘
▼
time_optimizer
(optional)
│
▼
autonomous_flight
(mission executive/state machine)
│
▼
px4_control_interface
(DDS tracking mode + setpoint writer + executor flow)
▼
PX4
Package roles
autonomous_flight: mission orchestration (takeoff,navigation,rl_navigation,dynamic_navigation,inspection,dynamic_inspection,dynamic_exploration)px4_control_interface: DDS-native PX4 mode/executor runtime and target tracking bridgemap_manager: occupancy and dynamic map representations, map servicesonboard_detector: dynamic obstacle perception, data association, trackingglobal_planner: global planning and exploration planning (RRT/RRT*, DEP)trajectory_planner: smooth local trajectory generation (poly/PWL/B-spline)time_optimizer: trajectory time allocation optimization utilitiesagi_viz: centralized RViz profiles for autonomy stack visualization
Note: the standalone legacy middle-level controller package is no longer part of the active DDS runtime control path.
Setup
Validated against PX4 v1.16.1 message definitions.
Prerequiste : PX4 ROS 2 interface setup (see PX4 ROS 2 interface)
Build:
cd ~/workspace/agipix_control/src
git clone https://github.com/SasaKuruppuarachchi/agipix_autonomy.git -b dds
git clone https://github.com/SasaKuruppuarachchi/agipix_user_interfaces.git
agidocker
# inside the container
cd /workspaces/agipix_control
colcon build # builds the autonomy stack
source install/setup.bash
Demo media (placeholders)
ros2 launch px4_control_interface dds_shadow.launch.py use_sim_time:=true start_legacy_stack:=true mission:=<mission_name>
Available missions:
takeoff_and_hover, takeoff_and_track_circle, navigation, rl_navigation, dynamic_navigation, dynamic_inspection, dynamic_exploration, inspection
- [PLACEHOLDER] Takeoff + hover demo video
- [PLACEHOLDER] Dynamic navigation demo video
- Dynamic exploration demo video:
- [PLACEHOLDER] Dynamic inspection demo video
Current status
- ROS 1 → ROS 2 porting completed for the autonomy stack in this repository.
- Runtime stack is PX4 DDS-native (MAVROS backend removed from active control path).
- Mission validation status:
- ✅ takeoff and hover
- ✅ takeoff and track circle
- ✅ navigation
- ✅ rl navigation
- ✅ dynamic navigation
- ✅ dynamic exploration
- ✅ dynamic inspection
Credits
This stack builds on original CERLAB autonomy components and research implementations by Zhefan Xu and collaborators.
This repository version is a ROS 2 integration within Agipix by Sasa Kuruppuarachchi.
Please credit both:
- Original algorithm/software authors (see package-level citations)
- Agipix ROS 2 integration and platform engineering work in this repository
Autonomy · https://sasakuruppuarachchi.github.io/agipix/docs/autonomy/3_planning_control_data.html
Agipix Autonomy: Data-driven Planning and Control

FAINT
The Robot Navigates to given subgoals using the end to end model. By leveraging pretrained visual representations, the proposed policy achieves up to 50% higher navigation success and generalizes across ground and aerial robots.
Agipix running FAINT - CoRL 25
User interface · https://sasakuruppuarachchi.github.io/agipix/docs/ui/
Agipix (UI) — Quick Guide
Use this page to navigate AgiUI workflows for teleoperation, supervision, and autonomy handover.

Teleoperation
- Safety RC as manual failsafe.
- Joystick and remote command pathways for direct robot control.
- Real-time state feedback for safe intervention.
Read: Teleoperation
Exploration UI
- Shared map and mission context visualization.
- Progress and status feedback during exploration tasks.
- Start/pause supervision actions for field use.
Read: Exploration Autonomy
Human‑in‑the‑Loop Autonomy
- High-level task specification with autonomy-level switching.
- Operator-in-the-loop supervision and intervention.
- Continuous state and map feedback for trust and safety.
Read: Human in the Loop Autonomy
Related:
User interface · https://sasakuruppuarachchi.github.io/agipix/docs/ui/1_teleoperation.html
Modes of Teleoperation
Manual Control RC
This is used as the safety failsafe for the robot

Manual Control UDP-Mavlink
The Px4 connects to Orin via secondary mavlink connection. This can be used to forward control signals via groundstation. USB joystick is used for manual control signal generation and the controls are forwarded via UDP
ROS2 Velocity control
This can be used to forward control signals via groundstation through the primary DDS link. USB joystick is used for manual control signal generation
User interface · https://sasakuruppuarachchi.github.io/agipix/docs/ui/2_exploration_autonomy.html
UI in Autonomous exploration
Status: planned. An exploration UI is in development and will be documented when it is released. It will show the live 3D map and the drone, the exploration frontiers and planned path, and a plain-language status of what the drone is doing.
User interface · https://sasakuruppuarachchi.github.io/agipix/docs/ui/3_human_in_the_loop_autonomy.html
Human-in-the-loop autonomy
Status: planned. A human-in-the-loop UI is in development and will be documented when it is released. It will show the live 3D map and the drone, turn high-level operator commands into trajectories, and give a plain-language status of what the drone is doing.
