source: flair-dev/trunk/include/FlairSensorActuator/VrpnObject.h @ 44

Last change on this file since 44 was 44, checked in by Sanahuja Guillaume, 4 years ago

m

File size: 3.4 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 <stdint.h>
19
20namespace flair {
21        namespace core {
22                class cvmatrix;
23                class Vector3D;
24                class Euler;
25                class Quaternion;
26        }
27        namespace gui {
28                class TabWidget;
29                class Tab;
30                class DataPlot1D;
31        }
32}
33
34class VrpnObject_impl;
35class VrpnClient_impl;
36
37namespace flair {
38namespace sensor {
39class VrpnClient;
40
41/*! \class VrpnObject
42*
43* \brief Class for VRPN object. The IODevice is created with
44*  the VrpnClient as parent. VrpnClient must be created before.
45*/
46class VrpnObject : public core::IODevice {
47  friend class ::VrpnObject_impl;
48  friend class ::VrpnClient_impl;
49
50public:
51  /*!
52  * \brief Constructor
53  *
54  * Construct a VrpnObject. Connection is done by IP.
55  *
56  * \param name VRPN object name, should be the same as defined in the server
57  * \param tab Tab for the user interface
58  */
59  VrpnObject(std::string name,
60             const gui::TabWidget *tab);
61
62  /*!
63  * \brief Constructor
64  *
65  * Construct a VrpnObject. Connection is done by IP.
66  *
67  * \param name name
68  * \param id VRPN object id, should be the same as defined in the server
69  * \param tab Tab for the user interface
70  */
71  VrpnObject(std::string name, uint8_t id,
72             const gui::TabWidget *tab);
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 packe
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 Euler angles
104  *
105  * \param euler output datas
106  */
107  void GetEuler(core::Euler &euler) const;
108
109  /*!
110  * \brief Get Quaternion
111  *
112  * \param quaternion output datas
113  */
114  void GetQuaternion(core::Quaternion &quaternion) const;
115  /*!
116  * \brief Get Position
117  *
118  * \param point output datas
119  */
120  void GetPosition(core::Vector3D &point) const;
121
122  /*!
123  * \brief Output matrix
124  *
125  * Matrix is of type float and as follows: \n
126  * (0,0) roll (rad) \n
127  * (1,0) pitch (rad) \n
128  * (2,0) yaw (rad) \n
129  * (3,0) x \n
130  * (4,0) y \n
131  * (5,0) z \n
132  *
133  * \return Output metrix
134  */
135  core::cvmatrix *Output(void) const;
136
137  /*!
138  * \brief State matrix
139  *
140  * Matrix is of type float and as follows: \n
141  * (0,0) roll (deg) \n
142  * (1,0) pitch (deg) \n
143  * (2,0) yaw (deg) \n
144  *
145  * \return State metrix
146  */
147  core::cvmatrix *State(void) const;
148
149  /*!
150  * \brief x plot
151  *
152  * \return x plot
153  */
154  gui::DataPlot1D *xPlot(void) const;
155
156  /*!
157  * \brief y plot
158  *
159  * \return y plot
160  */
161  gui::DataPlot1D *yPlot(void) const;
162
163  /*!
164  * \brief z plot
165  *
166  * \return z plot
167  */
168  gui::DataPlot1D *zPlot(void) const;
169
170private:
171  /*!
172  * \brief Update using provided datas
173  *
174  * Reimplemented from IODevice.
175  *
176  * \param data data from the parent to process
177  */
178  void UpdateFrom(const core::io_data *data){};
179
180  void mainloop(void);
181  class VrpnObject_impl *pimpl_;
182};
183} // end namespace sensor
184} // end namespace flair
185#endif // VRPNOBJECT_H
Note: See TracBrowser for help on using the repository browser.