MatrixMiniR4 1.1.9
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
MiniR4Motion Class Reference

Class for motion sensing using an IMU (Inertial Measurement Unit). More...

#include <MiniR4Motion.h>

Public Types

enum class  AxisType {
  X , Y , Z , Roll ,
  Pitch , Yaw
}
 

Public Member Functions

 MiniR4Motion ()
 
bool begin (void)
 
double getGyro (AxisType axis)
 Gets the gyro value for a specified axis.
 
double getAccel (AxisType axis)
 Gets the accelerometer value for a specified axis.
 
double getAccelRaw (AxisType axis)
 Gets the raw (uncalibrated) IMU accelerometer data for a specific axis.
 
double getEuler (AxisType axis)
 Gets the Euler angle for a specified axis.
 
uint8_t getAccel_All (double *dataX)
 Gets the accelerometer value for a specified axis.
 
uint8_t getGyro_All (double *dataX)
 Gets the gyro value for a specified axis.
 
uint8_t getEuler_All (double *dataX)
 Gets the Euler angle for a specified axis.
 
bool saveIMUCalData (float face1, float face2, float face3, float face4, float face5, float face6)
 Save IMU calibration data with 6 individual parameters (R4 EEPROM 0x32 - 0x49)
 
bool applyIMUCalData (void)
 Load and send IMU calibration data from EEPROM (R4 EEPROM 0x32 - 0x49)
 
bool getAllSpeed (int32_t *Speed_value)
 Gets the current encoder Speed value. (RPS)
 
bool getIMU_acc_real (float *accdataCX)
 Gets the raw (uncalibrated) IMU accelerometer data.
 
bool resetIMUValues (void)
 Resets the IMU values to zero.
 

Detailed Description

Class for motion sensing using an IMU (Inertial Measurement Unit).

Note: This Class is for Controller built-in IMU (PU6050) control by Lower MCU (STM32)

This class provides methods to retrieve gyro, accelerometer, and Euler angles data from the IMU. It also allows resetting the IMU values to zero.

Definition at line 20 of file MiniR4Motion.h.

Member Enumeration Documentation

◆ AxisType

enum class MiniR4Motion::AxisType
strong
Enumerator
Roll 
Pitch 
Yaw 

Definition at line 25 of file MiniR4Motion.h.

Constructor & Destructor Documentation

◆ MiniR4Motion()

MiniR4Motion::MiniR4Motion ( )
inline

Definition at line 23 of file MiniR4Motion.h.

Member Function Documentation

◆ applyIMUCalData()

bool MiniR4Motion::applyIMUCalData ( void )
inline

Load and send IMU calibration data from EEPROM (R4 EEPROM 0x32 - 0x49)

Reads the Six-Position Calibration data from EEPROM and sends it to the STM32 unit.

Returns
true if calibration data was successfully loaded and sent, false otherwise

Definition at line 222 of file MiniR4Motion.h.

◆ begin()

bool MiniR4Motion::begin ( void )
inline

Definition at line 35 of file MiniR4Motion.h.

◆ getAccel()

double MiniR4Motion::getAccel ( AxisType axis)
inline

Gets the accelerometer value for a specified axis.

Parameters
axisThe axis for which to retrieve the accelerometer value (X, Y, Z).
Returns
The accelerometer value for the specified axis.

Definition at line 68 of file MiniR4Motion.h.

◆ getAccel_All()

uint8_t MiniR4Motion::getAccel_All ( double * dataX)
inline

Gets the accelerometer value for a specified axis.

Parameters
axisThe axis for which to retrieve the accelerometer value (X, Y, Z).
Returns
The accelerometer value for the specified axis.

Definition at line 136 of file MiniR4Motion.h.

◆ getAccelRaw()

double MiniR4Motion::getAccelRaw ( AxisType axis)
inline

Gets the raw (uncalibrated) IMU accelerometer data for a specific axis.

Reads the uncalibrated accelerometer value for the specified axis (X, Y, or Z).

Parameters
axisThe axis to read (AxisType::X, AxisType::Y, or AxisType::Z)
Returns
The raw accelerometer value for the specified axis, or 0 if invalid axis

Definition at line 91 of file MiniR4Motion.h.

◆ getAllSpeed()

bool MiniR4Motion::getAllSpeed ( int32_t * Speed_value)
inline

Gets the current encoder Speed value. (RPS)

Returns
True if the Value is get successfully, false otherwise.

Definition at line 248 of file MiniR4Motion.h.

◆ getEuler()

double MiniR4Motion::getEuler ( AxisType axis)
inline

Gets the Euler angle for a specified axis.

Parameters
axisThe axis for which to retrieve the Euler angle (Roll, Pitch, Yaw).
Returns
The Euler angle for the specified axis.

Definition at line 115 of file MiniR4Motion.h.

◆ getEuler_All()

uint8_t MiniR4Motion::getEuler_All ( double * dataX)
inline

Gets the Euler angle for a specified axis.

Parameters
axisThe axis for which to retrieve the Euler angle (Roll, Pitch, Yaw).
Returns
The Euler angle for the specified axis.

Definition at line 171 of file MiniR4Motion.h.

◆ getGyro()

double MiniR4Motion::getGyro ( AxisType axis)
inline

Gets the gyro value for a specified axis.

Parameters
axisThe axis for which to retrieve the gyro value (X, Y, Z).
Returns
The gyro value for the specified axis.

Definition at line 47 of file MiniR4Motion.h.

◆ getGyro_All()

uint8_t MiniR4Motion::getGyro_All ( double * dataX)
inline

Gets the gyro value for a specified axis.

Parameters
axisThe axis for which to retrieve the gyro value (X, Y, Z).
Returns
The gyro value for the specified axis.

Definition at line 154 of file MiniR4Motion.h.

◆ getIMU_acc_real()

bool MiniR4Motion::getIMU_acc_real ( float * accdataCX)
inline

Gets the raw (uncalibrated) IMU accelerometer data.

Reads the 3-axis accelerometer values without calibration applied. Performs two consecutive reads with a 2ms delay for stability.

Parameters
accdataCXPointer to float array to store the accelerometer data (X, Y, Z axes)
Returns
true if data was successfully retrieved, false otherwise

Definition at line 271 of file MiniR4Motion.h.

◆ resetIMUValues()

bool MiniR4Motion::resetIMUValues ( void )
inline

Resets the IMU values to zero.

Returns
True if the reset operation was successful, false otherwise.

Definition at line 290 of file MiniR4Motion.h.

◆ saveIMUCalData()

bool MiniR4Motion::saveIMUCalData ( float face1,
float face2,
float face3,
float face4,
float face5,
float face6 )
inline

Save IMU calibration data with 6 individual parameters (R4 EEPROM 0x32 - 0x49)

Parameters
face1Calibration value for face 1
face2Calibration value for face 2
face3Calibration value for face 3
face4Calibration value for face 4
face5Calibration value for face 5
face6Calibration value for face 6
Returns
true if calibration data was successfully saved, false otherwise

Definition at line 194 of file MiniR4Motion.h.


The documentation for this class was generated from the following file: