-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbno055_wrapper.hpp
63 lines (52 loc) · 1.32 KB
/
bno055_wrapper.hpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef BNO055_WRAPPER_HPP
#define BNO055_WRAPPER_HPP
#include <string>
extern "C" {
#include "getbno055.h"
}
class BNO055 {
public:
BNO055(const std::string& i2c_bus = "/dev/i2c-1", const std::string& address = "0x28");
~BNO055();
// Device management
void reset();
void set_mode(::opmode_t mode);
void set_mode_from_string(const std::string& mode);
std::string get_mode() const;
void set_power_mode(const std::string& mode);
std::string get_power_mode() const;
// Data reading
struct EulerAngles {
double heading;
double roll;
double pitch;
};
struct Quaternion {
double w;
double x;
double y;
double z;
};
struct Vector3 {
double x;
double y;
double z;
};
// Sensor data methods
EulerAngles get_euler();
Quaternion get_quaternion();
Vector3 get_accelerometer();
Vector3 get_magnetometer();
Vector3 get_gyroscope();
Vector3 get_gravity();
Vector3 get_linear_acceleration();
// Calibration
bool is_fully_calibrated() const;
void save_calibration(const std::string& filename);
void load_calibration(const std::string& filename);
private:
std::string i2c_bus_;
std::string address_;
bool initialized_;
};
#endif // BNO055_WRAPPER_HPP