Installation Guide

You can see the PX4 Autopilot ROS 2 Guide for it installation, or follow the steps below.

We will use a colcon workspace for the installation:

mkdir -p ~/px4_ws/src

Note

You can add the following line to your ~/.bashrc file to source the workspace automatically.

echo "source ~/px4_ws/install/setup.bash" >> ~/.bashrc

PX4 Dependencies

Follow the steps below to install the dependencies for PX4:

  1. Clone the PX4 Messages repository:

cd ~/px4_ws/src
git clone https://github.com/PX4/px4_msgs.git
  1. Build workspace:

cd ~/px4_ws
colcon build --symlink-install

Install platform package

Clone the Aerostack2 Pixhawk Platform repository into the workspace created in the section before:

cd ~/px4_ws/src
git clone https://github.com/aerostack2/as2_platform_pixhawk.git

Build it:

source ~/px4_ws/install/setup.bash
cd ~/px4_ws
colcon build --symlink-install

XRCE-DDS (PX4-FastDDS Bridge)

For more information about XRCE-DDS, see PX4 Autopilot XRCE-DDS bridge. For its installation, clone it into the workspace and build it using colcon:

cd ~/px4_ws/src
git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git

Build it:

cd ~/px4_ws
colcon build --symlink-install

PX4 Autopilot

For more information about PX4 Autopilot, see PX4 Autopilot.

  1. Clone repository

mkdir -p ~/px4_ws/thirdparties
cd ~/px4_ws/thirdparties
git clone -b v1.14.0-rc2 https://github.com/PX4/PX4-Autopilot.git --recursive
  1. Add colcon ignore file to avoid building PX4-Autopilot with colcon

cd ~/px4_ws/thirdparties/
touch COLCON_IGNORE
  1. Set PX4_FOLDER environment variable

echo "export PX4_FOLDER=~/px4_ws/thirdparties/PX4-Autopilot" >> ~/.bashrc

Setting up PX4 Vision Autonomy Development Kit

For using PX4 Vision Autonomy Development Kit you need to follow the steps below:

  1. Build the PX4-Autopilot firmware with the following command:

cd ~/px4_ws/thirdparties/PX4-Autopilot
make px4_fmu-v6c_default
  1. Upload the firmware to the Pixhawk 4 using QGroundControl.

  2. Enable XRCE_DDS_0_CFG parameter in QGroundControl on the TELEM port. We use TELEM 2 port for this.

  3. Set up baud rate for the TELEM port. We recommend using 921600 baud rate for this.