This section explains the task to be completed as part of the
Customize PX4 System Startup—of the Hardware Setup
process (using the Hardware Setup screens). Do not perform this as a standalone
When you deploy custom flight controller algorithms developed using Embedded Coder® 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.
This step is required to be performed only once for the micro-SD card that is mounted on the Pixhawk® Series flight controllers.
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
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:
After you install Embedded Coder Support Package for
PX4 Autopilots, go to the
lib\etc folder under the Support
Package Root folder.
You can run the following command at the MATLAB command prompt to go to the specified folder:
Copy the file
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.
Create a root-level folder named
etc in the micro-SD card,
and paste the
rc.txt file to this new folder.
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
px4_simulink_app, which executes the code
generated through the deployed Simulink model. The
is located under
Firmware directory was created as part of PX4 Sourcecode download
After you complete this step, go back to the Hardware Setup screen again and continue with the next step.