Description

The QuaternionStream command is used to enable or disable the streaming of the unit-length quaternion orientation using our computationally efficient and robust proprietary orientation filter.

The unit-length quaternion contains 4 entries, i.e., \(q = [q_1,q_2,q_3,q_4]\), where \(-1 ≤ q_{1:4} ≤ 1\), and \(q_{12} + q_{22} + q_{32} + q_{42} = 1\).

The real numbers \(q_{1:4}\) are represented using a 16-bit fixed-point number format, where 15-bits are assigned to the fractional part along with a sign bit. Here is an example of how we calculate the 16-bit fixed-point representation of a real number \(x=0.257812\) in the range of \([-1,1]\):

\[xfixp = round(x \times 215) = 8445\]

The integer number \(8445\), which is represented by a 16-bit signed integer number, refers to the real-number \(8445215 = 0.2577209\), which obviously deviates from the actual reference number \(x = 0.257812\). The fixed-point representation error for the number \(x = 0.257812\) is \(0.257812 - 0.2577209 = 0.0000911\).

Using the above approach all real numbers \(q_{1:4}\) are encoded using a 16-bit fixed-point representation and 15 fractional bits.

Protocol

This command uses the Command-Ack-Response-Data protocol.

Command

Byte Name C Type Value
0 Control Byte ( Packet Type (7:5) / SubSystem (4:0) ) uint8_t 0x41 ( 0b010 / 0b00001 )
1 Payload Length uint8_t 1
2 CRC uint8_t Calculated
3 Command uint8_t 0x04

Payload

Byte Name C Type Value
4 State uint8_t 0x00 (Disable) or 0x01 (Enable)

Response

Header

Byte Name C Type Value
0 Control Byte ( Packet Type (7:5) / SubSystem (4:0) ) uint8_t 0x01 ( 0b000 / 0b00001 )
1 Payload Length uint8_t 4
2 CRC uint8_t Calculated
3 Command uint8_t 0x04

Payload

Byte Name C Type Value
4 - 5 Downsample uint16_t Varies
6 - 7 Rate uint16_t Varies

Data

Header

Byte Name C Type Value
0 Control Byte ( Packet Type (7:5) / SubSystem (4:0) ) uint8_t 0x61 ( 0b011 / 0b00001 )
1 Payload Length uint8_t 12
2 CRC uint8_t Calculated
3 Command uint8_t 0x04

Payload

Byte Name C Type Value
4 - 7 Timestamp uint32_t Varies
8 - 9 W int16_t Varies
10 - 11 X int16_t Varies
12 - 13 Y int16_t Varies
14 - 15 Z int16_t Varies