| 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 | // created: 2013/04/03
|
---|
| 6 | // filename: VrpnObject.cpp
|
---|
| 7 | //
|
---|
| 8 | // author: César Richard, Guillaume Sanahuja
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: Class for VRPN object
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #include "VrpnObject.h"
|
---|
| 19 | #include "VrpnObject_impl.h"
|
---|
| 20 | #include "VrpnClient.h"
|
---|
| 21 | #include <string.h>
|
---|
| 22 |
|
---|
| 23 | #include <cvmatrix.h>
|
---|
| 24 |
|
---|
| 25 | using std::string;
|
---|
| 26 | using namespace flair::core;
|
---|
| 27 | using namespace flair::gui;
|
---|
| 28 |
|
---|
| 29 | namespace flair
|
---|
| 30 | {
|
---|
| 31 | namespace sensor
|
---|
| 32 | {
|
---|
| 33 |
|
---|
| 34 | VrpnObject::VrpnObject(const VrpnClient *parent,string name,const TabWidget* tab): IODevice(parent,name)
|
---|
| 35 | {
|
---|
| 36 | pimpl_=new VrpnObject_impl(this,parent,name,-1,tab);
|
---|
| 37 | AddDataToLog(pimpl_->output);
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | VrpnObject::VrpnObject(const VrpnClient *parent,string name,uint8_t id,const TabWidget* tab): IODevice(parent,name)
|
---|
| 41 | {
|
---|
| 42 | Warn("Creation of object %s with id %i\n",name.c_str(),id);
|
---|
| 43 | pimpl_=new VrpnObject_impl(this,parent,name,id,tab);
|
---|
| 44 | AddDataToLog(pimpl_->output);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | VrpnObject::~VrpnObject(void)
|
---|
| 48 | {
|
---|
| 49 | delete pimpl_;
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | cvmatrix *VrpnObject::Output(void) const
|
---|
| 53 | {
|
---|
| 54 | return pimpl_->output;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | cvmatrix *VrpnObject::State(void) const
|
---|
| 58 | {
|
---|
| 59 | return pimpl_->state;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | Tab* VrpnObject::GetPlotTab(void) const
|
---|
| 63 | {
|
---|
| 64 | return pimpl_->plot_tab;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | DataPlot1D* VrpnObject::xPlot(void) const
|
---|
| 68 | {
|
---|
| 69 | return pimpl_->x_plot;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | DataPlot1D* VrpnObject::yPlot(void) const
|
---|
| 73 | {
|
---|
| 74 | return pimpl_->y_plot;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | DataPlot1D* VrpnObject::zPlot(void) const
|
---|
| 78 | {
|
---|
| 79 | return pimpl_->z_plot;
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | Time VrpnObject::GetLastPacketTime(void) const
|
---|
| 83 | {
|
---|
| 84 | return pimpl_->output->DataTime();
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | bool VrpnObject::IsTracked(unsigned int timeout_ms) const
|
---|
| 88 | {
|
---|
| 89 | return pimpl_->IsTracked(timeout_ms);
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | void VrpnObject::GetEuler(Euler &euler) const
|
---|
| 93 | {
|
---|
| 94 | pimpl_->GetEuler(euler);
|
---|
| 95 | }
|
---|
| 96 |
|
---|
| 97 | void VrpnObject::GetQuaternion(Quaternion &quaternion) const {
|
---|
| 98 | pimpl_->GetQuaternion(quaternion);
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | void VrpnObject::GetPosition(Vector3D &point) const
|
---|
| 102 | {
|
---|
| 103 | pimpl_->GetPosition(point);
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | void VrpnObject::mainloop(void)
|
---|
| 107 | {
|
---|
| 108 | pimpl_->mainloop();
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | } // end namespace sensor
|
---|
| 112 | } // end namespace flair
|
---|