Table of Contents
Multiwii Read Miscellaneous
Reads miscellaneous information from the auto-pilot, such as thresholds, triggers and counters.
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 Miscellaneous block uses the Multiwii protocol on the input stream to send a command to the aircraft to
read miscellaneous information from the auto-pilot, including thresholds, triggers and counters. The
Multiwii Read Miscellaneous block sends a MSP_MISC
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 outputs of the block are the internal power trigger level, throttle thresholds, arm counter and lifetime, magnetic declination, battery voltage scale factor and battery thresholds.
The throttle thresholds are output as a 4-vector containing the minimum throttle, maximum throttle, minimum command and failsafe threshold for the throttle respectively. The minimum and maximum throttle values are the minimum and maximum throttle values that may be sent to the motor (ESC) when they are armed. Defaults of 0.15 and 0.85 respectively are reasonable values for all ESCs. For the AfroESC, the values can be set to 0.064 and 0.864 respectively. The minimum command is the value sent to the ESCs when they are not armed. If the ESCs beep slowly when powered up, try decreasing this value. It can also be used for calibrating all ESCs at once.
The battery voltage scale should be adjusted slightly if the reported battery pack voltage is different from a multimeter reading. The current voltage is available from the Multiwii Analog block.
The battery thresholds are output as a 3-vector containing the warning level 1, warning level 2 and critical levels respectively. The units are Volts.
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 Miscellaneous 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 Miscellaneous 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.
pwr
An integer scalar (uint16) representing the internal power trigger.
thr
A 4-vector of doubles containing the minimum throttle, maximum throttle, minimum command (throttle at the lowest position), and failsafe threshold for the throttle respectively. The values are denoted as percentages between 0 and 1.
arm
An integer scalar (uint16) representing the arm counter.
life
An integer scalar (uint32) representing the lifetime.
mag
A scalar representing the magnetic declination in radians.
scale
An integer scalar (uint8) representing the battery voltage scale factor.
level
A 3-vector of doubles containing the warning level 1, warning level 2 and critical voltage levels for the battery respectively. The units are Volts.
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 Miscellaneous 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.