source: flair-src/trunk/lib/FlairSensorActuator/src/VrpnObject.h@ 309

Last change on this file since 309 was 309, checked in by Sanahuja Guillaume, 3 years ago

vrpnlite support

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