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 SimuImu.h |
---|
7 | * \brief Class for a simulation Imu |
---|
8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 |
---|
9 | * \date 2014/02/07 |
---|
10 | * \version 4.0 |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef SIMUIMU_H |
---|
14 | #define SIMUIMU_H |
---|
15 | |
---|
16 | #include <Imu.h> |
---|
17 | #include <Thread.h> |
---|
18 | |
---|
19 | namespace flair { |
---|
20 | namespace core { |
---|
21 | class SharedMem; |
---|
22 | class AhrsData; |
---|
23 | } |
---|
24 | namespace gui { |
---|
25 | class SpinBox; |
---|
26 | } |
---|
27 | } |
---|
28 | |
---|
29 | namespace flair { namespace sensor { |
---|
30 | /*! \class SimuImu |
---|
31 | * |
---|
32 | * \brief Class for a simulation Imu |
---|
33 | */ |
---|
34 | class SimuImu : public Imu, public core::Thread { |
---|
35 | public: |
---|
36 | /*! |
---|
37 | * \brief Constructor |
---|
38 | * |
---|
39 | * Construct a SimuImu. Control part. |
---|
40 | * |
---|
41 | * \param parent parent |
---|
42 | * \param name name |
---|
43 | * \param dev_id device id |
---|
44 | * \param priority priority of the Thread |
---|
45 | */ |
---|
46 | SimuImu(const core::FrameworkManager* parent,std::string name,uint32_t dev_id,uint8_t priority); |
---|
47 | |
---|
48 | /*! |
---|
49 | * \brief Constructor |
---|
50 | * |
---|
51 | * Construct a SimuImu. Simulation part.\n |
---|
52 | * The Thread of this class should not be run. |
---|
53 | * |
---|
54 | * \param parent parent |
---|
55 | * \param name name |
---|
56 | * \param dev_id device id |
---|
57 | */ |
---|
58 | SimuImu(const core::IODevice* parent,std::string name,uint32_t dev_id); |
---|
59 | |
---|
60 | /*! |
---|
61 | * \brief Destructor |
---|
62 | * |
---|
63 | */ |
---|
64 | ~SimuImu(); |
---|
65 | |
---|
66 | private: |
---|
67 | /*! |
---|
68 | * \brief Run function |
---|
69 | * |
---|
70 | * Reimplemented from Thread. |
---|
71 | * |
---|
72 | */ |
---|
73 | void Run(void); |
---|
74 | |
---|
75 | /*! |
---|
76 | * \brief Update using provided datas |
---|
77 | * |
---|
78 | * Reimplemented from IODevice. |
---|
79 | * |
---|
80 | * \param data data from the parent to process |
---|
81 | */ |
---|
82 | void UpdateFrom(const core::io_data *data); |
---|
83 | |
---|
84 | typedef struct { |
---|
85 | float q0; |
---|
86 | float q1; |
---|
87 | float q2; |
---|
88 | float q3; |
---|
89 | float wx; |
---|
90 | float wy; |
---|
91 | float wz; |
---|
92 | } imu_states_t; |
---|
93 | gui::SpinBox *data_rate; |
---|
94 | core::SharedMem *shmem; |
---|
95 | core::AhrsData *ahrsData; |
---|
96 | }; |
---|
97 | } // end namespace sensor |
---|
98 | } // end namespace flair |
---|
99 | #endif // SIMUIMU_H |
---|