-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIMUController.h
More file actions
41 lines (33 loc) · 845 Bytes
/
IMUController.h
File metadata and controls
41 lines (33 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef IMUCONTROLLER_H
#define IMUCONTROLLER_H
#include <rc/mpu.h>
#include <atomic>
#include <cstddef>
#include <cstdint>
#include <vector>
constexpr size_t kActualDataSize = 10;
class IMUController {
public:
IMUController();
int Init();
void SetEnable();
void SetDisable();
void Stop();
std::vector<float> GetData();
uint8_t GetId();
private:
const int kIdGetCommand = 0x06;
const int kI2cBus = 2;
const int kGpioIntPinChip = 3;
const int kGpioIntPinPin = 21;
const int kDmpSampleRate = 100;
const int kEnableMagnetometer = 1;
std::atomic<bool> isStarted_;
rc_mpu_config_t configuration_;
std::vector<float> actualData_;
rc_mpu_data_t data_;
std::vector<float> GetAccel();
std::vector<float> GetGyro();
std::vector<float> GetQaternion();
};
#endif