You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
605 B
45 lines
605 B
#pragma once |
|
|
|
#include <stdint.h> |
|
#include <MPU.hpp> |
|
|
|
namespace ugv { |
|
namespace io { |
|
|
|
struct Vec3f { |
|
float x; |
|
float y; |
|
float z; |
|
|
|
Vec3f(); |
|
Vec3f(float x, float y, float z); |
|
Vec3f(const mpud::float_axes_t &axes); |
|
}; |
|
|
|
struct MpuData { |
|
// G's |
|
Vec3f accel; |
|
// degrees/s |
|
Vec3f gyro_rate; |
|
// flux density uT |
|
Vec3f mag; |
|
}; |
|
|
|
class MPU { |
|
public: |
|
explicit MPU(); |
|
~MPU(); |
|
|
|
void Init(); |
|
void Calibrate(); |
|
|
|
void GetData(MpuData &data); |
|
|
|
private: |
|
mpud::mpu_bus_t *mpu_bus_; |
|
mpud::MPU * mpu_; |
|
mpud::raw_axes_t accel_, gyro_, mag_; |
|
}; |
|
|
|
} // namespace io |
|
} // namespace ugv
|
|
|