Multiwii Write RC Tuning Multiwii Write Waypoint navigation bar

Table of Contents

Multiwii Write Servo Configuration

Writes the servo configuration to the auto-pilot.

Library

QUARC Targets/Communications/Multiwii

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

qc_open_library('quarc_library/Communications/Multiwii')

Description

Multiwii Write Servo Configuration

The Multiwii Write Servo Configuration block uses the Multiwii protocol on the input stream to send a command to the aircraft to write the servo configuration to the auto-pilot. The Multiwii Write Servo Configuration block sends a MSP_SET_SERVO_CONF message to the auto-pilot.

This block is designed to be used with blocking I/O. It is typically used with a stream connected to a serial port. To open the stream a Multiwii Connect block should be used.

The inputs to the block are the servo configuration parameters expressed as percentages. In particular, there is the minimum, maximum, middle and rate parameters. The rate parameter is interpreted as a proportional range or a direction, depending on the Treat rate as direction parameter.

A copy of the stream is also output so that the Multiwii blocks may be chained together.

If an error occurs, then the block returns a negative error code at its err output. The Compare to Error block may be used to check for specific error codes. If the stream is not valid because it is not yet connected, the err output will be zero since this condition is expected and the validity of the stream may be checked using the con output of the Multiwii Connect block.

Helpful Hints

Other uses of this block

Hint Although it is intended for use in the main diagram with the other Multiwii blocks, the Multiwii Write Servo Configuration block may be used with the Advanced stream blocks, even in an asynchronous thread.

Input Ports

stm

A reference to the stream created by the Multiwii Connect block. If a connection has not yet been established, then the err output of the Multiwii Write Servo Configuration block will be zero.

rc_rate

A double scalar representing the RC rate, as a percentage between 0 and 1.

min

A double vector representing the minimum for each RC channel, expressed as a percentage between 0 and 1. A value of 0 corresponds to a 1 ms pulse, while a value of 1 corresponds to a 2 ms pulse.

max

A double vector representing the maximum for each RC channel, expressed as a percentage between 0 and 1. A value of 0 corresponds to a 1 ms pulse, while a value of 1 corresponds to a 2 ms pulse.

mid

A double vector representing the middle for each RC channel, expressed as a percentage between 0 and 1. A value of 0 corresponds to a 1 ms pulse, while a value of 1 corresponds to a 2 ms pulse.

rate

A double vector representing the rate for each RC channel, expressed as a percentage between 0 and 1. If the Treat rate as direction option is checked, then it is treated as a direction, where 0 is the positive direction and a non-zero value means the direction is reversed.

Output Ports

stm

A reference to the stream. This output is merely a copy of the stm input. Providing this output makes it much easier to establish the execution order of Multiwii blocks in the diagram because Simulink generally executes daisy-chained blocks in sequence.

err

An int32 value indicating whether the message was sent successfully. This value will be positive if message was sent successfully. It will be zero if no message was sent. If an error occurs then this value is a negative error code. See Error Codes for the different error codes and their values. Use the Compare to Error block rather than the error code itself to check for specific error codes. To check for errors in general use the Compare to Zero block to check whether the err output is less than zero.

Parameters and Dialog Box

Multiwii Write Servo Configuration

Treat rate as direction

If this option is unchecked then the rate passed to the block is interpreted as a proportional range expressed as a percentage between 0 and 1.

If this option is checked then the rate input is considered as a direction, where zero means the positive direction and a non-zero value means the reverse direction.

Write only when the input changes

Check this option to have the block only write a new servo configuration when the input changes. If this option is not checked then the block will write a new servo configuration every time it executes.

This option makes it easier to use the block, since it typically makes a

Triggered Subsystem

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

doc('simulink/triggeredsubsystem')
unnecessary when the option is checked.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar