Main Content

PX4 Actuator Write

Set actuator values for motors and servos

Since R2024b

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

Libraries:
UAV Toolbox Support Package for PX4 Autopilots / PX4 Peripheral Blocks

Description

The PX4 Actuator Write block writes motor and servo actuator values over the PWM and UAVCAN interfaces. The PX4 Actuator Write block accepts single scalar values between -1 to 1 as input and writes those values to the selected motors or servos using ActuatorTest uORB topic.

An input value of 1 indicates maximum output, a value of 0 centers the servos or sets the motors to their lowest possible thrust, and an input of -1 indicates the maximum output but in the reverse direction. However, for motors that do not support reverse operation, any value less than zero stops the motor.

Setting the Arm input to true value arms the actuators, while false serves as a kill switch and disarms the actuators.

Configure Actuators

For firmware version 1.14, you must configure the PWM & AUX pins in QGroundControl before using the PX4 Actuator Write block in Simulink. To configure the pins, you must use QGroundControl version 4.3.0, which can be downloaded from this location. For information on configuring the actuators, see Configure and Assign Actuators in QGC.

Examples

Ports

Input

expand all

Enable signal for arming the flight actuators.

A value of 0 indicates that the flight actuator is not armed, whereas a value of 1 indicates that the flight actuator is armed.

Data Types: Boolean

Connect the Motor x inputs to signals that represent single scalar values.

If you provide an input greater than 1 or less than -1, the block internally clips it to 1 and -1, respectively.

Dependencies

To enable these ports, select the required number of motors (1-12) from the Motors parameter.

Data Types: single

Connect the Servo x inputs to signals that represent single scalar values.

If you provide an input greater than 1 or less than -1, the block internally clips it to 1 and -1, respectively.

Dependencies

To enable these ports, select the required number of servos (1-8) from the Servos parameter.

Data Types: single

Connect the Motor Values inputs to signals that represent values as an array.

An input value of 1 indicates maximum output, a value of 0 sets the motors to their lowest possible thrust, and an input of -1 stops the motor.

Dependencies

To enable this port, select Input Motor Values as an array parameter.

Data Types: single

Connect the Servo Values inputs to signals that represent values as an array.

An input value of 1 indicates maximum output, a value of 0 centers the servos, and an input of -1 indicates the maximum output in the reverse direction.

Dependencies

To enable this port, select Input Servo Values as an array parameter.

Data Types: single

Parameters

expand all

Motors tab

Select the motor numbers to which you want to send the single scalar values. The number of Motor input ports on the block depends on the number of motors you select in this parameter.

Select this parameter to enable the Motor Values input port.

You can input the motor values as an array of size 1-by-12.

Servos tab

Select the servo numbers to which you want to send the single scalar values. The number of Servo input ports on the block depends on the number of servos you select in this parameter.

Select this parameter to enable the Servo Values input port.

You can input the servo values as an array of size 1-by-8.

Version History

Introduced in R2024b