Skip to content

Data & Frames

Basic Operation

Each OSCP-MK2 IMU is easy to operate. The unit will start performing 11-DoF measurements and transmit Operating Frames on the output interface, with no additional configuration required after power-up.

The IMU can operate in 3 different Operating Modes: Idle (I), Low (L), Medium (M) Speed. Each mode is described in the table below; these figures are identical across the MK2 family.

Table: Details of the MK2 IMU Family Operating Modes
Features Idle Low Medium
Startup Frame Length 40 bytes
Raw Operating Frame Length 61 bytes
Euler (AHRS) Operating Frame Length 25 bytes
Quaternion (AHRS) Operating Frame Length 29 bytes
Rot. Matrix (AHRS) Operating Frame Length 49 bytes
GNSS Operating Frame Length 64 bytes
Debug (User Configuration) Frames 1 & 2 Length 58 bytes
Raw Operating Frame Output Data Rate 0 Hz 100 Hz 500 Hz
AHRS Operating Frame Output Data Rate 0 Hz 100 Hz
GNSS Operating Frame Output Data Rate 0 Hz 1 Hz
Gyroscope Update Data Rate 10 Hz 100 Hz 500 Hz
Accelerometer Update Data Rate 10 Hz 100 Hz 500 Hz
Magnetometer Update Data Rate 10 Hz 100 Hz 100 Hz
Inclinometer Update Data Rate 10 Hz 100 Hz 500 Hz
Temperature Update Data Rate 4 Hz
GNSS Update Data Rate 1 Hz

Output Protocol Specifications

The unit is available in two hardware configurations, supporting either RS422 or CAN-FD as the output protocol, referred to as variants. This is independent of the MK2M2 / MK2E2 model — each model is offered in both variants.

The RS422 interface operates at 921600 baud, 8 data bits, no parity, 1 stop bit (8N1).

COBS Decoding & Encoding for the RS422 Variant

All communication with the IMU in the RS422 variant uses COBS (Consistent Overhead Byte Stuffing) encoding. It is mandatory to use this encoding for any data exchanged with the unit. This is not the case for the CAN-FD variant.

Please refer to RS422 Frame Decoding & Encoding — COBS below for decoding and encoding details, including guidance for C-based and Python-based platforms.

The CAN-FD (Flexible Data-Rate) variant offers the following specifications:

  • Arbitration bitrate: 1 Mbps
  • Data bitrate: 1 Mbps
  • Sample-point: 0.96
  • Data sample-point: 0.52
  • Extended frame length: up to 64 bytes per frame

The following CAN identifiers are used by the IMU to exchange data:

  • CAN Message IDs: 0x6F0 to 0x6FF
    • 0x6F0: Raw Operating Frame
    • 0x6F1: Euler Angles Operating Frame
    • 0x6F2: Quaternion Operating Frame
    • 0x6F3: Rotation Matrix Operating Frame
    • 0x6F4: GNSS Operating Frame
    • 0x6F5: Debug Frame 1
    • 0x6F6: Debug Frame 2
    • 0x6F7: Startup Frame
    • 0x6FC: Command from the User
    • 0x6FD: ASCII Response from the IMU

Setup for Linux-based systems

For Linux-based systems, the can0 interface can be configured with the following:

sudo ip link set can0 up type can bitrate 1000000 sample-point 0.96 dbitrate 1000000 dsample-point 0.52 fd on

Details for CAN-FD in Python

In Python, the python-can package provides support for CAN-FD. As an example using OSCP InertialGate, the interface slcan can be used.

State Diagram

IMU State Diagram

Startup Frame

After startup, the first frame sent by the IMU is a 40-byte startup frame. It contains its current configuration, and can also be requested with a startup frame command when the IMU is in configuration state (see Get a Startup Frame). The description is given in the table below.

