RBCX
Library for the RB3204-RBCX board with the ESP32 by RoboticsBrno.
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
rb::Mpu Class Reference

Helper class for controlling the Mpu. More...

#include <RBCXMpu.h>

Public Member Functions

void init ()
 Initialize the Mpu. This function must be called before using the Mpu. It will send a request to the coprocessor to initialize the Mpu. More...
 
void sendOne ()
 Send a one shot request to the coprocessor to get the Mpu data. The data will be available in the get functions. To get the data continuously, use the sendStart() function. More...
 
void sendStart ()
 Start sending the Mpu data continuously to the coprocessor. The data will be available in the get functions. To stop the continuous sending, use the sendStop() function. More...
 
void sendStop ()
 Stop sending the Mpu data continuously to the coprocessor. To start the continuous sending, use the sendStart() function. More...
 
void setCalibrationData ()
 Records current Gyro and Accelerometer data as "start" position and subtracts it from future readings. More...
 
void clearCalibrationData ()
 Clears the data recorded by setCalibrationData. More...
 
MpuVector getAcc ()
 Get the Mpu acceleration data. More...
 
float getAccX ()
 Get the Mpu acceleration data on the X axis. More...
 
float getAccY ()
 Get the Mpu acceleration data on the Y axis. More...
 
float getAccZ ()
 Get the Mpu acceleration data on the Z axis. More...
 
MpuVector getGyro ()
 Get the Mpu gyroscope data. More...
 
float getGyroX ()
 Get the Mpu gyroscope data on the X axis. More...
 
float getGyroY ()
 Get the Mpu gyroscope data on the Y axis. More...
 
float getGyroZ ()
 Get the Mpu gyroscope data on the Z axis. More...
 
MpuVector getAngle ()
 Get the Mpu angle data. More...
 
float getAngleX ()
 Get the Mpu angle data on the X axis. More...
 
float getAngleY ()
 Get the Mpu angle data on the Y axis. More...
 
float getAngleZ ()
 Get the Mpu angle data on the Z axis. More...
 
void resetAngleZ ()
 
void setCompressCoef (uint8_t coef)
 Set the Mpu compression coefficient (10 - 20). It is used to reduce sending interval. The Mpu data are summed up and sent every interval * coef ms. More...
 
uint8_t getCompressCoef ()
 Get the Mpu compression coefficient (1 - 20). More...
 

Friends

class Manager
 

Detailed Description

Helper class for controlling the Mpu.

Member Function Documentation

◆ clearCalibrationData()

void rb::Mpu::clearCalibrationData ( )

Clears the data recorded by setCalibrationData.

◆ getAcc()

MpuVector rb::Mpu::getAcc ( )

Get the Mpu acceleration data.

Returns
The Mpu acceleration data in Gs.

◆ getAccX()

float rb::Mpu::getAccX ( )

Get the Mpu acceleration data on the X axis.

Returns
The Mpu acceleration data on the X axis in Gs.

◆ getAccY()

float rb::Mpu::getAccY ( )

Get the Mpu acceleration data on the Y axis.

Returns
The Mpu acceleration data on the Y axis in Gs.

◆ getAccZ()

float rb::Mpu::getAccZ ( )

Get the Mpu acceleration data on the Z axis.

Returns
The Mpu acceleration data on the Z axis in Gs.

◆ getAngle()

MpuVector rb::Mpu::getAngle ( )

Get the Mpu angle data.

Returns
The Mpu angle data in degrees.

◆ getAngleX()

float rb::Mpu::getAngleX ( )

Get the Mpu angle data on the X axis.

Returns
The Mpu angle data on the X axis in degrees.

◆ getAngleY()

float rb::Mpu::getAngleY ( )

Get the Mpu angle data on the Y axis.

Returns
The Mpu angle data on the Y axis in degrees.

◆ getAngleZ()

float rb::Mpu::getAngleZ ( )

Get the Mpu angle data on the Z axis.

The Z angle is relative to the original heading of the robot at the start of the program, or after latest resetAngleZ() call, NOT to geographic north.

Returns
The Mpu angle data on the Z axis in degrees.

◆ getCompressCoef()

uint8_t rb::Mpu::getCompressCoef ( )

Get the Mpu compression coefficient (1 - 20).

Returns
The Mpu compression coefficient.

◆ getGyro()

MpuVector rb::Mpu::getGyro ( )

Get the Mpu gyroscope data.

Returns
The Mpu gyroscope data in degrees per second.

◆ getGyroX()

float rb::Mpu::getGyroX ( )

Get the Mpu gyroscope data on the X axis.

Returns
The Mpu gyroscope data on the X axis in degrees per second.

◆ getGyroY()

float rb::Mpu::getGyroY ( )

Get the Mpu gyroscope data on the Y axis.

Returns
The Mpu gyroscope data on the Y axis in degrees per second.

◆ getGyroZ()

float rb::Mpu::getGyroZ ( )

Get the Mpu gyroscope data on the Z axis.

Returns
The Mpu gyroscope data on the Z axis in degrees per second.

◆ init()

void rb::Mpu::init ( )

Initialize the Mpu. This function must be called before using the Mpu. It will send a request to the coprocessor to initialize the Mpu.

◆ resetAngleZ()

void rb::Mpu::resetAngleZ ( )

◆ sendOne()

void rb::Mpu::sendOne ( )

Send a one shot request to the coprocessor to get the Mpu data. The data will be available in the get functions. To get the data continuously, use the sendStart() function.

◆ sendStart()

void rb::Mpu::sendStart ( )

Start sending the Mpu data continuously to the coprocessor. The data will be available in the get functions. To stop the continuous sending, use the sendStop() function.

◆ sendStop()

void rb::Mpu::sendStop ( )

Stop sending the Mpu data continuously to the coprocessor. To start the continuous sending, use the sendStart() function.

◆ setCalibrationData()

void rb::Mpu::setCalibrationData ( )

Records current Gyro and Accelerometer data as "start" position and subtracts it from future readings.

◆ setCompressCoef()

void rb::Mpu::setCompressCoef ( uint8_t  coef)

Set the Mpu compression coefficient (10 - 20). It is used to reduce sending interval. The Mpu data are summed up and sent every interval * coef ms.

Parameters
coefThe Mpu compression coefficient.

Friends And Related Function Documentation

◆ Manager

friend class Manager
friend

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