IMU.h
Go to the documentation of this file.
1 /*
2  * IMU.h
3  *
4  * Created on: 2018-03-05
5  * Author: mathieu
6  */
7 
8 #ifndef IMU_H_
9 #define IMU_H_
10 
11 #include <opencv2/core/core.hpp>
13 
14 namespace rtabmap {
15 
16 
17 // Correspondence class to sensor_msgs/IMU
18 class IMU
19 {
20 public:
21  IMU() {}
22  IMU(const cv::Vec4d & orientation, // qx qy qz qw
23  const cv::Mat & orientationCovariance,
24  const cv::Vec3d & angularVelocity,
25  const cv::Mat & angularVelocityCovariance,
26  const cv::Vec3d & linearAcceleration,
27  const cv::Mat & linearAccelerationCovariance,
29  orientation_(orientation),
30  orientationCovariance_(orientationCovariance),
31  angularVelocity_(angularVelocity),
32  angularVelocityCovariance_(angularVelocityCovariance),
33  linearAcceleration_(linearAcceleration),
34  linearAccelerationCovariance_(linearAccelerationCovariance),
36  {
37  }
38  IMU(const cv::Vec3d & angularVelocity,
39  const cv::Mat & angularVelocityCovariance,
40  const cv::Vec3d & linearAcceleration,
41  const cv::Mat & linearAccelerationCovariance,
43  angularVelocity_(angularVelocity),
44  angularVelocityCovariance_(angularVelocityCovariance),
45  linearAcceleration_(linearAcceleration),
46  linearAccelerationCovariance_(linearAccelerationCovariance),
48  {
49  }
50 
51  // qx qy qz qw
52  const cv::Vec4d & orientation() const {return orientation_;}
53  const cv::Mat & orientationCovariance() const {return orientationCovariance_;} // 3x3 double Row major about x, y, z axes, empty if orientation is not set
54 
55  const cv::Vec3d & angularVelocity() const {return angularVelocity_;}
56  const cv::Mat & angularVelocityCovariance() const {return angularVelocityCovariance_;} // 3x3 double Row major about x, y, z axes, empty if angularVelocity is not set
57 
58  const cv::Vec3d linearAcceleration() const {return linearAcceleration_;}
59  const cv::Mat & linearAccelerationCovariance() const {return linearAccelerationCovariance_;} // 3x3 double Row major x, y z, empty if linearAcceleration is not set
60 
61  const Transform & localTransform() const {return localTransform_;}
62 
63  bool empty() const
64  {
65  return localTransform_.isNull();
66  }
67 
68 private:
69  cv::Vec4d orientation_;
70  cv::Mat orientationCovariance_; // 3x3 double Row major about x, y, z axes, empty if orientation is not set
71 
72  cv::Vec3d angularVelocity_;
73  cv::Mat angularVelocityCovariance_; // 3x3 double Row major about x, y, z axes, empty if angularVelocity is not set
74 
76  cv::Mat linearAccelerationCovariance_; // 3x3 double Row major x, y z, empty if linearAcceleration is not set
77 
79 };
80 
81 class IMUEvent : public UEvent
82 {
83 public:
85  stamp_(0.0)
86  {}
87  IMUEvent(const IMU & data, double stamp) :
88  data_(data),
89  stamp_(stamp)
90  {
91  }
92  virtual std::string getClassName() const {return "IMUEvent";}
93  const IMU & getData() const {return data_;}
94  double getStamp() const {return stamp_;}
95 
96 private:
98  double stamp_;
99 };
100 
101 }
102 
103 
104 #endif /* IMU_H_ */
IMU(const cv::Vec3d &angularVelocity, const cv::Mat &angularVelocityCovariance, const cv::Vec3d &linearAcceleration, const cv::Mat &linearAccelerationCovariance, const Transform &localTransform=Transform::getIdentity())
Definition: IMU.h:38
virtual std::string getClassName() const
Definition: IMU.h:92
const cv::Vec4d & orientation() const
Definition: IMU.h:52
Definition: UEvent.h:57
cv::Vec3d angularVelocity_
Definition: IMU.h:72
bool empty() const
Definition: IMU.h:63
const cv::Mat & linearAccelerationCovariance() const
Definition: IMU.h:59
cv::Mat angularVelocityCovariance_
Definition: IMU.h:73
cv::Mat linearAccelerationCovariance_
Definition: IMU.h:76
static Transform getIdentity()
Definition: Transform.cpp:380
cv::Vec4d orientation_
Definition: IMU.h:69
const cv::Mat & angularVelocityCovariance() const
Definition: IMU.h:56
cv::Mat orientationCovariance_
Definition: IMU.h:70
bool isNull() const
Definition: Transform.cpp:107
IMUEvent(const IMU &data, double stamp)
Definition: IMU.h:87
cv::Vec3d linearAcceleration_
Definition: IMU.h:75
const cv::Vec3d linearAcceleration() const
Definition: IMU.h:58
const IMU & getData() const
Definition: IMU.h:93
IMU(const cv::Vec4d &orientation, const cv::Mat &orientationCovariance, const cv::Vec3d &angularVelocity, const cv::Mat &angularVelocityCovariance, const cv::Vec3d &linearAcceleration, const cv::Mat &linearAccelerationCovariance, const Transform &localTransform=Transform::getIdentity())
Definition: IMU.h:22
double stamp_
Definition: IMU.h:98
IMU()
Definition: IMU.h:21
const Transform & localTransform() const
Definition: IMU.h:61
Transform localTransform_
Definition: IMU.h:78
double getStamp() const
Definition: IMU.h:94
ULogger class and convenient macros.
const cv::Mat & orientationCovariance() const
Definition: IMU.h:53
const cv::Vec3d & angularVelocity() const
Definition: IMU.h:55


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Dec 14 2020 03:34:59