Table: Full Description of a Startup Frame (S - 0b111)
Byte # Description Format
0 Misalignment Correction [7:6]
Operating Mode [5:3]
Frame Type [2:0] = 0b111
See Misalignment Correction
See Operating Mode
See Frame Type
1 - 10 Mark Number — fixed depending on model ASCII
11 - 12 Unit Number 16-bit unsigned integer
13 Software Major Version 8-bit unsigned integer
14 Software Minor Version 8-bit unsigned integer
15 Software Patch Version 8-bit unsigned integer
16 Enabled Frame Types See Enabled Frame Types
17 Accelerometer Dynamic Range [7:4]
Gyroscope Dynamic Range [3:0]
See Accelerometer Dynamic Range
See Gyroscope Dynamic Range
18 Gyroscope High-Pass Filter [7:5]
Gyroscope Low-Pass Filter [4:2]
Gyroscope Filters [1:0]
See Gyroscope Filters
19 Accelerometer High-Pass Filter [7:5]
Accelerometer Low-Pass Filter [4:2]
Accelerometer Filters [1:0]
See Accelerometer Filters
20 AHRS Heading Source [7:6]
AHRS Convention [5:4]
Inclinometer Dynamic Range [3:0]
See AHRS Configuration
See AHRS Configuration
See Inclinometer Dynamic Range
21 - 24 AHRS Gain See AHRS Configuration
25 - 28 AHRS Acceleration Rejection See AHRS Configuration
29 - 32 AHRS Magnetic Rejection See AHRS Configuration
33 - 36 AHRS Recovery Trigger Period See AHRS Configuration
37 Status Byte See Status Byte
38 - 39 Cyclic Redundancy Check (CRC-16) See Integrity Verification

Operating Frames

Once start-up has been completed, the IMU enters its main operating state and sends, at a given output data rate, the sensor readings in a frame that can contain 61-byte (R), 25-byte (E), 29-byte (Q) or 49-byte (M) depending on the type of frame selected. Optionally, a GNSS frame of 64-byte (G) can be requested as well.

Two 58-byte Debug frames (D) are available to read back the current unit configuration.

Frame Type

Table: Description of available Frame Types
Frame Type Description Binary
R Raw Operating Frame 0b000
E Euler Angles Operating Frame 0b001
Q Quaternions Operating Frame 0b010
M Rotation Matrix Operating Frame 0b011
G GNSS Operating Frame 0b100
D Debug Frame 1 0b101
D Debug Frame 2 0b110
S Startup Frame 0b111

Raw Frame (R)

Table: Full Description of a Raw Operating Frame (R - 0b000)
Byte # Description Format
0 Misalignment Correction [7:6]
Operating Mode [5:3]
Frame Type [2:0] = 0b000
See Misalignment Correction
See Operating Mode
See Frame Type
1 Frame Counter See Frame Counter
2 - 9 Timestamp (ms) 64-bit unsigned integer
10 - 13 Gyroscope - x-axis (°/sec) float32
14 - 17 Gyroscope - y-axis (°/sec) float32
18 - 21 Gyroscope - z-axis (°/sec) float32
22 - 25 Accelerometer - x-axis (g) float32
26 - 29 Accelerometer - y-axis (g) float32
30 - 33 Accelerometer - z-axis (g) float32
34 - 37 Inclinometer - x-axis (mg) float32
38 - 41 Inclinometer - y-axis (mg) float32
42 - 45 Magnetometer - x-axis (μT) float32
46 - 49 Magnetometer - y-axis (μT) float32
50 - 53 Magnetometer - z-axis (μT) float32
54 - 57 IMU Temperature (°C) See IMU Temperature Data
58 Status Byte See Status Byte
59 - 60 Cyclic Redundancy Check (CRC-16) See Integrity Verification

Variant note — z-axis gyroscope source (MK2E2 only)

On the MK2E2, the gyroscope's z-axis output (bytes 18-21 above) is sourced from the unit's optical gyroscope when the measured rotation rate is below 250 °/sec. Above this threshold, the output automatically switches to the MEMS gyroscope to maintain accuracy up to the selected range. The MK2M2 have no optical gyroscope, so their z-axis output always comes from the MEMS gyroscope.

