Main Content

Migrating from Pixhawk Pilot Support Package toUAV Toolbox Support Package forPX4Autopilots

Till R2018a, MathWorks provided support for the Pixhawk Pilot Support Package that has been used for developing Simulink models for the Pixhawk FMU using the PX4 toolchain. From R2018b, the official hardware support packages –Embedded Coder®Support Package for PX4®Autopilots(till R2020a) andUAV Toolbox Support Package for PX4 Autopilots(from R2020b) – are available for download.

After you downloadUAV Toolbox Support Package for PX4 Autopilots, you can migrate Simulink models that you developed using Pixhawk Pilot Support Package to the new support package.

Note

TheUAV Toolbox Support Package for PX4 Autopilotscontains blocks that are not backward compatible with the blocks of the Pixhawk Pilot Support Package. However, you can replace the blocks in older models with the newer blocks and deploy the model usingUAV Toolbox Support Package for PX4 Autopilots.

Note

Before proceeding with the migration procedure, it is highly recommended that you take a backup of the existing Simulink model that you created using Pixhawk PSP.

The migration process involves the following steps:

  1. Complete the setup and configuration activities ofUAV Toolbox Support Package for PX4 Autopilotsusing the Hardware Setup screens (seeSetup and Configuration).

    新的支持包支持P金宝appX4固件更小ion 1.10.2 whereas the Pixhawk PSP supports PX4 firmware version 1.6.5. Therefore, you also need to clone PX4 firmware v1.10.2 by following the steps mentioned in the Hardware Setup screens.

  2. Launch Simulink and create a new model.

  3. Open the Configuration Parameters dialog box and select the hardware (go to theHardware Implementationpane and use theHardware boarddrop-down list to select the Pixhawk board that you will be using to deploy the Simulink model). The new support package provides support for Pixhawk 1, Pixhawk 2.1, Pixracer, and Pixhawk 4 flight controllers.

    If you are using a board that is not officially supported, select thePX4 Pixhawk Seriesoption.

  4. Copy the contents of the entire Simulink model from Pixhawk PSP to the new Simulink model that you created.

  5. Replace the Simulink blocks for Pixhawk Pilot Support Package with the new Simulink blocks that are available in the new support package.

    Use the following table to migrate the Simulink blocks to the newUAV Toolbox Support Package for PX4 Autopilots, in R2018b and later releases.

    Mapping of Simulink blocks in Pixhawk Pilot Support Package toUAV Toolbox Support Package forPX4Autopilots

    Pixhawk Pilot Support Package Block New Block inUAV Toolbox Support Package for PX4 Autopilots Documentation Links
    uORB Write / uORB Write Advanced

    PX4 uORB Write and PX4 uORB Message

    PX4 uORB WriteandPX4 uORB Message
    uORB Read

    PX4 uORB Read

    PX4 uORB Read
    Read uORB Function Trigger

    ADC

    PX4 Analog Input

    PX4 Analog Input
    Serial

    Serial Transmit and Serial Receive

    Serial TransmitandSerial Receive
    PWM

    PX4 PWM Output

    PX4 PWM Output
    ParamUpdate

    Read Parameter

    Read Parameter
    Sensor_Combined

    Accelerometer

    Gyroscope

    Magnetometer

    Accelerometer

    Gyroscope

    Magnetometer

    Input_RC

    Radio Control Transmitter

    Radio Control Transmitter
    Speaker Tune

    This block can be modelled using uORB Write block and tune_control uORB topic. Refer topx4demo_LEDBuzzerSimulink model.
    LED

    This block can be modelled using uORB Write block and led_control uORB topic. Refer topx4demo_LEDBuzzerSimulink model.
    Battery

    Battery

    Battery
    Vehicle Attitude

    Vehicle Attitude

    Vehicle Attitude
    Vehicle GPS

    This block can be modelled using uORB Read block and vehicle_gps uORB topic. Refer topx4_readGPSSimulink model. Reading GPS Data from PX4 Autopilot
    Binary Logger

    Refer topx4_SDCard_loggingSimulink model.
    打印