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 VrpnObject.h
|
---|
7 | * \brief Class for VRPN object
|
---|
8 | * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS
|
---|
9 | * 7253
|
---|
10 | * \date 2013/04/03
|
---|
11 | * \version 4.0
|
---|
12 | */
|
---|
13 |
|
---|
14 | #ifndef VRPNOBJECT_H
|
---|
15 | #define VRPNOBJECT_H
|
---|
16 |
|
---|
17 | #include <IODevice.h>
|
---|
18 | #include <Vector3D.h>
|
---|
19 | #include <stdint.h>
|
---|
20 |
|
---|
21 | namespace flair {
|
---|
22 | namespace core {
|
---|
23 | class Matrix;
|
---|
24 | class Quaternion;
|
---|
25 | }
|
---|
26 | namespace gui {
|
---|
27 | class TabWidget;
|
---|
28 | class Tab;
|
---|
29 | class DataPlot1D;
|
---|
30 | }
|
---|
31 | }
|
---|
32 |
|
---|
33 | class VrpnObject_impl;
|
---|
34 | class VrpnClient_impl;
|
---|
35 |
|
---|
36 | namespace flair {
|
---|
37 | namespace sensor {
|
---|
38 | class VrpnClient;
|
---|
39 |
|
---|
40 | /*! \class VrpnObject
|
---|
41 | *
|
---|
42 | * \brief Class for VRPN object. The IODevice is created with
|
---|
43 | * the VrpnClient as parent. VrpnClient must be created before.
|
---|
44 | */
|
---|
45 | class VrpnObject : public core::IODevice {
|
---|
46 | friend class ::VrpnObject_impl;
|
---|
47 | friend class ::VrpnClient_impl;
|
---|
48 |
|
---|
49 | public:
|
---|
50 | /*!
|
---|
51 | * \brief Constructor
|
---|
52 | *
|
---|
53 | * Construct a VrpnObject. Connection is done by IP.
|
---|
54 | *
|
---|
55 | * \param name VRPN object name, should be the same as defined in the server
|
---|
56 | * \param tab Tab for the user interface
|
---|
57 | */
|
---|
58 | VrpnObject(std::string name,
|
---|
59 | const gui::TabWidget *tab);
|
---|
60 |
|
---|
61 | /*!
|
---|
62 | * \brief Constructor
|
---|
63 | *
|
---|
64 | * Construct a VrpnObject. Connection is done by IP.
|
---|
65 | *
|
---|
66 | * \param name name
|
---|
67 | * \param id VRPN object id, should be the same as defined in the server
|
---|
68 | * \param tab Tab for the user interface
|
---|
69 | */
|
---|
70 | VrpnObject(std::string name, uint8_t id,
|
---|
71 | const gui::TabWidget *tab);
|
---|
72 |
|
---|
73 | /*!
|
---|
74 | * \brief Destructor
|
---|
75 | *
|
---|
76 | */
|
---|
77 | ~VrpnObject(void);
|
---|
78 |
|
---|
79 | /*!
|
---|
80 | * \brief Plot tab
|
---|
81 | *
|
---|
82 | * \return plot Tab
|
---|
83 | */
|
---|
84 | gui::Tab *GetPlotTab(void) const;
|
---|
85 |
|
---|
86 | /*!
|
---|
87 | * \brief Get Last Packet Time
|
---|
88 | *
|
---|
89 | * \return Time of last received packe
|
---|
90 | */
|
---|
91 | core::Time GetLastPacketTime(void) const;
|
---|
92 |
|
---|
93 | /*!
|
---|
94 | * \brief Is object tracked?
|
---|
95 | *
|
---|
96 | * \param timeout_ms timeout
|
---|
97 | * \return true if object is tracked during timeout_ms time
|
---|
98 | */
|
---|
99 | bool IsTracked(unsigned int timeout_ms) const;
|
---|
100 |
|
---|
101 | /*!
|
---|
102 | * \brief Get Quaternion
|
---|
103 | *
|
---|
104 | * \param quaternion output datas
|
---|
105 | */
|
---|
106 | void GetQuaternion(core::Quaternion &quaternion) const;
|
---|
107 | /*!
|
---|
108 | * \brief Get Position
|
---|
109 | *
|
---|
110 | * \param point output datas
|
---|
111 | */
|
---|
112 | void GetPosition(core::Vector3Df &point) const;
|
---|
113 |
|
---|
114 | /*!
|
---|
115 | * \brief Output matrix
|
---|
116 | *
|
---|
117 | * Matrix is of type float and as follows: \n
|
---|
118 | * (0,0) q0 \n
|
---|
119 | * (1,0) q1 \n
|
---|
120 | * (2,0) q2 \n
|
---|
121 | * (3,0) q3 \n
|
---|
122 | * (4,0) x \n
|
---|
123 | * (5,0) y \n
|
---|
124 | * (6,0) z \n
|
---|
125 | *
|
---|
126 | * \return Output matrix
|
---|
127 | */
|
---|
128 | core::Matrix *Output(void) const;
|
---|
129 |
|
---|
130 | /*!
|
---|
131 | * \brief State matrix
|
---|
132 | *
|
---|
133 | * Used for plotting on ground station. \n
|
---|
134 | * Matrix is of type float and as follows: \n
|
---|
135 | * (0,0) roll (deg) \n
|
---|
136 | * (1,0) pitch (deg) \n
|
---|
137 | * (2,0) yaw (deg) \n
|
---|
138 | *
|
---|
139 | * \return State matrix
|
---|
140 | */
|
---|
141 | core::Matrix *State(void) const;
|
---|
142 |
|
---|
143 | /*!
|
---|
144 | * \brief x plot
|
---|
145 | *
|
---|
146 | * \return x plot
|
---|
147 | */
|
---|
148 | gui::DataPlot1D *xPlot(void) const;
|
---|
149 |
|
---|
150 | /*!
|
---|
151 | * \brief y plot
|
---|
152 | *
|
---|
153 | * \return y plot
|
---|
154 | */
|
---|
155 | gui::DataPlot1D *yPlot(void) const;
|
---|
156 |
|
---|
157 | /*!
|
---|
158 | * \brief z plot
|
---|
159 | *
|
---|
160 | * \return z plot
|
---|
161 | */
|
---|
162 | gui::DataPlot1D *zPlot(void) const;
|
---|
163 |
|
---|
164 | private:
|
---|
165 | /*!
|
---|
166 | * \brief Update using provided datas
|
---|
167 | *
|
---|
168 | * Reimplemented from IODevice.
|
---|
169 | *
|
---|
170 | * \param data data from the parent to process
|
---|
171 | */
|
---|
172 | void UpdateFrom(const core::io_data *data){};
|
---|
173 |
|
---|
174 | class VrpnObject_impl *pimpl_;
|
---|
175 | };
|
---|
176 | } // end namespace sensor
|
---|
177 | } // end namespace flair
|
---|
178 | #endif // VRPNOBJECT_H
|
---|