Euler Angles Frame (E)

Table: Full Description of a Euler Angles Operating Frame (E - 0b001)
Byte # Description Format
0 Misalignment Correction [7:6]
Operating Mode [5:3]
Frame Type [2:0] = 0b001
See Misalignment Correction
See Operating Mode
See Frame Type
1 Frame Counter See Frame Counter
2 - 9 Timestamp (ms) 64-bit unsigned integer
10 - 13 Euler - Roll See Euler Angles
14 - 17 Euler - Pitch See Euler Angles
18 - 21 Euler - Yaw See Euler Angles
22 Status Byte See Status Byte
23 - 24 Cyclic Redundancy Check (CRC-16) See Integrity Verification

Quaternions Frame (Q)

Table: Full Description of a Quaternions Operating Frame (Q - 0b010)
Byte # Description Format
0 Misalignment Correction [7:6]
Operating Mode [5:3]
Frame Type [2:0] = 0b010
See Misalignment Correction
See Operating Mode
See Frame Type
1 Frame Counter See Frame Counter
2 - 9 Timestamp (ms) 64-bit unsigned integer
10 - 13 Quaternion 0 - w See Quaternions
14 - 17 Quaternion 1 - x See Quaternions
18 - 21 Quaternion 2 - y See Quaternions
22 - 25 Quaternion 3 - z See Quaternions
26 Status Byte See Status Byte
27 - 28 Cyclic Redundancy Check (CRC-16) See Integrity Verification

Rotation Matrix Frame (M)

Table: Full Description of a Rotation Matrix Operating Frame (M - 0b011)
Byte # Description Format
0 Misalignment Correction [7:6]
Operating Mode [5:3]
Frame Type [2:0] = 0b011
See Misalignment Correction
See Operating Mode
See Frame Type
1 Frame Counter See Frame Counter
2 - 9 Timestamp (ms) 64-bit unsigned integer
10 - 13 Rotation Matrix M00 See Rotation Matrix
14 - 17 Rotation Matrix M01 See Rotation Matrix
18 - 21 Rotation Matrix M02 See Rotation Matrix
22 - 25 Rotation Matrix M10 See Rotation Matrix
26 - 29 Rotation Matrix M11 See Rotation Matrix
30 - 33 Rotation Matrix M12 See Rotation Matrix
34 - 37 Rotation Matrix M20 See Rotation Matrix
38 - 41 Rotation Matrix M21 See Rotation Matrix
42 - 45 Rotation Matrix M22 See Rotation Matrix
46 Status Byte See Status Byte
47 - 48 Cyclic Redundancy Check (CRC-16) See Integrity Verification

GNSS Frame (G)

Variant note — GNSS Frame availability (-G variants only)

The GNSS Operating Frame (G) is available only on -G variant units. It is being discontinued across the MK2 family in favor of the upcoming NavigationGate INS Module, which expands the OSCP product portfolio with integrated inertial-navigation capabilities, including GNSS-aided navigation and support for additional aiding sensors. For more information, contact us at info@oscp.com.

