Contenuto principale

Download PX4 Source Code in Windows Subsystem for Linux (WSL2)

R2026b

Note

This section explains the task to be completed as part of the step—Download PX4 Source Code—of the Hardware Setup process (using the Hardware Setup screens).

UAV Toolbox Support Package for PX4® Autopilots requires PX4 Autopilot Firmware v1.16.1.

Download PX4 Source Code from GitHub

To download the PX4 source code (PX4 Autopilot Firmware v1.16.1) on a Windows® Subsystem for Linux.

  1. Launch the WSL2 shell.

    1. Press the Windows Start key, type cmd, and press Enter.

    2. Launch the WSL2 shell by running this command.

      wsl

      This command launches the default WSL distribution. If you have multiple distributions installed, identify the correct one and launch it by name:

      1. List available distributions by running:

        wsl -l -v
      2. From the list, choose the distribution that you registered with Simulink in the Hardware Setup screens. Launch it by specifying the distribution name. For example, if your distribution is named Ubuntu-22.04:

        wsl -d Ubuntu-22.04
  2. Navigate to the home directory by executing the following command.

    cd ~
    After running this command, your terminal prompt should change to indicate that you are now in your home directory. For example:

    Tool strip

    Warning

    Cloning the firmware in WSL2 home directory is crucial. If you clone it outside of the WSL file system, then you will encounter slow execution issues and access right / permission errors.

    Note

    Ensure that your PC is connected to an active internet connection before proceeding with the next step.

  3. Download the PX4 source code using git.

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

    The download might take several minutes to complete (depends on the internet speed).

  4. After the firmware is cloned, run the below commands one by one in WSL2.

    1. cd PX4-Autopilot

    2. git checkout v1.16.1 -f

    3. git submodule update --init --recursive

  5. Run this command in WSL2 to verify that the required version of PX4 Firmware (v1.16.1) is cloned.

    • git describe --tags

    Confirm that the command outputs v1.16.1, which indicates you have cloned the required firmware version.

After you complete this step, return to the Hardware Setup screen and continue with the next steps.

See Also

Topics