PerformingPX4System 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 usingUAV 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 optionDesign Flight Controller Algorithm in Simulinkin theSelect 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 toQGroundControl documentationfor 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 installUAV 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'))
Copy the file
rc.txt
.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 therc.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, therc.txt
文件的微型sd卡插槽开始一个定制的达成ication calledpx4_simulink_app
,交货ecutes the code generated through the deployed Simulink model. Thepx4_simulink_app
is located underFirmware\src\modules
(theFirmware
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.