Changeset 15 in flair-src for trunk/lib/FlairMeta/src/MetaVrpnObject.cpp


Ignore:
Timestamp:
04/08/16 15:40:57 (8 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairMeta/src/MetaVrpnObject.cpp

    r10 r15  
    3636using namespace flair::filter;
    3737
    38 namespace flair { namespace meta {
     38namespace flair {
     39namespace meta {
    3940
    40 MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent,string name): VrpnObject(parent,name,parent->GetTabWidget())
    41 {
    42     ConstructorCommon(parent,name);
     41MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent, string name)
     42    : VrpnObject(parent, name, parent->GetTabWidget()) {
     43  ConstructorCommon(parent, name);
    4344}
    4445
    45 MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent,std::string name,uint8_t id): VrpnObject(parent,name,id,parent->GetTabWidget())
    46 {
    47     ConstructorCommon(parent,name);
     46MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent, std::string name,
     47                               uint8_t id)
     48    : VrpnObject(parent, name, id, parent->GetTabWidget()) {
     49  ConstructorCommon(parent, name);
    4850}
    4951
    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     }
     52void 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  }
    5961
    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);
    6164
    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  }
    7073
    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);
    7276
    73     vx_opti_plot=new DataPlot1D(GetPlotTab()->NewRow(),"vx",-3,3);
    74     vx_opti_plot->AddCurve(euler->Matrix()->Element(3));
    75     vy_opti_plot=new DataPlot1D(GetPlotTab()->LastRowLastCol(),"vy",-3,3);
    76     vy_opti_plot->AddCurve(euler->Matrix()->Element(4));
    77     vz_opti_plot=new DataPlot1D(GetPlotTab()->LastRowLastCol(),"vz",-2,2);
    78     vz_opti_plot->AddCurve(euler->Matrix()->Element(5));
     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));
    7983
    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));
    8387}
    8488
    85 MetaVrpnObject::~MetaVrpnObject() {
    86     delete plot_tab;
    87 }
     89MetaVrpnObject::~MetaVrpnObject() { delete plot_tab; }
    8890
    89 DataPlot1D* MetaVrpnObject::VxPlot(void) const
    90 {
    91     return vx_opti_plot;
    92 }
     91DataPlot1D *MetaVrpnObject::VxPlot(void) const { return vx_opti_plot; }
    9392
    94 DataPlot1D* MetaVrpnObject::VyPlot(void) const
    95 {
    96     return vy_opti_plot;
    97 }
     93DataPlot1D *MetaVrpnObject::VyPlot(void) const { return vy_opti_plot; }
    9894
    99 DataPlot1D* MetaVrpnObject::VzPlot(void) const
    100 {
    101     return vz_opti_plot;
    102 }
     95DataPlot1D *MetaVrpnObject::VzPlot(void) const { return vz_opti_plot; }
    10396
    104 DataPlot2D* MetaVrpnObject::XyPlot(void) const {
    105     return xy_plot;
    106 }
     97DataPlot2D *MetaVrpnObject::XyPlot(void) const { return xy_plot; }
    10798
    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);
     99void 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);
    113103}
    114104
Note: See TracChangeset for help on using the changeset viewer.