[397] | 1 | // %flair:license{
|
---|
| 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
| 4 | // %flair:license}
|
---|
| 5 | /*!
|
---|
| 6 | * \file IpcImu.h
|
---|
| 7 | * \brief Class for an ipc Imu
|
---|
| 8 | * \author Sébastien Ambroziak, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2021/03/03
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef IPCIMU_H
|
---|
| 14 | #define IPCIMU_H
|
---|
| 15 |
|
---|
| 16 | #include <Imu.h>
|
---|
| 17 | #include <Thread.h>
|
---|
| 18 |
|
---|
| 19 | namespace flair {
|
---|
| 20 | namespace core {
|
---|
| 21 | class AhrsData;
|
---|
| 22 | }
|
---|
| 23 | namespace gui {
|
---|
| 24 | class SpinBox;
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | namespace ipc{
|
---|
| 29 | namespace type{
|
---|
| 30 | struct imu;
|
---|
| 31 | struct ahrs;
|
---|
| 32 | struct vector3D_32;
|
---|
| 33 | struct vector4D_32;
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | template <typename T>
|
---|
| 38 | class IpcReceiver;
|
---|
| 39 |
|
---|
| 40 | namespace flair {
|
---|
| 41 | namespace sensor {
|
---|
| 42 | /*! \class IpcImu
|
---|
| 43 | *
|
---|
| 44 | * \brief Class for an Ipc Imu
|
---|
| 45 | */
|
---|
| 46 | class IpcImu : public Imu, public core::Thread {
|
---|
| 47 | public:
|
---|
| 48 | /*!
|
---|
| 49 | * \brief Constructor
|
---|
| 50 | *
|
---|
| 51 | * Construct an IpcImu.
|
---|
| 52 | * It will be child of the FrameworkManager.
|
---|
| 53 | *
|
---|
| 54 | * \param name name
|
---|
| 55 | * \param priority priority of the Thread
|
---|
| 56 | * \param ipc_name name of the ipc
|
---|
| 57 | * \param ipc_channel ipc channel number
|
---|
| 58 | * \param AhrsOnly AhrsOnly
|
---|
| 59 | */
|
---|
| 60 | IpcImu(std::string name, uint8_t priority,
|
---|
| 61 | const char* ipc_name, int ipc_channel, bool AhrsOnly=true);
|
---|
| 62 |
|
---|
| 63 | /*!
|
---|
| 64 | * \brief Destructor
|
---|
| 65 | *
|
---|
| 66 | */
|
---|
| 67 | ~IpcImu();
|
---|
| 68 |
|
---|
| 69 | private:
|
---|
| 70 | /*!
|
---|
| 71 | * \brief Run function
|
---|
| 72 | *
|
---|
| 73 | * Reimplemented from Thread.
|
---|
| 74 | *
|
---|
| 75 | */
|
---|
| 76 | void Run(void);
|
---|
| 77 |
|
---|
| 78 | /*!
|
---|
| 79 | * \brief Update using provided datas
|
---|
| 80 | *
|
---|
| 81 | * Reimplemented from IODevice.
|
---|
| 82 | *
|
---|
| 83 | * \param data data from the parent to process
|
---|
| 84 | */
|
---|
| 85 | void UpdateFrom(const core::io_data *data){};
|
---|
| 86 |
|
---|
| 87 | typedef struct {
|
---|
| 88 | float q0;
|
---|
| 89 | float q1;
|
---|
| 90 | float q2;
|
---|
| 91 | float q3;
|
---|
| 92 | float wx;
|
---|
| 93 | float wy;
|
---|
| 94 | float wz;
|
---|
| 95 | float ax;
|
---|
| 96 | float ay;
|
---|
| 97 | float az;
|
---|
| 98 | float mx;
|
---|
| 99 | float my;
|
---|
| 100 | float mz;
|
---|
| 101 | } imu_states_t;
|
---|
| 102 |
|
---|
| 103 | IpcReceiver<ipc::type::imu>* ImuReceiver;
|
---|
| 104 | IpcReceiver<ipc::type::ahrs>* AhrsReceiver;
|
---|
| 105 | IpcReceiver<ipc::type::vector4D_32>* orientation_quat;
|
---|
| 106 | IpcReceiver<ipc::type::vector3D_32>* angular_vel;
|
---|
| 107 | gui::SpinBox *dataRate;
|
---|
| 108 | core::AhrsData *ahrsData;
|
---|
| 109 | bool _AhrsOnly;
|
---|
| 110 | };
|
---|
| 111 | } // end namespace sensor
|
---|
| 112 | } // end namespace flair
|
---|
| 113 | #endif // IPCIMU_H
|
---|