mars_lib  0.1.0.3dc76ee85e09
Modular and Robust Sensor-Fusion
mag_sensor_state_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 MAG_SENSOR_STATE_TYPE_H
12 #define MAG_SENSOR_STATE_TYPE_H
13 
15 #include <Eigen/Dense>
16 
17 namespace mars
18 {
20 {
21 public:
22  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
23 
24  Eigen::Vector3d mag_;
25  Eigen::Quaterniond q_im_;
26 
27  MagSensorStateType() : BaseStates(6) // cov size
28  {
29  mag_.setZero();
30  q_im_.setIdentity();
31  }
32 
33  static std::string get_csv_state_header_string()
34  {
35  std::stringstream os;
36  os << "t, ";
37  os << "mag_w_x, mag_w_y, mag_w_z, ";
38  os << "q_im_w, q_im_x, q_im_y, q_im_z";
39 
40  return os.str();
41  }
42 
48  std::string to_csv_string(const double& timestamp) const
49  {
50  std::stringstream os;
51  os.precision(17);
52  os << timestamp;
53 
54  os << ", " << mag_(0) << ", " << mag_(1) << ", " << mag_(2);
55  Eigen::Vector4d q_im = q_im_.coeffs(); // x y z w
56  os << ", " << q_im(3) << ", " << q_im(0) << ", " << q_im(1) << ", " << q_im(2);
57 
58  return os.str();
59  }
60 };
61 } // namespace mars
62 #endif // MAG_SENSOR_STATE_TYPE_H
The BaseStates class is used to ensure that all sensor data classes define a covariance size for the ...
Definition: base_states.h:23
Definition: mag_sensor_state_type.h:20
Eigen::Quaterniond q_im_
Definition: mag_sensor_state_type.h:25
std::string to_csv_string(const double &timestamp) const
to_csv_string export state to single csv string
Definition: mag_sensor_state_type.h:48
MagSensorStateType()
Definition: mag_sensor_state_type.h:27
static std::string get_csv_state_header_string()
Definition: mag_sensor_state_type.h:33
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Vector3d mag_
Definition: mag_sensor_state_type.h:24
Definition: buffer.h:27