[4] | 1 | // %flair:license{
|
---|
[13] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[4] | 4 | // %flair:license}
|
---|
| 5 | /*!
|
---|
| 6 | * \file Imu.h
|
---|
| 7 | * \brief Base class for Imu
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2014/01/16
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef IMU_H
|
---|
| 14 | #define IMU_H
|
---|
| 15 |
|
---|
| 16 | #include <IODevice.h>
|
---|
[50] | 17 | #include <Vector3D.h>
|
---|
[4] | 18 |
|
---|
| 19 | namespace flair {
|
---|
[32] | 20 | namespace core {
|
---|
| 21 | class ImuData;
|
---|
| 22 | class OneAxisRotation;
|
---|
| 23 | }
|
---|
| 24 | namespace gui {
|
---|
| 25 | class Tab;
|
---|
| 26 | class TabWidget;
|
---|
| 27 | class GroupBox;
|
---|
| 28 | class Layout;
|
---|
| 29 | class DataPlot1D;
|
---|
| 30 | }
|
---|
[4] | 31 | }
|
---|
| 32 |
|
---|
| 33 | class Ahrs_impl;
|
---|
| 34 |
|
---|
[13] | 35 | namespace flair {
|
---|
| 36 | namespace sensor {
|
---|
| 37 | /*! \class Imu
|
---|
| 38 | *
|
---|
| 39 | * \brief Base class for Imu
|
---|
| 40 | *
|
---|
| 41 | * Use this class to define a custom Imu.
|
---|
| 42 | *
|
---|
| 43 | */
|
---|
| 44 | class Imu : public core::IODevice {
|
---|
| 45 | friend class ::Ahrs_impl;
|
---|
[4] | 46 |
|
---|
[13] | 47 | public:
|
---|
| 48 | /*!
|
---|
| 49 | * \brief Constructor
|
---|
| 50 | *
|
---|
| 51 | * Construct an Imu.
|
---|
[50] | 52 | * It will be child of the FrameworkManager.
|
---|
[13] | 53 | *
|
---|
| 54 | * \param name name
|
---|
[62] | 55 | * \param needRotation true will enable post rotation in GCS. Post rotation must be applied manually in reimplemented code
|
---|
[13] | 56 | */
|
---|
[62] | 57 | Imu(std::string name,bool needRotation=true);
|
---|
[4] | 58 |
|
---|
[13] | 59 | /*!
|
---|
| 60 | * \brief Constructor
|
---|
| 61 | *
|
---|
| 62 | * Construct an Imu. \n
|
---|
| 63 | * This contructor must only be called for a simulated device.
|
---|
| 64 | *
|
---|
| 65 | * \param parent parent
|
---|
| 66 | * \param name name
|
---|
| 67 | */
|
---|
| 68 | Imu(const core::IODevice *parent, std::string name);
|
---|
[4] | 69 |
|
---|
[13] | 70 | /*!
|
---|
| 71 | * \brief Destructor
|
---|
| 72 | *
|
---|
| 73 | */
|
---|
| 74 | ~Imu();
|
---|
[50] | 75 |
|
---|
| 76 | /*!
|
---|
| 77 | * \brief Get IMU datas
|
---|
| 78 | *
|
---|
| 79 | * \return ImuData
|
---|
| 80 | */
|
---|
| 81 | const core::ImuData *GetDatas(void) const;
|
---|
[4] | 82 |
|
---|
[50] | 83 |
|
---|
[13] | 84 | /*!
|
---|
| 85 | * \brief Setup Layout
|
---|
| 86 | *
|
---|
| 87 | * \return setup Layout
|
---|
| 88 | */
|
---|
| 89 | gui::Layout *GetLayout(void) const;
|
---|
[4] | 90 |
|
---|
[13] | 91 | /*!
|
---|
| 92 | * \brief Lock user interface
|
---|
| 93 | *
|
---|
| 94 | */
|
---|
| 95 | void LockUserInterface(void) const;
|
---|
[4] | 96 |
|
---|
[13] | 97 | /*!
|
---|
| 98 | * \brief Unlock user interface
|
---|
| 99 | *
|
---|
| 100 | */
|
---|
| 101 | void UnlockUserInterface(void) const;
|
---|
[4] | 102 |
|
---|
[13] | 103 | /*!
|
---|
| 104 | * \brief Use default plot
|
---|
| 105 | *
|
---|
| 106 | */
|
---|
| 107 | void UseDefaultPlot(void);
|
---|
[4] | 108 |
|
---|
[13] | 109 | /*!
|
---|
| 110 | * \brief Plot tab
|
---|
| 111 | *
|
---|
| 112 | * \return plot Tab
|
---|
| 113 | */
|
---|
| 114 | gui::Tab *GetPlotTab(void) const;
|
---|
[4] | 115 |
|
---|
[36] | 116 | /*!
|
---|
| 117 | * \brief Get OneAxisRotation
|
---|
| 118 | *
|
---|
| 119 | * \return fixed rotation of the imu
|
---|
| 120 | */
|
---|
| 121 | core::OneAxisRotation *GetOneAxisRotation(void) const;
|
---|
| 122 |
|
---|
| 123 |
|
---|
[13] | 124 | protected:
|
---|
| 125 | /*!
|
---|
| 126 | * \brief Setup GroupBox
|
---|
| 127 | *
|
---|
| 128 | * \return setup GroupBox
|
---|
| 129 | */
|
---|
| 130 | gui::GroupBox *GetGroupBox(void) const;
|
---|
[4] | 131 |
|
---|
[13] | 132 | /*!
|
---|
[50] | 133 | * \brief ApplyRotation
|
---|
[13] | 134 | *
|
---|
[50] | 135 | * The reimplemented class must call this function to rotate IMU datas, before filling the ImuData. \n
|
---|
[13] | 136 | * It handles the data rotation if it was defined.
|
---|
| 137 | *
|
---|
[50] | 138 | * \param vector vector to apply rotation to
|
---|
[13] | 139 | */
|
---|
[50] | 140 | void ApplyRotation(core::Vector3Df& vector);
|
---|
| 141 |
|
---|
| 142 | /*!
|
---|
| 143 | * \brief ApplyRotation
|
---|
| 144 | *
|
---|
| 145 | * The reimplemented class must call this function to rotate IMU datas, before filling the ImuData. \n
|
---|
| 146 | * It handles the data rotation if it was defined.
|
---|
| 147 | *
|
---|
| 148 | * \param quaternion quaternion to apply rotation to
|
---|
| 149 | */
|
---|
| 150 | void ApplyRotation(core::Quaternion& quaternion);
|
---|
[4] | 151 |
|
---|
[13] | 152 | /*!
|
---|
| 153 | * \brief Get imu datas
|
---|
| 154 | *
|
---|
[50] | 155 | * Can be used by dervied class to fill core::ImuData
|
---|
| 156 | *
|
---|
[13] | 157 | * \param imuData imu datas
|
---|
| 158 | */
|
---|
| 159 | void GetDatas(core::ImuData **imuData) const;
|
---|
[4] | 160 |
|
---|
[13] | 161 | private:
|
---|
| 162 | gui::Tab *mainTab, *sensorTab, *plotTab;
|
---|
| 163 | gui::TabWidget *tab;
|
---|
| 164 | gui::GroupBox *setupGroupbox;
|
---|
| 165 | core::OneAxisRotation *rotation;
|
---|
| 166 | core::ImuData *imuData;
|
---|
[4] | 167 |
|
---|
[13] | 168 | gui::DataPlot1D *axPlot, *ayPlot, *azPlot;
|
---|
| 169 | gui::DataPlot1D *gxPlot, *gyPlot, *gzPlot;
|
---|
| 170 | gui::DataPlot1D *mxPlot, *myPlot, *mzPlot;
|
---|
| 171 | };
|
---|
[4] | 172 | } // end namespace sensor
|
---|
| 173 | } // end namespace flair
|
---|
| 174 |
|
---|
| 175 | #endif // IMU_H
|
---|