Main Content

Performing PX4 System Startup from SD Card

Note

This section explains the task to be completed as part of the step—Customize PX4 System Startup—of the Hardware Setup process (using the Hardware Setup screens). Do not perform this as a standalone task.

When you deploy custom flight controller algorithms developed using UAV Toolbox Support Package for PX4® Autopilots, you need to suppress the execution of some of the default startup processes and run the application generated by Simulink®. This is done by using a start-up script, which is copied to the micro-SD card to be mounted on the Pixhawk® Series flight controllers.

Note

This step is required to be performed only once for the micro-SD card that is mounted on the Pixhawk Series flight controllers.

Note

This step is required to be performed only if you selected the option Design Flight Controller Algorithm in Simulink in the Select Application in Simulink screen of the Hardware Setup process.

Note

Before customizing the PX4 system startup, ensure that the Pixhawk Series flight controller is flashed with PX4 firmware. If you were using ArduPilot firmware before, or if you are not sure about the current firmware type and version of the flight controller (for example, if it is a new Pixhawk flight controller board), flash the latest stable release of the PX4 firmware, using QGroundControl. Refer to QGroundControl documentation for more details on uploading the PX4 firmware. This action needs to be done only once, for a specific board.

To enable Simulink-specific startup sequence from micro-SD card:

  1. After you install UAV Toolbox Support Package for PX4 Autopilots, go to the lib\etc folder under the Support Package Root folder.

    Tip

    You can run the following command at the MATLAB® command prompt to go to the specified folder:

    cd (fullfile(codertarget.pixhawk.internal.getSpPkgRootDir,'lib','etc'))

  2. Copy the file rc.txt.

  3. Connect a micro-SD card to the host computer using the micro-SD card slot on the host computer or by using an external card reader.

  4. Create a root-level folder named etc in the micro-SD card, and paste the rc.txt file to this new folder.

  5. Remove the micro-SD card from the host computer, and insert the same in the Pixhawk Series flight controller that you will be using to deploy the Simulink code.

Whenever you start the Pixhawk Series flight controller with a Simulink model deployed in it, the rc.txt file on the micro-SD card starts a customized application called px4_simulink_app, which executes the code generated through the deployed Simulink model. The px4_simulink_app is located under Firmware\src\modules (the Firmware directory was created as part of PX4 Sourcecode download step).

After you complete this step, go back to the Hardware Setup screen again and continue with the next step.

Related Topics