Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IMU_H_
00009 #define IMU_H_
00010
00011 #include <opencv2/core/core.hpp>
00012 #include <rtabmap/utilite/ULogger.h>
00013
00014 namespace rtabmap {
00015
00016
00017
00018 class IMU
00019 {
00020 public:
00021 IMU() {}
00022 IMU(const cv::Vec4d & orientation,
00023 const cv::Mat & orientationCovariance,
00024 const cv::Vec3d & angularVelocity,
00025 const cv::Mat & angularVelocityCovariance,
00026 const cv::Vec3d & linearAcceleration,
00027 const cv::Mat & linearAccelerationCovariance,
00028 const Transform & localTransform = Transform::getIdentity()) :
00029 orientation_(orientation),
00030 orientationCovariance_(orientationCovariance),
00031 angularVelocity_(angularVelocity),
00032 angularVelocityCovariance_(angularVelocityCovariance),
00033 linearAcceleration_(linearAcceleration),
00034 linearAccelerationCovariance_(linearAccelerationCovariance),
00035 localTransform_(localTransform)
00036 {
00037 }
00038 IMU(const cv::Vec3d & angularVelocity,
00039 const cv::Mat & angularVelocityCovariance,
00040 const cv::Vec3d & linearAcceleration,
00041 const cv::Mat & linearAccelerationCovariance,
00042 const Transform & localTransform = Transform::getIdentity()) :
00043 angularVelocity_(angularVelocity),
00044 angularVelocityCovariance_(angularVelocityCovariance),
00045 linearAcceleration_(linearAcceleration),
00046 linearAccelerationCovariance_(linearAccelerationCovariance),
00047 localTransform_(localTransform)
00048 {
00049 }
00050
00051 const cv::Vec4d & orientation() const {return orientation_;}
00052 const cv::Mat & orientationCovariance() const {return orientationCovariance_;}
00053
00054 const cv::Vec3d & angularVelocity() const {return angularVelocity_;}
00055 const cv::Mat & angularVelocityCovariance() const {return angularVelocityCovariance_;}
00056
00057 const cv::Vec3d linearAcceleration() const {return linearAcceleration_;}
00058 const cv::Mat & linearAccelerationCovariance() const {return linearAccelerationCovariance_;}
00059
00060 const Transform & localTransform() const {return localTransform_;}
00061
00062 bool empty() const
00063 {
00064 return localTransform_.isNull();
00065 }
00066
00067
00068 private:
00069 cv::Vec4d orientation_;
00070 cv::Mat orientationCovariance_;
00071
00072 cv::Vec3d angularVelocity_;
00073 cv::Mat angularVelocityCovariance_;
00074
00075 cv::Vec3d linearAcceleration_;
00076 cv::Mat linearAccelerationCovariance_;
00077
00078 Transform localTransform_;
00079 };
00080
00081 class IMUEvent : public UEvent
00082 {
00083 public:
00084 IMUEvent() :
00085 stamp_(0.0)
00086 {}
00087 IMUEvent(const IMU & data, double stamp) :
00088 data_(data),
00089 stamp_(stamp)
00090 {
00091 }
00092 virtual std::string getClassName() const {return "IMUEvent";}
00093 const IMU & getData() const {return data_;}
00094 double getStamp() const {return stamp_;}
00095
00096 private:
00097 IMU data_;
00098 double stamp_;
00099 };
00100
00101 }
00102
00103
00104 #endif