Changeset 15 in flair-src for trunk/lib/FlairMeta/src/MetaVrpnObject.cpp
- Timestamp:
- 04/08/16 15:40:57 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairMeta/src/MetaVrpnObject.cpp
r10 r15 36 36 using namespace flair::filter; 37 37 38 namespace flair { namespace meta { 38 namespace flair { 39 namespace meta { 39 40 40 MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent, string name): VrpnObject(parent,name,parent->GetTabWidget())41 {42 ConstructorCommon(parent,name);41 MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent, string name) 42 : VrpnObject(parent, name, parent->GetTabWidget()) { 43 ConstructorCommon(parent, name); 43 44 } 44 45 45 MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent,std::string name,uint8_t id): VrpnObject(parent,name,id,parent->GetTabWidget()) 46 { 47 ConstructorCommon(parent,name); 46 MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent, std::string name, 47 uint8_t id) 48 : VrpnObject(parent, name, id, parent->GetTabWidget()) { 49 ConstructorCommon(parent, name); 48 50 } 49 51 50 void MetaVrpnObject::ConstructorCommon(const VrpnClient *parent, string name) {51 cvmatrix_descriptor* desc=new cvmatrix_descriptor(6,1);52 for(int i=0;i<6;i++) {53 desc->SetElementName(i,0,Output()->Name(i,0));54 55 cvmatrix* prev_value=new cvmatrix(this,desc,elementDataType,name);56 for(int i=0;i<6;i++) {57 prev_value->SetValue(i,0,0);58 52 void MetaVrpnObject::ConstructorCommon(const VrpnClient *parent, string name) { 53 cvmatrix_descriptor *desc = new cvmatrix_descriptor(6, 1); 54 for (int i = 0; i < 6; i++) { 55 desc->SetElementName(i, 0, Output()->Name(i, 0)); 56 } 57 cvmatrix *prev_value = new cvmatrix(this, desc, elementDataType, name); 58 for (int i = 0; i < 6; i++) { 59 prev_value->SetValue(i, 0, 0); 60 } 59 61 60 pbas=new LowPassFilter(this,parent->GetLayout()->NewRow(),name + " Passe bas",prev_value); 62 pbas = new LowPassFilter(this, parent->GetLayout()->NewRow(), 63 name + " Passe bas", prev_value); 61 64 62 desc=new cvmatrix_descriptor(6,1);63 for(int i=0;i<6;i++) {64 desc->SetElementName(i,0,"d" + Output()->Name(i,0));65 66 prev_value=new cvmatrix(this,desc,elementDataType,name);67 for(int i=0;i<6;i++) {68 prev_value->SetValue(i,0,0);69 65 desc = new cvmatrix_descriptor(6, 1); 66 for (int i = 0; i < 6; i++) { 67 desc->SetElementName(i, 0, "d" + Output()->Name(i, 0)); 68 } 69 prev_value = new cvmatrix(this, desc, elementDataType, name); 70 for (int i = 0; i < 6; i++) { 71 prev_value->SetValue(i, 0, 0); 72 } 70 73 71 euler=new EulerDerivative(pbas,parent->GetLayout()->NewRow(),name + "_euler",prev_value); 74 euler = new EulerDerivative(pbas, parent->GetLayout()->NewRow(), 75 name + "_euler", prev_value); 72 76 73 vx_opti_plot=new DataPlot1D(GetPlotTab()->NewRow(),"vx",-3,3);74 75 vy_opti_plot=new DataPlot1D(GetPlotTab()->LastRowLastCol(),"vy",-3,3);76 77 vz_opti_plot=new DataPlot1D(GetPlotTab()->LastRowLastCol(),"vz",-2,2);78 77 vx_opti_plot = new DataPlot1D(GetPlotTab()->NewRow(), "vx", -3, 3); 78 vx_opti_plot->AddCurve(euler->Matrix()->Element(3)); 79 vy_opti_plot = new DataPlot1D(GetPlotTab()->LastRowLastCol(), "vy", -3, 3); 80 vy_opti_plot->AddCurve(euler->Matrix()->Element(4)); 81 vz_opti_plot = new DataPlot1D(GetPlotTab()->LastRowLastCol(), "vz", -2, 2); 82 vz_opti_plot->AddCurve(euler->Matrix()->Element(5)); 79 83 80 plot_tab=new Tab(parent->GetTabWidget(),"Mesures (xy) "+ name);81 xy_plot=new DataPlot2D(plot_tab->NewRow(),"xy","y",-5,5,"x",-5,5);82 xy_plot->AddCurve(Output()->Element(4,0),Output()->Element(3,0));84 plot_tab = new Tab(parent->GetTabWidget(), "Mesures (xy) " + name); 85 xy_plot = new DataPlot2D(plot_tab->NewRow(), "xy", "y", -5, 5, "x", -5, 5); 86 xy_plot->AddCurve(Output()->Element(4, 0), Output()->Element(3, 0)); 83 87 } 84 88 85 MetaVrpnObject::~MetaVrpnObject() { 86 delete plot_tab; 87 } 89 MetaVrpnObject::~MetaVrpnObject() { delete plot_tab; } 88 90 89 DataPlot1D* MetaVrpnObject::VxPlot(void) const 90 { 91 return vx_opti_plot; 92 } 91 DataPlot1D *MetaVrpnObject::VxPlot(void) const { return vx_opti_plot; } 93 92 94 DataPlot1D* MetaVrpnObject::VyPlot(void) const 95 { 96 return vy_opti_plot; 97 } 93 DataPlot1D *MetaVrpnObject::VyPlot(void) const { return vy_opti_plot; } 98 94 99 DataPlot1D* MetaVrpnObject::VzPlot(void) const 100 { 101 return vz_opti_plot; 102 } 95 DataPlot1D *MetaVrpnObject::VzPlot(void) const { return vz_opti_plot; } 103 96 104 DataPlot2D* MetaVrpnObject::XyPlot(void) const { 105 return xy_plot; 106 } 97 DataPlot2D *MetaVrpnObject::XyPlot(void) const { return xy_plot; } 107 98 108 void MetaVrpnObject::GetSpeed(Vector3D &speed) const 109 { 110 speed.x=euler->Output(3,0); 111 speed.y=euler->Output(4,0); 112 speed.z=euler->Output(5,0); 99 void MetaVrpnObject::GetSpeed(Vector3D &speed) const { 100 speed.x = euler->Output(3, 0); 101 speed.y = euler->Output(4, 0); 102 speed.z = euler->Output(5, 0); 113 103 } 114 104
Note:
See TracChangeset
for help on using the changeset viewer.