mars_lib  0.1.0.3dc76ee85e09
Modular and Robust Sensor-Fusion
vision_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 VISIONSENSORSTATETYPE_H
12 #define VISIONSENSORSTATETYPE_H
13 
15 #include <Eigen/Dense>
16 
17 namespace mars
18 {
20 {
21 public:
22  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
23 
24  Eigen::Vector3d p_vw_;
25  Eigen::Quaternion<double> q_vw_;
26  Eigen::Vector3d p_ic_;
27  Eigen::Quaternion<double> q_ic_;
28  double lambda_;
29 
30  VisionSensorStateType() : BaseStates(13) // size of covariance
31  {
32  p_vw_.setZero(); // 3
33  q_vw_.setIdentity(); // 4-1
34  p_ic_.setZero(); // 3
35  q_ic_.setIdentity(); // 4-1
36  lambda_ = 1; // 1
37  }
38 
39  static std::string get_csv_state_header_string()
40  {
41  std::stringstream os;
42  os << "t, ";
43  os << "p_vw_x, p_vw_y, p_vw_z, ";
44  os << "q_vw_w, q_vw_x, q_vw_y, q_vw_z,";
45  os << "p_ic_x, p_ic_y, p_ic_z, ";
46  os << "q_ic_w, q_ic_x, q_ic_y, q_ic_z,";
47  os << "lambda";
48 
49  return os.str();
50  }
51 
52  std::string to_csv_string(const double& timestamp) const
53  {
54  std::stringstream os;
55  os.precision(17);
56  os << timestamp;
57 
58  os << ", " << p_vw_(0) << ", " << p_vw_(1) << ", " << p_vw_(2);
59 
60  Eigen::Vector4d q_vw = q_vw_.coeffs(); // x y z w
61  os << ", " << q_vw(3) << ", " << q_vw(0) << ", " << q_vw(1) << ", " << q_vw(2);
62 
63  os << ", " << p_ic_(0) << ", " << p_ic_(1) << ", " << p_ic_(2);
64 
65  Eigen::Vector4d q_ic = q_ic_.coeffs(); // x y z w
66  os << ", " << q_ic(3) << ", " << q_ic(0) << ", " << q_ic(1) << ", " << q_ic(2);
67 
68  os << ", " << lambda_;
69 
70  return os.str();
71  }
72 };
73 } // namespace mars
74 #endif // VISIONSENSORSTATETYPE_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: vision_sensor_state_type.h:20
double lambda_
Definition: vision_sensor_state_type.h:28
Eigen::Quaternion< double > q_vw_
Definition: vision_sensor_state_type.h:25
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Vector3d p_vw_
Definition: vision_sensor_state_type.h:24
Eigen::Quaternion< double > q_ic_
Definition: vision_sensor_state_type.h:27
std::string to_csv_string(const double &timestamp) const
Definition: vision_sensor_state_type.h:52
static std::string get_csv_state_header_string()
Definition: vision_sensor_state_type.h:39
VisionSensorStateType()
Definition: vision_sensor_state_type.h:30
Eigen::Vector3d p_ic_
Definition: vision_sensor_state_type.h:26
Definition: buffer.h:27