[3] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[3] | 4 | // %flair:license}
|
---|
| 5 | /*!
|
---|
| 6 | * \file VrpnObject.h
|
---|
| 7 | * \brief Class for VRPN object
|
---|
[15] | 8 | * \author César Richard, Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS
|
---|
| 9 | * 7253
|
---|
[3] | 10 | * \date 2013/04/03
|
---|
| 11 | * \version 4.0
|
---|
| 12 | */
|
---|
| 13 |
|
---|
| 14 | #ifndef VRPNOBJECT_H
|
---|
| 15 | #define VRPNOBJECT_H
|
---|
[15] | 16 |
|
---|
[3] | 17 | #include <IODevice.h>
|
---|
[286] | 18 | #include <VrpnClient.h>
|
---|
[167] | 19 | #include <Vector3D.h>
|
---|
[3] | 20 | #include <stdint.h>
|
---|
| 21 |
|
---|
[15] | 22 | namespace flair {
|
---|
[122] | 23 | namespace core {
|
---|
[214] | 24 | class Matrix;
|
---|
[122] | 25 | class Quaternion;
|
---|
| 26 | }
|
---|
| 27 | namespace gui {
|
---|
| 28 | class TabWidget;
|
---|
| 29 | class Tab;
|
---|
| 30 | class DataPlot1D;
|
---|
| 31 | }
|
---|
[3] | 32 | }
|
---|
| 33 |
|
---|
| 34 | class VrpnObject_impl;
|
---|
| 35 |
|
---|
[15] | 36 | namespace flair {
|
---|
| 37 | namespace sensor {
|
---|
| 38 | class VrpnClient;
|
---|
[3] | 39 |
|
---|
[15] | 40 | /*! \class VrpnObject
|
---|
| 41 | *
|
---|
[122] | 42 | * \brief Class for VRPN object. The IODevice is created with
|
---|
| 43 | * the VrpnClient as parent. VrpnClient must be created before.
|
---|
[15] | 44 | */
|
---|
| 45 | class VrpnObject : public core::IODevice {
|
---|
| 46 | friend class ::VrpnObject_impl;
|
---|
[3] | 47 |
|
---|
[15] | 48 | public:
|
---|
| 49 | /*!
|
---|
| 50 | * \brief Constructor
|
---|
| 51 | *
|
---|
[309] | 52 | * Construct a VrpnObject. Connection is done by IP. (vrpn)
|
---|
[15] | 53 | *
|
---|
| 54 | * \param name VRPN object name, should be the same as defined in the server
|
---|
| 55 | * \param tab Tab for the user interface
|
---|
[286] | 56 | * \param client VrpnClient of the connection, if unspecified, use the default one
|
---|
[15] | 57 | */
|
---|
[122] | 58 | VrpnObject(std::string name,
|
---|
[286] | 59 | const gui::TabWidget *tab,sensor::VrpnClient *client=GetVrpnClient());
|
---|
[3] | 60 |
|
---|
[15] | 61 | /*!
|
---|
| 62 | * \brief Constructor
|
---|
| 63 | *
|
---|
[309] | 64 | * Construct a VrpnObject. Connection is done by xbee or vrpnlite (see tools/VrpnLite in flair-src)
|
---|
[15] | 65 | *
|
---|
| 66 | * \param name name
|
---|
[309] | 67 | * \param id VRPN object id, should be the same as defined in the xbee bridge or vrpnlite tool
|
---|
[15] | 68 | * \param tab Tab for the user interface
|
---|
[286] | 69 | * \param client VrpnClient of the connection, if unspecified, use the default one
|
---|
[15] | 70 | */
|
---|
[122] | 71 | VrpnObject(std::string name, uint8_t id,
|
---|
[286] | 72 | const gui::TabWidget *tab,sensor::VrpnClient *client=GetVrpnClient());
|
---|
[3] | 73 |
|
---|
[15] | 74 | /*!
|
---|
| 75 | * \brief Destructor
|
---|
| 76 | *
|
---|
| 77 | */
|
---|
| 78 | ~VrpnObject(void);
|
---|
[3] | 79 |
|
---|
[15] | 80 | /*!
|
---|
| 81 | * \brief Plot tab
|
---|
| 82 | *
|
---|
| 83 | * \return plot Tab
|
---|
| 84 | */
|
---|
| 85 | gui::Tab *GetPlotTab(void) const;
|
---|
[3] | 86 |
|
---|
[15] | 87 | /*!
|
---|
| 88 | * \brief Get Last Packet Time
|
---|
| 89 | *
|
---|
[309] | 90 | * \return Time of last received packet
|
---|
[15] | 91 | */
|
---|
| 92 | core::Time GetLastPacketTime(void) const;
|
---|
[3] | 93 |
|
---|
[15] | 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;
|
---|
[3] | 101 |
|
---|
[15] | 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 | */
|
---|
[167] | 113 | void GetPosition(core::Vector3Df &point) const;
|
---|
[3] | 114 |
|
---|
[15] | 115 | /*!
|
---|
| 116 | * \brief Output matrix
|
---|
| 117 | *
|
---|
| 118 | * Matrix is of type float and as follows: \n
|
---|
[135] | 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
|
---|
[15] | 126 | *
|
---|
[135] | 127 | * \return Output matrix
|
---|
[15] | 128 | */
|
---|
[214] | 129 | core::Matrix *Output(void) const;
|
---|
[3] | 130 |
|
---|
[15] | 131 | /*!
|
---|
| 132 | * \brief State matrix
|
---|
| 133 | *
|
---|
[135] | 134 | * Used for plotting on ground station. \n
|
---|
[15] | 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 | *
|
---|
[135] | 140 | * \return State matrix
|
---|
[15] | 141 | */
|
---|
[214] | 142 | core::Matrix *State(void) const;
|
---|
[3] | 143 |
|
---|
[15] | 144 | /*!
|
---|
| 145 | * \brief x plot
|
---|
| 146 | *
|
---|
| 147 | * \return x plot
|
---|
| 148 | */
|
---|
| 149 | gui::DataPlot1D *xPlot(void) const;
|
---|
[3] | 150 |
|
---|
[15] | 151 | /*!
|
---|
| 152 | * \brief y plot
|
---|
| 153 | *
|
---|
| 154 | * \return y plot
|
---|
| 155 | */
|
---|
| 156 | gui::DataPlot1D *yPlot(void) const;
|
---|
[3] | 157 |
|
---|
[15] | 158 | /*!
|
---|
| 159 | * \brief z plot
|
---|
| 160 | *
|
---|
| 161 | * \return z plot
|
---|
| 162 | */
|
---|
| 163 | gui::DataPlot1D *zPlot(void) const;
|
---|
| 164 |
|
---|
| 165 | private:
|
---|
| 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 | };
|
---|
[3] | 177 | } // end namespace sensor
|
---|
| 178 | } // end namespace flair
|
---|
[15] | 179 | #endif // VRPNOBJECT_H
|
---|