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