Table of Contents
Multiwii Read Boxes
Reads the box items. Each word in the output array is a bitmask of activation switches.
Library
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
The Multiwii Read Boxes block uses the Multiwii protocol on the input stream to send a command to the aircraft to
read the box items from the auto-pilot. The Multiwii Read Boxes block sends a MSP_BOX
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 output of the block is a variable-sized vector of uint16 bitmasks indicating the activation switches for each box. The bitmask contains the low, mid and high state of the AUX1, AUX2, AUX3 and AUX4 activation switches according to the following table:
Bit | Description |
---|---|
0 | AUX1 LOW state |
1 | AUX1 MID state |
2 | AUX1 HIGH state |
3 | AUX2 LOW state |
4 | AUX2 MID state |
5 | AUX2 HIGH state |
6 | AUX3 LOW state |
7 | AUX3 MID state |
8 | AUX3 HIGH state |
9 | AUX4 LOW state |
10 | AUX4 MID state |
11 | AUX4 HIGH state |
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
Although it is intended for use in the main diagram with the other Multiwii blocks, the Multiwii Read Boxes 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 Boxes 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.
mask
A variable-sized vector containing uint16 bitmask values. The bits in the mask correspond to the LOW, MID and HIGH states of the AUX1, AUX2, AUX3 and AUX4 activation switches respectively.
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
The Multiwii Read Boxes block has no parameters.
Targets
Target Name |
Compatible* |
Model Referencing |
Comments |
---|---|---|---|
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
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 |
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.