|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
Utility class for accelerometer-specific calculations. More...
Functions | |
| float | gToMps2 (float g_value) |
| Convert acceleration from g-force to m/s² | |
| float | mps2ToG (float mps2_value) |
| Convert acceleration from m/s² to g-force. | |
| float | rangeToG (AccelFullScaleRange range) |
| Convert full-scale range enumeration to g-force value. | |
| float | calculateMagnitude (const AccelerometerData &data) |
| Calculate magnitude of acceleration vector. | |
| float | calculateInclination (const AccelerometerData &data, uint8_t axis) |
| Calculate inclination angle of specified axis relative to gravity. | |
| float | calculateInclinationDegrees (const AccelerometerData &data, uint8_t axis) |
| Calculate inclination angle in degrees. | |
| SensorDirection | getDirection (const AccelerometerData &data) |
| Get the direction of the acceleration vector. | |
Utility class for accelerometer-specific calculations.
|
inline |
Calculate inclination angle of specified axis relative to gravity.
Computes the angle between the specified axis and the total acceleration vector. Useful for tilt sensing and orientation detection.
| data | Accelerometer data structure |
| axis | Axis to calculate inclination for (0=X, 1=Y, 2=Z) |
Definition at line 107 of file AccelerometerUtils.hpp.
References calculateMagnitude(), AccelerometerData::mps2, SensorVector::x, SensorVector::y, and SensorVector::z.
Referenced by calculateInclinationDegrees().
|
inline |
Calculate inclination angle in degrees.
Convenience wrapper that converts radians to degrees.
| data | Accelerometer data structure |
| axis | Axis to calculate inclination for (0=X, 1=Y, 2=Z) |
Definition at line 135 of file AccelerometerUtils.hpp.
References calculateInclination(), and M_PI.
|
inline |
Calculate magnitude of acceleration vector.
Computes the Euclidean norm: √(x² + y² + z²)
| data | Accelerometer data structure |
Definition at line 91 of file AccelerometerUtils.hpp.
References acc, AccelerometerData::mps2, IMUdata::x, IMUdata::y, and IMUdata::z.
Referenced by calculateInclination().
|
inline |
Get the direction of the acceleration vector.
| &data | The accelerometer data structure containing the acceleration vector. |
| The | primary direction of the acceleration vector. |
Definition at line 147 of file AccelerometerUtils.hpp.
References DIRECTION_BOTTOM, DIRECTION_BOTTOM_LEFT, DIRECTION_BOTTOM_RIGHT, DIRECTION_TOP, DIRECTION_TOP_LEFT, DIRECTION_TOP_RIGHT, DIRECTION_UNKNOWN, AccelerometerData::mps2, x, SensorVector::x, y, SensorVector::y, and SensorVector::z.
|
inline |
Convert acceleration from g-force to m/s²
| g_value | Acceleration in g-force (1g = 9.80665 m/s²) |
Definition at line 47 of file AccelerometerUtils.hpp.
Referenced by SensorQMI8658::readAccel(), SensorBMA4XX::readData(), and SensorQMI8658::readFromFifo().
|
inline |
Convert acceleration from m/s² to g-force.
| mps2_value | Acceleration in m/s² |
Definition at line 58 of file AccelerometerUtils.hpp.
|
inline |
Convert full-scale range enumeration to g-force value.
| range | Full-scale range enumeration |
Definition at line 69 of file AccelerometerUtils.hpp.
References FS_128G, FS_16G, FS_2G, FS_32G, FS_4G, FS_64G, and FS_8G.
Referenced by SensorBMA4XX::setFullScaleRange().