Skip to content

Latest commit

 

History

History
157 lines (99 loc) · 6.3 KB

v2.md

File metadata and controls

157 lines (99 loc) · 6.3 KB

PX4 with X-Plane and QGroundControl Setup Guide (v2.0.2, August 2024)

Watch the PX4 X-Plane Plugin v2.0.0 Demo

PX4 X-Plane Plugin v2.0.0 Demo

Curious about the new features in the PX4 X-Plane Plugin v2.0.0? Check out this demo video where I walk you through the simplified setup process, showcase the multi-airframe support, and test various drones like the Ehang 184, Alia 250, Cessna 172, and Bayraktar TB2. Whether you're a student, researcher, or industry professional, this quick overview will get you up and running in no time!

👉 Watch the full demo and installation guide here!

Table of Contents


Download and Install Softwares

  1. X-Plane Download X-Plane 11 or 12 from the X-Plane Official Website.

  2. eVTOL Air Taxi (eHang 184) You can download the eVTOL Air Taxi (eHang 184) from the X-Plane Forum, though it's no longer required as the script supports multiple default airframes already available in X-Plane.

  3. QGroundControl Download QGroundControl from the Official Download Page.

  4. PX4xplane Plugin Download the precompiled binary from PX4xplane Releases. Install the plugin in the Resources/Plugins folder in X-Plane.


Setting Up the Environment

Windows Users - Setting Up WSL2

WSL2 (Windows Subsystem for Linux) allows you to run a Linux environment directly in Windows. This setup is necessary for Windows users to run PX4 simulation.

  1. Ensure virtualization is enabled in your BIOS (Virtualization Technology, Intel VT-x, AMD-V).

  2. For Windows 10 (build 19041 or higher) and Windows 11, open Command Prompt as administrator and install WSL2 with Ubuntu 22.04:

    wsl --install
  3. Once you have set up WSL2 and completed the initial PX4 installation with the provided script, you can use the px4xplane command to build and run the simulation from anywhere in your Linux terminal.

Note: The script is optimized for WSL but works on Linux too.

Clone and Build PX4

Quick Setup Using the Automated Script

To quickly set up PX4 with X-Plane using WSL (Ubuntu 22.04), follow this simple step:

  1. Run the setup script directly from your terminal:

    First, make sure you are in your WSL Ubuntu terminal (launch it from PowerShell), then enter the following command in your WSL terminal:

    cd ~ && curl -O https://raw.githubusercontent.com/alireza787b/px4xplane/master/setup/setup_px4_sitl.sh && bash setup_px4_sitl.sh

Important Notes:

  • Time Required: The installation process may take some time, depending on your system and configuration, especially the first time.
  • Prompts: During installation, you will encounter several prompts asking you to customize the setup. You can either read and decide on each prompt or just let the defaults take effect (the script will automatically proceed with default settings if you don't respond).
  1. Once setup is complete, use the px4xplane command to run the simulation from anywhere in your terminal.

Manual Build and Run (If you dont want to use automated script)

Advanced users can manually clone and set up the environment using the forked PX4 repository:

git clone https://github.com/alireza787b/PX4-Autopilot-Me.git --recursive

Navigate to the cloned directory:

cd PX4-Autopilot-Me

Run the setup script:

bash ./Tools/setup/ubuntu.sh

Configure PX4 SITL:

  • In Windows Terminal, check your IP address (e.g., 172.21.144.1):
    ipconfig
  • In the WSL Terminal, inside the PX4-Autopilot directory, set the PX4 simulation hostname with your IP:
    export PX4_SIM_HOSTNAME=172.21.144.1

Follow the regular PX4 WSL setup instructions, replacing the official repository with the forked one. Once set up, you can build the desired airframes with commands like:

make px4_sitl xplane_ehang184

Other airframes include:

  • xplane_alia250
  • xplane_cessna172
  • xplane_tb2

Configuration

Configure PX4 SITL

Automatic Configuration: The automated script handles all configuration steps, including setting up the airframes for X-Plane. You only need to select the desired airframe during the setup process.

Start the simulation:

px4xplane

The selected airframe will automatically load in X-Plane, and you can manage the configuration through the PX4 SITL menus directly. Manual parameter loading is no longer required for the supported airframes.


Defining Custom Airframes

If you need to define new airframes for your simulation, follow the detailed guide here:

👉 How to Define Custom Airframes in PX4-XPlane

This guide will walk you through the process of setting up custom configurations, mapping PX4 channels to X-Plane datarefs, and integrating new airframes into your simulations. Whether you're using existing X-Plane models or creating new ones in Plane Maker, this guide has you covered.


Additional Tips

  • Maintain a high FPS in X-Plane for stable flight.
  • The EKF estimator may have limitations in high acceleration maneuvers.
  • For errors: use the script's repair mode: ./setup_px4_sitl.sh --repair.
  • If issues persist, you may need to delete the cloned repository and start from scratch.
  • You can remove the global paths using the uninstall option: px4xplane --uninstall.
  • Remember, you can always manually build by navigating to your cloned repository and running the build commands directly.
  • YouTube video demonstration will be released soon.
  • For more information, visit the Official GitHub Repository.