Table: Full Description of a GNSS Operating Frame (G - 0b100)
Byte # Description Format
0 Misalignment Correction [7:6]
Operating Mode [5:3]
Frame Type [2:0] = 0b100
See Misalignment Correction
See Operating Mode
See Frame Type
1 Frame Counter See Frame Counter
2 - 9 Timestamp (ms) 64-bit unsigned integer
10 GNSS Fix Type See GNSS Fix Type
11 Number of satellites used 8-bit unsigned integer
12 - 15 Longitude (°) float32
16 - 19 Latitude (°) float32
20 - 23 Height above ellipsoid (mm) 32-bit signed integer
24 - 27 Horizontal accuracy estimate (mm) 32-bit unsigned integer
28 - 31 Vertical accuracy estimate (mm) 32-bit unsigned integer
32 - 35 Velocity North (mm/sec) [NED Frame] 32-bit signed integer
36 - 39 Velocity East (mm/sec) [NED Frame] 32-bit signed integer
40 - 43 Velocity Down (mm/sec) [NED Frame] 32-bit signed integer
44 - 47 Speed Accuracy Estimate (mm/sec) 32-bit unsigned integer
48 - 51 Heading of Motion (°) [2D] float32
52 - 55 Heading Accuracy Estimate (°) float32
56 - 59 Position DOP float32
60 Last Correction Age [7:4]
RESERVED [3:2]
Invalid LLH [1]
GNSS Fix OK [0]
See GNSS Last Correction Age
-
-
-
61 Status Byte See Status Byte
62 - 63 Cyclic Redundancy Check (CRC-16) See Integrity Verification

Debug Frame (D)

The Debug Frame consists of two consecutive frames.

Table: Full Description of a Debug Frame 1 (D - 0b101)
Byte # Description Format
0 Misalignment Correction [7:6]
Operating Mode [5:3]
Frame Type [2:0] = 0b101
See Misalignment Correction
See Operating Mode
See Frame Type
1 Frame Counter See Frame Counter
2 - 5 Gyroscope X Bias — GXB See User Calibration
6 - 9 Gyroscope Y Bias — GYB See User Calibration
10 - 13 Gyroscope Z Bias — GZB See User Calibration
14 - 17 MK2E2: Optical Gyroscope Z Bias — GOB
MK2M2: RESERVED
See User Calibration
18 - 21 Accelerometer X Bias — AXB See User Calibration
22 - 25 Accelerometer Y Bias — AYB See User Calibration
26 - 29 Accelerometer Z Bias — AZB See User Calibration
30 - 33 Inclinometer X Bias — IXB See User Calibration
34 - 37 Inclinometer Y Bias — IYB See User Calibration
38 - 41 Magnetometer X Hard Iron — MXB See User Calibration
42 - 45 Magnetometer Y Hard Iron — MYB See User Calibration
46 - 49 Magnetometer Z Hard Iron — MZB See User Calibration
50 Gyroscope High-Pass Filter [7:5]
Gyroscope Low-Pass Filter [4:2]
Gyroscope Filters [1:0]
See Gyroscope Filters
51 Accelerometer High-Pass Filter [7:5]
Accelerometer Low-Pass Filter [4:2]
Accelerometer Filters [1:0]
See Accelerometer Filters
52 - 54 RESERVED -
55 Status Byte See Status Byte
56 - 57 Cyclic Redundancy Check (CRC-16) See Integrity Verification

Variant note — GOB register (MK2E2 only)

Bytes 14-17 of Debug Frame 1 carry the Optical Gyroscope Z Bias (GOB) register on the MK2E2 only, since it's the only model with an optical gyroscope. On the MK2M2, these bytes are RESERVED. See User Calibration for the full register list.

Table: Full Description of a Debug Frame 2 (D - 0b110)
Byte # Description Format
0 Misalignment Correction [7:6]
Operating Mode [5:3]
Frame Type [2:0] = 0b110
See Misalignment Correction
See Operating Mode
See Frame Type
1 Frame Counter See Frame Counter
2 - 5 Magnetometer XX Soft Iron — MXX See User Calibration
6 - 9 Magnetometer YX Soft Iron — MYX See User Calibration
10 - 13 Magnetometer ZX Soft Iron — MZX See User Calibration
14 - 17 Magnetometer XY Soft Iron — MXY See User Calibration
18 - 21 Magnetometer YY Soft Iron — MYY See User Calibration
22 - 25 Magnetometer ZY Soft Iron — MZY See User Calibration
26 - 29 Magnetometer XZ Soft Iron — MXZ See User Calibration
30 - 33 Magnetometer YZ Soft Iron — MYZ See User Calibration
34 - 37 Magnetometer ZZ Soft Iron — MZZ See User Calibration
38 - 41 AHRS Gain See AHRS Configuration
42 - 45 AHRS Acceleration Rejection See AHRS Configuration
46 - 49 AHRS Magnetic Rejection See AHRS Configuration
50 - 53 AHRS Recovery Trigger Period See AHRS Configuration
54 AHRS Heading Source [7:4]
AHRS Convention [3:0]
See AHRS Configuration
55 Status Byte See Status Byte
56 - 57 Cyclic Redundancy Check (CRC-16) See Integrity Verification

