Main Content


Create custom uORB topic for logging in a Simulink model

Since R2023b

    Add-On Required: This feature requires the UAV Toolbox Support Package for PX4 Autopilots add-on.



    createPX4uORBMessage(messageName,uORB fields) creates a custom uORB topic for logging in a Simulink® model running on a Pixhawk® hardware board.

    A custom uORB message refers to a user-defined message format in the uORB (micro Object Request Broker) messaging system. uORB is a publish-subscribe messaging system used in the PX4 autopilot software for communication between different modules and components.


    collapse all

    Create a new custom uORB message MyCustomMessage, with the required datatype and corresponding signal names

    This example shows the functioning of the API with the changes that are being made in the Firmware.

    To do this, enter the following command at the MATLAB® command prompt after the model has successfully run on the hardware:

    createPX4uORBMessage('MyCustomMessage', 'float32 x', 'float64 y')

    This creates a new message MyCustomMessage.msg with the mentioned fields x and y, with their datatype. Then, the message is included in the specified directory, C:\PX4\home\Firmware\msg\

    custom message

    It also updates the CMakeLists.txt with the newly created message as shown below.


    To use this custom uORB message, build the PX4 firmware using the Hardware Setup Screen. 

    Input Arguments

    collapse all

    Name of the message that you want to create. Message name must be a unique name that has not been used before in your project.

    Data Types: char | string

    Varargin input containing information about the required signals with their corresponding data types and signal names as mandatory inputs.

    Data Types: char | string

    Version History

    Introduced in R2023b