Integration with General PX4 Architecture
The UAV Toolbox Support Package for PX4® Autopilots enables you to design controllers, estimators, and navigators in Simulink® and deploy to PX4 Autopilot boards. You can integrate the generated code from the Simulink models, with the PX4 flight stack and then deploy the same to the PX4 Autopilots.
General PX4 Architecture
The high-level software architecture of PX4 includes modules for storage, external connectivity, drivers, uORB publish-subscribe message bus, and flight stack components.
PX4 Architecture (Image courtesy: https://dev.px4.io/v1.9.0/en/concept/architecture.html)
Some of the modules and interfaces of the general PX4 architecture can be integrated with UAV Toolbox Support Package for PX4 Autopilots.
Supported Simulink Blocks That Interface with the PX4 Modules
The UAV Toolbox Support Package for PX4 Autopilots enables you to design controllers, estimators, and navigators in Simulink and deploy to PX4 Autopilot boards. You can integrate the generated code from the Simulink models, with the PX4 flight stack and then deploy the same to the PX4 Autopilots.
The support package provides interfaces for some of the components in the PX4 architecture by using Simulink blocks. You can use these blocks as input and output for the algorithms in Simulink model.
Component in PX4 Architecture | Simulink Block in the Support Package |
---|---|
Parameters | Read Parameter |
uORB Message Bus | |
RC Input | Radio Control Transmitter |
Sensors Hub | |
GPS | GPS |
Position & Attitude Estimator | |
Output Driver | |
External serial communication | |
I2C communication | |
CAN communication | |
Time stamp |
Supported Modules That Can Be Replaced with User-Defined Algorithms
You can replace the Position Controller
and Attitude
& Rate Controller
modules in the general PX4 architecture with user-defined Controller algorithms that you develop
using UAV Toolbox Support Package for PX4 Autopilots.
User-Defined Algorithms in Simulink as a PX4 Module
Embedded Coder® allows you to generate code for the algorithms designed in your Simulink model. The UAV Toolbox Support Package for PX4 Autopilots integrates the generated code as a new module called px4_simulink_app in the PX4 Firmware. This new module from Simulink is also added the CMake build configuration for the desired hardware so that the module is compiled and integrated with the PX4 executable when the PX4 Firmware is built for the corresponding CMake build configuration. This module is added to the PX4 startup scripts also so that it is started automatically after the Autopilots boots up. For more information on PX4 startup scripts and how they are managed in the UAV Toolbox Support Package for PX4 Autopilots, see Load and Start Modules on PX4 Autopilot After Boot-Up.
See Also
Custom Startup Script in UAV Toolbox Support Package for PX4 Autopilots | Impact of Disabling MAVLink, Commander, and Navigator Modules