Using IMU Data

This section presents a more advanced description of some of the fields present in both the Startup Frame and Operating Frames to exploit IMU output.

RS422 Frame Decoding & Encoding - COBS (Consistent Overhead Byte Stuffing)

All frames transmitted by the IMU in the RS422 variant are encoded using COBS (Consistent Overhead Byte Stuffing) to ensure reliable frame boundary detection. Each encoded frame is terminated with a 0x00 byte, which serves as the frame delimiter. Users must decode each frame using the COBS algorithm before interpreting the data. Any 0x00 byte received marks the end of a complete COBS-encoded frame and should not be included in the decoding process. This is not required for the CAN-FD variant.

COBS Encoding

All commands or data sent to the IMU in the RS422 variant must also be COBS-encoded and terminated with a 0x00 byte. This ensures proper frame detection and parsing on the IMU side. Make sure to apply the same COBS encoding method when sending any configuration or control commands to the device in the RS422 variant.

Details for COBS Decoding and Encoding in C

On C-based platforms, the cobs-c library can be used to decode and encode data frames. After detecting a 0x00 byte (frame delimiter), the preceding bytes can be decoded using the cobs_decode() function provided by the library to retrieve the original data. Similarly, any data to be sent to the IMU should be passed through cobs_encode() and followed by a 0x00 delimiter.

Details for COBS Decoding and Encoding in Python

In Python, the cobs package provides cobs.decode() and cobs.encode() functions. Incoming data can be split on 0x00 and decoded, while outgoing commands should be COBS-encoded using cobs.encode(), with a 0x00 byte appended to the result before transmission.


Integrity Verification

Each type of frame contains a 16-bit Cyclic-Redundancy Check to verify the integrity of the data received and perform error-detection. The short 16-bit binary sequence, known as the CRC, is computed using the polynomial 0xD175 and sent with each block of data. Its "explicit + 1" form for computation is 0x1A2EB. It has a hamming distance of 4.

Cyclic Redundancy Check

It's important to note that the CRC is calculated on the entire frame, without the CRC itself. Once calculated, the latter can be compared with the transmitted one to validate data integrity or reject the frame.


Operating Mode

As the Operating Mode is encoded as a 3-bit unsigned integer, the table below shows the mapping between binary representation, ASCII and true value.

Table: Mapping of IMU Operating Modes
True Value ASCII Binary
Idle I (0x49) 0b000
Low Speed L (0x4C) 0b001
Medium Speed M (0x4D) 0b010
Reserved RESERVED 0b011 to 0b111

Enabled Frame Types

As the enabled frame types are encoded as an 8-bit unsigned integer, the table below shows the mapping between each bit (and its corresponding index) and the frame type. A value of 1 at position N indicates that frame with index N is enabled, while a value of 0 means disabled.

Table: Mapping of Enabled Frame Types
Enable Frame Type Description Binary (Index)
R Enabling Raw Operating Frame 0b00000001 (0)
E Enabling Euler Angles Operating Frame 0b00000010 (1)
Q Enabling Quaternions Operating Frame 0b00000100 (2)
M Enabling Rotation Matrix Operating Frame 0b00001000 (3)
G Enabling GNSS Operating Frame 0b00010000 (4)
Reserved RESERVED 0b11100000 (5-7)

The table below gives some examples of the data format used.

