Pixhawk Setup

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

PX4Space

We use PX4Space as the firmware for the Pixhawk 6X Mini, a fork of PX4 Drone Autopilot, openly available here: PX4Space at GitHub.

  1. Clone the PX4Space repository to your local machine:
    git clone git@github.com:DISCOWER/PX4-Space-Systems.git --recursive
    
  2. Navigate to the cloned PX4-Space-Systems 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 custom PX4 messages (available here: PX4-msgs at GitHub) on your local machine.
    mkdir -p ~/discower_ws/src/
    cd ~/discower_ws/src/
    git clone git@github.com:DISCOWER/px4_msgs.git
    cd ~/discower_ws
    colcon build
    source install/setup.bash 
    

Firmware Installation

To upload the PX4Space firmware to the Pixhawk controller:

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

Setting a Default Namespace

We recommend setting a default 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

To customise and communicate with the PX4 Space controller, use our custom QGroundControl build for spacecraft.

Building QGroundControl for Spacecraft

QGroundControl (QGC) is the ground control station used to interface with PX4. For PX4Space, we adapted some components to make it possible to tune our controllers, and therefore, we need to build from source this version of QGC, which is openly available here: Spacecraft QGC at GitHub.

First install the required QT versions using the aqt tool:

pip install aqtinstall
aqt install-qt --outputdir $HOME/qt linux desktop 6.6.3 gcc_64 -m qtcharts qtconnectivity qtlocation qtmultimedia qtpositioning qtsensors qtserialport qtspeech qtshadertools qt5compat qtquick3d
echo "export PATH=$HOME/qt/6.6.3/gcc_64/bin:$PATH" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=$HOME/qt/6.6.3/gcc_64/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
echo "export QT_PLUGIN_PATH=$HOME/qt/6.6.3/gcc_64/lib/pkgconfig:$PKG_CONFIG_PATH" >> ~/.bashrc
source ~/.bashrc

Then we are ready to build QGC:

cd ~/
git clone --recursive --depth=1 https://github.com/DISCOWER/qgroundcontrol.git 
sudo bash ./qgroundcontrol/tools/setup/install-dependencies-debian.sh
cd qgroundcontrol
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build --config Debug
cp ./build/QGroundControl $HOME/QGroundControlApp

At this point, you will have the QGC app in your $HOME directory. To run it, simply do:

cd ~/
./QGroundControlApp

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 ROS2 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 ""