Main Content

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)

px4 architecture

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 ArchitectureSimulink Block in the Support Package
ParametersRead Parameter
uORB Message Bus

PX4 uORB Read

PX4 uORB Write

PX4 uORB Message

RC InputRadio Control Transmitter
Sensors Hub

Vehicle Attitude

Accelerometer

Magnetometer

Gyroscope

GPSGPS
Position & Attitude Estimator

Vehicle Attitude

Output Driver

PX4 PWM Output

External serial communication

Serial Receive

Serial Transmit

I2C communication

I2C Controller Read

I2C Controller Write

CAN communication

PX4 CAN Receive

PX4 CAN Transmit

Time stamp

PX4 Timestamp

px4 modules

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.

px4 modules

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

|