Table: Enabled Frame Type Data Format Examples
Enabled Frames Decimal Binary Indexes
R + E 3 0b00000011 0, 1
Q + G 20 0b00010100 2, 4

Misalignment Correction

This field shows whether the misalignment correction algorithm for the gyroscopes and accelerometers is active. A value of 0 means the correction is disabled, while a value of 1 means it is enabled. This helps confirm if the sensor data is being adjusted for any known misalignment.


Frame Counter

Frame Counter continuously counts transmitted frames. This counter is an unsigned 8-bit binary counter, with values in the [0, 255]. It automatically wraps around.


Timestamp

The timestamp is transmitted directly within an Operating Frame of type R, E, Q, M, G with an unsigned 64-bit binary that can be read directly as the value in ms. It describes the time at which the frame is formed, relative to the last IMU power-up.


MEMS Gyroscope Dynamic Range

As the MEMS Gyroscope Dynamic Range is encoded as a 4-bit unsigned integer, the table below shows the mapping between binary representation, ASCII and true value. This register configures the MEMS gyroscopes; the MK2E2's optical gyroscope is not affected by it and has a fixed range.

Table: Mapping of MEMS Gyroscope Dynamic Ranges
True Value ASCII Binary
± 250 °/sec 0250 (0x30323530) 0b0000
± 4000 °/sec 4000 (0x34303030) 0b0001
± 125 °/sec 0125 (0x30313235) 0b0010
± 500 °/sec 0500 (0x30353030) 0b0100
± 1000 °/sec 1000 (0x31303030) 0b1000
± 2000 °/sec 2000 (0x32303030) 0b1100

MEMS Gyroscope Filters

The table below shows the MEMS Gyroscope Filters configuration mapping, and the one after it shows the MEMS Gyroscope Low-Pass mapping. Register IDs are GFI and GLP (see Write User Calibration Register).

Table: Mapping of MEMS Gyroscope Filters field
Configuration Decimal Binary
Filters disabled 0 0b00
Low-pass filter enable 1 0b01
High-pass filter enable 2 0b10
Low-pass and high-pass filters are enabled 3 0b11

Table: Mapping of Gyroscope Low-Pass Filter field
Cutoff for Low - Medium ODR Decimal Binary
33 Hz - 222 Hz 0 0b000
33 Hz - 186 Hz 1 0b001
33 Hz - 140 Hz 2 0b010
33 Hz - 260 Hz 3 0b011
34 Hz - 96 Hz 4 0b100
31 Hz - 49 Hz 5 0b101
19 Hz - 25 Hz 6 0b110
11.6 Hz - 12.6 Hz 7 0b111

The table below shows the Gyroscope High-Pass mapping. Register ID is GHP (see Write User Calibration Register).

Table: Mapping of Gyroscope High-Pass Filter field
Cutoff Decimal Binary
16 mHz 0 0b000
65 mHz 1 0b001
260 mHz 2 0b010
1.04 Hz 3 0b011

Accelerometer Dynamic Range

As the Accelerometer Dynamic Range is encoded as a 4-bit unsigned integer, the table below shows the mapping between binary representation, ASCII and true value.

Table: Mapping of Accelerometer Dynamic Ranges
True Value ASCII Binary
± 2 g 02 (0x3032) 0b0000
± 16 g 16 (0x3136) 0b0001
± 4 g 04 (0x3034) 0b0010
± 8 g 08 (0x3038) 0b0011

Accelerometer Filters

The table below shows the Accelerometer Filters configuration mapping. Register ID is AFI (see Write User Calibration Register).

Table: Mapping of Accelerometer Filters field
Configuration Decimal Binary
Filters disabled 0 0b00
Low-pass filter enable 1 0b01
High-pass filter enable 2 0b10

The table below shows the Accelerometer Low-Pass and High-Pass mapping. Register IDs are ALP and AHP (see Write User Calibration Register).

