主要内容

Write Parameter

R2026b

Write parameter value to ArduPilot

Since R2026b

  • Write Parameter block

Libraries:
UAV Toolbox Support Package for ArduPilot Autopilots / Utility Blocks

Description

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

The Write Parameter block writes a value to a specified ArduPilot® parameter. The block casts the input value to data type single, a 32-bit floating-point type with up to 24 bits of mantissa precision, before transmitting the value.

Specify the ArduPilot parameter name such as RC1_TRIM in the Parameter name field. The parameter value configured in ArduPilot must be within the minimum and maximum range defined in the official ArduPilot parameter reference documentation. Values outside this range can cause unexpected behavior.

Note

Some ArduPilot parameters use integer data types internally. For example, RC1_TRIM is an int16 parameter. The Write Parameter block casts the input value to single before transmitting it to ArduPilot. When ArduPilotapplies the transmitted value to an integer parameter, ArduPilot truncates the value according to that parameter’s internal data type. To inspect the value that the block writes by using a Display block, set the Numeric display format parameter to long.

Examples

Ports

Input

expand all

The port accepts the value to write to the specified ArduPilot parameter. The input must be a scalar single-precision value.

Data Types: single

Output

expand all

The port outputs the status of the write operation as one of these values:

  • 0 — Successful write operation

  • 1 — Invalid parameter name, or the selected vehicle does not support the specified parameter

Dependencies

To enable this port, select the Output status parameter.

Data Types: uint8

Parameters

expand all

Specify the name of the ArduPilot parameter to write for the selected ArduPilot target. To view the complete list of the parameters that control vehicle behavior, click View ArduPilot Parameters in the block parameters, or see Complete Parameter List in the ArduPilot documentation. Some ArduPilot parameters require a hardware reboot for updated values to take effect. After writing to those parameters, restart the hardware board to apply the changes.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

Parameter: ParameterName
Values: RC1_TRIM (default) | valid ArduPilot parameter name
Data Types: char | string

Select this parameter to enable the Status port, which outputs the write operation status.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

Parameter: OutputStatus
Values: off | on
Data Types: char | string

Version History

Introduced in R2026b

See Also

Blocks