Changeset 214 in flair-src


Ignore:
Timestamp:
02/07/18 17:49:27 (6 years ago)
Author:
Sanahuja Guillaume
Message:

matrix

Location:
trunk
Files:
117 edited

Legend:

Unmodified
Added
Removed
  • trunk/ReleaseNotes

    r212 r214  
    11* Actual Version:
     2
     3- replaced cvmatrix by Matrix
     4- added a timeout on SimuBldc: if nothing is sent within the timeout, motors will stop
    25
    36-----------------------------------------------------------
  • trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x4.xml

    r157 r214  
    2727    <DoubleSpinBox value="0.006" name="j_pitch:"/>
    2828    <DoubleSpinBox value="0.1" name="j_yaw:"/>
    29    </Tab>
     29   <SpinBox name="motor timeout:" value="100"/></Tab>
    3030   <Tab name="us">
    3131    <GroupBox name="position">
     
    4040    </GroupBox>
    4141    <DoubleSpinBox value="6" name="range:"/>
    42    <Vector3DSpinBox name="position" value_x="0.00" value_y="0.00" value_z="0.0400000000000000"/><Vector3DSpinBox name="direction" value_x="0" value_y="0" value_z="1"/></Tab>
     42   <Vector3DSpinBox name="position" value_x="0" value_y="0" value_z="0.04"/><Vector3DSpinBox name="direction" value_x="0" value_y="0" value_z="1"/></Tab>
    4343   <Tab name="bottom camera">
    4444    <GroupBox name="position">
  • trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x8.xml

    r21 r214  
    1616    <DoubleSpinBox value="-1.2" name="z:"/>
    1717    <SpinBox value="90" name="yaw (deg):"/>
    18    <Vector3DSpinBox name="position" value_x="-1.50" value_y="0.00" value_z="-1.00"/></Tab>
     18   <Vector3DSpinBox name="position" value_x="-1.5" value_y="0" value_z="-1"/></Tab>
    1919   <Tab name="model">
    2020    <DoubleSpinBox value="1.6" name="mass (kg):"/>
     
    3131    <DoubleSpinBox value="0.72" name="sigma:"/>
    3232    <DoubleSpinBox value="1" name="S:"/>
    33    </Tab>
     33   <SpinBox name="motor timeout:" value="100"/></Tab>
    3434   <Tab name="us">
    3535    <GroupBox name="position">
     
    4444    </GroupBox>
    4545    <DoubleSpinBox value="6" name="range:"/>
    46    <Vector3DSpinBox name="position" value_x="0.00" value_y="0.00" value_z="0.04"/><Vector3DSpinBox name="direction" value_x="0.00" value_y="0.00" value_z="1.00"/></Tab>
     46   <Vector3DSpinBox name="position" value_x="0" value_y="0" value_z="0.04"/><Vector3DSpinBox name="direction" value_x="0" value_y="0" value_z="1"/></Tab>
    4747   <Tab name="bottom camera">
    4848    <GroupBox name="position">
     
    9696    <DoubleSpinBox value="0" name="z:"/>
    9797    <SpinBox value="90" name="yaw (deg):"/>
    98    <Vector3DSpinBox name="position" value_x="-1.50" value_y="1.00" value_z="0.00"/></Tab>
     98   <Vector3DSpinBox name="position" value_x="-1.5" value_y="1" value_z="0"/></Tab>
    9999   <Tab name="model">
    100100    <DoubleSpinBox value="1.3" name="translational speed (m/s):"/>
  • trunk/demos/CircleFollower/uav/src/CircleFollower.cpp

    r171 r214  
    2424#include <MetaVrpnObject.h>
    2525#include <TrajectoryGenerator2DCircle.h>
     26#include <Matrix.h>
    2627#include <cvmatrix.h>
    2728#include <cmath>
     
    6162
    6263    circle=new TrajectoryGenerator2DCircle(vrpnclient->GetLayout()->NewRow(),"circle");
    63     uavVrpn->xPlot()->AddCurve(circle->Matrix()->Element(0,0),DataPlot::Blue);
    64     uavVrpn->yPlot()->AddCurve(circle->Matrix()->Element(0,1),DataPlot::Blue);
    65     uavVrpn->VxPlot()->AddCurve(circle->Matrix()->Element(1,0),DataPlot::Blue);
    66     uavVrpn->VyPlot()->AddCurve(circle->Matrix()->Element(1,1),DataPlot::Blue);
    67     uavVrpn->XyPlot()->AddCurve(circle->Matrix()->Element(0,1),circle->Matrix()->Element(0,0),DataPlot::Blue,"circle");
     64    uavVrpn->xPlot()->AddCurve(circle->GetMatrix()->Element(0,0),DataPlot::Blue);
     65    uavVrpn->yPlot()->AddCurve(circle->GetMatrix()->Element(0,1),DataPlot::Blue);
     66    uavVrpn->VxPlot()->AddCurve(circle->GetMatrix()->Element(1,0),DataPlot::Blue);
     67    uavVrpn->VyPlot()->AddCurve(circle->GetMatrix()->Element(1,1),DataPlot::Blue);
     68    uavVrpn->XyPlot()->AddCurve(circle->GetMatrix()->Element(0,1),circle->GetMatrix()->Element(0,0),DataPlot::Blue,"circle");
    6869
    6970    uX=new Pid(setupLawTab->At(1,0),"u_x");
  • trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp

    r167 r214  
    2222#include <LowPassFilter.h>
    2323#include <EulerDerivative.h>
    24 #include <cvmatrix.h>
     24#include <Matrix.h>
    2525#include <GridLayout.h>
    2626#include <DataPlot1D.h>
     
    6565  opticalFlowSpeedRaw=new OpticalFlowSpeed(opticalFlowCompensated,uav->GetAhrs(),uav->GetVerticalCamera()->GetLayout()->NewRow(),"vitesse du Flux Optique");
    6666  //opticalFlowSpeed=vitesse de déplacement en pixels par seconde (moyenne sur tous les points et division par le delta T)
    67   cvmatrix* twoByOneOFS=new cvmatrix((const Thread*)this,2,1,floatType);
    68   cvmatrix* twoByOneOFAR=new cvmatrix((const Thread*)this,2,1,floatType);
    69   cvmatrix* twoByOneOFA=new cvmatrix((const Thread*)this,2,1,floatType);
     67  Matrix* twoByOneOFS=new Matrix((const Thread*)this,2,1,floatType);
     68  Matrix* twoByOneOFAR=new Matrix((const Thread*)this,2,1,floatType);
     69  Matrix* twoByOneOFA=new Matrix((const Thread*)this,2,1,floatType);
    7070  opticalFlowSpeed=new LowPassFilter(opticalFlowSpeedRaw,uav->GetVerticalCamera()->GetLayout()->NewRow(),"Speed lowPass",twoByOneOFS);
    7171  opticalFlowAccelerationRaw=new EulerDerivative(opticalFlowSpeed,uav->GetVerticalCamera()->GetLayout()->NewRow(),"derivative",twoByOneOFAR);
     
    8383
    8484  xVelocityPlot->AddCurve(opticalFlowSpeedRaw->Output()->Element(0,0));
    85   xVelocityPlot->AddCurve(opticalFlowSpeed->Matrix()->Element(0,0),DataPlot::Blue);
     85  xVelocityPlot->AddCurve(opticalFlowSpeed->GetMatrix()->Element(0,0),DataPlot::Blue);
    8686  yVelocityPlot->AddCurve(opticalFlowSpeedRaw->Output()->Element(1,0));
    87   yVelocityPlot->AddCurve(opticalFlowSpeed->Matrix()->Element(1,0),DataPlot::Blue);
     87  yVelocityPlot->AddCurve(opticalFlowSpeed->GetMatrix()->Element(1,0),DataPlot::Blue);
    8888  xFirstPointPlot->AddCurve(opticalFlowCompensated->GetFirstPointDisplacement()->Element(0,0));
    8989  xFirstPointPlot->AddCurve(opticalFlowCompensated->GetFirstPointDisplacement()->Element(1,0),DataPlot::Blue);
     
    107107 
    108108  Tab* opticalFlowRealTab=new Tab(getFrameworkManager()->GetTabWidget(),"real speed");
    109   opticalFlowRealSpeed=new cvmatrix((const Thread*)this,2,1,floatType);
    110   opticalFlowReference=new cvmatrix((const Thread*)this,2,1,floatType);
    111   opticalFlowRealAcceleration=new cvmatrix((const Thread*)this,2,1,floatType);
     109  opticalFlowRealSpeed=new Matrix((const Thread*)this,2,1,floatType);
     110  opticalFlowReference=new Matrix((const Thread*)this,2,1,floatType);
     111  opticalFlowRealAcceleration=new Matrix((const Thread*)this,2,1,floatType);
    112112  DataPlot1D* xRealVelocityPlot=new DataPlot1D(opticalFlowRealTab->NewRow(),"x speed (m/s)",-2,2);
    113113  DataPlot1D* yRealVelocityPlot=new DataPlot1D(opticalFlowRealTab->LastRowLastCol(),"y speed (m/s)",-2,2);
  • trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.h

    r165 r214  
    2020namespace flair {
    2121    namespace core {
    22         class cvmatrix;
     22        class Matrix;
    2323    }
    2424    namespace gui {
     
    5555        flair::gui::GroupBox* opticalFlowGroupBox;
    5656        flair::gui::DoubleSpinBox *maxXSpeed,*maxYSpeed;
    57         flair::core::cvmatrix *opticalFlowReference;
     57        flair::core::Matrix *opticalFlowReference;
    5858        flair::filter::Pid *u_x, *u_y;
    5959        flair::filter::CvtColor* greyCameraImage;
    6060        flair::core::AhrsData *customReferenceOrientation;
    61         flair::core::cvmatrix *opticalFlowRealSpeed,*opticalFlowRealAcceleration;
     61        flair::core::Matrix *opticalFlowRealSpeed,*opticalFlowRealAcceleration;
    6262
    6363    private:
  • trunk/demos/SimpleFleet/uav/src/SimpleFleet.cpp

    r178 r214  
    2929#include <PidThrust.h>
    3030#include <Euler.h>
     31#include <Matrix.h>
    3132#include <cvmatrix.h>
    3233#include <AhrsData.h>
     
    6061
    6162    circle=new TrajectoryGenerator2DCircle(vrpnclient->GetLayout()->NewRow(),"circle");
    62     uavVrpn->xPlot()->AddCurve(circle->Matrix()->Element(0,0),0,0,255);
    63     uavVrpn->yPlot()->AddCurve(circle->Matrix()->Element(0,1),0,0,255);
    64     uavVrpn->VxPlot()->AddCurve(circle->Matrix()->Element(1,0),0,0,255);
    65     uavVrpn->VyPlot()->AddCurve(circle->Matrix()->Element(1,1),0,0,255);
     63    uavVrpn->xPlot()->AddCurve(circle->GetMatrix()->Element(0,0),0,0,255);
     64    uavVrpn->yPlot()->AddCurve(circle->GetMatrix()->Element(0,1),0,0,255);
     65    uavVrpn->VxPlot()->AddCurve(circle->GetMatrix()->Element(1,0),0,0,255);
     66    uavVrpn->VyPlot()->AddCurve(circle->GetMatrix()->Element(1,1),0,0,255);
    6667
    6768    xCircleCenter=new DoubleSpinBox(vrpnclient->GetLayout()->NewRow(),"x circle center"," m",-5,5,0.1,1,0);
  • trunk/demos/Sinus/src/Loop.cpp

    r16 r214  
    2424#include <PushButton.h>
    2525#include <DataPlot1D.h>
    26 #include <cvmatrix.h>
     26#include <Matrix.h>
    2727
    2828using namespace std;
     
    4747                                   "1st order lawpass filter");
    4848  sinus->GetPlot()->AddCurve(
    49       firstLowPass->Matrix()->Element(0),
     49      firstLowPass->GetMatrix()->Element(0),
    5050      DataPlot::Blue); // add output of the filter to signal's graph
    5151
     
    5454      sinus, sinus->GetSetupLayout()->NewRow(), "3rd order lawpass filter", 3);
    5555  sinus->GetPlot()->AddCurve(
    56       thirdLowPass->Matrix()->Element(0),
     56      thirdLowPass->GetMatrix()->Element(0),
    5757      DataPlot::Yellow); // add output of the filter to signal's graph
    5858
  • trunk/demos/Sinus/src/MeanFilter.cpp

    r157 r214  
    1313
    1414#include "MeanFilter.h"
    15 #include <cvmatrix.h>
     15#include <Matrix.h>
    1616#include <LayoutPosition.h>
    1717#include <GroupBox.h>
     
    4242  desc->SetElementName(0, 0,
    4343                       "mean filter"); // name will be used for graphs and logs
    44   output = new cvmatrix(this, desc, floatType, name);
     44  output = new Matrix(this, desc, floatType, name);
    4545  delete desc;
    4646
     
    5252MeanFilter::~MeanFilter() {}
    5353
    54 cvmatrix *MeanFilter::GetMatrix() const { return output; }
     54Matrix *MeanFilter::GetMatrix() const { return output; }
    5555
    5656float MeanFilter::GetValue(void) const { return output->Value(0, 0); }
     
    6464
    6565  float result = 0;
    66   // get input argument in a cvmatrix
    67   cvmatrix *input = (cvmatrix *)data;
     66  // get input argument in a matrix
     67  const Matrix* input = dynamic_cast<const Matrix*>(data);
     68 
     69  if (!input) {
     70      Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
     71      return;
     72  }
    6873
    6974  // simple (and not efficent!) implementation of the filter
  • trunk/demos/Sinus/src/MeanFilter.h

    r16 r214  
    2525namespace flair {
    2626namespace core {
    27 class cvmatrix;
     27class Matrix;
    2828}
    2929namespace gui {
     
    7070  * \return pointer to the output matrix
    7171  */
    72   core::cvmatrix *GetMatrix(void) const;
     72  core::Matrix *GetMatrix(void) const;
    7373
    7474  /*!
     
    8686  gui::GroupBox *groupBox;
    8787  gui::SpinBox *numberOfElements;
    88   core::cvmatrix *output;
     88  core::Matrix *output;
    8989  float previousValues[MAX_NUMBER_OF_ELEMENTS]; // previous values storage
    9090};
  • trunk/demos/Sinus/src/Sinus.cpp

    r157 r214  
    2121#include <SpinBox.h>
    2222#include <DataPlot1D.h>
    23 #include <cvmatrix.h>
     23#include <Matrix.h>
    2424#include <math.h>
    2525
     
    4141  cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
    4242  desc->SetElementName(0, 0, "value"); // name will be used for graphs and logs
    43   output = new cvmatrix((IODevice *)this, desc, floatType, name);
     43  output = new Matrix((IODevice *)this, desc, floatType, name);
    4444  delete desc;
    4545
     
    9494}
    9595
    96 cvmatrix *Sinus::GetMatrix(void) const { return output; }
     96Matrix *Sinus::GetMatrix(void) const { return output; }
    9797
    9898float Sinus::GetValue(void) const { return output->Value(0, 0); }
  • trunk/demos/Sinus/src/Sinus.h

    r16 r214  
    2323namespace core {
    2424class FrameworkManager;
    25 class cvmatrix;
     25class Matrix;
    2626}
    2727namespace gui {
     
    6969  * \return un pointeur vers la matrice de sortie
    7070  */
    71   core::cvmatrix *GetMatrix(void) const;
     71  core::Matrix *GetMatrix(void) const;
    7272
    7373  /*!
     
    113113  void Run(void);
    114114
    115   core::cvmatrix *output;
     115  core::Matrix *output;
    116116  gui::Tab *mainTab;
    117117  gui::TabWidget *tabWidget;
  • trunk/lib/FlairCore/src/FrameworkManager_impl.cpp

    r213 r214  
    211211  }
    212212                                                                                                                                                                                       
    213         UDT::startup();
     213        UDT::startup(1024*256,1024*256,1024*256);
    214214  this->rcv_buf_size = rcv_buf_size;
    215215
  • trunk/lib/FlairCore/src/Matrix.cpp

    r213 r214  
    1919#include <typeinfo>
    2020#include <string.h>
    21 
    22 //#include <iostream>
    2321
    2422using std::string;
     
    3735    this->col = col;
    3836    if (row >= matrix->Rows() || col >= matrix->Cols()) {
    39       matrix->Err("index (%i,%i) out of bound (%i,%i)\n", row, col,
     37      matrix->Err("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
    4038                  matrix->Rows() - 1, matrix->Cols() - 1);
    4139      size = 0;
     
    7169      } break;
    7270      }
     71    } else if (typeid(matrix->GetDataType().GetElementDataType()) ==
     72               typeid(UnsignedIntegerType)) {
     73      switch (matrix->GetDataType().GetElementDataType().GetSize()) {
     74      case 1: {
     75        uint8_t uint8Value = matrix->Value(row, col);
     76        memcpy(dst, &uint8Value, 1);
     77      } break;
     78      case 2: {
     79        uint16_t uint16Value = matrix->Value(row, col);
     80        memcpy(dst, &uint16Value, 2);
     81      } break;
     82      }
    7383    }
    7484  }
     
    133143  if (row >= (uint32_t)pimpl_->descriptor->Rows() ||
    134144      col >= (uint32_t)pimpl_->descriptor->Cols()) {
    135     Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
     145    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
    136146         pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1);
    137147    return 0;
     
    139149
    140150  GetMutex();
    141   value = pimpl_->datas[row][col];
     151  value = pimpl_->ValueNoMutex(row, col);
    142152  ReleaseMutex();
    143153
     
    148158  if (row >= (uint32_t)pimpl_->descriptor->Rows() ||
    149159      col >= (uint32_t)pimpl_->descriptor->Cols()) {
    150     Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
     160    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
    151161         pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1);
    152162    return 0;
    153163  }
    154164
    155   return pimpl_->datas[row][col];
     165  return pimpl_->ValueNoMutex(row, col);
    156166}
    157167
     
    159169  if (row >= (uint32_t)pimpl_->descriptor->Rows() ||
    160170      col >= (uint32_t)pimpl_->descriptor->Cols()) {
    161     Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
     171    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
    162172         pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1);
    163173  } else {
    164174    GetMutex();
    165     pimpl_->datas[row][col]=value;
     175    pimpl_->SetValueNoMutex(row, col,value);
    166176    ReleaseMutex();
    167177  }
     
    171181  if (row >= (uint32_t)pimpl_->descriptor->Rows() ||
    172182      col >= (uint32_t)pimpl_->descriptor->Cols()) {
    173     Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
     183    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
    174184         pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1);
    175185  } else {
    176     pimpl_->datas[row][col]=value;
     186    pimpl_->SetValueNoMutex(row, col,value);
    177187  }
    178188}
     
    180190void Matrix::CopyDatas(char *dst) const {
    181191  GetMutex();
    182   // printf("%f %x %i\n",cvGetReal2D(pimpl_->mat,0,0),dst,Size());
    183192  memcpy(dst, pimpl_->datas, dataType.GetSize());
    184193  ReleaseMutex();
  • trunk/lib/FlairCore/src/Matrix.h

    r213 r214  
    2727* \brief Class defining a matrix
    2828*
    29 * Only supports float for the moment
    30 * TODO: write a template
    3129*
    3230*/
     
    196194
    197195  Type const &GetDataType() const { return dataType; };
    198 
     196void CopyDatas(char *dst) const;
    199197private:
    200198  /*!
     
    206204  * \param dst destination buffer
    207205  */
    208   void CopyDatas(char *dst) const;
     206  //void CopyDatas(char *dst) const;
    209207
    210208  class Matrix_impl *pimpl_;
  • trunk/lib/FlairCore/src/Matrix_impl.cpp

    r213 r214  
    5454        dynamic_cast<ScalarType const &>(elementDataType);
    5555    if (typeid(scalarType) == typeid(FloatType)) {
    56       datas = (float **)malloc(descriptor->Rows() * sizeof(float*));
    57       if(datas==NULL) {
    58         self->Err("error allocating matrix\n");
    59         return;
    60       }
    61       for(uint32_t i=0 ; i < descriptor->Rows() ; i++){
    62         datas[i] = (float*)malloc(descriptor->Cols() * sizeof(float) );
    63         if(datas[i]==NULL) {
    64           self->Err("error allocating matrix\n");
    65           for(uint32_t j = i-1 ; j >= 0 ; j--) free(datas[j]);
    66           free(datas);
    67           return;
    68         }
    69       }
    70       /*
    71     } else if (typeid(scalarType) == typeid(SignedIntegerType)) {
     56      datas =malloc(descriptor->Rows() * descriptor->Cols() * sizeof(float));
     57    } else if (typeid(scalarType) == typeid(SignedIntegerType) || typeid(scalarType) == typeid(UnsignedIntegerType) ) {
    7258      switch (elementDataType.GetSize()) {
    7359      case 1:
    74         mat = cvCreateMat(descriptor->Rows(), descriptor->Cols(), CV_8SC1);
     60        datas=malloc(descriptor->Rows() * descriptor->Cols() * sizeof(uint8_t));
    7561        break;
    7662      case 2:
    77         mat = cvCreateMat(descriptor->Rows(), descriptor->Cols(), CV_16SC1);
     63        datas=malloc(descriptor->Rows() * descriptor->Cols() * sizeof(uint16_t));
    7864        break;
    7965      default:
    8066        self->Err("unsupported integer scalar type\n");
    81       }*/
     67      }
    8268    } else {
    8369      self->Err("unsupported scalar type\n");
     
    9480
    9581Matrix_impl::~Matrix_impl() {
    96   for (uint32_t i = 0; i < descriptor->Rows();i++) {
    97     free(datas[i]);
    98   }
    9982  free(datas);
    10083  delete descriptor;
    10184}
     85
     86float Matrix_impl::ValueNoMutex(uint32_t row, uint32_t col) const {
     87  ScalarType const &scalarType =
     88        dynamic_cast<ScalarType const &>(elementDataType);
     89  if (typeid(scalarType) == typeid(FloatType)) {
     90    return ((float*)datas)[row*descriptor->Cols()+col];
     91  } else if (typeid(scalarType) == typeid(SignedIntegerType)) {
     92    switch (elementDataType.GetSize()) {
     93    case 1:
     94      return ((int8_t*)datas)[row*descriptor->Cols()+col];
     95      break;
     96    case 2:
     97      return ((int16_t*)datas)[row*descriptor->Cols()+col];
     98      break;
     99    default:
     100      self->Err("unsupported signed integer scalar type\n");
     101    }
     102  } else if (typeid(scalarType) == typeid(UnsignedIntegerType)) {
     103    switch (elementDataType.GetSize()) {
     104    case 1:
     105      return ((uint8_t*)datas)[row*descriptor->Cols()+col];
     106      break;
     107    case 2:
     108      return ((uint16_t*)datas)[row*descriptor->Cols()+col];
     109      break;
     110    default:
     111      self->Err("unsupported unsigned integer scalar type\n");
     112    }
     113  } else {
     114    self->Err("unsupported scalar type\n");
     115  }
     116  return 0;
     117}
     118
     119void Matrix_impl::SetValueNoMutex(uint32_t row, uint32_t col, float value) {
     120 ScalarType const &scalarType =
     121        dynamic_cast<ScalarType const &>(elementDataType);
     122  if (typeid(scalarType) == typeid(FloatType)) {
     123    ((float*)datas)[row*descriptor->Cols()+col]=value;
     124  } else if (typeid(scalarType) == typeid(SignedIntegerType)) {
     125    switch (elementDataType.GetSize()) {
     126    case 1:
     127      ((int8_t*)datas)[row*descriptor->Cols()+col]=value;
     128      break;
     129    case 2:
     130      ((int16_t*)datas)[row*descriptor->Cols()+col]=value;
     131      break;
     132    default:
     133      self->Err("unsupported signed integer scalar type\n");
     134    }
     135  } else if (typeid(scalarType) == typeid(UnsignedIntegerType)) {
     136    switch (elementDataType.GetSize()) {
     137    case 1:
     138      ((uint8_t*)datas)[row*descriptor->Cols()+col]=value;
     139      break;
     140    case 2:
     141      ((uint16_t*)datas)[row*descriptor->Cols()+col]=value;
     142      break;
     143    default:
     144      self->Err("unsupported unsigned integer scalar type\n");
     145    }
     146  } else {
     147    self->Err("unsupported scalar type\n");
     148  }
     149}
  • trunk/lib/FlairCore/src/RangeFinderPlot.cpp

    r137 r214  
    1818
    1919#include "RangeFinderPlot.h"
    20 #include "cvmatrix.h"
    21 #include "Layout.h"
     20#include "Matrix.h"
    2221#include "LayoutPosition.h"
    2322#include <cxcore.h>
     
    3231                                 string x_name, float xmin, float xmax,
    3332                                 string y_name, float ymin, float ymax,
    34                                  const cvmatrix *datas, float start_angle,
     33                                 const Matrix *datas, float start_angle,
    3534                                 float end_angle, uint32_t nb_samples)
    3635    : SendData(position, name, "RangeFinderPlot", 200) {
    3736  this->datas = datas;
    38 
     37Warn("RangeFinderPlot::CopyDatas needs to be written\n");
    3938  SetSendSize(datas->GetDataType().GetSize());
    4039
     
    5958
    6059void RangeFinderPlot::CopyDatas(char *buf) const {
    61   datas->GetMutex();
    62   memcpy(buf, datas->getCvMat()->data.ptr, datas->GetDataType().GetSize());
    63   datas->ReleaseMutex();
     60  //datas->CopyDatas(buf);
    6461}
    6562
  • trunk/lib/FlairCore/src/RangeFinderPlot.h

    r15 r214  
    2020namespace flair {
    2121namespace core {
    22 class cvmatrix;
     22class Matrix;
    2323}
    2424}
     
    6161                  std::string x_name, float xmin, float xmax,
    6262                  std::string y_name, float ymin, float ymax,
    63                   const core::cvmatrix *datas, float start_angle,
     63                  const core::Matrix *datas, float start_angle,
    6464                  float end_angle, uint32_t nb_samples);
    6565
     
    8787  void ExtraXmlEvent(void){};
    8888
    89   const core::cvmatrix *datas;
     89  const core::Matrix *datas;
    9090};
    9191
  • trunk/lib/FlairCore/src/cvmatrix.cpp

    r15 r214  
    3737    this->col = col;
    3838    if (row >= matrix->Rows() || col >= matrix->Cols()) {
    39       matrix->Err("index (%i,%i) out of bound (%i,%i)\n", row, col,
     39      matrix->Err("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
    4040                  matrix->Rows() - 1, matrix->Cols() - 1);
    4141      size = 0;
     
    133133  if (row >= (uint32_t)pimpl_->mat->rows ||
    134134      col >= (uint32_t)pimpl_->mat->cols) {
    135     Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
     135    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
    136136         pimpl_->mat->rows - 1, pimpl_->mat->cols - 1);
    137137    return 0;
     
    148148  if (row >= (uint32_t)pimpl_->mat->rows ||
    149149      col >= (uint32_t)pimpl_->mat->cols) {
    150     Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
     150    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
    151151         pimpl_->mat->rows - 1, pimpl_->mat->cols - 1);
    152152    return 0;
     
    159159  if (row >= (uint32_t)pimpl_->mat->rows ||
    160160      col >= (uint32_t)pimpl_->mat->cols) {
    161     Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
     161    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
    162162         pimpl_->mat->rows - 1, pimpl_->mat->cols - 1);
    163163  } else {
     
    171171  if (row >= (uint32_t)pimpl_->mat->rows ||
    172172      col >= (uint32_t)pimpl_->mat->cols) {
    173     Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
     173    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
    174174         pimpl_->mat->rows - 1, pimpl_->mat->cols - 1);
    175175  } else {
  • trunk/lib/FlairCore/src/cvmatrix_descriptor.cpp

    r15 r214  
    4646                                         string name) {
    4747  if (row >= rows || col >= cols) {
    48     getFrameworkManager()->Err("index out of bound %s (%i,%i), range (%i,%i)\n",
     48    getFrameworkManager()->Err("index out of bound %s (%i,%i), max (%i,%i)\n",
    4949                               name.c_str(), row, col, rows - 1, cols - 1);
    5050    return;
     
    5555string cvmatrix_descriptor::ElementName(uint32_t row, uint32_t col) const {
    5656  if (row >= rows || col >= cols) {
    57     getFrameworkManager()->Err("index out of bound (%i,%i), range (%i,%i)\n",
     57    getFrameworkManager()->Err("index out of bound (%i,%i), max (%i,%i)\n",
    5858                               row, col, rows - 1, cols - 1);
    5959    return *element_names[0]; // safe value...
  • trunk/lib/FlairCore/src/unexported/Matrix_impl.h

    r213 r214  
    3333  flair::core::ScalarType const &elementDataType;
    3434  flair::core::cvmatrix_descriptor *descriptor;
    35   float **datas;
     35  void *datas;
     36  void SetValueNoMutex(uint32_t row, uint32_t col, float value);
     37  float ValueNoMutex(uint32_t row, uint32_t col) const;
    3638
    3739private:
  • trunk/lib/FlairCore/src/unexported/config.h

    r213 r214  
    2727
    2828// nrt pipe size
    29 #define NRT_PIPE_SIZE 1024 * 100
     29#define NRT_PIPE_SIZE 1024 * 100*10
    3030
    3131// rt log heap size
  • trunk/lib/FlairFilter/src/ButterworthLowPass.cpp

    r162 r214  
    1818#include "ButterworthLowPass.h"
    1919#include "ButterworthLowPass_impl.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Layout.h>
    2222#include <LayoutPosition.h>
     
    4848ButterworthLowPass::~ButterworthLowPass() { delete pimpl_; }
    4949
    50 cvmatrix *ButterworthLowPass::Matrix(void) const { return pimpl_->output; }
     50Matrix *ButterworthLowPass::GetMatrix(void) const { return pimpl_->output; }
    5151
    5252float ButterworthLowPass::Output(void) const {
  • trunk/lib/FlairFilter/src/ButterworthLowPass.h

    r162 r214  
    1818namespace flair {
    1919namespace core {
    20 class cvmatrix;
     20class Matrix;
    2121}
    2222namespace gui {
     
    9191  * \return filtered output
    9292  */
    93   core::cvmatrix *Matrix(void) const;
     93  core::Matrix *GetMatrix(void) const;
    9494
    9595  /*!
  • trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp

    r165 r214  
    1818#include "ButterworthLowPass_impl.h"
    1919#include "ButterworthLowPass.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Layout.h>
    2222#include <GroupBox.h>
     
    2929using namespace flair::filter;
    3030
    31 ButterworthLowPass_impl::ButterworthLowPass_impl(ButterworthLowPass *self,
     31ButterworthLowPass_impl::ButterworthLowPass_impl(const ButterworthLowPass *self,
    3232                                                 const LayoutPosition *position,
    3333                                                 string name, uint32_t order,uint32_t nbRow,uint32_t nbCol) {
     
    4141  cvmatrix_descriptor *desc = new cvmatrix_descriptor(nbRow, nbCol);
    4242  //desc->SetElementName(0, 0, "output");
    43   output = new cvmatrix(self, desc, floatType, name);
     43  output = new Matrix(self, desc, floatType, name);
    4444  delete desc;
    4545
     
    6060  this->nbRow=nbRow;
    6161  this->nbCol=nbCol;
     62  this->self=self;
    6263}
    6364
     
    7273
    7374void ButterworthLowPass_impl::UpdateFrom(const io_data *data) {
    74   cvmatrix *input = (cvmatrix *)data;
    7575  float delta_t;
     76  const Matrix* input = dynamic_cast<const Matrix*>(data);
     77 
     78  if (!input) {
     79      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
     80      return;
     81  }
    7682 
    7783  if (T->ValueChanged() && T->Value() != 0) {
  • trunk/lib/FlairFilter/src/ControlLaw.cpp

    r148 r214  
    1717
    1818#include "ControlLaw.h"
    19 #include <cvmatrix.h>
     19#include <Matrix.h>
    2020#include <cvmatrix_descriptor.h>
    2121#include <DataPlot1D.h>
     
    3232    : IODevice(parent, name) {
    3333  if (nb_out == 1) {
    34     output = new cvmatrix(this, nb_out, 1, floatType, name);
     34    output = new Matrix(this, nb_out, 1, floatType, name);
    3535  } else {
    3636    cvmatrix_descriptor *desc = new cvmatrix_descriptor(nb_out, 1);
     
    4040      desc->SetElementName(i, 0, ss.str());
    4141    }
    42     output = new cvmatrix(this, desc, floatType, name);
     42    output = new Matrix(this, desc, floatType, name);
    4343    delete desc;
    4444  }
  • trunk/lib/FlairFilter/src/ControlLaw.h

    r15 r214  
    2121}
    2222namespace core {
    23 class cvmatrix;
     23class Matrix;
    2424}
    2525}
     
    100100  *
    101101  */
    102   core::cvmatrix *input;
     102  core::Matrix *input;
    103103
    104104  /*!
     
    109109  *
    110110  */
    111   core::cvmatrix *output;
     111  core::Matrix *output;
    112112
    113113private:
  • trunk/lib/FlairFilter/src/EulerDerivative.cpp

    r157 r214  
    1818#include "EulerDerivative.h"
    1919#include "EulerDerivative_impl.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <LayoutPosition.h>
    2222
     
    3030EulerDerivative::EulerDerivative(const IODevice *parent,
    3131                                 const LayoutPosition *position, string name,
    32                                  const cvmatrix *init_value)
     32                                 const Matrix *init_value)
    3333    : IODevice(parent, name) {
    3434  pimpl_ = new EulerDerivative_impl(this, position, name, init_value);
     
    4040EulerDerivative::~EulerDerivative() { delete pimpl_; }
    4141
    42 cvmatrix *EulerDerivative::Matrix(void) const { return pimpl_->output; }
     42Matrix *EulerDerivative::GetMatrix(void) const { return pimpl_->output; }
    4343
    4444float EulerDerivative::Output(int row, int col) const {
  • trunk/lib/FlairFilter/src/EulerDerivative.h

    r147 r214  
    1818namespace flair {
    1919namespace core {
    20 class cvmatrix;
     20class Matrix;
    2121}
    2222namespace gui {
     
    5656  EulerDerivative(const core::IODevice *parent,
    5757                  const gui::LayoutPosition *position, std::string name,
    58                   const core::cvmatrix *init_value = NULL);
     58                  const core::Matrix *init_value = NULL);
    5959
    6060  /*!
     
    7979  * \return filtered output
    8080  */
    81   core::cvmatrix *Matrix(void) const;
     81  core::Matrix *GetMatrix(void) const;
    8282
    8383private:
  • trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp

    r148 r214  
    1818#include "EulerDerivative.h"
    1919#include "EulerDerivative_impl.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Layout.h>
    2222#include <GroupBox.h>
     
    3131                                           const LayoutPosition *position,
    3232                                           string name,
    33                                            const cvmatrix *init_value) {
     33                                           const Matrix *init_value) {
    3434  first_update = true;
     35  this->self = self;
    3536 
    3637  if (init_value != NULL) {
     
    4344      }
    4445    }
    45     output = new cvmatrix(self, desc,init_value->GetDataType().GetElementDataType(), name);
     46    output = new Matrix(self, desc,init_value->GetDataType().GetElementDataType(), name);
    4647    delete desc;
    4748    for (int i = 0; i < init_value->Rows(); i++) {
     
    5455    cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
    5556    desc->SetElementName(0, 0, "output");
    56     output = new cvmatrix(self, desc, floatType, name);
     57    output = new Matrix(self, desc, floatType, name);
    5758    delete desc;
    5859  }
     
    6061 
    6162  cvmatrix_descriptor *desc = new cvmatrix_descriptor(output->Rows(), output->Cols());
    62   prev_value = new cvmatrix(self, desc, output->GetDataType().GetElementDataType(), name);
     63  prev_value = new Matrix(self, desc, output->GetDataType().GetElementDataType(), name);
    6364
    6465
     
    7374void EulerDerivative_impl::UpdateFrom(const io_data *data) {
    7475  float delta_t;
    75   cvmatrix *input = (cvmatrix *)data;
     76  const Matrix* input = dynamic_cast<const Matrix*>(data);
     77 
     78  if (!input) {
     79      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
     80      return;
     81  }
    7682
    7783  // on prend une fois pour toute les mutex et on fait des accès directs
  • trunk/lib/FlairFilter/src/JoyReference.cpp

    r157 r214  
    2020#include <Layout.h>
    2121#include <LayoutPosition.h>
    22 #include <cvmatrix.h>
     22#include <Matrix.h>
    2323#include <AhrsData.h>
    2424#include <Euler.h>
  • trunk/lib/FlairFilter/src/JoyReference_impl.cpp

    r167 r214  
    2020#include <AhrsData.h>
    2121#include <Euler.h>
    22 #include <cvmatrix.h>
     22#include <Matrix.h>
    2323#include <Layout.h>
    2424#include <GroupBox.h>
     
    4040
    4141  ahrsData = new AhrsData(self);
    42   input = new cvmatrix(self, 4, 1, floatType, name);
     42  input = new Matrix(self, 4, 1, floatType, name);
    4343
    4444  cvmatrix_descriptor *desc = new cvmatrix_descriptor(4, 1);
     
    4848  desc->SetElementName(2, 0, "trim_roll");
    4949  desc->SetElementName(3, 0, "trim_pitch");
    50   output = new cvmatrix(self, desc, floatType, name);
     50  output = new Matrix(self, desc, floatType, name);
    5151  delete desc;
    5252
     
    147147
    148148void JoyReference_impl::UpdateFrom(const io_data *data) {
    149   cvmatrix *input = (cvmatrix *)data;
     149  const Matrix* input = dynamic_cast<const Matrix*>(data);
     150 
     151  if (!input) {
     152      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
     153      return;
     154  }
    150155
    151156  if (previous_time == 0)
  • trunk/lib/FlairFilter/src/LowPassFilter.cpp

    r157 r214  
    1818#include "LowPassFilter.h"
    1919#include "LowPassFilter_impl.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <LayoutPosition.h>
    2222
     
    3030LowPassFilter::LowPassFilter(const IODevice *parent,
    3131                             const LayoutPosition *position, string name,
    32                              const cvmatrix *init_value)
     32                             const Matrix *init_value)
    3333    : IODevice(parent, name) {
    3434  pimpl_ = new LowPassFilter_impl(this, position, name, init_value);
     
    4040LowPassFilter::~LowPassFilter() { delete pimpl_; }
    4141
    42 cvmatrix *LowPassFilter::Matrix(void) const { return pimpl_->output; }
     42Matrix *LowPassFilter::GetMatrix(void) const { return pimpl_->output; }
    4343
    4444float LowPassFilter::Output(int row, int col) const {
  • trunk/lib/FlairFilter/src/LowPassFilter.h

    r147 r214  
    1818namespace flair {
    1919namespace core {
    20 class cvmatrix;
     20class Matrix;
    2121}
    2222namespace gui {
     
    5656  LowPassFilter(const core::IODevice *parent,
    5757                const gui::LayoutPosition *position, std::string name,
    58                 const core::cvmatrix *init_value = NULL);
     58                const core::Matrix *init_value = NULL);
    5959
    6060  /*!
     
    7979  * \return filtered output
    8080  */
    81   core::cvmatrix *Matrix(void) const;
     81  core::Matrix *GetMatrix(void) const;
    8282
    8383private:
  • trunk/lib/FlairFilter/src/LowPassFilter_impl.cpp

    r148 r214  
    1818#include "LowPassFilter_impl.h"
    1919#include "LowPassFilter.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Layout.h>
    2222#include <GroupBox.h>
    2323#include <SpinBox.h>
    2424#include <DoubleSpinBox.h>
    25 
     25#include <typeinfo>
    2626#define PI ((float)3.14159265358979323846)
    2727
     
    3434                                       const LayoutPosition *position,
    3535                                       string name,
    36                                        const cvmatrix *init_value) {
     36                                       const Matrix *init_value) {
    3737
    3838  if (init_value != NULL) {
     
    4545      }
    4646    }
    47     output = new cvmatrix(self, desc,init_value->GetDataType().GetElementDataType(), name);
     47    output = new Matrix(self, desc,init_value->GetDataType().GetElementDataType(), name);
    4848    for (int i = 0; i < init_value->Rows(); i++) {
    4949      for (int j = 0; j < init_value->Cols(); j++) {
     
    5656    cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
    5757    desc->SetElementName(0, 0, "output");
    58     output = new cvmatrix(self, desc, floatType, name);
     58    output = new Matrix(self, desc, floatType, name);
    5959    delete desc;
    6060  }
     
    6868                           
    6969  previous_time=GetTime();
     70  this->self = self;
    7071}
    7172
     
    7475void LowPassFilter_impl::UpdateFrom(const io_data *data) {
    7576  float delta_t;
    76   cvmatrix *input = (cvmatrix *)data;
     77  const Matrix* input = dynamic_cast<const Matrix*>(data);
     78 
     79  if (!input) {
     80      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
     81      return;
     82  }
    7783
    7884  // on prend une fois pour toute les mutex et on fait des accès directs
  • trunk/lib/FlairFilter/src/NestedSat.cpp

    r157 r214  
    1818#include "NestedSat.h"
    1919#include "NestedSat_impl.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Layout.h>
    2222#include <LayoutPosition.h>
  • trunk/lib/FlairFilter/src/NestedSat_impl.cpp

    r15 r214  
    1818#include "NestedSat_impl.h"
    1919#include "NestedSat.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Layout.h>
    2222#include <GroupBox.h>
     
    3434
    3535  // init matrix
    36   self->input = new cvmatrix(self, 3, 1, floatType, name);
     36  self->input = new Matrix(self, 3, 1, floatType, name);
    3737
    3838  GroupBox *reglages_groupbox = new GroupBox(position, name);
     
    5050void NestedSat_impl::UpdateFrom(const io_data *data) {
    5151  float cons, dcons, law;
    52   cvmatrix *input = (cvmatrix *)data;
     52  const Matrix* input = dynamic_cast<const Matrix*>(data);
     53 
     54  if (!input) {
     55      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
     56      return;
     57  }
    5358
    5459  input->GetMutex();
  • trunk/lib/FlairFilter/src/Pid.cpp

    r157 r214  
    1818#include "Pid.h"
    1919#include "Pid_impl.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Layout.h>
    2222#include <LayoutPosition.h>
  • trunk/lib/FlairFilter/src/PidThrust.cpp

    r206 r214  
    1818#include "PidThrust.h"
    1919#include "PidThrust_impl.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Layout.h>
    2222#include <LayoutPosition.h>
  • trunk/lib/FlairFilter/src/PidThrust_impl.cpp

    r148 r214  
    1717#include "PidThrust_impl.h"
    1818#include "PidThrust.h"
    19 #include <cvmatrix.h>
     19#include <Matrix.h>
    2020#include <Layout.h>
    2121#include <GroupBox.h>
     
    3636
    3737  // init matrix
    38   self->input = new cvmatrix(self, 2, 1, floatType, name);
     38  self->input = new Matrix(self, 2, 1, floatType, name);
    3939
    4040  cvmatrix_descriptor *desc = new cvmatrix_descriptor(5, 1);
     
    4444  desc->SetElementName(3, 0, "p+i+d");
    4545  desc->SetElementName(4, 0, "p+i+d+offset");
    46   state = new cvmatrix(self, desc, floatType, name);
     46  state = new Matrix(self, desc, floatType, name);
    4747  delete desc;
    4848
     
    7676  float p, d, total;
    7777  float delta_t;
    78   cvmatrix *input = (cvmatrix *)data;
     78  const Matrix* input = dynamic_cast<const Matrix*>(data);
     79 
     80  if (!input) {
     81      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
     82      return;
     83  }
    7984
    8085  if (T->Value() == 0) {
  • trunk/lib/FlairFilter/src/Pid_impl.cpp

    r148 r214  
    1717#include "Pid_impl.h"
    1818#include "Pid.h"
    19 #include <cvmatrix.h>
     19#include <Matrix.h>
    2020#include <Layout.h>
    2121#include <GroupBox.h>
     
    3434
    3535  // init matrix
    36   self->input = new cvmatrix(self, 2, 1, floatType, name);
     36  self->input = new Matrix(self, 2, 1, floatType, name);
    3737
    3838  cvmatrix_descriptor *desc = new cvmatrix_descriptor(4, 1);
     
    4141  desc->SetElementName(2, 0, "d");
    4242  desc->SetElementName(3, 0, "p+i+d");
    43   state = new cvmatrix(self, desc, floatType, name);
     43  state = new Matrix(self, desc, floatType, name);
    4444  delete desc;
    4545
     
    7171  float p, d, total;
    7272  float delta_t;
    73   cvmatrix *input = (cvmatrix *)data;
     73  const Matrix* input = dynamic_cast<const Matrix*>(data);
     74 
     75  if (!input) {
     76      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
     77      return;
     78  }
    7479
    7580  if (T->Value() == 0) {
  • trunk/lib/FlairFilter/src/TrajectoryGenerator1D.cpp

    r205 r214  
    1818#include "TrajectoryGenerator1D.h"
    1919#include "TrajectoryGenerator1D_impl.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Layout.h>
    2222#include <LayoutPosition.h>
     
    3939TrajectoryGenerator1D::~TrajectoryGenerator1D() { delete pimpl_; }
    4040
    41 cvmatrix *TrajectoryGenerator1D::Matrix(void) const { return pimpl_->output; }
     41Matrix *TrajectoryGenerator1D::GetMatrix(void) const { return pimpl_->output; }
    4242
    4343void TrajectoryGenerator1D::StartTraj(float startPosition, float endPosition,float startVelocity) {
  • trunk/lib/FlairFilter/src/TrajectoryGenerator1D.h

    r205 r214  
    1818namespace flair {
    1919namespace core {
    20 class cvmatrix;
     20class Matrix;
    2121}
    2222namespace gui {
     
    152152  * \return matrix
    153153  */
    154   core::cvmatrix *Matrix(void) const;
     154  core::Matrix *GetMatrix(void) const;
    155155
    156156private:
  • trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp

    r205 r214  
    1818#include "TrajectoryGenerator1D.h"
    1919#include "TrajectoryGenerator1D_impl.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Layout.h>
    2222#include <GroupBox.h>
     
    6363  desc->SetElementName(0, 0, "pos");
    6464  desc->SetElementName(1, 0, "vel");
    65   output = new cvmatrix(self, desc, floatType, name);
     65  output = new Matrix(self, desc, floatType, name);
    6666  delete desc;
    6767
  • trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.cpp

    r167 r214  
    1818#include "TrajectoryGenerator2DCircle.h"
    1919#include "TrajectoryGenerator2DCircle_impl.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Layout.h>
    2222#include <LayoutPosition.h>
     
    4444}
    4545
    46 cvmatrix *TrajectoryGenerator2DCircle::Matrix(void) const {
     46Matrix *TrajectoryGenerator2DCircle::GetMatrix(void) const {
    4747  return pimpl_->output;
    4848}
  • trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.h

    r167 r214  
    1919namespace flair {
    2020namespace core {
    21 class cvmatrix;
     21class Matrix;
    2222}
    2323namespace gui {
     
    131131  * \return matrix
    132132  */
    133   core::cvmatrix *Matrix(void) const;
     133  core::Matrix *GetMatrix(void) const;
    134134
    135135  /*!
  • trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp

    r167 r214  
    1818#include "TrajectoryGenerator2DCircle_impl.h"
    1919#include "TrajectoryGenerator2DCircle.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Layout.h>
    2222#include <GroupBox.h>
     
    5656  desc->SetElementName(1, 0, "vel.x");
    5757  desc->SetElementName(1, 1, "vel.y");
    58   output = new cvmatrix(self, desc, floatType, name);
     58  output = new Matrix(self, desc, floatType, name);
    5959  delete desc;
    6060}
  • trunk/lib/FlairFilter/src/UavMultiplex.cpp

    r137 r214  
    1818#include "UavMultiplex.h"
    1919#include "UavMultiplex_impl.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <FrameworkManager.h>
    2222#include <Tab.h>
  • trunk/lib/FlairFilter/src/UavMultiplex_impl.cpp

    r137 r214  
    1818#include "UavMultiplex_impl.h"
    1919#include "UavMultiplex.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <FrameworkManager.h>
    2222#include <TabWidget.h>
     
    3434
    3535UavMultiplex_impl::UavMultiplex_impl(UavMultiplex *self, std::string name) {
    36   input = new cvmatrix(self, 7, 1, floatType);
     36  input = new Matrix(self, 7, 1, floatType);
    3737  multiplexcombobox = NULL;
    3838  this->self = self;
  • trunk/lib/FlairFilter/src/X4X8Multiplex_impl.cpp

    r148 r214  
    1818#include "X4X8Multiplex_impl.h"
    1919#include "X4X8Multiplex.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Tab.h>
    2222#include <GridLayout.h>
     
    5555  }
    5656
    57   output = new cvmatrix(self, desc, floatType);
     57  output = new Matrix(self, desc, floatType);
    5858  delete desc;
    5959  self->AddDataToLog(output);
     
    8383  float value[MAX_MOTORS];
    8484
    85   cvmatrix *input = (cvmatrix *)data;
     85  const Matrix* input = dynamic_cast<const Matrix*>(data);
     86 
     87  if (!input) {
     88      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
     89      return;
     90  }
    8691
    8792  // on prend une fois pour toute le mutex et on fait des accès directs
  • trunk/lib/FlairFilter/src/unexported/ButterworthLowPass_impl.h

    r162 r214  
    1919namespace flair {
    2020namespace core {
    21 class cvmatrix;
     21class Matrix;
    2222}
    2323namespace gui {
     
    120120class ButterworthLowPass_impl {
    121121public:
    122   ButterworthLowPass_impl(flair::filter::ButterworthLowPass *self,
     122  ButterworthLowPass_impl(const flair::filter::ButterworthLowPass *self,
    123123                          const flair::gui::LayoutPosition *position,
    124124                          std::string name, uint32_t order,uint32_t nbRow,uint32_t nbCol);
    125125  ~ButterworthLowPass_impl();
    126126  void UpdateFrom(const flair::core::io_data *data);
    127   flair::core::cvmatrix *output;
     127  flair::core::Matrix *output;
    128128
    129129private:
     
    135135  uint32_t order;
    136136  uint32_t nbRow, nbCol;
     137  const flair::filter::ButterworthLowPass *self;
    137138};
    138139
  • trunk/lib/FlairFilter/src/unexported/EulerDerivative_impl.h

    r15 r214  
    1818namespace flair {
    1919namespace core {
    20 class cvmatrix;
     20class Matrix;
    2121}
    2222namespace gui {
     
    3838                       const flair::gui::LayoutPosition *position,
    3939                       std::string name,
    40                        const flair::core::cvmatrix *init_value = NULL);
     40                       const flair::core::Matrix *init_value = NULL);
    4141  ~EulerDerivative_impl();
    4242  void UpdateFrom(const flair::core::io_data *data);
    43   flair::core::cvmatrix *output;
     43  flair::core::Matrix *output;
    4444
    4545private:
     
    4747  flair::core::Time previous_time;
    4848  bool first_update;
    49   flair::core::cvmatrix *prev_value;
     49  flair::core::Matrix *prev_value;
     50  flair::filter::EulerDerivative *self;
    5051};
    5152
  • trunk/lib/FlairFilter/src/unexported/JoyReference_impl.h

    r15 r214  
    2525namespace flair {
    2626namespace core {
    27 class cvmatrix;
     27class Matrix;
    2828class io_data;
    2929class AhrsData;
     
    6565  void Update(flair::core::Time time);
    6666  void UpdateFrom(const flair::core::io_data *data);
    67   flair::core::cvmatrix *output;
     67  flair::core::Matrix *output;
    6868  flair::core::AhrsData *ahrsData;
    6969
    7070private:
    71   flair::core::cvmatrix *input;
     71  flair::core::Matrix *input;
    7272
    7373  flair::gui::GroupBox *reglages_groupbox;
  • trunk/lib/FlairFilter/src/unexported/LowPassFilter_impl.h

    r147 r214  
    1818namespace flair {
    1919namespace core {
    20 class cvmatrix;
     20class Matrix;
    2121}
    2222namespace gui {
     
    3636                     const flair::gui::LayoutPosition *position,
    3737                     std::string name,
    38                      const flair::core::cvmatrix *init_value = NULL);
     38                     const flair::core::Matrix *init_value = NULL);
    3939  ~LowPassFilter_impl();
    4040  void UpdateFrom(const flair::core::io_data *data);
    41   flair::core::cvmatrix *output;
     41  flair::core::Matrix *output;
    4242
    4343private:
    4444  flair::core::Time previous_time;
    4545  flair::gui::DoubleSpinBox *freq, *T;
     46  const flair::filter::LowPassFilter *self;
    4647};
    4748
  • trunk/lib/FlairFilter/src/unexported/PidThrust_impl.h

    r15 r214  
    1818namespace flair {
    1919namespace core {
    20 class cvmatrix;
     20class Matrix;
    2121class io_data;
    2222}
     
    5050
    5151  // matrix
    52   flair::core::cvmatrix *state;
     52  flair::core::Matrix *state;
    5353
    5454  flair::gui::DoubleSpinBox *T, *kp, *ki, *kd, *sat, *sati;
  • trunk/lib/FlairFilter/src/unexported/Pid_impl.h

    r15 r214  
    1818namespace flair {
    1919namespace core {
    20 class cvmatrix;
     20class Matrix;
    2121class io_data;
    2222}
     
    4949
    5050  // matrix
    51   flair::core::cvmatrix *state;
     51  flair::core::Matrix *state;
    5252
    5353  flair::gui::DoubleSpinBox *T, *kp, *ki, *kd, *sat, *sati;
  • trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator1D_impl.h

    r205 r214  
    1616namespace flair {
    1717namespace core {
    18 class cvmatrix;
     18class Matrix;
    1919}
    2020namespace gui {
     
    3939  void Reset(void);
    4040  float GetPercentageOfCompletion(void) const;
    41   flair::core::cvmatrix *output;
     41  flair::core::Matrix *output;
    4242  float pos_off, vel_off;
    4343  bool is_finished, is_started;
  • trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator2DCircle_impl.h

    r167 r214  
    1919namespace flair {
    2020namespace core {
    21 class cvmatrix;
     21class Matrix;
    2222class io_data;
    2323}
     
    4646  void FinishTraj(void);
    4747  bool is_running;
    48   flair::core::cvmatrix *output;
     48  flair::core::Matrix *output;
    4949  flair::core::Vector2Df pos_off, vel_off;
    5050
  • trunk/lib/FlairFilter/src/unexported/UavMultiplex_impl.h

    r137 r214  
    2020namespace core {
    2121class FrameworkManager;
    22 class cvmatrix;
     22class Matrix;
    2323class io_data;
    2424}
     
    5656  ~UavMultiplex_impl();
    5757
    58   flair::core::cvmatrix *input;
     58  flair::core::Matrix *input;
    5959  void SetMultiplexComboBox(std::string name, int index);
    6060  int MultiplexValue(int index) const;
  • trunk/lib/FlairFilter/src/unexported/X4X8Multiplex_impl.h

    r15 r214  
    1818namespace flair {
    1919namespace core {
    20 class cvmatrix;
     20class Matrix;
    2121class io_data;
    2222}
     
    4444
    4545private:
    46   flair::core::cvmatrix *output;
     46  flair::core::Matrix *output;
    4747  flair::gui::ComboBox *pas;
    4848  flair::gui::DataPlot1D *plots[4];
  • trunk/lib/FlairMeta/src/MetaDualShock3.cpp

    r157 r214  
    2222#include <Tab.h>
    2323#include <FrameworkManager.h>
    24 #include <cvmatrix.h>
     24#include <Matrix.h>
    2525#include <Ahrs.h>
    2626#include <AhrsData.h>
  • trunk/lib/FlairMeta/src/MetaDualShock3_impl.cpp

    r38 r214  
    2020#include <JoyReference.h>
    2121#include <Tab.h>
    22 #include <cvmatrix.h>
     22#include <Matrix.h>
    2323#include <FrameworkManager.h>
    2424
     
    4343// receives updates from the controler
    4444void MetaDualShock3_impl::UpdateFrom(const io_data *data) {
    45   cvmatrix *input = (cvmatrix *)data;
     45  const Matrix* input = dynamic_cast<const Matrix*>(data);
     46 
     47  if (!input) {
     48      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
     49      return;
     50  }
    4651
    4752  // on prend une fois pour toute le mutex et on fait des accès directs
  • trunk/lib/FlairMeta/src/MetaUsRangeFinder.cpp

    r170 r214  
    2727#include <EulerDerivative.h>
    2828#include <GroupBox.h>
    29 #include <cvmatrix.h>
     29#include <Matrix.h>
    3030
    3131using std::string;
     
    5353  us->UseDefaultPlot();
    5454
    55   us->GetPlot()->AddCurve(pbas_z->Matrix()->Element(0), DataPlot::Blue);
     55  us->GetPlot()->AddCurve(pbas_z->GetMatrix()->Element(0), DataPlot::Blue);
    5656
    5757  vz_plot = new DataPlot1D(us->GetPlotTab()->LastRowLastCol(), "vz", -2, 2);
    58   vz_plot->AddCurve(vz_euler->Matrix()->Element(0));
    59   vz_plot->AddCurve(pbas_vz->Matrix()->Element(0), DataPlot::Blue);
     58  vz_plot->AddCurve(vz_euler->GetMatrix()->Element(0));
     59  vz_plot->AddCurve(pbas_vz->GetMatrix()->Element(0), DataPlot::Blue);
    6060}
    6161
  • trunk/lib/FlairMeta/src/MetaVrpnObject.cpp

    r170 r214  
    2727#include <Tab.h>
    2828#include <TabWidget.h>
    29 #include <cvmatrix.h>
     29#include <Matrix.h>
    3030
    3131using std::string;
     
    5454    desc->SetElementName(i, 0, Output()->Name(i, 0));
    5555  }
    56   cvmatrix *prev_value = new cvmatrix(this, desc, floatType, name);
     56  Matrix *prev_value = new Matrix(this, desc, floatType, name);
    5757  delete desc;
    5858
     
    6565    desc->SetElementName(i, 0, "d" + Output()->Name(i, 0));
    6666  }
    67   prev_value = new cvmatrix(this, desc, floatType, name);
     67  prev_value = new Matrix(this, desc, floatType, name);
    6868  delete desc;
    6969
     
    7373
    7474  vx_opti_plot = new DataPlot1D(GetPlotTab()->NewRow(), "vx", -3, 3);
    75   vx_opti_plot->AddCurve(euler->Matrix()->Element(4));
     75  vx_opti_plot->AddCurve(euler->GetMatrix()->Element(4));
    7676  vy_opti_plot = new DataPlot1D(GetPlotTab()->LastRowLastCol(), "vy", -3, 3);
    77   vy_opti_plot->AddCurve(euler->Matrix()->Element(5));
     77  vy_opti_plot->AddCurve(euler->GetMatrix()->Element(5));
    7878  vz_opti_plot = new DataPlot1D(GetPlotTab()->LastRowLastCol(), "vz", -2, 2);
    79   vz_opti_plot->AddCurve(euler->Matrix()->Element(6));
     79  vz_opti_plot->AddCurve(euler->GetMatrix()->Element(6));
    8080
    8181  plot_tab = new Tab(GetVrpnClient()->GetTabWidget(), "Mesures (xy) " + name);
  • trunk/lib/FlairMeta/src/Uav.cpp

    r186 r214  
    2828#include <NmeaGps.h>
    2929#include <Bldc.h>
    30 #include <cvmatrix.h>
     30#include <Matrix.h>
    3131#include "MetaUsRangeFinder.h"
    3232#include "MetaVrpnObject.h"
  • trunk/lib/FlairMeta/src/UavStateMachine.cpp

    r206 r214  
    3939#include <Vector3D.h>
    4040#include <Vector2D.h>
    41 #include <cvmatrix.h>
     41#include <Matrix.h>
    4242#include <stdio.h>
    4343#include <TrajectoryGenerator1D.h>
     
    109109      new TrajectoryGenerator1D(uavTab->NewRow(), "alt cons", "m");
    110110  uav->GetMetaUsRangeFinder()->GetZPlot()->AddCurve(
    111       altitudeTrajectory->Matrix()->Element(0), DataPlot::Green);
     111      altitudeTrajectory->GetMatrix()->Element(0), DataPlot::Green);
    112112  uav->GetMetaUsRangeFinder()->GetVzPlot()->AddCurve(
    113       altitudeTrajectory->Matrix()->Element(1), DataPlot::Green);
     113      altitudeTrajectory->GetMatrix()->Element(1), DataPlot::Green);
    114114}
    115115
     
    459459void UavStateMachine::TakeOff(void) {
    460460  flagZTrajectoryFinished = false;
    461 
    462   if((altitudeState==AltitudeState_t::Stopped) && safeToFly && uav->isReadyToFly()  && uav->GetBatteryMonitor()->IsBatteryLow()==false && !flagConnectionLost) {
     461 
     462  if(altitudeState!=AltitudeState_t::Stopped) {
     463    Warn("cannot takeoff, altitudeState!=AltitudeState_t::Stopped\n");
     464    joy->ErrorNotify();
     465  } else if(!safeToFly) {
     466    Warn("cannot takeoff, uav is not safe to fly\n");
     467    joy->ErrorNotify();
     468  } else if(!uav->isReadyToFly()) {
     469    Warn("cannot takeoff, uav is not ready\n");
     470    joy->ErrorNotify();
     471  } else if(uav->GetBatteryMonitor()->IsBatteryLow()) {
     472    Warn("cannot takeoff, battery is low\n");
     473    joy->ErrorNotify();
     474  } else if(flagConnectionLost) {
     475    Warn("cannot takeoff, connection with flairgcs lost\n");
     476    joy->ErrorNotify();
     477  } else {
    463478    //The uav always takes off in fail safe mode
    464479    flagBatteryLow=false;
     
    480495    altitudeState = AltitudeState_t::TakingOff;
    481496    SignalEvent(Event_t::TakingOff);
    482   } else {
    483     Warn("cannot takeoff\n");
    484     joy->ErrorNotify();
    485497  }
    486498}
     
    511523    altitudeState=AltitudeState_t::FinishLanding;
    512524    safeToFly=false;
    513 Printf("Emergency landing!\n");
     525    Warn("Emergency landing!\n");
     526    Warn("You will not be able to take off again\n");
    514527}
    515528
  • trunk/lib/FlairSensorActuator/src/AfroBldc_impl.cpp

    r15 r214  
    2222#include <SpinBox.h>
    2323#include <Label.h>
    24 #include <cvmatrix.h>
     24#include <Matrix.h>
    2525#include <string.h>
    2626
  • trunk/lib/FlairSensorActuator/src/BlCtrlV2_impl.cpp

    r15 r214  
    2323#include <SpinBox.h>
    2424#include <Label.h>
    25 #include <cvmatrix.h>
     25#include <Matrix.h>
    2626#include <string.h>
    2727
     
    9696
    9797  // on prend une fois pour toute le mutex et on fait des accès directs
    98   cvmatrix *output = self->output;
     98  Matrix *output = self->output;
    9999  output->GetMutex();
    100100  for (int i = 0; i < nb_mot; i++)
  • trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.cpp

    r170 r214  
    2525#include <ComboBox.h>
    2626#include <PushButton.h>
    27 #include <cvmatrix.h>
     27#include <Matrix.h>
    2828#include <Mutex.h>
    2929#include <FrameworkManager.h>
     
    119119  pas->AddItem("inverse");
    120120
    121   input = new cvmatrix((IODevice *)this, 8, 1, floatType);
     121  input = new Matrix((IODevice *)this, 8, 1, floatType);
    122122
    123123  cvmatrix_descriptor *desc = new cvmatrix_descriptor(4, 2);
     
    131131  desc->SetElementName(2, 1, "cons avant droite");
    132132  desc->SetElementName(3, 1, "cons arriere gauche");
    133   output = new cvmatrix((IODevice *)this, desc, floatType);
     133  output = new Matrix((IODevice *)this, desc, floatType);
    134134  delete desc;
    135135 
  • trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.h

    r137 r214  
    2424namespace flair {
    2525namespace core {
    26 class cvmatrix;
     26class Matrix;
    2727class I2cPort;
    2828}
     
    9797
    9898  // matrix
    99   core::cvmatrix *input;
    100   core::cvmatrix *output;
     99  core::Matrix *input;
     100  core::Matrix *output;
    101101
    102102  int tested_motor;
  • trunk/lib/FlairSensorActuator/src/Bldc.cpp

    r157 r214  
    1818#include "Bldc.h"
    1919#include "Bldc_impl.h"
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <DoubleSpinBox.h>
    2222#include <sstream>
     
    5353  }
    5454
    55   output = new cvmatrix(this, desc, floatType);
     55  output = new Matrix(this, desc, floatType);
    5656  delete desc;
    5757  AddDataToLog(output);
     
    8181uint8_t Bldc::MotorsCount(void) const { return pimpl_->motors_count; }
    8282
    83 cvmatrix *Bldc::Output(void) const { return output; }
     83Matrix *Bldc::Output(void) const { return output; }
    8484
    8585bool Bldc::AreEnabled(void) const { return pimpl_->are_enabled; }
  • trunk/lib/FlairSensorActuator/src/Bldc.h

    r170 r214  
    1919namespace flair {
    2020namespace core {
    21 class cvmatrix;
     21class Matrix;
    2222}
    2323namespace gui {
     
    9696  *
    9797  */
    98   core::cvmatrix *Output(void) const;
     98  core::Matrix *Output(void) const;
    9999
    100100  /*!
     
    161161
    162162protected:
    163   core::cvmatrix *output;
     163  core::Matrix *output;
    164164
    165165private:
  • trunk/lib/FlairSensorActuator/src/Bldc_impl.cpp

    r137 r214  
    2020#include <GroupBox.h>
    2121#include <DoubleSpinBox.h>
    22 #include <cvmatrix.h>
     22#include <Matrix.h>
    2323#include <Label.h>
    2424#include <PushButton.h>
     
    110110
    111111void Bldc_impl::UpdateFrom(const io_data *data) {
    112   cvmatrix *input = (cvmatrix *)data;
     112  Matrix *input = (Matrix *)data;
    113113  bool is_motor_running = false;
    114114
  • trunk/lib/FlairSensorActuator/src/Camera.cpp

    r169 r214  
    119119                if(logFormat==LogFormat::JPG) {
    120120                        data->GetMutex();
    121                         IplImage *img=((cvimage*)data)->img;
     121      //IplImage *img=((cvimage*)data)->img;
     122      const cvimage* input = dynamic_cast<const cvimage*>(data);
     123      if (!input) {
     124          Warn("casting %s to cvimage failed\n",data->ObjectName().c_str());
     125          return;
     126      }
     127                        IplImage *img=input->img;
     128     
    122129                        string filename=getFrameworkManager()->GetLogPath()+"/"+ObjectName()+"_"+std::to_string(data->DataTime())+".jpg";
    123130                        switch(((cvimage*)data)->GetDataType().GetFormat()) {
  • trunk/lib/FlairSensorActuator/src/EmulatedController.cpp

    r202 r214  
    1717#include <cstring>
    1818#include <string>
    19 #include <cvmatrix.h>
     19#include <Matrix.h>
    2020#include <stdexcept>
    2121
     
    4646}
    4747
    48 template<typename T> void EmulatedController::fillVectorNoMutex(cvmatrix &vector,T data[],unsigned int size) {
     48template<typename T> void EmulatedController::fillVectorNoMutex(Matrix &vector,T data[],unsigned int size) {
    4949    for (unsigned int i=0; i<size; i++) {
    5050        vector.SetValueNoMutex(i,0,data[i]);
     
    5252}
    5353
    54 void EmulatedController::fillVectorNoMutex(cvmatrix &destination,cvmatrix &source,unsigned int size) {
     54void EmulatedController::fillVectorNoMutex(Matrix &destination,Matrix &source,unsigned int size) {
    5555    for (unsigned int i=0; i<size; i++) {
    5656        destination.SetValueNoMutex(i,0,source.Value(i,0));
     
    6969
    7070void EmulatedController::AddStep(unsigned int durationMs,string description,uint16_t buttonPressed, float leftAxisX, float leftAxisY, float rightAxisX, float rightAxisY) {
    71     cvmatrix *axisMatrix=new cvmatrix((IODevice *)this,4,1,floatType);
     71    Matrix *axisMatrix=new Matrix((IODevice *)this,4,1,floatType);
    7272    axisMatrix->SetValueNoMutex(0,0,leftAxisX);
    7373    axisMatrix->SetValueNoMutex(1,0,leftAxisY);
     
    7575    axisMatrix->SetValueNoMutex(3,0,rightAxisY);
    7676
    77     cvmatrix *buttonMatrix=new cvmatrix((IODevice *)this,16,1,SignedIntegerType(8));
     77    Matrix *buttonMatrix=new Matrix((IODevice *)this,16,1,SignedIntegerType(8));
    7878    if (buttonPressed&(uint16_t)ButtonType::start) buttonMatrix->SetValueNoMutex(0,0,1);
    7979    if (buttonPressed&(uint16_t)ButtonType::select) buttonMatrix->SetValueNoMutex(1,0,1);
     
    9898}
    9999
    100 void EmulatedController::ComputeControllerData(DataType dataType, cvmatrix &data) {
     100void EmulatedController::ComputeControllerData(DataType dataType, Matrix &data) {
    101101    static Time startStepTime=GetTime();
    102102
     
    130130}
    131131
    132 void EmulatedController::AcquireAxisData(core::cvmatrix &axis) {
     132void EmulatedController::AcquireAxisData(core::Matrix &axis) {
    133133    ComputeControllerData(DataType::axis,axis);
    134134}
    135135
    136 void EmulatedController::AcquireButtonData(core::cvmatrix &button) {
     136void EmulatedController::AcquireButtonData(core::Matrix &button) {
    137137    ComputeControllerData(DataType::button,button);
    138138}
  • trunk/lib/FlairSensorActuator/src/EmulatedController.h

    r137 r214  
    2121namespace flair {
    2222    namespace core {
    23         class cvmatrix;
     23        class Matrix;
    2424    }
    2525    namespace gui {
     
    5252        bool ProcessMessage(core::Message *msg);
    5353        bool IsDataFrameReady();
    54         void AcquireAxisData(core::cvmatrix &axis); //responsible for getting the axis data from the hardware
    55         void AcquireButtonData(core::cvmatrix &button); //responsible for getting the button data from the hardware
     54        void AcquireAxisData(core::Matrix &axis); //responsible for getting the axis data from the hardware
     55        void AcquireButtonData(core::Matrix &button); //responsible for getting the button data from the hardware
    5656        bool ControllerInitialization();
    5757
    5858    private:
    5959        enum class DataType { axis,button };
    60         void ComputeControllerData(DataType dataType, core::cvmatrix &data);
    61         template<typename T> void fillVectorNoMutex(core::cvmatrix &vector,T data[],unsigned int size);
    62         void fillVectorNoMutex(core::cvmatrix &destination,core::cvmatrix &source,unsigned int size);
     60        void ComputeControllerData(DataType dataType, core::Matrix &data);
     61        template<typename T> void fillVectorNoMutex(core::Matrix &vector,T data[],unsigned int size);
     62        void fillVectorNoMutex(core::Matrix &destination,core::Matrix &source,unsigned int size);
    6363        struct StepData {
    6464            unsigned int durationMs; //milliseconds
    65             core::cvmatrix *axisData;
    66             core::cvmatrix *buttonData;
     65            core::Matrix *axisData;
     66            core::Matrix *buttonData;
    6767            std::string description;
    6868            void Print();
  • trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.cpp

    r170 r214  
    2121#include <FrameworkManager.h>
    2222#include <RangeFinderPlot.h>
    23 #include <cvmatrix.h>
     23#include <Matrix.h>
    2424#include <Tab.h>
    2525#include <sstream>
     
    4040  main_tab = new Tab(getFrameworkManager()->GetTabWidget(), name);
    4141  cvmatrix_descriptor *desc = new cvmatrix_descriptor(1081, 1);
    42   output = new cvmatrix((IODevice *)this, desc, SignedIntegerType(16));
     42  output = new Matrix((IODevice *)this, desc, SignedIntegerType(16));
    4343  delete desc;
    4444
     
    246246#endif
    247247}
    248 cvmatrix *HokuyoUTM30Lx::getDatas() { return output; }
     248Matrix *HokuyoUTM30Lx::getDatas() { return output; }
    249249
    250250void HokuyoUTM30Lx::UseDefaultPlot(void) {
  • trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.h

    r170 r214  
    2323namespace flair {
    2424namespace core {
    25 class cvmatrix;
     25class Matrix;
    2626class SerialPort;
    2727class Mutex;
     
    5656  void getMesure(int startStep, int endStep, int clusterCount, int interval,
    5757                 int scanNumber = 0);
    58   core::cvmatrix *getDatas(void);
     58  core::Matrix *getDatas(void);
    5959
    6060  /*!
     
    7878
    7979  // matrix
    80   core::cvmatrix *output;
     80  core::Matrix *output;
    8181
    8282  std::queue<std::string> bufRet;
  • trunk/lib/FlairSensorActuator/src/HostEthController.cpp

    r178 r214  
    1818#include "HostEthController.h"
    1919#include <Controller.h>
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Tab.h>
    2222#include <TabWidget.h>
  • trunk/lib/FlairSensorActuator/src/HostEthController.h

    r178 r214  
    2626namespace flair {
    2727namespace core {
    28 class cvmatrix;
     28class Matrix;
    2929class TcpSocket;
    3030class UdpSocket;
     
    8181  GetAxisData() = 0; // responsible for getting the axis data from the hardware
    8282  unsigned int axisNumber;
    83   core::cvmatrix *axis;
     83  core::Matrix *axis;
    8484  gui::DataPlot1D **axisPlot;
    8585  uint32_t bitsPerAxis;
     
    9090                                    // from the hardware
    9191  unsigned int buttonNumber;
    92   core::cvmatrix *button;
     92  core::Matrix *button;
    9393  uint8_t buttonOffset;
    9494  bool meaningfulDataAvailable;
  • trunk/lib/FlairSensorActuator/src/LaserRangeFinder.cpp

    r148 r214  
    1717
    1818#include "LaserRangeFinder.h"
    19 #include <cvmatrix.h>
     19#include <Matrix.h>
    2020#include <Tab.h>
    2121#include <TabWidget.h>
     
    3838    : IODevice(getFrameworkManager(), name) {
    3939  cvmatrix_descriptor *desc = new cvmatrix_descriptor(360, 1);
    40   output = new cvmatrix(this, desc, floatType);
     40  output = new Matrix(this, desc, floatType);
    4141  delete desc;
    4242  AddDataToLog(output);
  • trunk/lib/FlairSensorActuator/src/LaserRangeFinder.h

    r170 r214  
    1919namespace core {
    2020class FrameworkManager;
    21 class cvmatrix;
     21class Matrix;
    2222}
    2323namespace gui {
     
    102102      * \return output matrix
    103103      */
    104   core::cvmatrix *output;
     104  core::Matrix *output;
    105105
    106106  /*!
  • trunk/lib/FlairSensorActuator/src/NmeaGps.cpp

    r206 r214  
    176176
    177177  int result;
    178 Printf("%s\n",frame);
    179 Printf("%x %x\n",&parser,parser.buffer);
    180178  result = nmea_parse(&parser, frame, frame_size, &info);
    181   Printf("%x %x\n",&parser,parser.buffer);
     179 
    182180  if (result != 1) {
    183181    Warn("unrecognized nmea sentence: %s\n",frame);
    184182    return;
    185183  }
    186 Printf("3\n");
    187 Printf("%x %x\n",&parser,parser.buffer);
     184
    188185  result = nmea_parse_GPGGA(frame, frame_size, &pack);
    189 Printf("%x %x\n",&parser,parser.buffer);
     186
    190187  if (result == 1) {
    191     Printf("%x %x\n",&parser,parser.buffer);
    192188    nmea_info2pos(&info, &pos);
    193      Printf("%x %x\n",&parser,parser.buffer);
    194189   //  Printf("nb:%i fix:%i lat:%f long:%f alt:%f vel:%f angle:%f\n",pack.satinuse,pack.sig,info.lat,info.lon,info.elv,info.speed*1000./3600.,info.direction);
    195190//Printf("lat:%f long:%f\n",pos.lat,pos.lon);
  • trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp

    r157 r214  
    2020#include <TabWidget.h>
    2121#include <FrameworkManager.h>
    22 #include <cvmatrix.h>
     22#include <Matrix.h>
    2323#include <sstream>
    2424
     
    4444    desc->SetElementName(i, 0, channel_name.str());
    4545  }
    46   output = new cvmatrix(this, desc, floatType, name);
     46  output = new Matrix(this, desc, floatType, name);
    4747  delete desc;
    4848
  • trunk/lib/FlairSensorActuator/src/RadioReceiver.h

    r137 r214  
    1919namespace flair {
    2020namespace core {
    21 class cvmatrix;
     21class Matrix;
    2222}
    2323namespace gui {
     
    8787  void UpdateFrom(const core::io_data *data){};
    8888
    89   core::cvmatrix *output;
     89  core::Matrix *output;
    9090  bool is_connected;
    9191  unsigned int nb_channels;
  • trunk/lib/FlairSensorActuator/src/SimuBldc.cpp

    r158 r214  
    2121#include <GroupBox.h>
    2222#include <SharedMem.h>
    23 #include <cvmatrix.h>
     23#include <Matrix.h>
    2424#include <sstream>
     25#include <string.h>
    2526
    2627using std::string;
     
    3637    : Bldc(parent, layout, name, motors_count) {
    3738  shmem =
    38       new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float));
     39      new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)+sizeof(Time));
    3940
    4041  GroupBox *groupbox = new GroupBox(layout->NewRow(), "simubldc");
    4142  k = new DoubleSpinBox(groupbox->NewRow(), "k driver:", 0, 10000, 1);
    4243 
     44  buf=(char*)malloc(motors_count * sizeof(float)+sizeof(Time));
     45  if(buf==NULL) {
     46    Err("error creating buffer\n");
     47    return;
     48  }
    4349  SetIsReady(true);
    4450}
     
    4854    : Bldc(parent, name, motors_count) {
    4955  shmem =
    50       new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float));
     56      new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)+sizeof(Time));
     57     
     58  buf=(char*)malloc(motors_count * sizeof(float)+sizeof(Time));
     59  if(buf==NULL) {
     60    Err("error creating buffer\n");
     61    return;
     62  }
     63 
     64  // reset values
     65  float *values=(float*)buf;
     66  for (int i = 0; i < motors_count; i++) values[i] = 0;
     67  Time time=GetTime();
     68  memcpy(buf+motors_count * sizeof(float),&time,sizeof(Time));
    5169
    52   // reset values
    53   float values[motors_count];
    54   for (int i = 0; i < motors_count; i++)
    55     values[i] = 0;
    56 
    57   shmem->Write((char *)&values, motors_count * sizeof(float));
     70  shmem->Write(buf, motors_count * sizeof(float)+sizeof(Time));
    5871 
    5972  SetIsReady(true);
    6073}
    6174
    62 SimuBldc::~SimuBldc() {}
     75SimuBldc::~SimuBldc() {
     76  if(buf!=NULL) free(buf);
     77}
    6378
    6479string SimuBldc::ShMemName(uint32_t modelId,uint32_t deviceId) {
     
    6984
    7085void SimuBldc::SetMotors(float *value) {
    71   float values[MotorsCount()];
     86  float *values=(float*)buf;
     87  for (int i = 0; i < MotorsCount(); i++) values[i] = k->Value() * value[i];
     88  Time time=GetTime();
     89  memcpy(buf+MotorsCount() * sizeof(float),&time,sizeof(Time));
    7290
    73   for (int i = 0; i < MotorsCount(); i++)
    74     values[i] = k->Value() * value[i];
    75 
    76   shmem->Write((char *)&values, MotorsCount() * sizeof(float));
     91  shmem->Write(buf, MotorsCount() * sizeof(float)+sizeof(Time));
    7792
    7893  // on prend une fois pour toute le mutex et on fait des accès directs
    7994  output->GetMutex();
    80   for (int i = 0; i < MotorsCount(); i++)
     95  for (int i = 0; i < MotorsCount(); i++) {
    8196    output->SetValueNoMutex(i, 0, values[i]);
     97  }
    8298  output->ReleaseMutex();
    8399}
    84100
    85 void SimuBldc::GetSpeeds(float *value) const {
    86   float values[MotorsCount()];
    87   shmem->Read((char *)&values, MotorsCount() * sizeof(float));
     101void SimuBldc::GetSpeeds(float *value,Time* time) const {
     102  float *values=(float*)buf;
     103  shmem->Read(buf, MotorsCount() * sizeof(float)+sizeof(Time));
     104  memcpy(time,buf+MotorsCount() * sizeof(float),sizeof(Time));
    88105
    89   for (int i = 0; i < MotorsCount(); i++)
     106  for (int i = 0; i < MotorsCount(); i++) {
    90107    value[i] = values[i];
     108  }
    91109}
    92110
  • trunk/lib/FlairSensorActuator/src/SimuBldc.h

    r158 r214  
    2020class SharedMem;
    2121class IODevice;
    22 class cvmatrix;
     22class Matrix;
    2323}
    2424namespace gui {
     
    7878  *
    7979  * \param value array to store motors speeds
     80  * \param time time when shared memory was written
    8081  */
    81   void GetSpeeds(float *value) const;
     82  void GetSpeeds(float *value,core::Time* time) const;
    8283
    8384  /*!
     
    113114  core::SharedMem *shmem;
    114115  gui::DoubleSpinBox *k;
     116  char *buf;
     117
    115118};
    116119} // end namespace actuator
  • trunk/lib/FlairSensorActuator/src/SimuGps.cpp

    r206 r214  
    2525#include <GroupBox.h>
    2626#include <Euler.h>
    27 #include <cvmatrix.h>
     27#include <Matrix.h>
    2828#include <sstream>
    2929#include "geodesie.h"
     
    8080void SimuGps::UpdateFrom(const io_data *data) {
    8181  if (data != NULL) {
    82     cvmatrix *input = (cvmatrix *)data;
     82    Matrix *input = (Matrix *)data;
    8383    gps_states_t state;
    8484
     
    109109  vtg.spk_k='K';
    110110  vtg.spn_n='N';
     111  gga.elv_units='M';
     112  gga.diff_units='M';
    111113
    112114  if (dataRate == NULL) {
     
    152154    gga.satinuse=numberOfSatellites->Value();
    153155
    154     nmea_gen_GPGGA(buf,sizeof(buf),&gga);
    155     Printf("1\n");
    156     parseFrame(buf,sizeof(buf));
    157 
     156    int size=nmea_gen_GPGGA(buf,sizeof(buf),&gga);
     157    parseFrame(buf,size);
     158   
    158159    vtg.dir=90-Euler::ToDegree(atan2f(state.vn,state.ve));
    159160    vtg.spk=sqrtf(state.ve*state.ve+state.vn*state.vn)*3600./1000.;
    160     nmea_gen_GPVTG(buf,sizeof(buf),&vtg);
    161     Printf("2\n");
    162     parseFrame(buf,sizeof(buf));
     161    size=nmea_gen_GPVTG(buf,sizeof(buf),&vtg);
     162    parseFrame(buf,size);
    163163  }
    164164
  • trunk/lib/FlairSensorActuator/src/SimuImu.cpp

    r202 r214  
    2121#include <SpinBox.h>
    2222#include <GroupBox.h>
    23 #include <cvmatrix.h>
     23#include <Matrix.h>
    2424#include <SharedMem.h>
    2525#include <AhrsData.h>
     
    7070void SimuImu::UpdateFrom(const io_data *data) {
    7171  if (data != NULL) {
    72     cvmatrix *input = (cvmatrix *)data;
     72    Matrix *input = (Matrix *)data;
    7373    imu_states_t state;
    7474
  • trunk/lib/FlairSensorActuator/src/SimuLaser.cpp

    r158 r214  
    2020#include <SpinBox.h>
    2121#include <GroupBox.h>
    22 #include <cvmatrix.h>
     22#include <Matrix.h>
    2323#include <SharedMem.h>
    2424#include <sstream>
  • trunk/lib/FlairSensorActuator/src/SimuUs.cpp

    r158 r214  
    2020#include <SpinBox.h>
    2121#include <GroupBox.h>
    22 #include <cvmatrix.h>
     22#include <Matrix.h>
    2323#include <SharedMem.h>
    2424#include <sstream>
  • trunk/lib/FlairSensorActuator/src/Srf08.cpp

    r157 r214  
    2121#include <GroupBox.h>
    2222#include <SpinBox.h>
    23 #include <cvmatrix.h>
     23#include <Matrix.h>
    2424#include <string.h>
    2525#include <errno.h>
  • trunk/lib/FlairSensorActuator/src/TargetController.cpp

    r202 r214  
    2020#include <Tab.h>
    2121#include <FrameworkManager.h>
    22 #include <cvmatrix.h>
     22#include <Matrix.h>
    2323
    2424#include <cstring>
     
    122122  } else {
    123123
    124     axis = new cvmatrix((IODevice *)this, axisNumber, 1, floatType);
     124    axis = new Matrix((IODevice *)this, axisNumber, 1, floatType);
    125125    button =
    126         new cvmatrix((IODevice *)this, buttonNumber, 1, SignedIntegerType(8));
     126        new Matrix((IODevice *)this, buttonNumber, 1, SignedIntegerType(8));
    127127
    128128    while (!ToBeStopped()) {
  • trunk/lib/FlairSensorActuator/src/TargetController.h

    r137 r214  
    2727namespace core {
    2828class FrameworkManager;
    29 class cvmatrix;
     29class Matrix;
    3030class Socket;
    3131class io_data;
     
    8282  // axis stuff
    8383  unsigned int axisNumber;
    84   core::cvmatrix *axis = NULL;
    85   virtual void AcquireAxisData(core::cvmatrix &axis) = 0; // responsible for
     84  core::Matrix *axis = NULL;
     85  virtual void AcquireAxisData(core::Matrix &axis) = 0; // responsible for
    8686                                                          // getting the axis
    8787                                                          // data from the
     
    9090  // button stuff
    9191  unsigned int buttonNumber;
    92   core::cvmatrix *button = NULL;
    93   virtual void AcquireButtonData(core::cvmatrix &button) = 0; // responsible for
     92  core::Matrix *button = NULL;
     93  virtual void AcquireButtonData(core::Matrix &button) = 0; // responsible for
    9494                                                              // getting the
    9595                                                              // button data
  • trunk/lib/FlairSensorActuator/src/TargetEthController.cpp

    r202 r214  
    2424#include <cstring>
    2525#include <string>
    26 #include <cvmatrix.h>
     26#include <Matrix.h>
    2727#include <stdexcept>
    2828
     
    150150}
    151151
    152 void TargetEthController::AcquireAxisData(core::cvmatrix &axis) {
     152void TargetEthController::AcquireAxisData(core::Matrix &axis) {
    153153  axis.GetMutex();
    154154  // char testFrameBuffer[3]={(char)0x09,(char)0x59,(char)0xB8};
     
    166166}
    167167
    168 void TargetEthController::AcquireButtonData(core::cvmatrix &button) {
     168void TargetEthController::AcquireButtonData(core::Matrix &button) {
    169169  uint8_t buttonValue;
    170170  int currentButton = 0;
  • trunk/lib/FlairSensorActuator/src/TargetEthController.h

    r178 r214  
    2727namespace core {
    2828class FrameworkManager;
    29 class cvmatrix;
     29class Matrix;
    3030class TcpSocket;
    3131class UdpSocket;
     
    6262
    6363  bool IsDataFrameReady();
    64   void AcquireAxisData(core::cvmatrix &axis);     // responsible for getting the
     64  void AcquireAxisData(core::Matrix &axis);     // responsible for getting the
    6565                                                  // axis data from the hardware
    66   void AcquireButtonData(core::cvmatrix &button); // responsible for getting the
     66  void AcquireButtonData(core::Matrix &button); // responsible for getting the
    6767                                                  // button data from the
    6868                                                  // hardware
  • trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp

    r148 r214  
    2323#include <Layout.h>
    2424#include <DataPlot1D.h>
    25 #include <cvmatrix.h>
     25#include <Matrix.h>
    2626
    2727using std::string;
     
    3838  cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
    3939  desc->SetElementName(0, 0, name);
    40   output = new cvmatrix(this, desc, floatType);
     40  output = new Matrix(this, desc, floatType);
    4141  delete desc;
    4242  AddDataToLog(output);
  • trunk/lib/FlairSensorActuator/src/UsRangeFinder.h

    r137 r214  
    1717
    1818namespace flair {
    19 namespace core {
    20 class cvmatrix;
    21 }
    22 namespace gui {
    23 class Tab;
    24 class TabWidget;
    25 class GroupBox;
    26 class Layout;
    27 class DataPlot1D;
    28 }
     19  namespace core {
     20    class Matrix;
     21  }
     22  namespace gui {
     23    class Tab;
     24    class TabWidget;
     25    class GroupBox;
     26    class Layout;
     27    class DataPlot1D;
     28  }
    2929}
    3030
     
    119119  * \return output matrix
    120120  */
    121   core::cvmatrix *output;
     121  core::Matrix *output;
    122122
    123123  /*!
  • trunk/lib/FlairSensorActuator/src/VrpnObject.cpp

    r167 r214  
    2020#include "VrpnClient.h"
    2121#include <string.h>
    22 
    23 #include <cvmatrix.h>
     22#include <Matrix.h>
    2423
    2524using std::string;
     
    5352}
    5453
    55 cvmatrix *VrpnObject::Output(void) const { return pimpl_->output; }
     54Matrix *VrpnObject::Output(void) const { return pimpl_->output; }
    5655
    57 cvmatrix *VrpnObject::State(void) const { return pimpl_->state; }
     56Matrix *VrpnObject::State(void) const { return pimpl_->state; }
    5857
    5958Tab *VrpnObject::GetPlotTab(void) const { return pimpl_->plot_tab; }
  • trunk/lib/FlairSensorActuator/src/VrpnObject.h

    r167 r214  
    2121namespace flair {
    2222        namespace core {
    23                 class cvmatrix;
     23                class Matrix;
    2424                class Quaternion;
    2525        }
     
    126126  * \return Output matrix
    127127  */
    128   core::cvmatrix *Output(void) const;
     128  core::Matrix *Output(void) const;
    129129
    130130  /*!
     
    139139  * \return State matrix
    140140  */
    141   core::cvmatrix *State(void) const;
     141  core::Matrix *State(void) const;
    142142
    143143  /*!
  • trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp

    r167 r214  
    2525#include <unistd.h>
    2626#include <vrpn_Connection.h>
    27 #include <cvmatrix.h>
     27#include <Matrix.h>
    2828#include <Tab.h>
    2929#include <TabWidget.h>
     
    6565  desc->SetElementName(5, 0, "y");
    6666  desc->SetElementName(6, 0, "z");
    67   output = new cvmatrix(self, desc, floatType);
     67  output = new Matrix(self, desc, floatType);
    6868  delete desc;
    6969
     
    7272  desc->SetElementName(1, 0, "pitch");
    7373  desc->SetElementName(2, 0, "yaw");
    74   state = new cvmatrix(self, desc, floatType);
     74  state = new Matrix(self, desc, floatType);
    7575  delete desc;
    7676
  • trunk/lib/FlairSensorActuator/src/XBldc_impl.cpp

    r15 r214  
    1919#include "XBldc.h"
    2020#include <I2cPort.h>
    21 #include <cvmatrix.h>
     21#include <Matrix.h>
    2222#include <string.h>
    2323
  • trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h

    r167 r214  
    2828namespace flair {
    2929        namespace core {
    30                 class cvmatrix;
     30                class Matrix;
    3131        }
    3232        namespace gui {
     
    5858  flair::gui::DataPlot1D *y_plot;
    5959  flair::gui::DataPlot1D *z_plot;
    60   flair::core::cvmatrix *output, *state;
     60  flair::core::Matrix *output, *state;
    6161
    6262  static void VRPN_CALLBACK handle_pos(void *userdata, const vrpn_TRACKERCB t);
  • trunk/lib/FlairSimulator/src/Model_impl.cpp

    r202 r214  
    2525#include "SpinBox.h"
    2626#include "CheckBox.h"
    27 #include "cvmatrix.h"
     27#include "Matrix.h"
    2828#include "Euler.h"
    2929#include <math.h>
     
    134134  desc->SetElementName(17, 0, "my");
    135135  desc->SetElementName(18, 0, "mz");
    136   output = new cvmatrix(this, desc, floatType, "state");
     136  output = new Matrix(this, desc, floatType, "state");
    137137  delete desc;
    138138
  • trunk/lib/FlairSimulator/src/SimuLaserGL.cpp

    r158 r214  
    2020#include "Model.h"
    2121#include "Gui.h"
    22 #include <cvmatrix.h>
     22#include <Matrix.h>
    2323#include <SharedMem.h>
    2424#include <TabWidget.h>
  • trunk/lib/FlairSimulator/src/SimuUsGL.cpp

    r167 r214  
    1717#include "SimuUsGL.h"
    1818#include "Model.h"
    19 #include <cvmatrix.h>
     19#include <Matrix.h>
    2020#include <SharedMem.h>
    2121#include <TabWidget.h>
     
    5454#endif
    5555    // todo: utiliser le placement de l'us dans le drone et sa portée
    56     cvmatrix *input = (cvmatrix *)data;
     56    Matrix *input = (Matrix *)data;
    5757    value = input->Value(9, 0);
    5858    shmem->Write((char *)&value, sizeof(float));
  • trunk/lib/FlairSimulator/src/X4.cpp

    r167 r214  
    2020#include <Tab.h>
    2121#include <DoubleSpinBox.h>
     22#include <SpinBox.h>
    2223#include <GroupBox.h>
    2324#include <math.h>
     
    7374  j_yaw = new DoubleSpinBox(setup_tab->LastRowLastCol(), "j_yaw:", 0, 1, 0.001,
    7475                            5); // moment d'inertie d'un axe (N.m.s²/rad)
     76                           
     77  motorTimeout = new SpinBox(setup_tab->NewRow(), "motor timeout:","ms", 0, 1000, 100,100);
    7578
    7679  motors = new SimuBldc(this, name, 4, modelId,0);
     
    199202  float fl_speed, fr_speed, rl_speed, rr_speed;
    200203  float u_roll, u_pitch, u_yaw, u_thrust;
     204  Time motorTime;
    201205#ifdef GL
    202206  motor_speed_mutex->GetMutex();
    203207#endif // GL
    204   motors->GetSpeeds(motor_speed);
     208  motors->GetSpeeds(motor_speed,&motorTime);
     209  if((GetTime()-motorTime)/1000000>motorTimeout->Value()) {
     210    for(int i=0;i<4;i++) {
     211      if(motor_speed[i]!=0) {
     212         //Printf("timout\n");
     213        for(int i=0;i<4;i++) motor_speed[i]=0;
     214        break;
     215      }
     216    }
     217  }
    205218#ifdef GL
    206219  motor_speed_mutex->ReleaseMutex();
    207220#endif // GL
     221 
    208222  fl_speed = motor_speed[0];
    209223  fr_speed = motor_speed[1];
     
    212226
    213227  /*
    214       ** ===================================================================
    215       **    u roll: roll torque
    216       **
    217       ** ===================================================================
    218       */
     228  ** ===================================================================
     229  **    u roll: roll torque
     230  **
     231  ** ===================================================================
     232  */
    219233  u_roll = arm_length->Value() * k_mot->Value() *
    220234           (fl_speed * fl_speed + rl_speed * rl_speed - fr_speed * fr_speed -
  • trunk/lib/FlairSimulator/src/X4.h

    r158 r214  
    2626namespace gui {
    2727class DoubleSpinBox;
     28class SpinBox;
    2829}
    2930namespace actuator {
     
    6364  gui::DoubleSpinBox *f_air_vert, *f_air_lat;
    6465  gui::DoubleSpinBox *j_roll, *j_pitch, *j_yaw;
     66  gui::SpinBox *motorTimeout;
    6567};
    6668} // end namespace simulator
  • trunk/lib/FlairSimulator/src/X8.cpp

    r167 r214  
    2020#include <Tab.h>
    2121#include <DoubleSpinBox.h>
     22#include <SpinBox.h>
    2223#include <GroupBox.h>
    2324#include <math.h>
     
    8182      setup_tab->LastRowLastCol(), "S:", 1, 2,
    8283      0.1); // coefficient de forme des helices 1<S=1+Ss/Sprop<2 (sans unite)
     84     
     85  motorTimeout = new SpinBox(setup_tab->NewRow(), "motor timeout:","ms", 0, 1000, 100,100);
    8386
    8487  motors = new SimuBldc(this, name, 8, modelId,0);
     
    231234  float u_roll, u_pitch, u_yaw, u_thrust;
    232235  float omega;
     236  Time motorTime;
    233237#ifdef GL
    234238  motor_speed_mutex->GetMutex();
    235239#endif // GL
    236   motors->GetSpeeds(motor_speed);
     240  motors->GetSpeeds(motor_speed,&motorTime);
     241  if((GetTime()-motorTime)/1000000>motorTimeout->Value()) {
     242    for(int i=0;i<8;i++) {
     243      if(motor_speed[i]!=0) {
     244         //Printf("timout\n");
     245        for(int i=0;i<8;i++) motor_speed[i]=0;
     246        break;
     247      }
     248    }
     249  }
    237250#ifdef GL
    238251  motor_speed_mutex->ReleaseMutex();
  • trunk/lib/FlairSimulator/src/X8.h

    r158 r214  
    2626namespace gui {
    2727class DoubleSpinBox;
     28class SpinBox;
    2829}
    2930namespace actuator {
     
    6566  gui::DoubleSpinBox *j_roll, *j_pitch, *j_yaw;
    6667  gui::DoubleSpinBox *j_r, *sigma, *S;
     68  gui::SpinBox *motorTimeout;
    6769};
    6870} // end namespace simulator
  • trunk/lib/FlairSimulator/src/unexported/Model_impl.h

    r167 r214  
    2525namespace flair {
    2626namespace core {
    27 class cvmatrix;
     27class Matrix;
    2828class Mutex;
    2929class ConditionVariable;
     
    101101  flair::gui::CheckBox *enable_opti;
    102102  flair::simulator::Model *self;
    103   flair::core::cvmatrix *output;
     103  flair::core::Matrix *output;
    104104  flair::core::Mutex *states_mutex;
    105105
  • trunk/lib/FlairVisionFilter/src/HoughLines.cpp

    r157 r214  
    1414#include "HoughLines.h"
    1515#include <cvimage.h>
    16 #include <cvmatrix.h>
     16#include <Matrix.h>
    1717#include <Layout.h>
    1818#include <GroupBox.h>
     
    4949    desc->SetElementName(2,0,"orientation deg");
    5050    desc->SetElementName(3,0,"line_detected");
    51     output=new cvmatrix(this,desc,floatType,name);
     51    output=new Matrix(this,desc,floatType,name);
    5252    delete desc;
    5353
     
    9090}
    9191
    92 cvmatrix *HoughLines::Output(void) const {
     92Matrix *HoughLines::Output(void) const {
    9393    return output;
    9494}
  • trunk/lib/FlairVisionFilter/src/HoughLines.h

    r122 r214  
    1717    namespace core {
    1818        class cvimage;
    19         class cvmatrix;
     19        class Matrix;
    2020    }
    2121    namespace gui {
     
    5656            float GetOrientation(void) const;
    5757            float GetDistance(void) const;
    58             core::cvmatrix *Output(void) const;
     58            core::Matrix *Output(void) const;
    5959
    6060        private:
     
    6969            float distance,orientation;
    7070            CvMat* linesStorage;
    71             core::cvmatrix *output;
     71            core::Matrix *output;
    7272    };
    7373} // end namespace filter
  • trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp

    r157 r214  
    1414#include "OpticalFlowSpeed.h"
    1515#include "OpticalFlowData.h"
    16 #include <cvmatrix.h>
     16#include <Matrix.h>
    1717#include <Object.h>
    1818
     
    3030  desc->SetElementName(0,0,"vx");
    3131  desc->SetElementName(1,0,"vy");
    32   output=new cvmatrix(this,desc,floatType,name);
     32  output=new Matrix(this,desc,floatType,name);
    3333  delete desc;
    3434
     
    8181}
    8282
    83 core::cvmatrix *OpticalFlowSpeed::Output() const
     83core::Matrix *OpticalFlowSpeed::Output() const
    8484{
    8585    return output;
  • trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.h

    r143 r214  
    1717    namespace core
    1818    {
    19         class cvmatrix;
     19        class Matrix;
    2020    }
    2121}
     
    7171            * Second line is speed along y axis. \n
    7272            */
    73             core::cvmatrix *Output() const;
     73            core::Matrix *Output() const;
    7474
    7575        private:
     
    8383            void UpdateFrom(const core::io_data *data);
    8484
    85             core::cvmatrix *output;
     85            core::Matrix *output;
    8686    };
    8787} // end namespace filter
  • trunk/tools/Controller/DualShock3/src/DualShock3.cpp

    r148 r214  
    1818#include "DualShock3.h"
    1919#include <Controller.h>
    20 #include <cvmatrix.h>
     20#include <Matrix.h>
    2121#include <Tab.h>
    2222#include <TabWidget.h>
     
    9696    axisDescriptor->SetElementName(i, 0, GetAxisDescription(i));
    9797  }
    98   axis = new cvmatrix((IODevice *)this, axisDescriptor, Int16Type);
     98  axis = new Matrix((IODevice *)this, axisDescriptor, Int16Type);
    9999  delete axisDescriptor;
    100100  AddDataToLog(axis);
     
    107107    buttonDescriptor->SetElementName(i, 0, GetButtonDescription(i));
    108108  }
    109   button = new cvmatrix((IODevice *)this, buttonDescriptor, Int8Type);
     109  button = new Matrix((IODevice *)this, buttonDescriptor, Int8Type);
    110110  AddDataToLog(button);
    111111
  • trunk/tools/FlairGCS/src/file_ui.cpp

    r51 r214  
    193193        uint8_t *value = (uint8_t *)(data + offset);
    194194        offset += sizeof(uint8_t);
     195        out << "," << *value;
     196      } else if (data_type.at(i) == "int16_t)") {
     197        int16_t *value = (int16_t *)(data + offset);
     198        offset += sizeof(int16_t);
     199        out << "," << *value;
     200      } else if (data_type.at(i) == "uint16_t)") {
     201        uint16_t *value = (uint16_t *)(data + offset);
     202        offset += sizeof(uint16_t);
    195203        out << "," << *value;
    196204      } else {
Note: See TracChangeset for help on using the changeset viewer.