Pixhawk Setup

This guide outlines the firmware setup process of the ATMOS Freeflyers’ onboard microcontroller, the Pixhawk 6X Mini.

PX4 Autopilot

We use PX4 Autopilot as the firmware for the Pixhawk 6X Mini, openly available here: PX4 at GitHub. To begin, clone the PX4 repository to your local machine:

  1. Clone the PX4 repository to your local machine:
    git clone git@github.com:PX4/PX4-Autopilot.git --recursive
    
  2. Navigate to the cloned PX4-Autopilot directory and install the required packages:
    bash ./Tools/setup/ubuntu.sh
    

    After this step, rebooting your machine is recommended.

  3. Build PX4 messages for ROS 2.
    To communicate with the Pixhawk via ROS 2, you need its PX4 messages (available here: PX4-msgs at GitHub) on your local machine.
    mkdir -p ~/px4_ws/src/
    cd ~/px4_ws/src/
    git clone git@github.com:PX4/px4_msgs.git
    cd ~/px4_ws
    colcon build
    source install/setup.bash 
    

Firmware Installation

To upload the PX4 firmware to the Pixhawk controller:

  1. Connect the Pixhawk to your computer via serial.
  2. Navigate to the cloned PX4-Autopilot directory.
  3. Upload the firmware using:
make px4_fmu-v6x_spacecraft upload

Setting a Default Namespace

We recommend setting a default ROS 2 namespace for PX4 using the PX4_UXRCE_DDS_NS parameter. Specify it during firmware upload:

PX4_UXRCE_DDS_NS=<namespace> make px4_fmu-v6x_spacecraft upload

Vehicle Configuration and QGroundControl

QGroundControl is the ground control station used to interface with PX4 from a local machine. It is openly available here: QGroundControl at GitHub.

Setting up QGroundControl

To build QGroundControl for Linux Ubuntu, you first need:

sudo usermod -a -G dialout $USER
sudo apt-get remove modemmanager -y
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

Logout and login again to enable the change to user permissions.

Download QGroundControl-x86_64.AppImageand make it executable:

chmod +x ./QGroundControl-x86_64.AppImage

To launch it, simply run:

./QGroundControlApp.AppImage

PX4 Vehicle Setup

Once QGroundControl is installed, follow these steps:

  1. Connect the Pixhawk to QGroundControl
    • Open QGroundControl and connect the Pixhawk to configure the PX4.
    • Navigate to Vehicle Setup.
  2. Calibrate the RC (First-time Setup)
    • Go to the Radio tab and follow the calibration procedure.
    • Go to the Flight Modes tab and assign flight modes to RC switches:
      • One switch for ARMING/DISARMING.
      • One for MANUAL/ACRO/POSITION.
      • One for OFFBOARD ON/OFF.
  3. Configure Parameters
    • Go to the Parameters tab.
    • Micro-XRCE-DDS-Agent IP-Address
      • The PX4 runs a Micro-XRCE-DDS client to expose local UORB topics to the ROS 2 environment. If using ethernet for communication between PX4 and the onboard computer, you need to set the Micro-XRCE-DDS agent’s IP address. This is controlled with the parameter UXRCE_DDS_AG_IP via an integer value. We are using 192.168.0.1, which is mapped to -1062731775. Set this parameter to the agent’s IP mapping. For other mappings, run:

         python3 Tools/convert_ip.py "<IP-address>"
        
    • Set MAVLink System ID (Optional)
      • If using multiple spacecraft, assign each PX4 controller a unique MAVLink system ID using the MAV_SYS_ID parameter.
    • Reboot the PX4 controller
      • Either power cycle the Pixhawk or reboot it via Parameters -> Tools -> Reboot Vehicle.

PX4 IP Setup

  1. In QGroundControl, navigate to Analyze Tools -> MAVLink Console.
  2. Set the IP-address of the PX4 controller by: In MAVLink Console:
    echo DEVICE=eth0 > /fs/microsd/net.cfg
    echo BOOTPROTO=fallback >> /fs/microsd/net.cfg
    echo IPADDR=192.168.0.10 >> /fs/microsd/net.cfg
    echo NETMASK=255.255.255.0 >>/fs/microsd/net.cfg
    echo ROUTER=192.168.0.254 >>/fs/microsd/net.cfg
    echo DNS=192.168.0.254 >>/fs/microsd/net.cfg
    
  3. Reboot the PX4 controller to apply the settings.
    • Either power cycle the Pixhawk or reboot it via Vehicle Setup -> Parameters -> Tools -> Reboot Vehicle.
  4. In MAVLink Console, verify that the IP is set correctly after reboot:
       netman show
    

Once completed, the PX4 should be ready to communicate with the onboard computer.

PX4 Setup Completed

Now we are ready to set up the Nvidia Jetson Orin NX. Please proceed to the next page.

results matching ""

    No results matching ""