Changes

no edit summary
Line 107: Line 107:     
The sum of these products is 1,137, the checksum value.
 
The sum of these products is 1,137, the checksum value.
 +
 +
== Operation ==
 +
The following operations are defined by STINGR Gesture Specification I -- for legacy operations defined by STINGR Gesture Specification I, visit its page.
 +
STINGR has a specific control flow that must be strictly followed to ensure proper operation. Luckily, most of this is handled within the STINGR internal code. It is described here in full detail, however, for posterity, debugging purposes, and for context in the following section, which enumerates specific methods and their purposes/parameters.
 +
 +
=== Initialization ===
 +
Each board using STINGR must initialize the suite in order to properly utilize it. This initialization routine allows proper communication between boards in the stack, as well as gives vital information to each board about the actual structure of the stack, which isn't formally known unless hardcoded (a poor choice).
 +
 +
When a board initializes STINGR, it must provide its unique identifier. Once STINGR obtains the unique identifier of a board, it will send a broadcast gesture on the CAN Bus -- this signal has a destination identifier of 256 -- that is, it is sent to all boards in the flight stack. This is the first gesture sent out by a board, and its definition is as follows:
 +
 +
{| class="wikitable"
 +
| style="background-color: #4CC9FF;"|
 +
Type -- 1 (Response)
 +
| style="background-color: #8AFFDF;"|
 +
State Flags -- 0 (no flags)
 +
| style="background-color: #FFA6CE;"|
 +
Source Identifier (8 bit)
 +
| style="background-color: #EDFF7A;"|
 +
Destination Identifier -- 256 (broadcast)
 +
| style="background-color: #AD6DF9;"|
 +
Data -- '/1/0' (empty payload)
 +
| style="background-color: #C25959;"|
 +
Checksum (8 byte)
 +
|}
 +
 +
This particular gesture definition is reserved, and is known as the ''beacon gesture''. It is defined by a strict Type of 1, 0 State Flags, a unique source identifier, a broadcast destination identifier, an empty payload, and a checksum.
 +
 +
The beacon gesture indicates to all boards in the flight stack the presence and identity of a given board. Since all identifiers are enumerated within the STINGR source code, a beacon gesture allows any board to identify what boards are in the stack. Hence, if, for example, Macaw were to send a beacon gesture, with its identifier of 00000010, all boards would receive this gesture, correlate the identifier to that of Macaw, and consequently be aware of the presence of Macaw in the flight stack.
 +
 +
Once a board in the flight stack has sent its beacon gesture, it is now ''live'', and other boards are allowed to send it messages using STINGR.  By means of each board in the flight stack sending out a beacon gesture, all boards will be aware of the full definition of the flight stack.
 +
 +
=== Standard Mode ===
 +
Once STINGR passes initialization, it enters ''Standard Mode''. In Standard Mode, a board is able to send and receive gestures via the CAN Bus through STINGR. A board may send a message as frequently or infrequently as desired in Standard Mode. The other defining characteristic of Standard Mode is that, in Standard Mode, STINGR will transmit the beacon gesture every 60 seconds. This is known as the heartbeat gesture, and allows boards in the stack to continue to acknowledge the presence of a board, as well as register a boards presence if they hadn't already registered it.
 +
 +
=== Silent Mode ===
 +
Silent Mode can be triggered by the ''Silence Gesture'', a gesture reserved for the avionics board. Silent Mode can be triggered for a specific board in the flight stack, or for the entirety of the flight stack.
 +
 +
To put a board into Silent Mode, the avionics transmits a reserved gesture that has a payload of '/0'. The Avionics can request a specific board to enter silent mode by specifying a destination identifier, or it can request all boards to enter silent mode by using the broadcast identifier.
 +
 +
Silence Gesture:
 +
{| class="wikitable"
 +
| style="background-color: #4CC9FF;"|
 +
Type -- 0 (Request)
 +
| style="background-color: #8AFFDF;"|
 +
State Flags -- 0 (no flags)
 +
| style="background-color: #FFA6CE;"|
 +
Source Identifier (avionics identifier)
 +
| style="background-color: #EDFF7A;"|
 +
Destination Identifier
 +
| style="background-color: #AD6DF9;"|
 +
Data -- '/1/0/0' (payload is '/0')
 +
| style="background-color: #C25959;"|
 +
Checksum (8 byte)
 +
|}
 +
There is, additionally, a gesture to reverse this, and put a board back into Standard Mode -- this is the ''Unsilence Gesture'', which is identical to the Silence Gesture, except the payload is '/1', as shown below.
 +
Unsilence Gesture:
 +
{| class="wikitable"
 +
| style="background-color: #4CC9FF;"|
 +
Type -- 0 (Request)
 +
| style="background-color: #8AFFDF;"|
 +
State Flags -- 0 (no flags)
 +
| style="background-color: #FFA6CE;"|
 +
Source Identifier (avionics identifier)
 +
| style="background-color: #EDFF7A;"|
 +
Destination Identifier
 +
| style="background-color: #AD6DF9;"|
 +
Data -- '/1/1/0' (payload is '/1')
 +
| style="background-color: #C25959;"|
 +
Checksum (8 byte)
 +
|}