MatrixMiniR4 1.1.5
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
MiniR4Motion.h
Go to the documentation of this file.
1
6#ifndef MINIR4MOTION_H
7#define MINIR4MOTION_H
8
9#include "MMLower.h"
10
20{
21public:
23
24 enum class AxisType
25 {
26 X,
27 Y,
28 Z,
29 Roll,
30 Pitch,
31 Yaw
32 };
33
40 double getGyro(AxisType axis)
41 {
42 double x = 0, y = 0, z = 0;
43 mmL.GetIMUGyro(x, y, z);
44
45 if (axis == AxisType::X)
46 return x;
47 else if (axis == AxisType::Y)
48 return y;
49 else if (axis == AxisType::Z)
50 return z;
51 else
52 return 0;
53 }
54
61 double getAccel(AxisType axis)
62 {
63 double x = 0, y = 0, z = 0;
64 mmL.GetIMUAcc(x, y, z);
65
66 if (axis == AxisType::X)
67 return x;
68 else if (axis == AxisType::Y)
69 return y;
70 else if (axis == AxisType::Z)
71 return z;
72 else
73 return 0;
74 }
75
82 int16_t getEuler(AxisType axis)
83 {
84 int16_t roll = 0, pitch = 0, yaw = 0;
85 mmL.GetIMUEuler(roll, pitch, yaw);
86
87 if (axis == AxisType::Roll)
88 return roll;
89 else if (axis == AxisType::Pitch)
90 return pitch;
91 else if (axis == AxisType::Yaw)
92 return yaw;
93 else
94 return -999;
95 }
96
103
104private:
105};
106
107#endif // MINIR4MOTION_H
MMLower mmL(8, 9, 57600)
Handling the Lower MCU (STM32) communication.
RESULT GetIMUGyro(double &x, double &y, double &z)
Definition MMLower.cpp:837
RESULT GetIMUAcc(double &x, double &y, double &z)
Definition MMLower.cpp:860
RESULT GetIMUEuler(int16_t &roll, int16_t &pitch, int16_t &yaw)
Definition MMLower.cpp:813
RESULT SetIMUToZero(void)
Definition MMLower.cpp:698
Class for motion sensing using an IMU (Inertial Measurement Unit).
int16_t getEuler(AxisType axis)
Gets the Euler angle for a specified axis.
bool resetIMUValues(void)
Resets the IMU values to zero.
double getAccel(AxisType axis)
Gets the accelerometer value for a specified axis.
double getGyro(AxisType axis)
Gets the gyro value for a specified axis.