Table: Mapping of Accelerometer Low-Pass and High-Pass Filters fields
Cutoff for Low - Medium ODR Decimal Binary
26 Hz - 208.25 Hz 0 0b000
10.4 Hz - 83.3 Hz 1 0b001
5.2 Hz - 41.65 Hz 2 0b010
2.3 Hz - 18.5 Hz 3 0b011
1.04 Hz - 8.33 Hz 4 0b100
0.52 Hz - 4.17 Hz 5 0b101
0.26 Hz - 2.08 Hz 6 0b110
0.13 Hz - 1.04 Hz 7 0b111

Inclinometer Dynamic Range

As the Inclinometer Dynamic Range is encoded as a 4-bit unsigned integer, the table below shows the mapping between binary representation, ASCII and true value.

Table: Mapping of Inclinometer Dynamic Ranges
True Value ASCII Binary
± 0.5 g 0.5 (0x302E35) 0b0000
± 3.0 g 3.0 (0x332E30) 0b0001
± 1.0 g 1.0 (0x312E30) 0b0010
± 2.0 g 2.0 (0x322E30) 0b0011

AHRS Configuration

The AHRS configuration consists of six parameters that control the algorithm behind the AHRS frames (Euler, Rotation Matrix, Quaternions). The table below presents these parameters.

Table: AHRS Configuration Parameters
Register ID Name Type Description
FCO Earth Axis Convention 2-bit unsigned integer 0 : NWU, 1: ENU, 2: NED
FHS Heading Source 2-bit unsigned integer 0 : None, 1: Internal magnetometer, 2: RESERVED
FGA Gain float32 Determines the influence of the gyroscope relative to other sensor. 0.5 by default.
FAR Acceleration Rejection float32 Threshold (in degrees) used by the acceleration rejection feature. 10.0 deg by default.
FMR Magnetic Rejection float32 Threshold (in degrees) used by the magnetic rejection feature. 10.0 deg by default.
FRT Recovery Trigger Period 32-bit unsigned integer Acceleration and magnetic recovery trigger period (seconds). 5 sec by default.

IMU Temperature Data

This temperature value is best for observing relative changes in the thermal environment, since it represents a coarse temperature inside the IMU. The reading is simply encoded as a float32 (also known as FP32) and can be read directly as the temperature in °C.

The internal temperature is roughly 10 to 13°C higher than external temperature.


Euler Angles

Euler angles represent orientation as a sequence of three rotations about the principal axes. In the ZYX convention, the rotation is applied in the following order: yaw (z-axis), pitch (y-axis), and roll (x-axis). This format is intuitive and commonly used to express orientation in AHRS systems. However, Euler angles are susceptible to singularities such as gimbal lock, where two axes align and one degree of freedom is lost, potentially affecting stability in certain configurations.


Quaternions

Quaternions offer a compact and singularity-free representation of 3D orientation using four components. Widely used in AHRS implementations, quaternions enable smooth and stable orientation tracking even during fast or complex motion. They are well-suited for sensor fusion and real-time computation but require conversion to Euler angles or rotation matrices for human interpretation. The order of the quaternions is (w, x, y, z).


Rotation Matrix

Rotation matrix is an alternative way to represent the orientation using a 3 × 3 orthonormal matrix that defines the transformation relative to a fixed coordinate system. While precise, they are more computationally intensive to maintain compared to quaternions.


GNSS Fix Type

Each GNSS frame contains a GNSS fix type byte to indicate the health of the current navigation solution. This makes it easy to give a confidence level to the current data. The table below gives the mapping of the field.

Table: Interpreting GNSS Fix Type Byte
True Value Decimal Binary
No GNSS Fix 0 0b000
Dead Reckoning Fix only 1 0b001
2D GNSS Fix 2 0b010
3D GNSS Fix 3 0b011
GNSS + Dead Reckoning Combined 4 0b100
Time Only Fix 5 0b101

GNSS Last Correction Age

