mars_lib 0.1.0.2abe2576fe7f
Modular and Robust Sensor-Fusion
Loading...
Searching...
No Matches
imu_measurement_type.h
Go to the documentation of this file.
1// Copyright (C) 2021 Christian Brommer, Control of Networked Systems, University of Klagenfurt, Austria.
2//
3// All rights reserved.
4//
5// This software is licensed under the terms of the BSD-2-Clause-License with
6// no commercial use allowed, the full terms of which are made available
7// in the LICENSE file. No license in patents is granted.
8//
9// You can contact the author at <christian.brommer@ieee.org>
10
11#ifndef IMU_MEASUREMENT_TYPE_H
12#define IMU_MEASUREMENT_TYPE_H
13
15#include <Eigen/Dense>
16#include <utility>
17
18namespace mars
19{
21{
22public:
23 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
24
25 Eigen::Vector3d linear_acceleration_{ 0, 0, 0 };
26 Eigen::Vector3d angular_velocity_{ 0, 0, 0 };
27
28 IMUMeasurementType() = default;
29
30 IMUMeasurementType(Eigen::Vector3d linear_acceleration, Eigen::Vector3d angular_velocity)
31 : linear_acceleration_(std::move(linear_acceleration)), angular_velocity_(std::move(angular_velocity))
32 {
33 }
34
35 bool operator==(const IMUMeasurementType& rhs) const
36 {
38 }
39
40 bool operator!=(const IMUMeasurementType& rhs) const
41 {
42 return !(*this == rhs);
43 }
44
45 static std::string get_csv_state_header_string()
46 {
47 std::stringstream os;
48 os << "t, ";
49 os << "a_x, a_y, a_z, ";
50 os << "w_x, w_y, w_z";
51
52 return os.str();
53 }
54
55 std::string to_csv_string(const double& timestamp) const
56 {
57 std::stringstream os;
58 os.precision(17);
59 os << timestamp;
60
61 os << ", " << linear_acceleration_(0) << ", " << linear_acceleration_(1) << ", " << linear_acceleration_(2);
62 os << ", " << angular_velocity_(0) << ", " << angular_velocity_(1) << ", " << angular_velocity_(2);
63
64 return os.str();
65 }
66};
67} // namespace mars
68#endif // IMU_MEASUREMENT_TYPE_H
Definition measurement_base_class.h:20
Definition imu_measurement_type.h:21
IMUMeasurementType(Eigen::Vector3d linear_acceleration, Eigen::Vector3d angular_velocity)
Definition imu_measurement_type.h:30
bool operator==(const IMUMeasurementType &rhs) const
Definition imu_measurement_type.h:35
static std::string get_csv_state_header_string()
Definition imu_measurement_type.h:45
Eigen::Vector3d angular_velocity_
Definition imu_measurement_type.h:26
bool operator!=(const IMUMeasurementType &rhs) const
Definition imu_measurement_type.h:40
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Vector3d linear_acceleration_
Definition imu_measurement_type.h:25
std::string to_csv_string(const double &timestamp) const
Definition imu_measurement_type.h:55
Definition buffer.h:27