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