mars_lib 0.1.0.2abe2576fe7f
Modular and Robust Sensor-Fusion
Loading...
Searching...
No Matches
attitude_measurement_type.h
Go to the documentation of this file.
1// Copyright (C) 2021 Martin Scheiber and Christian Brommer, Control of Networked Systems, University of Klagenfurt,
2// Austria.
3//
4// All rights reserved.
5//
6// This software is licensed under the terms of the BSD-2-Clause-License with
7// no commercial use allowed, the full terms of which are made available
8// in the LICENSE file. No license in patents is granted.
9//
10// You can contact the authors at <martin.scheiber@ieee.org>
11// and <christian.brommer@ieee.org>.
12
13#ifndef ATTITUDE_MEASUREMENT_TYPE_H
14#define ATTITUDE_MEASUREMENT_TYPE_H
15
19#include <Eigen/Dense>
20#include <iostream>
21#include <utility>
22
23namespace mars
24{
26{
27public:
28 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
29
30 // Eigen::Vector2d rp_vector_; ///< Raw attitude measurement [roll pitch]
32
34
35 // AttitudeMeasurementType(Eigen::Vector2d rp_vector) : rp_vector_(std::move(rp_vector))
36 // {
37 // }
38
39 // since we do not know what order the roll pitch rotation is, we expect a rotation matrix and extract this ourselves
40 // AttitudeMeasurementType(Eigen::Matrix3d rot_mat)
41 // {
42 // Eigen::Vector3d rpy = mars::Utils::RPYFromRotMat(rot_mat);
43 // rp_vector_ << rpy(0), rpy(1);
44
45 // // DEBUG
46 // std::cout << "[SensorType]: attitude with rpy [deg]: [" << rpy.transpose() * 180.0/M_PI << "]" << std::endl;
47 // }
48
49 AttitudeMeasurementType(const Eigen::Matrix3d& rot_mat) : attitude_(rot_mat)
50 {
51 }
52
53 static std::string get_csv_state_header_string()
54 {
55 std::stringstream os;
56 os << "t, ";
57 os << "q_w, q_x, q_y, q_z";
58
59 return os.str();
60 }
61
62 std::string to_csv_string(const double& timestamp) const
63 {
64 std::stringstream os;
65 os.precision(17);
66 os << timestamp;
67
68 os << ", " << attitude_.quaternion_.w() << ", " << attitude_.quaternion_.x() << ", " << attitude_.quaternion_.y()
69 << ", " << attitude_.quaternion_.z();
70
71 return os.str();
72 }
73};
74} // namespace mars
75
76#endif // ATTITUDE_MEASUREMENT_TYPE_H
Definition attitude_measurement_type.h:26
static std::string get_csv_state_header_string()
Definition attitude_measurement_type.h:53
AttitudeMeasurementType(const Eigen::Matrix3d &rot_mat)
Definition attitude_measurement_type.h:49
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Attitude attitude_
Definition attitude_measurement_type.h:31
std::string to_csv_string(const double &timestamp) const
Definition attitude_measurement_type.h:62
Definition measurement_base_class.h:20
Definition buffer.h:27
The Attitude struct.
Definition attitude_conversion.h:23
Eigen::Quaterniond quaternion_
Definition attitude_conversion.h:48