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