Multiwii Names Multiwii Read Boxes navigation bar

Table of Contents

Multiwii Read Actuators

Reads the commands for the servos or motors from the auto-pilot.

Library

QUARC Targets/Communications/Multiwii

Description

Multiwii Read Actuators

The Multiwii Read Actuators block uses the Multiwii protocol on the input stream to send a command to the aircraft to read the servo or motor values from the auto-pilot. The Multiwii Read Actuators block sends a MSP_SERVO or MSP_MOTOR message respectively 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 output of the block is a variable-sized vector. The units depend on the Output units parameter. The order of the actuators depends on the auto-pilot.

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 Read Actuators 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 Read Actuators block will be zero.

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.

val

This output depends on the Output units parameter. Each element of the output vector corresponds to a separate actuator. However the data type and range changes depending on the output units. Refer to the Output units parameter for details.

The output is a variable-sized vector. The order depends on the auto-pilot.

err

An int32 value indicating whether the data was read successfully. This value will be positive if data was read successfully. It will be zero if data could not be read immediately. 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 Read Actuators

Type

Select whether the servos or motors will be read.

Output units

This parameter determines the data type and units of the val output. The table below shows the output for each of the different units:

Units

Data Type

Description

Bipolar percentage

double

Each element maps the typical [1000,2000] range to [-1,1] such that 1000 becomes -1, 1500 becomes 0 and 2000 becomes 1. Any values outside this range are mapped according to the same affine transformation. These units are useful when the RC data represent -100% to 100% throttle.

Unipolar percentage

double

Each element maps the typical [1000,2000] range to [0,1] such that 1000 becomes 0 and 2000 becomes 1. Any values outside this range are mapped according to the same affine transformation. These units are useful when the RC data represent 0 to 100% throttle.

Seconds

double

Each element maps the typical [1000,2000] range to [0.001,0.002] such that 1000 becomes 0.001 and 2000 becomes 0.002 so that the output is the RC pulse width in seconds. Any values outside this range are mapped according to the same affine transformation. These units are useful when the RC data are being used to drive PWM pulse widths via the HIL blocks.

Microseconds (raw)

uint16

Each element is the raw RC value, which is the RC pulse width in microseconds.

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