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>
12 #include <rtabmap/utilite/UEvent.h>
13 #include <rtabmap/core/Transform.h>
14 
15 namespace rtabmap {
16 
17 
18 // Correspondence class to sensor_msgs/IMU
19 class IMU
20 {
21 public:
22  IMU() {}
23  IMU(const cv::Vec4d & orientation, // qx qy qz qw
24  const cv::Mat & orientationCovariance,
25  const cv::Vec3d & angularVelocity,
26  const cv::Mat & angularVelocityCovariance,
27  const cv::Vec3d & linearAcceleration,
28  const cv::Mat & linearAccelerationCovariance,
37  {
38  }
39  IMU(const cv::Vec3d & angularVelocity,
40  const cv::Mat & angularVelocityCovariance,
41  const cv::Vec3d & linearAcceleration,
42  const cv::Mat & linearAccelerationCovariance,
49  {
50  }
51 
52  // qx qy qz qw
53  const cv::Vec4d & orientation() const {return orientation_;}
54  const cv::Mat & orientationCovariance() const {return orientationCovariance_;} // 3x3 double Row major about x, y, z axes, empty if orientation is not set
55 
56  const cv::Vec3d & angularVelocity() const {return angularVelocity_;}
57  const cv::Mat & angularVelocityCovariance() const {return angularVelocityCovariance_;} // 3x3 double Row major about x, y, z axes, empty if angularVelocity is not set
58 
59  const cv::Vec3d linearAcceleration() const {return linearAcceleration_;}
60  const cv::Mat & linearAccelerationCovariance() const {return linearAccelerationCovariance_;} // 3x3 double Row major x, y z, empty if linearAcceleration is not set
61 
62  const Transform & localTransform() const {return localTransform_;}
63 
64  // apply local transform rotation to data, and set Identity rotation for local transform
65  void convertToBaseFrame();
66 
67  bool empty() const
68  {
69  return localTransform_.isNull();
70  }
71 
72 private:
73  cv::Vec4d orientation_;
74  cv::Mat orientationCovariance_; // 3x3 double Row major about x, y, z axes, empty if orientation is not set
75 
76  cv::Vec3d angularVelocity_;
77  cv::Mat angularVelocityCovariance_; // 3x3 double Row major about x, y, z axes, empty if angularVelocity is not set
78 
80  cv::Mat linearAccelerationCovariance_; // 3x3 double Row major x, y z, empty if linearAcceleration is not set
81 
83 };
84 
85 class IMUEvent : public UEvent
86 {
87 public:
89  stamp_(0.0)
90  {}
91  IMUEvent(const IMU & data, double stamp) :
92  data_(data),
93  stamp_(stamp)
94  {
95  }
96  virtual std::string getClassName() const {return "IMUEvent";}
97  const IMU & getData() const {return data_;}
98  double getStamp() const {return stamp_;}
99 
100 private:
102  double stamp_;
103 };
104 
105 }
106 
107 
108 #endif /* IMU_H_ */
rtabmap::IMU::linearAcceleration
const cv::Vec3d linearAcceleration() const
Definition: IMU.h:59
rtabmap::IMU::empty
bool empty() const
Definition: IMU.h:67
rtabmap::IMU::linearAccelerationCovariance_
cv::Mat linearAccelerationCovariance_
Definition: IMU.h:80
rtabmap::Transform::getIdentity
static Transform getIdentity()
Definition: Transform.cpp:411
rtabmap::IMU::angularVelocity_
cv::Vec3d angularVelocity_
Definition: IMU.h:76
rtabmap::IMUEvent
Definition: IMU.h:85
Transform.h
rtabmap::IMU::angularVelocityCovariance
const cv::Mat & angularVelocityCovariance() const
Definition: IMU.h:57
rtabmap::IMU::localTransform_
Transform localTransform_
Definition: IMU.h:82
rtabmap::IMU::IMU
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:23
rtabmap::IMUEvent::data_
IMU data_
Definition: IMU.h:101
rtabmap::IMUEvent::getStamp
double getStamp() const
Definition: IMU.h:98
rtabmap::IMU::localTransform
const Transform & localTransform() const
Definition: IMU.h:62
rtabmap::Transform::isNull
bool isNull() const
Definition: Transform.cpp:107
rtabmap::IMUEvent::IMUEvent
IMUEvent(const IMU &data, double stamp)
Definition: IMU.h:91
rtabmap::IMUEvent::stamp_
double stamp_
Definition: IMU.h:102
rtabmap::IMU::linearAccelerationCovariance
const cv::Mat & linearAccelerationCovariance() const
Definition: IMU.h:60
UEvent
Definition: UEvent.h:57
rtabmap::IMU
Definition: IMU.h:19
UEvent.h
data
int data[]
rtabmap::IMU::linearAcceleration_
cv::Vec3d linearAcceleration_
Definition: IMU.h:79
rtabmap::IMU::IMU
IMU()
Definition: IMU.h:22
rtabmap::IMU::orientationCovariance_
cv::Mat orientationCovariance_
Definition: IMU.h:74
rtabmap::IMU::orientation
const cv::Vec4d & orientation() const
Definition: IMU.h:53
rtabmap::IMU::IMU
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:39
rtabmap::IMU::orientation_
cv::Vec4d orientation_
Definition: IMU.h:73
rtabmap::IMUEvent::IMUEvent
IMUEvent()
Definition: IMU.h:88
rtabmap::Transform
Definition: Transform.h:41
rtabmap::IMU::convertToBaseFrame
void convertToBaseFrame()
Definition: IMU.cpp:33
rtabmap::IMU::angularVelocityCovariance_
cv::Mat angularVelocityCovariance_
Definition: IMU.h:77
rtabmap::IMU::angularVelocity
const cv::Vec3d & angularVelocity() const
Definition: IMU.h:56
rtabmap::IMUEvent::getData
const IMU & getData() const
Definition: IMU.h:97
rtabmap
Definition: CameraARCore.cpp:35
rtabmap::IMU::orientationCovariance
const cv::Mat & orientationCovariance() const
Definition: IMU.h:54
rtabmap::IMUEvent::getClassName
virtual std::string getClassName() const
Definition: IMU.h:96


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:11