OpenEV
Extending OpenCV to event-based vision
Loading...
Searching...
No Matches
imu.hpp
Go to the documentation of this file.
1
6#ifndef OPENEV_CORE_IMU_HPP
7#define OPENEV_CORE_IMU_HPP
8
10#include <ostream>
11#include <queue>
12#include <vector>
13
14namespace ev {
15[[maybe_unused]] constexpr bool USING_IMU_HPP = true;
16
20struct xyz_t {
21 double x{0};
22 double y{0};
23 double z{0};
24
25 [[nodiscard]] bool empty() const {
26 return x == 0 && y == 0 && z == 0;
27 }
28
29 void release() {
30 x = y = z = 0;
31 }
32
33 friend std::ostream &operator<<(std::ostream &os, const xyz_t &xyz) {
34 os << "(" << xyz.x << ", " << xyz.y << ", " << xyz.z << ")";
35 return os;
36 }
37};
38
48struct Imu {
49 TimeType t{0};
50 xyz_t linear_acceleration;
51 xyz_t angular_velocity;
52
53 [[nodiscard]] bool empty() const {
54 return t == 0 && linear_acceleration.empty() && angular_velocity.empty();
55 }
56
57 void release() {
58 t = 0;
59 linear_acceleration.release();
60 angular_velocity.release();
61 }
62
63 friend std::ostream &operator<<(std::ostream &os, const Imu &imu) {
64 os << "t: " << imu.t << ", acc: " << imu.linear_acceleration << ", gyr: " << imu.angular_velocity;
65 return os;
66 }
67};
68using ImuVector = std::vector<Imu>;
69using ImuQueue = std::queue<Imu>;
70
71} // namespace ev
72
73#endif // OPENEV_CORE_IMU_HPP
This struct is used to store IMU data from a DAVIS event camera.
Definition imu.hpp:48
This struct is used to store linear acceleration and angular velocity.
Definition imu.hpp:20
Basic event-based vision structures based on OpenCV components.