Doly C++ SDK v1.00
Loading...
Searching...
No Matches
ImuControl Namespace Reference

Functions

int8_t init (uint8_t delay=0, int16_t gx=0, int16_t gy=0, int16_t gz=0, int16_t ax=0, int16_t ay=0, int16_t az=0)
 Initialize the IMU subsystem.
int8_t dispose ()
 Dispose/stop the IMU subsystem and release resources.
int8_t calculate_offsets (int16_t *gx, int16_t *gy, int16_t *gz, int16_t *ax, int16_t *ay, int16_t *az)
 Calculate and output sensor offsets.
ImuData getImuData ()
 Get the last IMU reading snapshot.
float getTemperature ()
 Get the last temperature reading from the IMU.
float getVersion ()
 Get current library version.

Function Documentation

◆ calculate_offsets()

int8_t ImuControl::calculate_offsets ( int16_t * gx,
int16_t * gy,
int16_t * gz,
int16_t * ax,
int16_t * ay,
int16_t * az )

Calculate and output sensor offsets.

Typically used to perform a calibration routine and retrieve offsets that can be passed to init() on later boots.

Parameters
gxOutput gyroscope X offset.
gyOutput gyroscope Y offset.
gzOutput gyroscope Z offset.
axOutput accelerometer X offset.
ayOutput accelerometer Y offset.
azOutput accelerometer Z offset.
Returns
Status code:
  • 0 : success
  • -1 : init failed
  • -2 : calculation failed
Warning
All output pointers must be valid (non-null).

◆ dispose()

int8_t ImuControl::dispose ( )

Dispose/stop the IMU subsystem and release resources.

Returns
Status code:
  • 0 : success
  • 1 : not active
  • -1 : dispose failed
Examples
ImuControl/main.cpp.

◆ getImuData()

ImuData ImuControl::getImuData ( )

Get the last IMU reading snapshot.

Returns
Latest ImuData captured by the IMU subsystem.
Note
init() must have been called successfully before meaningful data is available.

◆ getTemperature()

float ImuControl::getTemperature ( )

Get the last temperature reading from the IMU.

Returns
Temperature in degrees Celsius.

◆ getVersion()

float ImuControl::getVersion ( )

Get current library version.

Original note: format 0.XYZ (3 digits after major).

Returns
Version as float.
Examples
ImuControl/main.cpp.

◆ init()

int8_t ImuControl::init ( uint8_t delay = 0,
int16_t gx = 0,
int16_t gy = 0,
int16_t gz = 0,
int16_t ax = 0,
int16_t ay = 0,
int16_t az = 0 )

Initialize the IMU subsystem.

This must be called once before reading IMU data or receiving events.

Parameters
delayOptional delay (milliseconds) before processing events.
gxGyroscope X offset.
gyGyroscope Y offset.
gzGyroscope Z offset.
axAccelerometer X offset.
ayAccelerometer Y offset.
azAccelerometer Z offset.
Returns
Status code:
  • 0 : success
  • 1 : already active
  • -1 : init failed
Note
Sampling rate 104hz (accel + gyro), 1Hz (temperature)
Examples
ImuControl/main.cpp.