[4] | 1 | // %flair:license{
|
---|
[13] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[4] | 4 | // %flair:license}
|
---|
| 5 | /*!
|
---|
| 6 | * \file VrpnObject.h
|
---|
| 7 | * \brief Class for VRPN object
|
---|
[13] | 8 | * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS
|
---|
| 9 | * 7253
|
---|
[4] | 10 | * \date 2013/04/03
|
---|
| 11 | * \version 4.0
|
---|
| 12 | */
|
---|
| 13 |
|
---|
| 14 | #ifndef VRPNOBJECT_H
|
---|
| 15 | #define VRPNOBJECT_H
|
---|
[13] | 16 |
|
---|
[4] | 17 | #include <IODevice.h>
|
---|
| 18 | #include <stdint.h>
|
---|
| 19 |
|
---|
[13] | 20 | namespace flair {
|
---|
[44] | 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 | }
|
---|
[4] | 32 | }
|
---|
| 33 |
|
---|
| 34 | class VrpnObject_impl;
|
---|
| 35 | class VrpnClient_impl;
|
---|
| 36 |
|
---|
[13] | 37 | namespace flair {
|
---|
| 38 | namespace sensor {
|
---|
| 39 | class VrpnClient;
|
---|
[4] | 40 |
|
---|
[13] | 41 | /*! \class VrpnObject
|
---|
| 42 | *
|
---|
[44] | 43 | * \brief Class for VRPN object. The IODevice is created with
|
---|
| 44 | * the VrpnClient as parent. VrpnClient must be created before.
|
---|
[13] | 45 | */
|
---|
| 46 | class VrpnObject : public core::IODevice {
|
---|
| 47 | friend class ::VrpnObject_impl;
|
---|
| 48 | friend class ::VrpnClient_impl;
|
---|
[4] | 49 |
|
---|
[13] | 50 | public:
|
---|
| 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 | */
|
---|
[44] | 59 | VrpnObject(std::string name,
|
---|
[13] | 60 | const gui::TabWidget *tab);
|
---|
[4] | 61 |
|
---|
[13] | 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 | */
|
---|
[44] | 71 | VrpnObject(std::string name, uint8_t id,
|
---|
[13] | 72 | const gui::TabWidget *tab);
|
---|
[4] | 73 |
|
---|
[13] | 74 | /*!
|
---|
| 75 | * \brief Destructor
|
---|
| 76 | *
|
---|
| 77 | */
|
---|
| 78 | ~VrpnObject(void);
|
---|
[4] | 79 |
|
---|
[13] | 80 | /*!
|
---|
| 81 | * \brief Plot tab
|
---|
| 82 | *
|
---|
| 83 | * \return plot Tab
|
---|
| 84 | */
|
---|
| 85 | gui::Tab *GetPlotTab(void) const;
|
---|
[4] | 86 |
|
---|
[13] | 87 | /*!
|
---|
| 88 | * \brief Get Last Packet Time
|
---|
| 89 | *
|
---|
| 90 | * \return Time of last received packe
|
---|
| 91 | */
|
---|
| 92 | core::Time GetLastPacketTime(void) const;
|
---|
[4] | 93 |
|
---|
[13] | 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;
|
---|
[4] | 101 |
|
---|
[13] | 102 | /*!
|
---|
| 103 | * \brief Get Euler angles
|
---|
| 104 | *
|
---|
| 105 | * \param euler output datas
|
---|
| 106 | */
|
---|
| 107 | void GetEuler(core::Euler &euler) const;
|
---|
[4] | 108 |
|
---|
[13] | 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;
|
---|
[4] | 121 |
|
---|
[13] | 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;
|
---|
[4] | 136 |
|
---|
[13] | 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;
|
---|
[4] | 148 |
|
---|
[13] | 149 | /*!
|
---|
| 150 | * \brief x plot
|
---|
| 151 | *
|
---|
| 152 | * \return x plot
|
---|
| 153 | */
|
---|
| 154 | gui::DataPlot1D *xPlot(void) const;
|
---|
[4] | 155 |
|
---|
[13] | 156 | /*!
|
---|
| 157 | * \brief y plot
|
---|
| 158 | *
|
---|
| 159 | * \return y plot
|
---|
| 160 | */
|
---|
| 161 | gui::DataPlot1D *yPlot(void) const;
|
---|
[4] | 162 |
|
---|
[13] | 163 | /*!
|
---|
| 164 | * \brief z plot
|
---|
| 165 | *
|
---|
| 166 | * \return z plot
|
---|
| 167 | */
|
---|
| 168 | gui::DataPlot1D *zPlot(void) const;
|
---|
| 169 |
|
---|
| 170 | private:
|
---|
| 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 | };
|
---|
[4] | 183 | } // end namespace sensor
|
---|
| 184 | } // end namespace flair
|
---|
[13] | 185 | #endif // VRPNOBJECT_H
|
---|