[3] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[3] | 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>
|
---|
[173] | 17 | #include <Vector3D.h>
|
---|
[3] | 18 |
|
---|
| 19 | namespace flair {
|
---|
[51] | 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 | }
|
---|
[3] | 31 | }
|
---|
| 32 |
|
---|
| 33 | class Ahrs_impl;
|
---|
| 34 |
|
---|
[15] | 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;
|
---|
[3] | 46 |
|
---|
[15] | 47 | public:
|
---|
| 48 | /*!
|
---|
| 49 | * \brief Constructor
|
---|
| 50 | *
|
---|
| 51 | * Construct an Imu.
|
---|
[137] | 52 | * It will be child of the FrameworkManager.
|
---|
[15] | 53 | *
|
---|
| 54 | * \param name name
|
---|
| 55 | */
|
---|
[137] | 56 | Imu(std::string name);
|
---|
[3] | 57 |
|
---|
[15] | 58 | /*!
|
---|
| 59 | * \brief Constructor
|
---|
| 60 | *
|
---|
| 61 | * Construct an Imu. \n
|
---|
| 62 | * This contructor must only be called for a simulated device.
|
---|
| 63 | *
|
---|
| 64 | * \param parent parent
|
---|
| 65 | * \param name name
|
---|
| 66 | */
|
---|
| 67 | Imu(const core::IODevice *parent, std::string name);
|
---|
[3] | 68 |
|
---|
[15] | 69 | /*!
|
---|
| 70 | * \brief Destructor
|
---|
| 71 | *
|
---|
| 72 | */
|
---|
| 73 | ~Imu();
|
---|
[3] | 74 |
|
---|
[15] | 75 | /*!
|
---|
| 76 | * \brief Setup Layout
|
---|
| 77 | *
|
---|
| 78 | * \return setup Layout
|
---|
| 79 | */
|
---|
| 80 | gui::Layout *GetLayout(void) const;
|
---|
[3] | 81 |
|
---|
[15] | 82 | /*!
|
---|
| 83 | * \brief Lock user interface
|
---|
| 84 | *
|
---|
| 85 | */
|
---|
| 86 | void LockUserInterface(void) const;
|
---|
[3] | 87 |
|
---|
[15] | 88 | /*!
|
---|
| 89 | * \brief Unlock user interface
|
---|
| 90 | *
|
---|
| 91 | */
|
---|
| 92 | void UnlockUserInterface(void) const;
|
---|
[3] | 93 |
|
---|
[15] | 94 | /*!
|
---|
| 95 | * \brief Use default plot
|
---|
| 96 | *
|
---|
| 97 | */
|
---|
| 98 | void UseDefaultPlot(void);
|
---|
[3] | 99 |
|
---|
[15] | 100 | /*!
|
---|
| 101 | * \brief Plot tab
|
---|
| 102 | *
|
---|
| 103 | * \return plot Tab
|
---|
| 104 | */
|
---|
| 105 | gui::Tab *GetPlotTab(void) const;
|
---|
[3] | 106 |
|
---|
[99] | 107 | /*!
|
---|
| 108 | * \brief Get OneAxisRotation
|
---|
| 109 | *
|
---|
| 110 | * \return fixed rotation of the imu
|
---|
| 111 | */
|
---|
| 112 | core::OneAxisRotation *GetOneAxisRotation(void) const;
|
---|
| 113 |
|
---|
| 114 |
|
---|
[15] | 115 | protected:
|
---|
| 116 | /*!
|
---|
| 117 | * \brief Setup GroupBox
|
---|
| 118 | *
|
---|
| 119 | * \return setup GroupBox
|
---|
| 120 | */
|
---|
| 121 | gui::GroupBox *GetGroupBox(void) const;
|
---|
[3] | 122 |
|
---|
[15] | 123 | /*!
|
---|
[173] | 124 | * \brief ApplyRotation
|
---|
[15] | 125 | *
|
---|
[173] | 126 | * The reimplemented class must call this function to rotate IMU datas, before filling the ImuData. \n
|
---|
[15] | 127 | * It handles the data rotation if it was defined.
|
---|
| 128 | *
|
---|
[173] | 129 | * \param vector vector to apply rotation to
|
---|
[15] | 130 | */
|
---|
[173] | 131 | void ApplyRotation(core::Vector3Df& vector);
|
---|
| 132 |
|
---|
| 133 | /*!
|
---|
| 134 | * \brief ApplyRotation
|
---|
| 135 | *
|
---|
| 136 | * The reimplemented class must call this function to rotate IMU datas, before filling the ImuData. \n
|
---|
| 137 | * It handles the data rotation if it was defined.
|
---|
| 138 | *
|
---|
| 139 | * \param quaternion quaternion to apply rotation to
|
---|
| 140 | */
|
---|
| 141 | void ApplyRotation(core::Quaternion& quaternion);
|
---|
[3] | 142 |
|
---|
[15] | 143 | /*!
|
---|
| 144 | * \brief Get imu datas
|
---|
| 145 | *
|
---|
| 146 | * \param imuData imu datas
|
---|
| 147 | */
|
---|
| 148 | void GetDatas(core::ImuData **imuData) const;
|
---|
[3] | 149 |
|
---|
[15] | 150 | private:
|
---|
| 151 | gui::Tab *mainTab, *sensorTab, *plotTab;
|
---|
| 152 | gui::TabWidget *tab;
|
---|
| 153 | gui::GroupBox *setupGroupbox;
|
---|
| 154 | core::OneAxisRotation *rotation;
|
---|
| 155 | core::ImuData *imuData;
|
---|
[3] | 156 |
|
---|
[15] | 157 | gui::DataPlot1D *axPlot, *ayPlot, *azPlot;
|
---|
| 158 | gui::DataPlot1D *gxPlot, *gyPlot, *gzPlot;
|
---|
| 159 | gui::DataPlot1D *mxPlot, *myPlot, *mzPlot;
|
---|
| 160 | };
|
---|
[3] | 161 | } // end namespace sensor
|
---|
| 162 | } // end namespace flair
|
---|
| 163 |
|
---|
| 164 | #endif // IMU_H
|
---|