API Documentation

Encoding and Decoding

Decodes response fields to an Event.

Parameters:
  • ticks – The decoded ticks value.

  • fields – The fields to decode.

Returns:

The decoded Event.

Decodes a response string to an event.

Parameters:

line – The response string to decode.

Returns:

A decoded event.

Decodes response fields to a MetaEvent.

Parameters:
  • ticks – The decoded ticks value.

  • fields – The fields to decode.

Returns:

The decoded MetaEvent.

Decodes a meta event type name or id string to a MetaEventType enum value.

Parameters:

meta_event_string – The meta event tu[e name or id string to decode.

Returns:

The decoded MetaEvent enum value.

Decodes response fields to a SensorEvent.

Parameters:
  • ticks – The decoded ticks value.

  • fields – The fields to decode.

Returns:

The decoded SensorEvent.

Decodes a test result name or id string to a TestResult enum value.

Parameters:

test_result_string – The test result name or id string to decode.

Returns:

The decoded TestResult enum value.

Decodes response fields to a WakeupEvent.

Parameters:
  • ticks – The decoded ticks value.

  • fields – The fields to decode.

Returns:

The decoded WakeupEvent.

Encodes the autocal start command to a string.

Returns:

The encoded command string.

Encodes the autocal stop command to a string.

Returns:

The encoded command string.

Encodes the power down command to a string.

Returns:

The encoded command string.

Encodes the save calibration parameters command to a string.

Returns:

The encoded command string.

Encodes the self-test command to a string.

Returns:

The encoded command string.

Encodes the set accelerometer sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set application mode command to a string.

Parameters:

application_mode – The application mode to set.

Returns:

The encoded command string.

Encodes the set coordinate system command to a string.

Parameters:

coordinate_system – The coordinate system to set.

Returns:

The encoded command string.

Encodes the set custom application mode command to a string.

Parameters:
  • overall_merge – The overall merge rate to use.

  • mag_merge – The mag merge rate to use.

  • accel_merge – The accel merge rate to use.

Dynamic accel:

The dynamic accel value to use.

Still_delay:

The still delay value to use.

Returns:

The encoded command string.

Encodes the set game rotation vector sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set geo-magnetic rotation vector sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set gravity sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set gyroscope sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set gyroscope uncalibrated sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set linear acceleration sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set magnetometer sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set magnetometer uncalibrated sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set meta event reporting off command to a string.

Returns:

The encoded command string.

Encodes the set meta event reporting on command to a string.

Returns:

The encoded command string.

Encodes the set mounting option command to a string.

Parameters:

mounting_option – The mounting option to set.

Returns:

The encoded command string.

Encodes the set orientation sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set pressure sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set rotation vector sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set sensor event reporting off command to a string.

Returns:

The encoded command string.

Encodes the set sensor event reporting on command to a string.

Returns:

The encoded command string.

Encodes the set temperature sensor command to a string.

Parameters:

rate – The desired output data rate in Hz.

Returns:

The encoded command string.

Encodes the set verbose mode off command to a string.

Returns:

The encoded command string.

Encodes the set verbose mode on command to a string.

Returns:

The encoded command string.

Encodes the system restart command to a string.

Returns:

The encoded command string.

Encodes the orientation one-shot command to a string.

Returns:

The encoded command string.

Events

Base class for events.

Number of clock ticks since boot.

Event reported when device powers up or wakes from sleep.

Meta Events

Base class for meta events.

Event reported when calibration status has changed.

Event reported when calibration is stable.

Event reported when the dynamic range for a sensor has changed.

Event reported when a general error has occurred.

Event reported when the event FIFO has overflowed.

Event reported when the event FIFO is about to overflow.

Event reported when the device has completed initialization.

Event reported when magnetic transient has been detected.

Event reported when the power mode for a sensor has changed.

Event reported when the sample rate for a sensor has changed.

Event reported when a self-test result is available.

Event reported when a sensor error has occurred.

Event reported when stillness has changed.

Event reported when a sensor hardware bus error has occurred.

Sensor Events

Base class for sensor events.

Number of clock ticks since boot.

Event reported when accelerometer sensor data is available.

Acceleration force along the x axis (including gravity). in m/s².

Acceleration force along the y axis (including gravity). in m/s².

Acceleration force along the z axis (including gravity). in m/s².

Number of clock ticks since boot.

Event reported when game rotation vector sensor data is available.

Rotation vector component along the x axis (x * sin(θ/2)).

Rotation vector component along the y axis (y * sin(θ/2)).

Rotation vector component along the z axis (z * sin(θ/2)).

Scalar component of the rotation vector ((cos(θ/2)).

Number of clock ticks since boot.

Event reported when geo-magnetic rotation vector sensor data is available.

Rotation vector component along the x axis (x * sin(θ/2)).

Rotation vector component along the y axis (y * sin(θ/2)).

Rotation vector component along the z axis (z * sin(θ/2)).

Scalar component of the rotation vector ((cos(θ/2)).

Number of clock ticks since boot.

Event reported when gravity sensor data is available.

Force of gravity along the x axis in m/s².

Force of gravity along the y axis in m/s².

Force of gravity along the z axis in m/s².

Number of clock ticks since boot.

Event reported when uncalibrated gyroscope sensor data is available.

Rate of rotation (without drift compensation) around the x axis in rad/s

Rate of rotation (without drift compensation) around the y axis in rad/s

Rate of rotation (without drift compensation) around the z axis in rad/s

Estimated drift around the x axis in rad/s

Estimated drift around the y axis in rad/s

Estimated drift around the z axis in rad/s

Number of clock ticks since boot.

Event reported when uncalibrated gyroscope sensor data is available.

Rate of rotation around the x axis in rad/s

Rate of rotation around the y axis in rad/s

Rate of rotation around the z axis in rad/s

Number of clock ticks since boot.

Event reported when linear acceleration sensor data is available.

Acceleration force along the x axis (excluding gravity) in m/s².

Acceleration force along the y axis (excluding gravity) in m/s².

Acceleration force along the z axis (excluding gravity) in m/s².

Number of clock ticks since boot.

Geomagnetic field strength (without hard iron calibration) along the x axis in micro-Tesla (µT).

Number of clock ticks since boot.

Geomagnetic field strength (without hard iron calibration) along the y axis in micro-Tesla (µT).

Geomagnetic field strength (without hard iron calibration) along the z axis in micro-Tesla (µT).

Iron bias estimation along the x axis in micro-Tesla (µT).

Iron bias estimation along the y axis in micro-Tesla (µT).

Iron bias estimation along the z axis in micro-Tesla (µT).

Event reported when magnetometer data is available.

Number of clock ticks since boot.

Geomagnetic field strength along the x axis in micro-Tesla (µT).

Geomagnetic field strength along the y axis in micro-Tesla (µT).

Geomagnetic field strength along the z axis in micro-Tesla (µT).

Event reported when orientation sensor data is available.

Number of clock ticks since boot.

Azimuth (angle around the z-axis) in degrees.

Pitch (angle around the x-axis) in degrees.

Roll (angle around the y-axis) in degrees.

Accuracy value

Event reported when pressure sensor data is available.

Number of clock ticks since boot.

Ambient air pressure in hPa.

Event reported when rotation vector sensor data is available.

Number of clock ticks since boot.

Rotation vector component along the x axis (x * sin(θ/2)).

Rotation vector component along the y axis (y * sin(θ/2)).

Rotation vector component along the z axis (z * sin(θ/2)).

Scalar component of the rotation vector ((cos(θ/2)).

Event reported when temperature sensor data is available.

Number of clock ticks since boot.

Device temperature in degrees Celsius (°C).

Types

Enum class representing possible application mode values.

Slow merging.

Slow-Medium merging.

Medium merging.

Medium-Fast merging.

Fast merging.

Enum class representing possible coordinate system values.

East, north, up (ENU) coordinate system.

North, east, down (NED) coordinate system.

Enum class representing possible meta event types.

The event FIFO has been flushed.

A sensor’s sample rate has changed.

A sensor’s power mode has changed.

A general error has occurred.

Magnetic transient has been detected.

Calibration status has changed.

Stillness has changed.

Calibration is stable.

A sensor error has occurred.

The event FIFO has overflowed.

A sensor’s dynamic range has changed.

The event FIFO is about to overflow.

Self-test result is available.

Device initialization has completed.

A sensor hardware bus error has occurred.

Enum class representing possible mounting option values.

Standard mounting.

-90° heading offset.

-180° heading offset.

-270° heading offset.

-90° pitch, 0° heading offset.

-90° pitch, -90° heading offset.

-90° pitch, -180° heading offset.

-90° pitch, -270° heading offset.

+90° roll, 0° heading offset.

+90° roll, -90° heading offset.

+90° roll, -180° heading offset.

+90° roll, -270° heading offset.

+180° roll, 0° heading offset.

+180° roll, -90° heading offset.

+180° roll, -180° heading offset.

+180° roll, -270° heading offset.

Enum class representing possible sensor types.

Accelerometer sensor.

Magnetometer sensor.

Orientation sensor.

Gyroscope sensor.

Pressure sensor.

Temperature sensor.

Gravity sensor.

Linear acceleration sensor.

Rotation vector sensor.

Uncalibrated magnetometer sensor.

Game rotation vector sensor.

Uncalibrated gyroscope sensor.

Significant motion sensor.

Geo-magnetic rotation vector sensor.

Enum class representing possible test result values.

All axes passed.

X axis failed.

Y axis failed.

X and Y axes failed.

Z axis failed.

X and Z axes failed.

Y and Z axes failed.

All axes failed.