After installing the RflySim platform, you can open the MATLAB/Simulink software and find the Pixhawk Pilot Support Package toolbox in the Simulink Library Browser, as shown in the following image.
For more detailed information, please refer to:
An Introduction to Automatic Code Generation Using RflySim and Simulink。
RflySim：A Toolchain For The Development, Testing, And Evaluation Of An Unmanned Aerial System (UAS) Based On PX4
Allow reading and writing to devices, with the option to specify the device name and read or write preferences.
You can record data vectors to a file on an SD card. If caching in memory is enabled, data is written to the file when ‘en’ goes low or when the specified maximum record count is reached. Otherwise, the ‘maximum record count’ is used to indicate when an ‘fflush’ operation to the file should be executed.
Show an example module that uses the ‘printf’ function with ‘coder.ceval’.
Update custom PX4 software parameters.
Through this module, real-time data about the battery can be obtained. It is achieved by subscribing to the uORB topic ‘battery_status,’ so it’s essential to ensure that a power module is connected to the Pixhawk to obtain accurate data during actual operation.
This module allows you to select the number of channels to receive from the remote control and other information. The meaning of each option can be found by clicking the ‘help’ button in the dialog box or by referring to the official PDF documentation.
Through this module, PWM signals can be sent to the output ports of PX4IO to control motor rotation. You can choose the PWM update rate and input channels.
This module allows you to control the mode and color of LED light flashes. As shown below, the module receives two inputs: ‘Mode’ and ‘Color.’ Available modes and colors can be found by clicking the ‘help’ button in the dialog box.
Through this module, you can obtain available sensor data in the Pixhawk, which can be used for model design. The data that can be acquired includes magnetometer, accelerometer, gyroscope, barometer, and timestamp.
This module allows you to control the buzzer to emit specific tones for particular events.
This module provides filtered attitude data (Euler angles and quaternions). You can select the desired attitude data for output through checkboxes.
Through this module, you can obtain GPS data from Pixhawk. This is achieved by subscribing to the uORB topic ‘vehicle_gps,’ so it’s important to ensure that a GPS module is connected to the Pixhawk to obtain accurate data during actual operation."
Obtaining Data Related to uORB Topics
This block operates in two modes. Mode 1: Reading uORB data, in which the block uses the uORB_CHECK() call to retrieve data and writes it into a structure. This structure is accessed as a bus object. The buttons below allow the creation of bus objects for any uORB message, provided that the message is specified in .msg format. The header file is added to the generated code in C:\px4\Firmware\src\modules\uORB\topics. Mode 2: Asynchronous task, in which the block generates a data-driven thread. When uORB messages for the specified topics arrive, the thread continues execution and runs the associated function call subsystem.
This interface allows users to publish specified values or structures to uORB topics.
This interface permits users to have more flexible control over the data they publish. Using the uORB Write Advanced interface in Simulink enables more complex and precise message publishing. You can choose the message file to write to and specify a message ID. Additionally, advanced options such as message priority and queue size can be set.
Advanced uORB Message Data Publishing Interface Module with Custom uORB MsgID Functionality.
For more detailed information, please visit https://doc.rflysim.com . The basic and advanced trial versions of RflySim can be obtained by providing your email address through the download link at https://rflysim.com/download . For the full-featured complete version, please inquire at firstname.lastname@example.org .