Each GNSS frame contains a last correction age field to indicate the age of the most recently received correction. The table below gives the mapping of the field.

Table: GNSS Last Correction Age Byte
Description Decimal Binary
Not available 0 0b0000
Age between 0 and 1 second 1 0b0001
Age between 1 (inclusive) and 2 seconds 2 0b0010
Age between 2 (inclusive) and 5 seconds 3 0b0011
Age between 5 (inclusive) and 10 seconds 4 0b0100
Age between 10 (inclusive) and 15 seconds 5 0b0101
Age between 15 (inclusive) and 20 seconds 6 0b0110
Age between 20 (inclusive) and 30 seconds 7 0b0111
Age between 30 (inclusive) and 45 seconds 8 0b1000
Age between 45 (inclusive) and 60 seconds 9 0b1001
Age between 60 (inclusive) and 90 seconds 10 0b1010
Age between 90 (inclusive) and 120 seconds 11 0b1011
Age greater or equal than 120 seconds ≥ 12 0b1100

User Calibration

There are 20 registers — 21 on the MK2E2, which adds the optical gyroscope's bias register — that allow users to adjust the calibration to match their specific setup. Each value is interpreted as a float32 and transferred to and from the IMU using an 8-character hexadecimal representation of a 32-bit floating-point number.

The exact registers available are the following:

Table: User Calibration Registers
Register ID Register Full Name
GXB Gyroscope X Bias
GYB Gyroscope Y Bias
GZB Gyroscope Z Bias
GOB Optical Gyroscope Z BiasMK2E2 only
AXB Accelerometer X Bias
AYB Accelerometer Y Bias
AZB Accelerometer Z Bias
IXB Inclinometer X Bias
IYB Inclinometer Y Bias
MXB Magnetometer X Hard Iron
MYB Magnetometer Y Hard Iron
MZB Magnetometer Z Hard Iron
MXX Magnetometer XX Soft Iron
MYX Magnetometer YX Soft Iron
MZX Magnetometer ZX Soft Iron
MXY Magnetometer XY Soft Iron
MYY Magnetometer YY Soft Iron
MZY Magnetometer ZY Soft Iron
MXZ Magnetometer XZ Soft Iron
MYZ Magnetometer YZ Soft Iron
MZZ Magnetometer ZZ Soft Iron

All registers above, including GOB, are written the same way via the WR command (see Write User Calibration Register).

Regarding the calibration biases, the correction follows the model below. For the gyroscope, accelerometer and inclinometer registers (including GOB on the MK2E2), it's a simple bias subtraction:

sensorout = sensorcal − biasuser

For magnetometer compensation, both hard-iron and soft-iron corrections are applied:

magout = M × (magcal − magbias)

where mag_bias is the hard-iron bias vector (MXB, MYB, MZB), and M is the 3×3 soft-iron correction matrix built from the nine MXXMZZ registers above:

    | MXX  MYX  MZX |
M = | MXY  MYY  MZY |
    | MXZ  MYZ  MZZ |

Status Byte

Each frame contains a status byte to indicate the health of the IMU and of the current readings. This byte is sticky, meaning that every time a new frame is formed, it is reset to 0x00. This makes it easy to distinguish between persistent and temporary errors. The table below gives the meaning of each of the 8 bits. Note that a status byte of 0x00 indicates that everything is working fine.

Table: Interpreting Status Byte
Bit # Description Meaning
0 OSCP IMU Overrun Error Bit 0: OK, 1: KO
1 MEMS Sensors Error Bit 0: OK, 1: KO
2 MEMS Inclinometer Error Bit 0: OK, 1: KO
3 TMR Magnetometer Error Bit 0: OK, 1: KO
4 Temperature Sensor Error Bit 0: OK, 1: KO
5 GNSS Error Bit 0: OK, 1: KO
6 MK2E2: Optical Gyroscope Error Bit
MK2M2: Reserved for future use
0: OK, 1: KO
7 Reserved for future use 0: OK, 1: KO