SPIKE-RT C API Reference [English]
An RTOS-based software platform for LEGO® Education SPIKE™.
Loading...
Searching...
No Matches
IMU

API for the hub built-in IMU. More...

Functions

pbio_error_t hub_imu_init (void)
 Initialize the IMU driver.
 
bool hub_imu_is_ready (void)
 Check if the IMU module is "ready.".
 
bool hub_imu_is_stationary (void)
 Check if the IMU module is "stationary.".
 
void hub_imu_set_tilt (float angle)
 Set the tilt angle of the IMU module.
 
void hub_imu_get_acceleration (float accel[3])
 Get the acceleration by the IMU.
 
void hub_imu_get_angular_velocity (float angv[3])
 Get the angular velocity by the IMU.
 
float hub_imu_get_temperature (void)
 Get the temperature by the IMU.
 
float hub_imu_get_heading (void)
 Get the heading angle of the IMU.
 
void hub_imu_reset_heading (void)
 Reset the heading angle of the IMU.
 

Detailed Description

API for the hub built-in IMU.

Function Documentation

◆ hub_imu_get_acceleration()

void hub_imu_get_acceleration ( float accel[3])

Get the acceleration by the IMU.

Parameters
accelFloat array to store the x/y/z axes acceleration[mm/s^2].

◆ hub_imu_get_angular_velocity()

void hub_imu_get_angular_velocity ( float angv[3])

Get the angular velocity by the IMU.

Parameters
angvFloat array to store the x/y/z axes angular velocity [°/s].

◆ hub_imu_get_heading()

float hub_imu_get_heading ( void )

Get the heading angle of the IMU.

Return values
Anglein degrees.

◆ hub_imu_get_temperature()

float hub_imu_get_temperature ( void )

Get the temperature by the IMU.

Return values
Temperature[℃].

◆ hub_imu_init()

pbio_error_t hub_imu_init ( void )

Initialize the IMU driver.

Return values
PBIO_SUCCESSSuccessfully initialized.
PBIO_ERROR_FAILEDFailed to initialized.

◆ hub_imu_is_ready()

bool hub_imu_is_ready ( void )

Check if the IMU module is "ready.".

Return values
trueModule is ready.
falseModule still needs more quiet time.

◆ hub_imu_is_stationary()

bool hub_imu_is_stationary ( void )

Check if the IMU module is "stationary.".

Return values
trueModule is stationary.
falseModule is in motion.

◆ hub_imu_set_tilt()

void hub_imu_set_tilt ( float angle)

Set the tilt angle of the IMU module.

Parameters
angleTilt angle (wrt the Y-axis) in degrees.