Prepare Model for Simulation and Deployment
After you configure the Simulink model by including the necessaryTo Workspace
blocks, you need to complete the prerequisites for simulation and deployment.
Use px4PrepareModelForMATFileLogging to Optimize Memory
Thepx4PrepareModelForMATFileLogging
function needs to be run in the MATLAB command prompt to optimize the memory. The function checks theLimit data points to lastparameter in the variousTo Workspace
blocks and adjusts its value for memory optimization.
You can use thepx4PrepareModelForMATFileLogging
function by specifying the model name either as character or string:
-
px4PrepareModelForMATFileLogging(bdroot)
-
px4PrepareModelForMATFileLogging('modelname')
Here,
modelname
is the file name of the Simulink model.
After you run this function, a dialog box opens requesting your permission to fix the values for memory optimization. ClickFix itto optimize the memory.
After you clickFix it, the value forLimit data points to lastcorresponding to all 'To Workspace' blocks is changed.
It is recommended that you run the functionpx4PrepareModelForMATFileLogging
every time you make changes in the model.
Enable MAVLink
MAVLink needs to be enabled to retrieve the log files from SD card inserted on the Pixhawk hardware board (for details about retrieving files, seegetMATFilesFromPixhawk
). To enable MAVLink, open the Configuration Parameters dialog box, go toHardware Implementation>Target hardware resources>MAVLink, and selectEnable MAVLink on /dev/ttyACM0.