← AI & Robotics Lab

Connecting to and Controlling the PX4 Flight Controller with the Jetson Orin Nano Companion Computer

Author: Daniel Jordan Viray

Step by Step Guide

May 26, 2026 · Autonomy & Mapping · by Daniel Jordan Viray

The objective of this session was to prove that the companion computer could successfully connect to and control the flight controller.

How I did it:

  1. Physically connect the flight controller to the Jetson Orin Nano.

    1. FC Telem 2 ports (only Tx, Rx, and GND pins). (Only pins 2,3,6 are relevant). Read pins left to right wight flight controller facing forward. Other pins are not needed - and should not be used.

    2. Needs JST to DuPont wiring connection. Adapter/wires available on Amazon.

    3. Connect wires to CP2102 USB-to-UART adapter. The USB adapter has GND, Tx, and Rx pins labelled. Note that GND <> GND, Tx <> Rxd, Rx <> Txd to/from flight controller.

  2. Configure the correct parameters on PX4 using QGroundControl. Must reboot FC for configurations to take effect.

    1. Mav_1_Config = Telem2 (was set to Disabled by default) - this tells the FC to output data from the Telem2 port.

    2. Mav_1_mode = Onboard (will only appear after mav_1_config is configured properly)

    3. Ser_Tel2_Baud = 921600 (will only appear after mav_1_config is configured properly)

  3. Check that there is raw data flowing between FC and Companion Computer:

    1. sudo apt install -y screen

      sudo screen /dev/ttyUSB0 921600

  4. Add dialout group permission settings; otherwise pymavlink and mavros will both fail. May require reboot to take effect.

    1. sudo usermod -a -G dialout $USER

  5. Install pymavlink and do a heartbeat test - to test that the FC and computer can communicate over Mavlink (the language that the flight controller speaks).

    1. pip3 install --user pymavlink pyserial

    2. heartbeat.py

      1. from pymavlink import mavutil

        master = mavutil.mavlink_connection(’/dev/ttyUSB0’, baud=921600)

        master.wait_heartbeat()

        print(f”Heartbeat from system {master.target_system}, component {master.target_component}”)

  6. Install MAVROS - to test if FC can communicate with the computer via Mavlink and ROS (MAVROS is like the translator between Mavlink and ROS)

    1. sudo apt update

      sudo apt install -y ros-humble-mavros ros-humble-mavros-extras ros-humble-mavros-msgs

      sudo /opt/ros/humble/lib/mavros/install_geographiclib_datasets.sh

  7. Launch Mavros

    1. ros2 launch mavros px4.launch fcu_url:=”serial:///dev/ttyUSB0:921600”

  8. Verify Mavros connects. Expect “connected: true”.

    1. ros2 topic echo /mavros/state --once

  9. Arm/disarm motors via ROS command — make sure that flight controller and battery is plugged in.

    1. ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool “{value: true}”

      ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool “{value: false}”

    2. flight controller will auto disarm if there are no commands after the arming.

This session proved that the companion computer can successfully connect to and control the flight controller.