Changeset 148 in flair-src for trunk/lib


Ignore:
Timestamp:
Feb 28, 2017, 4:18:13 PM (8 years ago)
Author:
Sanahuja Guillaume
Message:

m

Location:
trunk/lib
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/cvmatrix.h

    r147 r148  
    5959  *
    6060  * \param parent parent
    61   * \param descriptor matrix description
     61  * \param descriptor matrix description, it is safe to destroy it after calling this constructor
    6262  * \param type type of matrix elements
    6363  * \param name name
  • trunk/lib/FlairCore/src/cvmatrix_impl.cpp

    r15 r148  
    3333
    3434cvmatrix_impl::cvmatrix_impl(cvmatrix *self,
    35                              const cvmatrix_descriptor *descriptor,
     35                             const cvmatrix_descriptor *inDescriptor,
    3636                             flair::core::ScalarType const &_elementDataType,
    3737                             int n)
    3838    : elementDataType(_elementDataType) {
    39   this->descriptor = descriptor;
     39  descriptor = new cvmatrix_descriptor(inDescriptor->Rows(), inDescriptor->Cols());
     40
     41  for (uint32_t i = 0; i < descriptor->Rows(); i++) {
     42    for (uint32_t j = 0; j < descriptor->Cols(); j++) {
     43      descriptor->SetElementName(i, j, inDescriptor->ElementName(i, j));
     44    }
     45  }
    4046  Init(self, n);
    4147}
  • trunk/lib/FlairCore/src/unexported/cvmatrix_impl.h

    r15 r148  
    3434  CvMat *mat;
    3535  flair::core::ScalarType const &elementDataType;
    36   // const since if element description is modified it would be a mess in the
    37   // log
    38   const flair::core::cvmatrix_descriptor *descriptor;
     36  flair::core::cvmatrix_descriptor *descriptor;
    3937
    4038private:
  • trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp

    r147 r148  
    4242  desc->SetElementName(0, 0, "output");
    4343  output = new cvmatrix(self, desc, floatType, name);
    44 
    45   output->SetValue(0, 0, 0);
     44  delete desc;
    4645
    4746  f = new PoleFilter(order);
  • trunk/lib/FlairFilter/src/ControlLaw.cpp

    r15 r148  
    4141    }
    4242    output = new cvmatrix(this, desc, floatType, name);
     43    delete desc;
    4344  }
    4445
  • trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp

    r147 r148  
    4444    }
    4545    output = new cvmatrix(self, desc,init_value->GetDataType().GetElementDataType(), name);
     46    delete desc;
    4647    for (int i = 0; i < init_value->Rows(); i++) {
    4748      for (int j = 0; j < init_value->Cols(); j++) {
     
    5455    desc->SetElementName(0, 0, "output");
    5556    output = new cvmatrix(self, desc, floatType, name);
    56     output->SetValue(0, 0, 0);
     57    delete desc;
    5758  }
    5859 
  • trunk/lib/FlairFilter/src/JoyReference_impl.cpp

    r15 r148  
    4949  desc->SetElementName(3, 0, "trim_pitch");
    5050  output = new cvmatrix(self, desc, floatType, name);
     51  delete desc;
    5152
    5253  reglages_groupbox = new GroupBox(position, name);
  • trunk/lib/FlairFilter/src/LowPassFilter_impl.cpp

    r147 r148  
    5151      }
    5252    }
     53    delete desc;
    5354  } else {
    5455    // if NULL, assume dimension 1, and init=0
     
    5657    desc->SetElementName(0, 0, "output");
    5758    output = new cvmatrix(self, desc, floatType, name);
    58     output->SetValue(0, 0, 0);
     59    delete desc;
    5960  }
    6061
  • trunk/lib/FlairFilter/src/PidThrust_impl.cpp

    r15 r148  
    4545  desc->SetElementName(4, 0, "p+i+d+offset");
    4646  state = new cvmatrix(self, desc, floatType, name);
     47  delete desc;
    4748
    4849  GroupBox *reglages_groupbox = new GroupBox(position, name);
  • trunk/lib/FlairFilter/src/Pid_impl.cpp

    r15 r148  
    4242  desc->SetElementName(3, 0, "p+i+d");
    4343  state = new cvmatrix(self, desc, floatType, name);
     44  delete desc;
    4445
    4546  GroupBox *reglages_groupbox = new GroupBox(position, name);
  • trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp

    r15 r148  
    6464  desc->SetElementName(1, 0, "vel");
    6565  output = new cvmatrix(self, desc, floatType, name);
     66  delete desc;
    6667
    6768  output->SetValue(0, 0, pos);
  • trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp

    r15 r148  
    5757  desc->SetElementName(1, 1, "vel.y");
    5858  output = new cvmatrix(self, desc, floatType, name);
    59 
    60   output->SetValue(0, 0, 0);
    61   output->SetValue(0, 1, 0);
    62   output->SetValue(1, 0, 0);
    63   output->SetValue(1, 1, 0);
     59  delete desc;
    6460}
    6561
  • trunk/lib/FlairFilter/src/X4X8Multiplex_impl.cpp

    r106 r148  
    5656
    5757  output = new cvmatrix(self, desc, floatType);
    58 
     58  delete desc;
    5959  self->AddDataToLog(output);
    6060}
  • trunk/lib/FlairMeta/src/MetaVrpnObject.cpp

    r147 r148  
    5656  }
    5757  cvmatrix *prev_value = new cvmatrix(this, desc, elementDataType, name);
    58   for (int i = 0; i < prev_value->Rows(); i++) {
    59     prev_value->SetValue(i, 0, 0);
    60   }
     58  delete desc;
    6159
    6260  pbas = new LowPassFilter(this, GetVrpnClient()->GetLayout()->NewRow(),
     
    6967  }
    7068  prev_value = new cvmatrix(this, desc, elementDataType, name);
    71   for (int i = 0; i < prev_value->Rows(); i++) {
    72     prev_value->SetValue(i, 0, 0);
    73   }
     69  delete desc;
    7470
    7571  euler = new EulerDerivative(pbas, GetVrpnClient()->GetLayout()->NewRow(),
  • trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.cpp

    r137 r148  
    132132  desc->SetElementName(3, 1, "cons arriere gauche");
    133133  output = new cvmatrix((IODevice *)this, desc, floatType);
    134 
     134  delete desc;
     135 
    135136  /*
    136137
  • trunk/lib/FlairSensorActuator/src/Bldc.cpp

    r45 r148  
    5454
    5555  output = new cvmatrix(this, desc, floatType);
     56  delete desc;
    5657  AddDataToLog(output);
    5758}
  • trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.cpp

    r137 r148  
    4141  cvmatrix_descriptor *desc = new cvmatrix_descriptor(1081, 1);
    4242  output = new cvmatrix((IODevice *)this, desc, SignedIntegerType(16));
     43  delete desc;
    4344
    4445  bufRetMut =
  • trunk/lib/FlairSensorActuator/src/LaserRangeFinder.cpp

    r137 r148  
    3939  cvmatrix_descriptor *desc = new cvmatrix_descriptor(360, 1);
    4040  output = new cvmatrix(this, desc, floatType);
     41  delete desc;
    4142  AddDataToLog(output);
    42 
     43Warn("output matrix is created in LaserRangeFinder and utm30lx\n");
    4344  // station sol
    4445  main_tab = new Tab(getFrameworkManager()->GetTabWidget(), name);
  • trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp

    r137 r148  
    4545  }
    4646  output = new cvmatrix(this, desc, floatType, name);
     47  delete desc;
    4748
    4849  // station sol
  • trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp

    r137 r148  
    3939  desc->SetElementName(0, 0, name);
    4040  output = new cvmatrix(this, desc, floatType);
     41  delete desc;
    4142  AddDataToLog(output);
    4243
  • trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp

    r140 r148  
    6666  desc->SetElementName(6, 0, "z");
    6767  output = new cvmatrix(self, desc, floatType);
     68  delete desc;
    6869
    6970  desc = new cvmatrix_descriptor(3, 1);
     
    7273  desc->SetElementName(2, 0, "yaw");
    7374  state = new cvmatrix(self, desc, floatType);
     75  delete desc;
    7476
    7577  // ui
  • trunk/lib/FlairSimulator/src/Model_impl.cpp

    r146 r148  
    128128  desc->SetElementName(12, 0, "vz");
    129129  output = new cvmatrix(this, desc, floatType, "state");
     130  delete desc;
    130131
    131132  self->AddDataToLog(output);
  • trunk/lib/FlairVisionFilter/src/HoughLines.cpp

    r124 r148  
    5050    desc->SetElementName(3,0,"line_detected");
    5151    output=new cvmatrix(this,desc,floatType,name);
     52    delete desc;
    5253
    5354    try{
  • trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp

    r143 r148  
    2727OpticalFlowSpeed::OpticalFlowSpeed(const IODevice* parent,string name) : IODevice(parent,name)
    2828{
    29     cvmatrix_descriptor* desc=new cvmatrix_descriptor(2,1);
    30     desc->SetElementName(0,0,"vx");
    31         desc->SetElementName(1,0,"vy");
    32     output=new cvmatrix(this,desc,floatType,name);
     29  cvmatrix_descriptor* desc=new cvmatrix_descriptor(2,1);
     30  desc->SetElementName(0,0,"vx");
     31  desc->SetElementName(1,0,"vy");
     32  output=new cvmatrix(this,desc,floatType,name);
     33  delete desc;
    3334
    3435        AddDataToLog(output);
Note: See TracChangeset for help on using the changeset viewer.