Index: /trunk/ReleaseNotes
===================================================================
--- /trunk/ReleaseNotes	(revision 213)
+++ /trunk/ReleaseNotes	(revision 214)
@@ -1,3 +1,6 @@
 * Actual Version:
+
+- replaced cvmatrix by Matrix
+- added a timeout on SimuBldc: if nothing is sent within the timeout, motors will stop
 
 -----------------------------------------------------------
Index: /trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x4.xml
===================================================================
--- /trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x4.xml	(revision 213)
+++ /trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x4.xml	(revision 214)
@@ -27,5 +27,5 @@
     <DoubleSpinBox value="0.006" name="j_pitch:"/>
     <DoubleSpinBox value="0.1" name="j_yaw:"/>
-   </Tab>
+   <SpinBox name="motor timeout:" value="100"/></Tab>
    <Tab name="us">
     <GroupBox name="position">
@@ -40,5 +40,5 @@
     </GroupBox>
     <DoubleSpinBox value="6" name="range:"/>
-   <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>
+   <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>
    <Tab name="bottom camera">
     <GroupBox name="position">
Index: /trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x8.xml
===================================================================
--- /trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x8.xml	(revision 213)
+++ /trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x8.xml	(revision 214)
@@ -16,5 +16,5 @@
     <DoubleSpinBox value="-1.2" name="z:"/>
     <SpinBox value="90" name="yaw (deg):"/>
-   <Vector3DSpinBox name="position" value_x="-1.50" value_y="0.00" value_z="-1.00"/></Tab>
+   <Vector3DSpinBox name="position" value_x="-1.5" value_y="0" value_z="-1"/></Tab>
    <Tab name="model">
     <DoubleSpinBox value="1.6" name="mass (kg):"/>
@@ -31,5 +31,5 @@
     <DoubleSpinBox value="0.72" name="sigma:"/>
     <DoubleSpinBox value="1" name="S:"/>
-   </Tab>
+   <SpinBox name="motor timeout:" value="100"/></Tab>
    <Tab name="us">
     <GroupBox name="position">
@@ -44,5 +44,5 @@
     </GroupBox>
     <DoubleSpinBox value="6" name="range:"/>
-   <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>
+   <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>
    <Tab name="bottom camera">
     <GroupBox name="position">
@@ -96,5 +96,5 @@
     <DoubleSpinBox value="0" name="z:"/>
     <SpinBox value="90" name="yaw (deg):"/>
-   <Vector3DSpinBox name="position" value_x="-1.50" value_y="1.00" value_z="0.00"/></Tab>
+   <Vector3DSpinBox name="position" value_x="-1.5" value_y="1" value_z="0"/></Tab>
    <Tab name="model">
     <DoubleSpinBox value="1.3" name="translational speed (m/s):"/>
Index: /trunk/demos/CircleFollower/uav/src/CircleFollower.cpp
===================================================================
--- /trunk/demos/CircleFollower/uav/src/CircleFollower.cpp	(revision 213)
+++ /trunk/demos/CircleFollower/uav/src/CircleFollower.cpp	(revision 214)
@@ -24,4 +24,5 @@
 #include <MetaVrpnObject.h>
 #include <TrajectoryGenerator2DCircle.h>
+#include <Matrix.h>
 #include <cvmatrix.h>
 #include <cmath>
@@ -61,9 +62,9 @@
 
     circle=new TrajectoryGenerator2DCircle(vrpnclient->GetLayout()->NewRow(),"circle");
-    uavVrpn->xPlot()->AddCurve(circle->Matrix()->Element(0,0),DataPlot::Blue);
-    uavVrpn->yPlot()->AddCurve(circle->Matrix()->Element(0,1),DataPlot::Blue);
-    uavVrpn->VxPlot()->AddCurve(circle->Matrix()->Element(1,0),DataPlot::Blue);
-    uavVrpn->VyPlot()->AddCurve(circle->Matrix()->Element(1,1),DataPlot::Blue);
-    uavVrpn->XyPlot()->AddCurve(circle->Matrix()->Element(0,1),circle->Matrix()->Element(0,0),DataPlot::Blue,"circle");
+    uavVrpn->xPlot()->AddCurve(circle->GetMatrix()->Element(0,0),DataPlot::Blue);
+    uavVrpn->yPlot()->AddCurve(circle->GetMatrix()->Element(0,1),DataPlot::Blue);
+    uavVrpn->VxPlot()->AddCurve(circle->GetMatrix()->Element(1,0),DataPlot::Blue);
+    uavVrpn->VyPlot()->AddCurve(circle->GetMatrix()->Element(1,1),DataPlot::Blue);
+    uavVrpn->XyPlot()->AddCurve(circle->GetMatrix()->Element(0,1),circle->GetMatrix()->Element(0,0),DataPlot::Blue,"circle");
 
     uX=new Pid(setupLawTab->At(1,0),"u_x");
Index: /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp
===================================================================
--- /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp	(revision 213)
+++ /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp	(revision 214)
@@ -22,5 +22,5 @@
 #include <LowPassFilter.h>
 #include <EulerDerivative.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <GridLayout.h>
 #include <DataPlot1D.h>
@@ -65,7 +65,7 @@
   opticalFlowSpeedRaw=new OpticalFlowSpeed(opticalFlowCompensated,uav->GetAhrs(),uav->GetVerticalCamera()->GetLayout()->NewRow(),"vitesse du Flux Optique");
   //opticalFlowSpeed=vitesse de déplacement en pixels par seconde (moyenne sur tous les points et division par le delta T)
-  cvmatrix* twoByOneOFS=new cvmatrix((const Thread*)this,2,1,floatType);
-  cvmatrix* twoByOneOFAR=new cvmatrix((const Thread*)this,2,1,floatType);
-  cvmatrix* twoByOneOFA=new cvmatrix((const Thread*)this,2,1,floatType);
+  Matrix* twoByOneOFS=new Matrix((const Thread*)this,2,1,floatType);
+  Matrix* twoByOneOFAR=new Matrix((const Thread*)this,2,1,floatType);
+  Matrix* twoByOneOFA=new Matrix((const Thread*)this,2,1,floatType);
   opticalFlowSpeed=new LowPassFilter(opticalFlowSpeedRaw,uav->GetVerticalCamera()->GetLayout()->NewRow(),"Speed lowPass",twoByOneOFS);
   opticalFlowAccelerationRaw=new EulerDerivative(opticalFlowSpeed,uav->GetVerticalCamera()->GetLayout()->NewRow(),"derivative",twoByOneOFAR);
@@ -83,7 +83,7 @@
 
   xVelocityPlot->AddCurve(opticalFlowSpeedRaw->Output()->Element(0,0));
-  xVelocityPlot->AddCurve(opticalFlowSpeed->Matrix()->Element(0,0),DataPlot::Blue);
+  xVelocityPlot->AddCurve(opticalFlowSpeed->GetMatrix()->Element(0,0),DataPlot::Blue);
   yVelocityPlot->AddCurve(opticalFlowSpeedRaw->Output()->Element(1,0));
-  yVelocityPlot->AddCurve(opticalFlowSpeed->Matrix()->Element(1,0),DataPlot::Blue);
+  yVelocityPlot->AddCurve(opticalFlowSpeed->GetMatrix()->Element(1,0),DataPlot::Blue);
   xFirstPointPlot->AddCurve(opticalFlowCompensated->GetFirstPointDisplacement()->Element(0,0));
   xFirstPointPlot->AddCurve(opticalFlowCompensated->GetFirstPointDisplacement()->Element(1,0),DataPlot::Blue);
@@ -107,7 +107,7 @@
   
   Tab* opticalFlowRealTab=new Tab(getFrameworkManager()->GetTabWidget(),"real speed");
-  opticalFlowRealSpeed=new cvmatrix((const Thread*)this,2,1,floatType);
-  opticalFlowReference=new cvmatrix((const Thread*)this,2,1,floatType);
-  opticalFlowRealAcceleration=new cvmatrix((const Thread*)this,2,1,floatType);
+  opticalFlowRealSpeed=new Matrix((const Thread*)this,2,1,floatType);
+  opticalFlowReference=new Matrix((const Thread*)this,2,1,floatType);
+  opticalFlowRealAcceleration=new Matrix((const Thread*)this,2,1,floatType);
   DataPlot1D* xRealVelocityPlot=new DataPlot1D(opticalFlowRealTab->NewRow(),"x speed (m/s)",-2,2);
   DataPlot1D* yRealVelocityPlot=new DataPlot1D(opticalFlowRealTab->LastRowLastCol(),"y speed (m/s)",-2,2);
Index: /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.h
===================================================================
--- /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.h	(revision 213)
+++ /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.h	(revision 214)
@@ -20,5 +20,5 @@
 namespace flair {
     namespace core {
-        class cvmatrix;
+        class Matrix;
     }
     namespace gui {
@@ -55,9 +55,9 @@
         flair::gui::GroupBox* opticalFlowGroupBox;
         flair::gui::DoubleSpinBox *maxXSpeed,*maxYSpeed;
-        flair::core::cvmatrix *opticalFlowReference;
+        flair::core::Matrix *opticalFlowReference;
         flair::filter::Pid *u_x, *u_y;
         flair::filter::CvtColor* greyCameraImage;
         flair::core::AhrsData *customReferenceOrientation;
-        flair::core::cvmatrix *opticalFlowRealSpeed,*opticalFlowRealAcceleration;
+        flair::core::Matrix *opticalFlowRealSpeed,*opticalFlowRealAcceleration;
 
     private:
Index: /trunk/demos/SimpleFleet/uav/src/SimpleFleet.cpp
===================================================================
--- /trunk/demos/SimpleFleet/uav/src/SimpleFleet.cpp	(revision 213)
+++ /trunk/demos/SimpleFleet/uav/src/SimpleFleet.cpp	(revision 214)
@@ -29,4 +29,5 @@
 #include <PidThrust.h>
 #include <Euler.h>
+#include <Matrix.h>
 #include <cvmatrix.h>
 #include <AhrsData.h>
@@ -60,8 +61,8 @@
 
     circle=new TrajectoryGenerator2DCircle(vrpnclient->GetLayout()->NewRow(),"circle");
-    uavVrpn->xPlot()->AddCurve(circle->Matrix()->Element(0,0),0,0,255);
-    uavVrpn->yPlot()->AddCurve(circle->Matrix()->Element(0,1),0,0,255);
-    uavVrpn->VxPlot()->AddCurve(circle->Matrix()->Element(1,0),0,0,255);
-    uavVrpn->VyPlot()->AddCurve(circle->Matrix()->Element(1,1),0,0,255);
+    uavVrpn->xPlot()->AddCurve(circle->GetMatrix()->Element(0,0),0,0,255);
+    uavVrpn->yPlot()->AddCurve(circle->GetMatrix()->Element(0,1),0,0,255);
+    uavVrpn->VxPlot()->AddCurve(circle->GetMatrix()->Element(1,0),0,0,255);
+    uavVrpn->VyPlot()->AddCurve(circle->GetMatrix()->Element(1,1),0,0,255);
 
     xCircleCenter=new DoubleSpinBox(vrpnclient->GetLayout()->NewRow(),"x circle center"," m",-5,5,0.1,1,0);
Index: /trunk/demos/Sinus/src/Loop.cpp
===================================================================
--- /trunk/demos/Sinus/src/Loop.cpp	(revision 213)
+++ /trunk/demos/Sinus/src/Loop.cpp	(revision 214)
@@ -24,5 +24,5 @@
 #include <PushButton.h>
 #include <DataPlot1D.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 
 using namespace std;
@@ -47,5 +47,5 @@
                                    "1st order lawpass filter");
   sinus->GetPlot()->AddCurve(
-      firstLowPass->Matrix()->Element(0),
+      firstLowPass->GetMatrix()->Element(0),
       DataPlot::Blue); // add output of the filter to signal's graph
 
@@ -54,5 +54,5 @@
       sinus, sinus->GetSetupLayout()->NewRow(), "3rd order lawpass filter", 3);
   sinus->GetPlot()->AddCurve(
-      thirdLowPass->Matrix()->Element(0),
+      thirdLowPass->GetMatrix()->Element(0),
       DataPlot::Yellow); // add output of the filter to signal's graph
 
Index: /trunk/demos/Sinus/src/MeanFilter.cpp
===================================================================
--- /trunk/demos/Sinus/src/MeanFilter.cpp	(revision 213)
+++ /trunk/demos/Sinus/src/MeanFilter.cpp	(revision 214)
@@ -13,5 +13,5 @@
 
 #include "MeanFilter.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <LayoutPosition.h>
 #include <GroupBox.h>
@@ -42,5 +42,5 @@
   desc->SetElementName(0, 0,
                        "mean filter"); // name will be used for graphs and logs
-  output = new cvmatrix(this, desc, floatType, name);
+  output = new Matrix(this, desc, floatType, name);
   delete desc;
 
@@ -52,5 +52,5 @@
 MeanFilter::~MeanFilter() {}
 
-cvmatrix *MeanFilter::GetMatrix() const { return output; }
+Matrix *MeanFilter::GetMatrix() const { return output; }
 
 float MeanFilter::GetValue(void) const { return output->Value(0, 0); }
@@ -64,6 +64,11 @@
 
   float result = 0;
-  // get input argument in a cvmatrix
-  cvmatrix *input = (cvmatrix *)data;
+  // get input argument in a matrix
+  const Matrix* input = dynamic_cast<const Matrix*>(data);
+  
+  if (!input) {
+      Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
+      return;
+  }
 
   // simple (and not efficent!) implementation of the filter
Index: /trunk/demos/Sinus/src/MeanFilter.h
===================================================================
--- /trunk/demos/Sinus/src/MeanFilter.h	(revision 213)
+++ /trunk/demos/Sinus/src/MeanFilter.h	(revision 214)
@@ -25,5 +25,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -70,5 +70,5 @@
   * \return pointer to the output matrix
   */
-  core::cvmatrix *GetMatrix(void) const;
+  core::Matrix *GetMatrix(void) const;
 
   /*!
@@ -86,5 +86,5 @@
   gui::GroupBox *groupBox;
   gui::SpinBox *numberOfElements;
-  core::cvmatrix *output;
+  core::Matrix *output;
   float previousValues[MAX_NUMBER_OF_ELEMENTS]; // previous values storage
 };
Index: /trunk/demos/Sinus/src/Sinus.cpp
===================================================================
--- /trunk/demos/Sinus/src/Sinus.cpp	(revision 213)
+++ /trunk/demos/Sinus/src/Sinus.cpp	(revision 214)
@@ -21,5 +21,5 @@
 #include <SpinBox.h>
 #include <DataPlot1D.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <math.h>
 
@@ -41,5 +41,5 @@
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
   desc->SetElementName(0, 0, "value"); // name will be used for graphs and logs
-  output = new cvmatrix((IODevice *)this, desc, floatType, name);
+  output = new Matrix((IODevice *)this, desc, floatType, name);
   delete desc;
 
@@ -94,5 +94,5 @@
 }
 
-cvmatrix *Sinus::GetMatrix(void) const { return output; }
+Matrix *Sinus::GetMatrix(void) const { return output; }
 
 float Sinus::GetValue(void) const { return output->Value(0, 0); }
Index: /trunk/demos/Sinus/src/Sinus.h
===================================================================
--- /trunk/demos/Sinus/src/Sinus.h	(revision 213)
+++ /trunk/demos/Sinus/src/Sinus.h	(revision 214)
@@ -23,5 +23,5 @@
 namespace core {
 class FrameworkManager;
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -69,5 +69,5 @@
   * \return un pointeur vers la matrice de sortie
   */
-  core::cvmatrix *GetMatrix(void) const;
+  core::Matrix *GetMatrix(void) const;
 
   /*!
@@ -113,5 +113,5 @@
   void Run(void);
 
-  core::cvmatrix *output;
+  core::Matrix *output;
   gui::Tab *mainTab;
   gui::TabWidget *tabWidget;
Index: /trunk/lib/FlairCore/src/FrameworkManager_impl.cpp
===================================================================
--- /trunk/lib/FlairCore/src/FrameworkManager_impl.cpp	(revision 213)
+++ /trunk/lib/FlairCore/src/FrameworkManager_impl.cpp	(revision 214)
@@ -211,5 +211,5 @@
   }
 																							
-	UDT::startup();
+	UDT::startup(1024*256,1024*256,1024*256);
   this->rcv_buf_size = rcv_buf_size;
 
Index: /trunk/lib/FlairCore/src/Matrix.cpp
===================================================================
--- /trunk/lib/FlairCore/src/Matrix.cpp	(revision 213)
+++ /trunk/lib/FlairCore/src/Matrix.cpp	(revision 214)
@@ -19,6 +19,4 @@
 #include <typeinfo>
 #include <string.h>
-
-//#include <iostream>
 
 using std::string;
@@ -37,5 +35,5 @@
     this->col = col;
     if (row >= matrix->Rows() || col >= matrix->Cols()) {
-      matrix->Err("index (%i,%i) out of bound (%i,%i)\n", row, col,
+      matrix->Err("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
                   matrix->Rows() - 1, matrix->Cols() - 1);
       size = 0;
@@ -71,4 +69,16 @@
       } break;
       }
+    } else if (typeid(matrix->GetDataType().GetElementDataType()) ==
+               typeid(UnsignedIntegerType)) {
+      switch (matrix->GetDataType().GetElementDataType().GetSize()) {
+      case 1: {
+        uint8_t uint8Value = matrix->Value(row, col);
+        memcpy(dst, &uint8Value, 1);
+      } break;
+      case 2: {
+        uint16_t uint16Value = matrix->Value(row, col);
+        memcpy(dst, &uint16Value, 2);
+      } break;
+      }
     }
   }
@@ -133,5 +143,5 @@
   if (row >= (uint32_t)pimpl_->descriptor->Rows() ||
       col >= (uint32_t)pimpl_->descriptor->Cols()) {
-    Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
+    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
          pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1);
     return 0;
@@ -139,5 +149,5 @@
 
   GetMutex();
-  value = pimpl_->datas[row][col];
+  value = pimpl_->ValueNoMutex(row, col);
   ReleaseMutex();
 
@@ -148,10 +158,10 @@
   if (row >= (uint32_t)pimpl_->descriptor->Rows() ||
       col >= (uint32_t)pimpl_->descriptor->Cols()) {
-    Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
+    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
          pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1);
     return 0;
   }
 
-  return pimpl_->datas[row][col];
+  return pimpl_->ValueNoMutex(row, col);
 }
 
@@ -159,9 +169,9 @@
   if (row >= (uint32_t)pimpl_->descriptor->Rows() ||
       col >= (uint32_t)pimpl_->descriptor->Cols()) {
-    Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
+    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
          pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1);
   } else {
     GetMutex();
-    pimpl_->datas[row][col]=value;
+    pimpl_->SetValueNoMutex(row, col,value);
     ReleaseMutex();
   }
@@ -171,8 +181,8 @@
   if (row >= (uint32_t)pimpl_->descriptor->Rows() ||
       col >= (uint32_t)pimpl_->descriptor->Cols()) {
-    Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
+    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
          pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1);
   } else {
-    pimpl_->datas[row][col]=value;
+    pimpl_->SetValueNoMutex(row, col,value);
   }
 }
@@ -180,5 +190,4 @@
 void Matrix::CopyDatas(char *dst) const {
   GetMutex();
-  // printf("%f %x %i\n",cvGetReal2D(pimpl_->mat,0,0),dst,Size());
   memcpy(dst, pimpl_->datas, dataType.GetSize());
   ReleaseMutex();
Index: /trunk/lib/FlairCore/src/Matrix.h
===================================================================
--- /trunk/lib/FlairCore/src/Matrix.h	(revision 213)
+++ /trunk/lib/FlairCore/src/Matrix.h	(revision 214)
@@ -27,6 +27,4 @@
 * \brief Class defining a matrix
 * 
-* Only supports float for the moment
-* TODO: write a template
 *
 */
@@ -196,5 +194,5 @@
 
   Type const &GetDataType() const { return dataType; };
-
+void CopyDatas(char *dst) const;
 private:
   /*!
@@ -206,5 +204,5 @@
   * \param dst destination buffer
   */
-  void CopyDatas(char *dst) const;
+  //void CopyDatas(char *dst) const;
 
   class Matrix_impl *pimpl_;
Index: /trunk/lib/FlairCore/src/Matrix_impl.cpp
===================================================================
--- /trunk/lib/FlairCore/src/Matrix_impl.cpp	(revision 213)
+++ /trunk/lib/FlairCore/src/Matrix_impl.cpp	(revision 214)
@@ -54,30 +54,16 @@
         dynamic_cast<ScalarType const &>(elementDataType);
     if (typeid(scalarType) == typeid(FloatType)) {
-      datas = (float **)malloc(descriptor->Rows() * sizeof(float*));
-      if(datas==NULL) {
-        self->Err("error allocating matrix\n");
-        return;
-      }
-      for(uint32_t i=0 ; i < descriptor->Rows() ; i++){
-        datas[i] = (float*)malloc(descriptor->Cols() * sizeof(float) ); 
-        if(datas[i]==NULL) {
-          self->Err("error allocating matrix\n");
-          for(uint32_t j = i-1 ; j >= 0 ; j--) free(datas[j]);
-          free(datas);
-          return;
-        }
-      }
-      /*
-    } else if (typeid(scalarType) == typeid(SignedIntegerType)) {
+      datas =malloc(descriptor->Rows() * descriptor->Cols() * sizeof(float));
+    } else if (typeid(scalarType) == typeid(SignedIntegerType) || typeid(scalarType) == typeid(UnsignedIntegerType) ) {
       switch (elementDataType.GetSize()) {
       case 1:
-        mat = cvCreateMat(descriptor->Rows(), descriptor->Cols(), CV_8SC1);
+        datas=malloc(descriptor->Rows() * descriptor->Cols() * sizeof(uint8_t));
         break;
       case 2:
-        mat = cvCreateMat(descriptor->Rows(), descriptor->Cols(), CV_16SC1);
+        datas=malloc(descriptor->Rows() * descriptor->Cols() * sizeof(uint16_t));
         break;
       default:
         self->Err("unsupported integer scalar type\n");
-      }*/
+      }
     } else {
       self->Err("unsupported scalar type\n");
@@ -94,8 +80,70 @@
 
 Matrix_impl::~Matrix_impl() {
-  for (uint32_t i = 0; i < descriptor->Rows();i++) {
-    free(datas[i]);
-  }
   free(datas);
   delete descriptor;
 }
+
+float Matrix_impl::ValueNoMutex(uint32_t row, uint32_t col) const {
+  ScalarType const &scalarType =
+        dynamic_cast<ScalarType const &>(elementDataType);
+  if (typeid(scalarType) == typeid(FloatType)) {
+    return ((float*)datas)[row*descriptor->Cols()+col];
+  } else if (typeid(scalarType) == typeid(SignedIntegerType)) {
+    switch (elementDataType.GetSize()) {
+    case 1:
+      return ((int8_t*)datas)[row*descriptor->Cols()+col];
+      break;
+    case 2:
+      return ((int16_t*)datas)[row*descriptor->Cols()+col];
+      break;
+    default:
+      self->Err("unsupported signed integer scalar type\n");
+    }
+  } else if (typeid(scalarType) == typeid(UnsignedIntegerType)) {
+    switch (elementDataType.GetSize()) {
+    case 1:
+      return ((uint8_t*)datas)[row*descriptor->Cols()+col];
+      break;
+    case 2:
+      return ((uint16_t*)datas)[row*descriptor->Cols()+col];
+      break;
+    default:
+      self->Err("unsupported unsigned integer scalar type\n");
+    }
+  } else {
+    self->Err("unsupported scalar type\n");
+  }
+  return 0;
+}
+
+void Matrix_impl::SetValueNoMutex(uint32_t row, uint32_t col, float value) {
+ ScalarType const &scalarType =
+        dynamic_cast<ScalarType const &>(elementDataType);
+  if (typeid(scalarType) == typeid(FloatType)) {
+    ((float*)datas)[row*descriptor->Cols()+col]=value;
+  } else if (typeid(scalarType) == typeid(SignedIntegerType)) {
+    switch (elementDataType.GetSize()) {
+    case 1:
+      ((int8_t*)datas)[row*descriptor->Cols()+col]=value;
+      break;
+    case 2:
+      ((int16_t*)datas)[row*descriptor->Cols()+col]=value;
+      break;
+    default:
+      self->Err("unsupported signed integer scalar type\n");
+    }
+  } else if (typeid(scalarType) == typeid(UnsignedIntegerType)) {
+    switch (elementDataType.GetSize()) {
+    case 1:
+      ((uint8_t*)datas)[row*descriptor->Cols()+col]=value;
+      break;
+    case 2:
+      ((uint16_t*)datas)[row*descriptor->Cols()+col]=value;
+      break;
+    default:
+      self->Err("unsupported unsigned integer scalar type\n");
+    }
+  } else {
+    self->Err("unsupported scalar type\n");
+  }
+}
Index: /trunk/lib/FlairCore/src/RangeFinderPlot.cpp
===================================================================
--- /trunk/lib/FlairCore/src/RangeFinderPlot.cpp	(revision 213)
+++ /trunk/lib/FlairCore/src/RangeFinderPlot.cpp	(revision 214)
@@ -18,6 +18,5 @@
 
 #include "RangeFinderPlot.h"
-#include "cvmatrix.h"
-#include "Layout.h"
+#include "Matrix.h"
 #include "LayoutPosition.h"
 #include <cxcore.h>
@@ -32,9 +31,9 @@
                                  string x_name, float xmin, float xmax,
                                  string y_name, float ymin, float ymax,
-                                 const cvmatrix *datas, float start_angle,
+                                 const Matrix *datas, float start_angle,
                                  float end_angle, uint32_t nb_samples)
     : SendData(position, name, "RangeFinderPlot", 200) {
   this->datas = datas;
-
+Warn("RangeFinderPlot::CopyDatas needs to be written\n");
   SetSendSize(datas->GetDataType().GetSize());
 
@@ -59,7 +58,5 @@
 
 void RangeFinderPlot::CopyDatas(char *buf) const {
-  datas->GetMutex();
-  memcpy(buf, datas->getCvMat()->data.ptr, datas->GetDataType().GetSize());
-  datas->ReleaseMutex();
+  //datas->CopyDatas(buf);
 }
 
Index: /trunk/lib/FlairCore/src/RangeFinderPlot.h
===================================================================
--- /trunk/lib/FlairCore/src/RangeFinderPlot.h	(revision 213)
+++ /trunk/lib/FlairCore/src/RangeFinderPlot.h	(revision 214)
@@ -20,5 +20,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 }
@@ -61,5 +61,5 @@
                   std::string x_name, float xmin, float xmax,
                   std::string y_name, float ymin, float ymax,
-                  const core::cvmatrix *datas, float start_angle,
+                  const core::Matrix *datas, float start_angle,
                   float end_angle, uint32_t nb_samples);
 
@@ -87,5 +87,5 @@
   void ExtraXmlEvent(void){};
 
-  const core::cvmatrix *datas;
+  const core::Matrix *datas;
 };
 
Index: /trunk/lib/FlairCore/src/cvmatrix.cpp
===================================================================
--- /trunk/lib/FlairCore/src/cvmatrix.cpp	(revision 213)
+++ /trunk/lib/FlairCore/src/cvmatrix.cpp	(revision 214)
@@ -37,5 +37,5 @@
     this->col = col;
     if (row >= matrix->Rows() || col >= matrix->Cols()) {
-      matrix->Err("index (%i,%i) out of bound (%i,%i)\n", row, col,
+      matrix->Err("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
                   matrix->Rows() - 1, matrix->Cols() - 1);
       size = 0;
@@ -133,5 +133,5 @@
   if (row >= (uint32_t)pimpl_->mat->rows ||
       col >= (uint32_t)pimpl_->mat->cols) {
-    Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
+    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
          pimpl_->mat->rows - 1, pimpl_->mat->cols - 1);
     return 0;
@@ -148,5 +148,5 @@
   if (row >= (uint32_t)pimpl_->mat->rows ||
       col >= (uint32_t)pimpl_->mat->cols) {
-    Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
+    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
          pimpl_->mat->rows - 1, pimpl_->mat->cols - 1);
     return 0;
@@ -159,5 +159,5 @@
   if (row >= (uint32_t)pimpl_->mat->rows ||
       col >= (uint32_t)pimpl_->mat->cols) {
-    Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
+    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
          pimpl_->mat->rows - 1, pimpl_->mat->cols - 1);
   } else {
@@ -171,5 +171,5 @@
   if (row >= (uint32_t)pimpl_->mat->rows ||
       col >= (uint32_t)pimpl_->mat->cols) {
-    Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,
+    Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col,
          pimpl_->mat->rows - 1, pimpl_->mat->cols - 1);
   } else {
Index: /trunk/lib/FlairCore/src/cvmatrix_descriptor.cpp
===================================================================
--- /trunk/lib/FlairCore/src/cvmatrix_descriptor.cpp	(revision 213)
+++ /trunk/lib/FlairCore/src/cvmatrix_descriptor.cpp	(revision 214)
@@ -46,5 +46,5 @@
                                          string name) {
   if (row >= rows || col >= cols) {
-    getFrameworkManager()->Err("index out of bound %s (%i,%i), range (%i,%i)\n",
+    getFrameworkManager()->Err("index out of bound %s (%i,%i), max (%i,%i)\n",
                                name.c_str(), row, col, rows - 1, cols - 1);
     return;
@@ -55,5 +55,5 @@
 string cvmatrix_descriptor::ElementName(uint32_t row, uint32_t col) const {
   if (row >= rows || col >= cols) {
-    getFrameworkManager()->Err("index out of bound (%i,%i), range (%i,%i)\n",
+    getFrameworkManager()->Err("index out of bound (%i,%i), max (%i,%i)\n",
                                row, col, rows - 1, cols - 1);
     return *element_names[0]; // safe value...
Index: /trunk/lib/FlairCore/src/unexported/Matrix_impl.h
===================================================================
--- /trunk/lib/FlairCore/src/unexported/Matrix_impl.h	(revision 213)
+++ /trunk/lib/FlairCore/src/unexported/Matrix_impl.h	(revision 214)
@@ -33,5 +33,7 @@
   flair::core::ScalarType const &elementDataType;
   flair::core::cvmatrix_descriptor *descriptor;
-  float **datas;
+  void *datas;
+  void SetValueNoMutex(uint32_t row, uint32_t col, float value);
+  float ValueNoMutex(uint32_t row, uint32_t col) const;
 
 private:
Index: /trunk/lib/FlairCore/src/unexported/config.h
===================================================================
--- /trunk/lib/FlairCore/src/unexported/config.h	(revision 213)
+++ /trunk/lib/FlairCore/src/unexported/config.h	(revision 214)
@@ -27,5 +27,5 @@
 
 // nrt pipe size
-#define NRT_PIPE_SIZE 1024 * 100
+#define NRT_PIPE_SIZE 1024 * 100*10
 
 // rt log heap size
Index: /trunk/lib/FlairFilter/src/ButterworthLowPass.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/ButterworthLowPass.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/ButterworthLowPass.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "ButterworthLowPass.h"
 #include "ButterworthLowPass_impl.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <LayoutPosition.h>
@@ -48,5 +48,5 @@
 ButterworthLowPass::~ButterworthLowPass() { delete pimpl_; }
 
-cvmatrix *ButterworthLowPass::Matrix(void) const { return pimpl_->output; }
+Matrix *ButterworthLowPass::GetMatrix(void) const { return pimpl_->output; }
 
 float ButterworthLowPass::Output(void) const {
Index: /trunk/lib/FlairFilter/src/ButterworthLowPass.h
===================================================================
--- /trunk/lib/FlairFilter/src/ButterworthLowPass.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/ButterworthLowPass.h	(revision 214)
@@ -18,5 +18,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -91,5 +91,5 @@
   * \return filtered output
   */
-  core::cvmatrix *Matrix(void) const;
+  core::Matrix *GetMatrix(void) const;
 
   /*!
Index: /trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "ButterworthLowPass_impl.h"
 #include "ButterworthLowPass.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <GroupBox.h>
@@ -29,5 +29,5 @@
 using namespace flair::filter;
 
-ButterworthLowPass_impl::ButterworthLowPass_impl(ButterworthLowPass *self,
+ButterworthLowPass_impl::ButterworthLowPass_impl(const ButterworthLowPass *self,
                                                  const LayoutPosition *position,
                                                  string name, uint32_t order,uint32_t nbRow,uint32_t nbCol) {
@@ -41,5 +41,5 @@
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(nbRow, nbCol);
   //desc->SetElementName(0, 0, "output");
-  output = new cvmatrix(self, desc, floatType, name);
+  output = new Matrix(self, desc, floatType, name);
   delete desc;
 
@@ -60,4 +60,5 @@
   this->nbRow=nbRow;
   this->nbCol=nbCol;
+  this->self=self;
 }
 
@@ -72,6 +73,11 @@
 
 void ButterworthLowPass_impl::UpdateFrom(const io_data *data) {
-  cvmatrix *input = (cvmatrix *)data;
   float delta_t;
+  const Matrix* input = dynamic_cast<const Matrix*>(data);
+  
+  if (!input) {
+      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
+      return;
+  }
   
   if (T->ValueChanged() && T->Value() != 0) {
Index: /trunk/lib/FlairFilter/src/ControlLaw.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/ControlLaw.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/ControlLaw.cpp	(revision 214)
@@ -17,5 +17,5 @@
 
 #include "ControlLaw.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <cvmatrix_descriptor.h>
 #include <DataPlot1D.h>
@@ -32,5 +32,5 @@
     : IODevice(parent, name) {
   if (nb_out == 1) {
-    output = new cvmatrix(this, nb_out, 1, floatType, name);
+    output = new Matrix(this, nb_out, 1, floatType, name);
   } else {
     cvmatrix_descriptor *desc = new cvmatrix_descriptor(nb_out, 1);
@@ -40,5 +40,5 @@
       desc->SetElementName(i, 0, ss.str());
     }
-    output = new cvmatrix(this, desc, floatType, name);
+    output = new Matrix(this, desc, floatType, name);
     delete desc;
   }
Index: /trunk/lib/FlairFilter/src/ControlLaw.h
===================================================================
--- /trunk/lib/FlairFilter/src/ControlLaw.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/ControlLaw.h	(revision 214)
@@ -21,5 +21,5 @@
 }
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 }
@@ -100,5 +100,5 @@
   *
   */
-  core::cvmatrix *input;
+  core::Matrix *input;
 
   /*!
@@ -109,5 +109,5 @@
   *
   */
-  core::cvmatrix *output;
+  core::Matrix *output;
 
 private:
Index: /trunk/lib/FlairFilter/src/EulerDerivative.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/EulerDerivative.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/EulerDerivative.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "EulerDerivative.h"
 #include "EulerDerivative_impl.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <LayoutPosition.h>
 
@@ -30,5 +30,5 @@
 EulerDerivative::EulerDerivative(const IODevice *parent,
                                  const LayoutPosition *position, string name,
-                                 const cvmatrix *init_value)
+                                 const Matrix *init_value)
     : IODevice(parent, name) {
   pimpl_ = new EulerDerivative_impl(this, position, name, init_value);
@@ -40,5 +40,5 @@
 EulerDerivative::~EulerDerivative() { delete pimpl_; }
 
-cvmatrix *EulerDerivative::Matrix(void) const { return pimpl_->output; }
+Matrix *EulerDerivative::GetMatrix(void) const { return pimpl_->output; }
 
 float EulerDerivative::Output(int row, int col) const {
Index: /trunk/lib/FlairFilter/src/EulerDerivative.h
===================================================================
--- /trunk/lib/FlairFilter/src/EulerDerivative.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/EulerDerivative.h	(revision 214)
@@ -18,5 +18,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -56,5 +56,5 @@
   EulerDerivative(const core::IODevice *parent,
                   const gui::LayoutPosition *position, std::string name,
-                  const core::cvmatrix *init_value = NULL);
+                  const core::Matrix *init_value = NULL);
 
   /*!
@@ -79,5 +79,5 @@
   * \return filtered output
   */
-  core::cvmatrix *Matrix(void) const;
+  core::Matrix *GetMatrix(void) const;
 
 private:
Index: /trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "EulerDerivative.h"
 #include "EulerDerivative_impl.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <GroupBox.h>
@@ -31,6 +31,7 @@
                                            const LayoutPosition *position,
                                            string name,
-                                           const cvmatrix *init_value) {
+                                           const Matrix *init_value) {
   first_update = true;
+  this->self = self;
   
   if (init_value != NULL) {
@@ -43,5 +44,5 @@
       }
     }
-    output = new cvmatrix(self, desc,init_value->GetDataType().GetElementDataType(), name);
+    output = new Matrix(self, desc,init_value->GetDataType().GetElementDataType(), name);
     delete desc;
     for (int i = 0; i < init_value->Rows(); i++) {
@@ -54,5 +55,5 @@
     cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
     desc->SetElementName(0, 0, "output");
-    output = new cvmatrix(self, desc, floatType, name);
+    output = new Matrix(self, desc, floatType, name);
     delete desc;
   }
@@ -60,5 +61,5 @@
  
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(output->Rows(), output->Cols());
-  prev_value = new cvmatrix(self, desc, output->GetDataType().GetElementDataType(), name);
+  prev_value = new Matrix(self, desc, output->GetDataType().GetElementDataType(), name);
 
 
@@ -73,5 +74,10 @@
 void EulerDerivative_impl::UpdateFrom(const io_data *data) {
   float delta_t;
-  cvmatrix *input = (cvmatrix *)data;
+  const Matrix* input = dynamic_cast<const Matrix*>(data);
+  
+  if (!input) {
+      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
+      return;
+  }
 
   // on prend une fois pour toute les mutex et on fait des accès directs
Index: /trunk/lib/FlairFilter/src/JoyReference.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/JoyReference.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/JoyReference.cpp	(revision 214)
@@ -20,5 +20,5 @@
 #include <Layout.h>
 #include <LayoutPosition.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <AhrsData.h>
 #include <Euler.h>
Index: /trunk/lib/FlairFilter/src/JoyReference_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/JoyReference_impl.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/JoyReference_impl.cpp	(revision 214)
@@ -20,5 +20,5 @@
 #include <AhrsData.h>
 #include <Euler.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <GroupBox.h>
@@ -40,5 +40,5 @@
 
   ahrsData = new AhrsData(self);
-  input = new cvmatrix(self, 4, 1, floatType, name);
+  input = new Matrix(self, 4, 1, floatType, name);
 
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(4, 1);
@@ -48,5 +48,5 @@
   desc->SetElementName(2, 0, "trim_roll");
   desc->SetElementName(3, 0, "trim_pitch");
-  output = new cvmatrix(self, desc, floatType, name);
+  output = new Matrix(self, desc, floatType, name);
   delete desc;
 
@@ -147,5 +147,10 @@
 
 void JoyReference_impl::UpdateFrom(const io_data *data) {
-  cvmatrix *input = (cvmatrix *)data;
+  const Matrix* input = dynamic_cast<const Matrix*>(data);
+  
+  if (!input) {
+      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
+      return;
+  }
 
   if (previous_time == 0)
Index: /trunk/lib/FlairFilter/src/LowPassFilter.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/LowPassFilter.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/LowPassFilter.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "LowPassFilter.h"
 #include "LowPassFilter_impl.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <LayoutPosition.h>
 
@@ -30,5 +30,5 @@
 LowPassFilter::LowPassFilter(const IODevice *parent,
                              const LayoutPosition *position, string name,
-                             const cvmatrix *init_value)
+                             const Matrix *init_value)
     : IODevice(parent, name) {
   pimpl_ = new LowPassFilter_impl(this, position, name, init_value);
@@ -40,5 +40,5 @@
 LowPassFilter::~LowPassFilter() { delete pimpl_; }
 
-cvmatrix *LowPassFilter::Matrix(void) const { return pimpl_->output; }
+Matrix *LowPassFilter::GetMatrix(void) const { return pimpl_->output; }
 
 float LowPassFilter::Output(int row, int col) const {
Index: /trunk/lib/FlairFilter/src/LowPassFilter.h
===================================================================
--- /trunk/lib/FlairFilter/src/LowPassFilter.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/LowPassFilter.h	(revision 214)
@@ -18,5 +18,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -56,5 +56,5 @@
   LowPassFilter(const core::IODevice *parent,
                 const gui::LayoutPosition *position, std::string name,
-                const core::cvmatrix *init_value = NULL);
+                const core::Matrix *init_value = NULL);
 
   /*!
@@ -79,5 +79,5 @@
   * \return filtered output
   */
-  core::cvmatrix *Matrix(void) const;
+  core::Matrix *GetMatrix(void) const;
 
 private:
Index: /trunk/lib/FlairFilter/src/LowPassFilter_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/LowPassFilter_impl.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/LowPassFilter_impl.cpp	(revision 214)
@@ -18,10 +18,10 @@
 #include "LowPassFilter_impl.h"
 #include "LowPassFilter.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <GroupBox.h>
 #include <SpinBox.h>
 #include <DoubleSpinBox.h>
-
+#include <typeinfo>
 #define PI ((float)3.14159265358979323846)
 
@@ -34,5 +34,5 @@
                                        const LayoutPosition *position,
                                        string name,
-                                       const cvmatrix *init_value) {
+                                       const Matrix *init_value) {
 
   if (init_value != NULL) {
@@ -45,5 +45,5 @@
       }
     }
-    output = new cvmatrix(self, desc,init_value->GetDataType().GetElementDataType(), name);
+    output = new Matrix(self, desc,init_value->GetDataType().GetElementDataType(), name);
     for (int i = 0; i < init_value->Rows(); i++) {
       for (int j = 0; j < init_value->Cols(); j++) {
@@ -56,5 +56,5 @@
     cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
     desc->SetElementName(0, 0, "output");
-    output = new cvmatrix(self, desc, floatType, name);
+    output = new Matrix(self, desc, floatType, name);
     delete desc;
   }
@@ -68,4 +68,5 @@
                            
   previous_time=GetTime();
+  this->self = self;
 }
 
@@ -74,5 +75,10 @@
 void LowPassFilter_impl::UpdateFrom(const io_data *data) {
   float delta_t;
-  cvmatrix *input = (cvmatrix *)data;
+  const Matrix* input = dynamic_cast<const Matrix*>(data);
+  
+  if (!input) {
+      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
+      return;
+  }
 
   // on prend une fois pour toute les mutex et on fait des accès directs
Index: /trunk/lib/FlairFilter/src/NestedSat.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/NestedSat.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/NestedSat.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "NestedSat.h"
 #include "NestedSat_impl.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <LayoutPosition.h>
Index: /trunk/lib/FlairFilter/src/NestedSat_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/NestedSat_impl.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/NestedSat_impl.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "NestedSat_impl.h"
 #include "NestedSat.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <GroupBox.h>
@@ -34,5 +34,5 @@
 
   // init matrix
-  self->input = new cvmatrix(self, 3, 1, floatType, name);
+  self->input = new Matrix(self, 3, 1, floatType, name);
 
   GroupBox *reglages_groupbox = new GroupBox(position, name);
@@ -50,5 +50,10 @@
 void NestedSat_impl::UpdateFrom(const io_data *data) {
   float cons, dcons, law;
-  cvmatrix *input = (cvmatrix *)data;
+  const Matrix* input = dynamic_cast<const Matrix*>(data);
+  
+  if (!input) {
+      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
+      return;
+  }
 
   input->GetMutex();
Index: /trunk/lib/FlairFilter/src/Pid.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/Pid.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/Pid.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "Pid.h"
 #include "Pid_impl.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <LayoutPosition.h>
Index: /trunk/lib/FlairFilter/src/PidThrust.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/PidThrust.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/PidThrust.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "PidThrust.h"
 #include "PidThrust_impl.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <LayoutPosition.h>
Index: /trunk/lib/FlairFilter/src/PidThrust_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/PidThrust_impl.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/PidThrust_impl.cpp	(revision 214)
@@ -17,5 +17,5 @@
 #include "PidThrust_impl.h"
 #include "PidThrust.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <GroupBox.h>
@@ -36,5 +36,5 @@
 
   // init matrix
-  self->input = new cvmatrix(self, 2, 1, floatType, name);
+  self->input = new Matrix(self, 2, 1, floatType, name);
 
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(5, 1);
@@ -44,5 +44,5 @@
   desc->SetElementName(3, 0, "p+i+d");
   desc->SetElementName(4, 0, "p+i+d+offset");
-  state = new cvmatrix(self, desc, floatType, name);
+  state = new Matrix(self, desc, floatType, name);
   delete desc;
 
@@ -76,5 +76,10 @@
   float p, d, total;
   float delta_t;
-  cvmatrix *input = (cvmatrix *)data;
+  const Matrix* input = dynamic_cast<const Matrix*>(data);
+  
+  if (!input) {
+      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
+      return;
+  }
 
   if (T->Value() == 0) {
Index: /trunk/lib/FlairFilter/src/Pid_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/Pid_impl.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/Pid_impl.cpp	(revision 214)
@@ -17,5 +17,5 @@
 #include "Pid_impl.h"
 #include "Pid.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <GroupBox.h>
@@ -34,5 +34,5 @@
 
   // init matrix
-  self->input = new cvmatrix(self, 2, 1, floatType, name);
+  self->input = new Matrix(self, 2, 1, floatType, name);
 
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(4, 1);
@@ -41,5 +41,5 @@
   desc->SetElementName(2, 0, "d");
   desc->SetElementName(3, 0, "p+i+d");
-  state = new cvmatrix(self, desc, floatType, name);
+  state = new Matrix(self, desc, floatType, name);
   delete desc;
 
@@ -71,5 +71,10 @@
   float p, d, total;
   float delta_t;
-  cvmatrix *input = (cvmatrix *)data;
+  const Matrix* input = dynamic_cast<const Matrix*>(data);
+  
+  if (!input) {
+      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
+      return;
+  }
 
   if (T->Value() == 0) {
Index: /trunk/lib/FlairFilter/src/TrajectoryGenerator1D.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/TrajectoryGenerator1D.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/TrajectoryGenerator1D.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "TrajectoryGenerator1D.h"
 #include "TrajectoryGenerator1D_impl.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <LayoutPosition.h>
@@ -39,5 +39,5 @@
 TrajectoryGenerator1D::~TrajectoryGenerator1D() { delete pimpl_; }
 
-cvmatrix *TrajectoryGenerator1D::Matrix(void) const { return pimpl_->output; }
+Matrix *TrajectoryGenerator1D::GetMatrix(void) const { return pimpl_->output; }
 
 void TrajectoryGenerator1D::StartTraj(float startPosition, float endPosition,float startVelocity) {
Index: /trunk/lib/FlairFilter/src/TrajectoryGenerator1D.h
===================================================================
--- /trunk/lib/FlairFilter/src/TrajectoryGenerator1D.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/TrajectoryGenerator1D.h	(revision 214)
@@ -18,5 +18,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -152,5 +152,5 @@
   * \return matrix
   */
-  core::cvmatrix *Matrix(void) const;
+  core::Matrix *GetMatrix(void) const;
 
 private:
Index: /trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "TrajectoryGenerator1D.h"
 #include "TrajectoryGenerator1D_impl.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <GroupBox.h>
@@ -63,5 +63,5 @@
   desc->SetElementName(0, 0, "pos");
   desc->SetElementName(1, 0, "vel");
-  output = new cvmatrix(self, desc, floatType, name);
+  output = new Matrix(self, desc, floatType, name);
   delete desc;
 
Index: /trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "TrajectoryGenerator2DCircle.h"
 #include "TrajectoryGenerator2DCircle_impl.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <LayoutPosition.h>
@@ -44,5 +44,5 @@
 }
 
-cvmatrix *TrajectoryGenerator2DCircle::Matrix(void) const {
+Matrix *TrajectoryGenerator2DCircle::GetMatrix(void) const {
   return pimpl_->output;
 }
Index: /trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.h
===================================================================
--- /trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.h	(revision 214)
@@ -19,5 +19,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -131,5 +131,5 @@
   * \return matrix
   */
-  core::cvmatrix *Matrix(void) const;
+  core::Matrix *GetMatrix(void) const;
 
   /*!
Index: /trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "TrajectoryGenerator2DCircle_impl.h"
 #include "TrajectoryGenerator2DCircle.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <GroupBox.h>
@@ -56,5 +56,5 @@
   desc->SetElementName(1, 0, "vel.x");
   desc->SetElementName(1, 1, "vel.y");
-  output = new cvmatrix(self, desc, floatType, name);
+  output = new Matrix(self, desc, floatType, name);
   delete desc;
 }
Index: /trunk/lib/FlairFilter/src/UavMultiplex.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/UavMultiplex.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/UavMultiplex.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "UavMultiplex.h"
 #include "UavMultiplex_impl.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <FrameworkManager.h>
 #include <Tab.h>
Index: /trunk/lib/FlairFilter/src/UavMultiplex_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/UavMultiplex_impl.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/UavMultiplex_impl.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "UavMultiplex_impl.h"
 #include "UavMultiplex.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <FrameworkManager.h>
 #include <TabWidget.h>
@@ -34,5 +34,5 @@
 
 UavMultiplex_impl::UavMultiplex_impl(UavMultiplex *self, std::string name) {
-  input = new cvmatrix(self, 7, 1, floatType);
+  input = new Matrix(self, 7, 1, floatType);
   multiplexcombobox = NULL;
   this->self = self;
Index: /trunk/lib/FlairFilter/src/X4X8Multiplex_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/X4X8Multiplex_impl.cpp	(revision 213)
+++ /trunk/lib/FlairFilter/src/X4X8Multiplex_impl.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "X4X8Multiplex_impl.h"
 #include "X4X8Multiplex.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Tab.h>
 #include <GridLayout.h>
@@ -55,5 +55,5 @@
   }
 
-  output = new cvmatrix(self, desc, floatType);
+  output = new Matrix(self, desc, floatType);
   delete desc;
   self->AddDataToLog(output);
@@ -83,5 +83,10 @@
   float value[MAX_MOTORS];
 
-  cvmatrix *input = (cvmatrix *)data;
+  const Matrix* input = dynamic_cast<const Matrix*>(data);
+  
+  if (!input) {
+      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
+      return;
+  }
 
   // on prend une fois pour toute le mutex et on fait des accès directs
Index: /trunk/lib/FlairFilter/src/unexported/ButterworthLowPass_impl.h
===================================================================
--- /trunk/lib/FlairFilter/src/unexported/ButterworthLowPass_impl.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/unexported/ButterworthLowPass_impl.h	(revision 214)
@@ -19,5 +19,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -120,10 +120,10 @@
 class ButterworthLowPass_impl {
 public:
-  ButterworthLowPass_impl(flair::filter::ButterworthLowPass *self,
+  ButterworthLowPass_impl(const flair::filter::ButterworthLowPass *self,
                           const flair::gui::LayoutPosition *position,
                           std::string name, uint32_t order,uint32_t nbRow,uint32_t nbCol);
   ~ButterworthLowPass_impl();
   void UpdateFrom(const flair::core::io_data *data);
-  flair::core::cvmatrix *output;
+  flair::core::Matrix *output;
 
 private:
@@ -135,4 +135,5 @@
   uint32_t order;
   uint32_t nbRow, nbCol;
+  const flair::filter::ButterworthLowPass *self;
 };
 
Index: /trunk/lib/FlairFilter/src/unexported/EulerDerivative_impl.h
===================================================================
--- /trunk/lib/FlairFilter/src/unexported/EulerDerivative_impl.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/unexported/EulerDerivative_impl.h	(revision 214)
@@ -18,5 +18,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -38,8 +38,8 @@
                        const flair::gui::LayoutPosition *position,
                        std::string name,
-                       const flair::core::cvmatrix *init_value = NULL);
+                       const flair::core::Matrix *init_value = NULL);
   ~EulerDerivative_impl();
   void UpdateFrom(const flair::core::io_data *data);
-  flair::core::cvmatrix *output;
+  flair::core::Matrix *output;
 
 private:
@@ -47,5 +47,6 @@
   flair::core::Time previous_time;
   bool first_update;
-  flair::core::cvmatrix *prev_value;
+  flair::core::Matrix *prev_value;
+  flair::filter::EulerDerivative *self;
 };
 
Index: /trunk/lib/FlairFilter/src/unexported/JoyReference_impl.h
===================================================================
--- /trunk/lib/FlairFilter/src/unexported/JoyReference_impl.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/unexported/JoyReference_impl.h	(revision 214)
@@ -25,5 +25,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 class io_data;
 class AhrsData;
@@ -65,9 +65,9 @@
   void Update(flair::core::Time time);
   void UpdateFrom(const flair::core::io_data *data);
-  flair::core::cvmatrix *output;
+  flair::core::Matrix *output;
   flair::core::AhrsData *ahrsData;
 
 private:
-  flair::core::cvmatrix *input;
+  flair::core::Matrix *input;
 
   flair::gui::GroupBox *reglages_groupbox;
Index: /trunk/lib/FlairFilter/src/unexported/LowPassFilter_impl.h
===================================================================
--- /trunk/lib/FlairFilter/src/unexported/LowPassFilter_impl.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/unexported/LowPassFilter_impl.h	(revision 214)
@@ -18,5 +18,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -36,12 +36,13 @@
                      const flair::gui::LayoutPosition *position,
                      std::string name,
-                     const flair::core::cvmatrix *init_value = NULL);
+                     const flair::core::Matrix *init_value = NULL);
   ~LowPassFilter_impl();
   void UpdateFrom(const flair::core::io_data *data);
-  flair::core::cvmatrix *output;
+  flair::core::Matrix *output;
 
 private:
   flair::core::Time previous_time;
   flair::gui::DoubleSpinBox *freq, *T;
+  const flair::filter::LowPassFilter *self;
 };
 
Index: /trunk/lib/FlairFilter/src/unexported/PidThrust_impl.h
===================================================================
--- /trunk/lib/FlairFilter/src/unexported/PidThrust_impl.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/unexported/PidThrust_impl.h	(revision 214)
@@ -18,5 +18,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 class io_data;
 }
@@ -50,5 +50,5 @@
 
   // matrix
-  flair::core::cvmatrix *state;
+  flair::core::Matrix *state;
 
   flair::gui::DoubleSpinBox *T, *kp, *ki, *kd, *sat, *sati;
Index: /trunk/lib/FlairFilter/src/unexported/Pid_impl.h
===================================================================
--- /trunk/lib/FlairFilter/src/unexported/Pid_impl.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/unexported/Pid_impl.h	(revision 214)
@@ -18,5 +18,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 class io_data;
 }
@@ -49,5 +49,5 @@
 
   // matrix
-  flair::core::cvmatrix *state;
+  flair::core::Matrix *state;
 
   flair::gui::DoubleSpinBox *T, *kp, *ki, *kd, *sat, *sati;
Index: /trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator1D_impl.h
===================================================================
--- /trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator1D_impl.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator1D_impl.h	(revision 214)
@@ -16,5 +16,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -39,5 +39,5 @@
   void Reset(void);
   float GetPercentageOfCompletion(void) const;
-  flair::core::cvmatrix *output;
+  flair::core::Matrix *output;
   float pos_off, vel_off;
   bool is_finished, is_started;
Index: /trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator2DCircle_impl.h
===================================================================
--- /trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator2DCircle_impl.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator2DCircle_impl.h	(revision 214)
@@ -19,5 +19,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 class io_data;
 }
@@ -46,5 +46,5 @@
   void FinishTraj(void);
   bool is_running;
-  flair::core::cvmatrix *output;
+  flair::core::Matrix *output;
   flair::core::Vector2Df pos_off, vel_off;
 
Index: /trunk/lib/FlairFilter/src/unexported/UavMultiplex_impl.h
===================================================================
--- /trunk/lib/FlairFilter/src/unexported/UavMultiplex_impl.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/unexported/UavMultiplex_impl.h	(revision 214)
@@ -20,5 +20,5 @@
 namespace core {
 class FrameworkManager;
-class cvmatrix;
+class Matrix;
 class io_data;
 }
@@ -56,5 +56,5 @@
   ~UavMultiplex_impl();
 
-  flair::core::cvmatrix *input;
+  flair::core::Matrix *input;
   void SetMultiplexComboBox(std::string name, int index);
   int MultiplexValue(int index) const;
Index: /trunk/lib/FlairFilter/src/unexported/X4X8Multiplex_impl.h
===================================================================
--- /trunk/lib/FlairFilter/src/unexported/X4X8Multiplex_impl.h	(revision 213)
+++ /trunk/lib/FlairFilter/src/unexported/X4X8Multiplex_impl.h	(revision 214)
@@ -18,5 +18,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 class io_data;
 }
@@ -44,5 +44,5 @@
 
 private:
-  flair::core::cvmatrix *output;
+  flair::core::Matrix *output;
   flair::gui::ComboBox *pas;
   flair::gui::DataPlot1D *plots[4];
Index: /trunk/lib/FlairMeta/src/MetaDualShock3.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/MetaDualShock3.cpp	(revision 213)
+++ /trunk/lib/FlairMeta/src/MetaDualShock3.cpp	(revision 214)
@@ -22,5 +22,5 @@
 #include <Tab.h>
 #include <FrameworkManager.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Ahrs.h>
 #include <AhrsData.h>
Index: /trunk/lib/FlairMeta/src/MetaDualShock3_impl.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/MetaDualShock3_impl.cpp	(revision 213)
+++ /trunk/lib/FlairMeta/src/MetaDualShock3_impl.cpp	(revision 214)
@@ -20,5 +20,5 @@
 #include <JoyReference.h>
 #include <Tab.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <FrameworkManager.h>
 
@@ -43,5 +43,10 @@
 // receives updates from the controler
 void MetaDualShock3_impl::UpdateFrom(const io_data *data) {
-  cvmatrix *input = (cvmatrix *)data;
+  const Matrix* input = dynamic_cast<const Matrix*>(data);
+  
+  if (!input) {
+      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
+      return;
+  }
 
   // on prend une fois pour toute le mutex et on fait des accès directs
Index: /trunk/lib/FlairMeta/src/MetaUsRangeFinder.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/MetaUsRangeFinder.cpp	(revision 213)
+++ /trunk/lib/FlairMeta/src/MetaUsRangeFinder.cpp	(revision 214)
@@ -27,5 +27,5 @@
 #include <EulerDerivative.h>
 #include <GroupBox.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 
 using std::string;
@@ -53,9 +53,9 @@
   us->UseDefaultPlot();
 
-  us->GetPlot()->AddCurve(pbas_z->Matrix()->Element(0), DataPlot::Blue);
+  us->GetPlot()->AddCurve(pbas_z->GetMatrix()->Element(0), DataPlot::Blue);
 
   vz_plot = new DataPlot1D(us->GetPlotTab()->LastRowLastCol(), "vz", -2, 2);
-  vz_plot->AddCurve(vz_euler->Matrix()->Element(0));
-  vz_plot->AddCurve(pbas_vz->Matrix()->Element(0), DataPlot::Blue);
+  vz_plot->AddCurve(vz_euler->GetMatrix()->Element(0));
+  vz_plot->AddCurve(pbas_vz->GetMatrix()->Element(0), DataPlot::Blue);
 }
 
Index: /trunk/lib/FlairMeta/src/MetaVrpnObject.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/MetaVrpnObject.cpp	(revision 213)
+++ /trunk/lib/FlairMeta/src/MetaVrpnObject.cpp	(revision 214)
@@ -27,5 +27,5 @@
 #include <Tab.h>
 #include <TabWidget.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 
 using std::string;
@@ -54,5 +54,5 @@
     desc->SetElementName(i, 0, Output()->Name(i, 0));
   }
-  cvmatrix *prev_value = new cvmatrix(this, desc, floatType, name);
+  Matrix *prev_value = new Matrix(this, desc, floatType, name);
   delete desc;
 
@@ -65,5 +65,5 @@
     desc->SetElementName(i, 0, "d" + Output()->Name(i, 0));
   }
-  prev_value = new cvmatrix(this, desc, floatType, name);
+  prev_value = new Matrix(this, desc, floatType, name);
   delete desc;
 
@@ -73,9 +73,9 @@
 
   vx_opti_plot = new DataPlot1D(GetPlotTab()->NewRow(), "vx", -3, 3);
-  vx_opti_plot->AddCurve(euler->Matrix()->Element(4));
+  vx_opti_plot->AddCurve(euler->GetMatrix()->Element(4));
   vy_opti_plot = new DataPlot1D(GetPlotTab()->LastRowLastCol(), "vy", -3, 3);
-  vy_opti_plot->AddCurve(euler->Matrix()->Element(5));
+  vy_opti_plot->AddCurve(euler->GetMatrix()->Element(5));
   vz_opti_plot = new DataPlot1D(GetPlotTab()->LastRowLastCol(), "vz", -2, 2);
-  vz_opti_plot->AddCurve(euler->Matrix()->Element(6));
+  vz_opti_plot->AddCurve(euler->GetMatrix()->Element(6));
 
   plot_tab = new Tab(GetVrpnClient()->GetTabWidget(), "Mesures (xy) " + name);
Index: /trunk/lib/FlairMeta/src/Uav.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/Uav.cpp	(revision 213)
+++ /trunk/lib/FlairMeta/src/Uav.cpp	(revision 214)
@@ -28,5 +28,5 @@
 #include <NmeaGps.h>
 #include <Bldc.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include "MetaUsRangeFinder.h"
 #include "MetaVrpnObject.h"
Index: /trunk/lib/FlairMeta/src/UavStateMachine.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/UavStateMachine.cpp	(revision 213)
+++ /trunk/lib/FlairMeta/src/UavStateMachine.cpp	(revision 214)
@@ -39,5 +39,5 @@
 #include <Vector3D.h>
 #include <Vector2D.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <stdio.h>
 #include <TrajectoryGenerator1D.h>
@@ -109,7 +109,7 @@
       new TrajectoryGenerator1D(uavTab->NewRow(), "alt cons", "m");
   uav->GetMetaUsRangeFinder()->GetZPlot()->AddCurve(
-      altitudeTrajectory->Matrix()->Element(0), DataPlot::Green);
+      altitudeTrajectory->GetMatrix()->Element(0), DataPlot::Green);
   uav->GetMetaUsRangeFinder()->GetVzPlot()->AddCurve(
-      altitudeTrajectory->Matrix()->Element(1), DataPlot::Green);
+      altitudeTrajectory->GetMatrix()->Element(1), DataPlot::Green);
 }
 
@@ -459,6 +459,21 @@
 void UavStateMachine::TakeOff(void) {
   flagZTrajectoryFinished = false;
-
-  if((altitudeState==AltitudeState_t::Stopped) && safeToFly && uav->isReadyToFly()  && uav->GetBatteryMonitor()->IsBatteryLow()==false && !flagConnectionLost) {
+  
+  if(altitudeState!=AltitudeState_t::Stopped) {
+    Warn("cannot takeoff, altitudeState!=AltitudeState_t::Stopped\n");
+    joy->ErrorNotify();
+  } else if(!safeToFly) {
+    Warn("cannot takeoff, uav is not safe to fly\n");
+    joy->ErrorNotify();
+  } else if(!uav->isReadyToFly()) {
+    Warn("cannot takeoff, uav is not ready\n");
+    joy->ErrorNotify();
+  } else if(uav->GetBatteryMonitor()->IsBatteryLow()) {
+    Warn("cannot takeoff, battery is low\n");
+    joy->ErrorNotify();
+  } else if(flagConnectionLost) {
+    Warn("cannot takeoff, connection with flairgcs lost\n");
+    joy->ErrorNotify();
+  } else {
     //The uav always takes off in fail safe mode
     flagBatteryLow=false;
@@ -480,7 +495,4 @@
     altitudeState = AltitudeState_t::TakingOff;
     SignalEvent(Event_t::TakingOff);
-  } else {
-    Warn("cannot takeoff\n");
-    joy->ErrorNotify();
   }
 }
@@ -511,5 +523,6 @@
     altitudeState=AltitudeState_t::FinishLanding;
     safeToFly=false;
-Printf("Emergency landing!\n");
+    Warn("Emergency landing!\n");
+    Warn("You will not be able to take off again\n");
 }
 
Index: /trunk/lib/FlairSensorActuator/src/AfroBldc_impl.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/AfroBldc_impl.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/AfroBldc_impl.cpp	(revision 214)
@@ -22,5 +22,5 @@
 #include <SpinBox.h>
 #include <Label.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <string.h>
 
Index: /trunk/lib/FlairSensorActuator/src/BlCtrlV2_impl.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/BlCtrlV2_impl.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/BlCtrlV2_impl.cpp	(revision 214)
@@ -23,5 +23,5 @@
 #include <SpinBox.h>
 #include <Label.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <string.h>
 
@@ -96,5 +96,5 @@
 
   // on prend une fois pour toute le mutex et on fait des accès directs
-  cvmatrix *output = self->output;
+  Matrix *output = self->output;
   output->GetMutex();
   for (int i = 0; i < nb_mot; i++)
Index: /trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.cpp	(revision 214)
@@ -25,5 +25,5 @@
 #include <ComboBox.h>
 #include <PushButton.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Mutex.h>
 #include <FrameworkManager.h>
@@ -119,5 +119,5 @@
   pas->AddItem("inverse");
 
-  input = new cvmatrix((IODevice *)this, 8, 1, floatType);
+  input = new Matrix((IODevice *)this, 8, 1, floatType);
 
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(4, 2);
@@ -131,5 +131,5 @@
   desc->SetElementName(2, 1, "cons avant droite");
   desc->SetElementName(3, 1, "cons arriere gauche");
-  output = new cvmatrix((IODevice *)this, desc, floatType);
+  output = new Matrix((IODevice *)this, desc, floatType);
   delete desc;
   
Index: /trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.h	(revision 214)
@@ -24,5 +24,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 class I2cPort;
 }
@@ -97,6 +97,6 @@
 
   // matrix
-  core::cvmatrix *input;
-  core::cvmatrix *output;
+  core::Matrix *input;
+  core::Matrix *output;
 
   int tested_motor;
Index: /trunk/lib/FlairSensorActuator/src/Bldc.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/Bldc.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/Bldc.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "Bldc.h"
 #include "Bldc_impl.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <DoubleSpinBox.h>
 #include <sstream>
@@ -53,5 +53,5 @@
   }
 
-  output = new cvmatrix(this, desc, floatType);
+  output = new Matrix(this, desc, floatType);
   delete desc;
   AddDataToLog(output);
@@ -81,5 +81,5 @@
 uint8_t Bldc::MotorsCount(void) const { return pimpl_->motors_count; }
 
-cvmatrix *Bldc::Output(void) const { return output; }
+Matrix *Bldc::Output(void) const { return output; }
 
 bool Bldc::AreEnabled(void) const { return pimpl_->are_enabled; }
Index: /trunk/lib/FlairSensorActuator/src/Bldc.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/Bldc.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/Bldc.h	(revision 214)
@@ -19,5 +19,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -96,5 +96,5 @@
   *
   */
-  core::cvmatrix *Output(void) const;
+  core::Matrix *Output(void) const;
 
   /*!
@@ -161,5 +161,5 @@
 
 protected:
-  core::cvmatrix *output;
+  core::Matrix *output;
 
 private:
Index: /trunk/lib/FlairSensorActuator/src/Bldc_impl.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/Bldc_impl.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/Bldc_impl.cpp	(revision 214)
@@ -20,5 +20,5 @@
 #include <GroupBox.h>
 #include <DoubleSpinBox.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Label.h>
 #include <PushButton.h>
@@ -110,5 +110,5 @@
 
 void Bldc_impl::UpdateFrom(const io_data *data) {
-  cvmatrix *input = (cvmatrix *)data;
+  Matrix *input = (Matrix *)data;
   bool is_motor_running = false;
 
Index: /trunk/lib/FlairSensorActuator/src/Camera.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/Camera.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/Camera.cpp	(revision 214)
@@ -119,5 +119,12 @@
 		if(logFormat==LogFormat::JPG) {
 			data->GetMutex();
-			IplImage *img=((cvimage*)data)->img;
+      //IplImage *img=((cvimage*)data)->img;
+      const cvimage* input = dynamic_cast<const cvimage*>(data);
+      if (!input) {
+          Warn("casting %s to cvimage failed\n",data->ObjectName().c_str());
+          return;
+      }
+			IplImage *img=input->img;
+     
 			string filename=getFrameworkManager()->GetLogPath()+"/"+ObjectName()+"_"+std::to_string(data->DataTime())+".jpg";
 			switch(((cvimage*)data)->GetDataType().GetFormat()) {
Index: /trunk/lib/FlairSensorActuator/src/EmulatedController.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/EmulatedController.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/EmulatedController.cpp	(revision 214)
@@ -17,5 +17,5 @@
 #include <cstring>
 #include <string>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <stdexcept>
 
@@ -46,5 +46,5 @@
 }
 
-template<typename T> void EmulatedController::fillVectorNoMutex(cvmatrix &vector,T data[],unsigned int size) {
+template<typename T> void EmulatedController::fillVectorNoMutex(Matrix &vector,T data[],unsigned int size) {
     for (unsigned int i=0; i<size; i++) {
         vector.SetValueNoMutex(i,0,data[i]);
@@ -52,5 +52,5 @@
 }
 
-void EmulatedController::fillVectorNoMutex(cvmatrix &destination,cvmatrix &source,unsigned int size) {
+void EmulatedController::fillVectorNoMutex(Matrix &destination,Matrix &source,unsigned int size) {
     for (unsigned int i=0; i<size; i++) {
         destination.SetValueNoMutex(i,0,source.Value(i,0));
@@ -69,5 +69,5 @@
 
 void EmulatedController::AddStep(unsigned int durationMs,string description,uint16_t buttonPressed, float leftAxisX, float leftAxisY, float rightAxisX, float rightAxisY) {
-    cvmatrix *axisMatrix=new cvmatrix((IODevice *)this,4,1,floatType);
+    Matrix *axisMatrix=new Matrix((IODevice *)this,4,1,floatType);
     axisMatrix->SetValueNoMutex(0,0,leftAxisX);
     axisMatrix->SetValueNoMutex(1,0,leftAxisY);
@@ -75,5 +75,5 @@
     axisMatrix->SetValueNoMutex(3,0,rightAxisY);
 
-    cvmatrix *buttonMatrix=new cvmatrix((IODevice *)this,16,1,SignedIntegerType(8));
+    Matrix *buttonMatrix=new Matrix((IODevice *)this,16,1,SignedIntegerType(8));
     if (buttonPressed&(uint16_t)ButtonType::start) buttonMatrix->SetValueNoMutex(0,0,1);
     if (buttonPressed&(uint16_t)ButtonType::select) buttonMatrix->SetValueNoMutex(1,0,1);
@@ -98,5 +98,5 @@
 }
 
-void EmulatedController::ComputeControllerData(DataType dataType, cvmatrix &data) {
+void EmulatedController::ComputeControllerData(DataType dataType, Matrix &data) {
     static Time startStepTime=GetTime();
 
@@ -130,9 +130,9 @@
 }
 
-void EmulatedController::AcquireAxisData(core::cvmatrix &axis) {
+void EmulatedController::AcquireAxisData(core::Matrix &axis) {
     ComputeControllerData(DataType::axis,axis);
 }
 
-void EmulatedController::AcquireButtonData(core::cvmatrix &button) {
+void EmulatedController::AcquireButtonData(core::Matrix &button) {
     ComputeControllerData(DataType::button,button);
 }
Index: /trunk/lib/FlairSensorActuator/src/EmulatedController.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/EmulatedController.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/EmulatedController.h	(revision 214)
@@ -21,5 +21,5 @@
 namespace flair {
     namespace core {
-        class cvmatrix;
+        class Matrix;
     }
     namespace gui {
@@ -52,17 +52,17 @@
         bool ProcessMessage(core::Message *msg);
         bool IsDataFrameReady();
-        void AcquireAxisData(core::cvmatrix &axis); //responsible for getting the axis data from the hardware
-        void AcquireButtonData(core::cvmatrix &button); //responsible for getting the button data from the hardware
+        void AcquireAxisData(core::Matrix &axis); //responsible for getting the axis data from the hardware
+        void AcquireButtonData(core::Matrix &button); //responsible for getting the button data from the hardware
         bool ControllerInitialization();
 
     private:
         enum class DataType { axis,button };
-        void ComputeControllerData(DataType dataType, core::cvmatrix &data);
-        template<typename T> void fillVectorNoMutex(core::cvmatrix &vector,T data[],unsigned int size);
-        void fillVectorNoMutex(core::cvmatrix &destination,core::cvmatrix &source,unsigned int size);
+        void ComputeControllerData(DataType dataType, core::Matrix &data);
+        template<typename T> void fillVectorNoMutex(core::Matrix &vector,T data[],unsigned int size);
+        void fillVectorNoMutex(core::Matrix &destination,core::Matrix &source,unsigned int size);
         struct StepData {
             unsigned int durationMs; //milliseconds
-            core::cvmatrix *axisData;
-            core::cvmatrix *buttonData;
+            core::Matrix *axisData;
+            core::Matrix *buttonData;
             std::string description;
             void Print();
Index: /trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.cpp	(revision 214)
@@ -21,5 +21,5 @@
 #include <FrameworkManager.h>
 #include <RangeFinderPlot.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Tab.h>
 #include <sstream>
@@ -40,5 +40,5 @@
   main_tab = new Tab(getFrameworkManager()->GetTabWidget(), name);
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(1081, 1);
-  output = new cvmatrix((IODevice *)this, desc, SignedIntegerType(16));
+  output = new Matrix((IODevice *)this, desc, SignedIntegerType(16));
   delete desc;
 
@@ -246,5 +246,5 @@
 #endif
 }
-cvmatrix *HokuyoUTM30Lx::getDatas() { return output; }
+Matrix *HokuyoUTM30Lx::getDatas() { return output; }
 
 void HokuyoUTM30Lx::UseDefaultPlot(void) {
Index: /trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.h	(revision 214)
@@ -23,5 +23,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 class SerialPort;
 class Mutex;
@@ -56,5 +56,5 @@
   void getMesure(int startStep, int endStep, int clusterCount, int interval,
                  int scanNumber = 0);
-  core::cvmatrix *getDatas(void);
+  core::Matrix *getDatas(void);
 
   /*!
@@ -78,5 +78,5 @@
 
   // matrix
-  core::cvmatrix *output;
+  core::Matrix *output;
 
   std::queue<std::string> bufRet;
Index: /trunk/lib/FlairSensorActuator/src/HostEthController.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/HostEthController.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/HostEthController.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "HostEthController.h"
 #include <Controller.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Tab.h>
 #include <TabWidget.h>
Index: /trunk/lib/FlairSensorActuator/src/HostEthController.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/HostEthController.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/HostEthController.h	(revision 214)
@@ -26,5 +26,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 class TcpSocket;
 class UdpSocket;
@@ -81,5 +81,5 @@
   GetAxisData() = 0; // responsible for getting the axis data from the hardware
   unsigned int axisNumber;
-  core::cvmatrix *axis;
+  core::Matrix *axis;
   gui::DataPlot1D **axisPlot;
   uint32_t bitsPerAxis;
@@ -90,5 +90,5 @@
                                     // from the hardware
   unsigned int buttonNumber;
-  core::cvmatrix *button;
+  core::Matrix *button;
   uint8_t buttonOffset;
   bool meaningfulDataAvailable;
Index: /trunk/lib/FlairSensorActuator/src/LaserRangeFinder.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/LaserRangeFinder.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/LaserRangeFinder.cpp	(revision 214)
@@ -17,5 +17,5 @@
 
 #include "LaserRangeFinder.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Tab.h>
 #include <TabWidget.h>
@@ -38,5 +38,5 @@
     : IODevice(getFrameworkManager(), name) {
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(360, 1);
-  output = new cvmatrix(this, desc, floatType);
+  output = new Matrix(this, desc, floatType);
   delete desc;
   AddDataToLog(output);
Index: /trunk/lib/FlairSensorActuator/src/LaserRangeFinder.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/LaserRangeFinder.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/LaserRangeFinder.h	(revision 214)
@@ -19,5 +19,5 @@
 namespace core {
 class FrameworkManager;
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -102,5 +102,5 @@
       * \return output matrix
       */
-  core::cvmatrix *output;
+  core::Matrix *output;
 
   /*!
Index: /trunk/lib/FlairSensorActuator/src/NmeaGps.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/NmeaGps.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/NmeaGps.cpp	(revision 214)
@@ -176,20 +176,15 @@
 
   int result;
-Printf("%s\n",frame);
-Printf("%x %x\n",&parser,parser.buffer);
   result = nmea_parse(&parser, frame, frame_size, &info);
-  Printf("%x %x\n",&parser,parser.buffer);
+  
   if (result != 1) {
     Warn("unrecognized nmea sentence: %s\n",frame);
     return;
   }
-Printf("3\n");
-Printf("%x %x\n",&parser,parser.buffer);
+
   result = nmea_parse_GPGGA(frame, frame_size, &pack);
-Printf("%x %x\n",&parser,parser.buffer);
+
   if (result == 1) {
-    Printf("%x %x\n",&parser,parser.buffer);
     nmea_info2pos(&info, &pos);
-     Printf("%x %x\n",&parser,parser.buffer);
    //  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);
 //Printf("lat:%f long:%f\n",pos.lat,pos.lon);
Index: /trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp	(revision 214)
@@ -20,5 +20,5 @@
 #include <TabWidget.h>
 #include <FrameworkManager.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <sstream>
 
@@ -44,5 +44,5 @@
     desc->SetElementName(i, 0, channel_name.str());
   }
-  output = new cvmatrix(this, desc, floatType, name);
+  output = new Matrix(this, desc, floatType, name);
   delete desc;
 
Index: /trunk/lib/FlairSensorActuator/src/RadioReceiver.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/RadioReceiver.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/RadioReceiver.h	(revision 214)
@@ -19,5 +19,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -87,5 +87,5 @@
   void UpdateFrom(const core::io_data *data){};
 
-  core::cvmatrix *output;
+  core::Matrix *output;
   bool is_connected;
   unsigned int nb_channels;
Index: /trunk/lib/FlairSensorActuator/src/SimuBldc.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuBldc.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/SimuBldc.cpp	(revision 214)
@@ -21,6 +21,7 @@
 #include <GroupBox.h>
 #include <SharedMem.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <sstream>
+#include <string.h>
 
 using std::string;
@@ -36,9 +37,14 @@
     : Bldc(parent, layout, name, motors_count) {
   shmem =
-      new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float));
+      new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)+sizeof(Time));
 
   GroupBox *groupbox = new GroupBox(layout->NewRow(), "simubldc");
   k = new DoubleSpinBox(groupbox->NewRow(), "k driver:", 0, 10000, 1);
   
+  buf=(char*)malloc(motors_count * sizeof(float)+sizeof(Time));
+  if(buf==NULL) {
+    Err("error creating buffer\n");
+    return;
+  }
   SetIsReady(true);
 }
@@ -48,17 +54,26 @@
     : Bldc(parent, name, motors_count) {
   shmem =
-      new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float));
+      new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)+sizeof(Time));
+      
+  buf=(char*)malloc(motors_count * sizeof(float)+sizeof(Time));
+  if(buf==NULL) {
+    Err("error creating buffer\n");
+    return;
+  } 
+  
+  // reset values
+  float *values=(float*)buf;
+  for (int i = 0; i < motors_count; i++) values[i] = 0;
+  Time time=GetTime();
+  memcpy(buf+motors_count * sizeof(float),&time,sizeof(Time));
 
-  // reset values
-  float values[motors_count];
-  for (int i = 0; i < motors_count; i++)
-    values[i] = 0;
-
-  shmem->Write((char *)&values, motors_count * sizeof(float));
+  shmem->Write(buf, motors_count * sizeof(float)+sizeof(Time));
   
   SetIsReady(true);
 }
 
-SimuBldc::~SimuBldc() {}
+SimuBldc::~SimuBldc() {
+  if(buf!=NULL) free(buf);
+}
 
 string SimuBldc::ShMemName(uint32_t modelId,uint32_t deviceId) {
@@ -69,24 +84,27 @@
 
 void SimuBldc::SetMotors(float *value) {
-  float values[MotorsCount()];
+  float *values=(float*)buf;
+  for (int i = 0; i < MotorsCount(); i++) values[i] = k->Value() * value[i];
+  Time time=GetTime();
+  memcpy(buf+MotorsCount() * sizeof(float),&time,sizeof(Time));
 
-  for (int i = 0; i < MotorsCount(); i++)
-    values[i] = k->Value() * value[i];
-
-  shmem->Write((char *)&values, MotorsCount() * sizeof(float));
+  shmem->Write(buf, MotorsCount() * sizeof(float)+sizeof(Time));
 
   // on prend une fois pour toute le mutex et on fait des accès directs
   output->GetMutex();
-  for (int i = 0; i < MotorsCount(); i++)
+  for (int i = 0; i < MotorsCount(); i++) {
     output->SetValueNoMutex(i, 0, values[i]);
+  }
   output->ReleaseMutex();
 }
 
-void SimuBldc::GetSpeeds(float *value) const {
-  float values[MotorsCount()];
-  shmem->Read((char *)&values, MotorsCount() * sizeof(float));
+void SimuBldc::GetSpeeds(float *value,Time* time) const {
+  float *values=(float*)buf;
+  shmem->Read(buf, MotorsCount() * sizeof(float)+sizeof(Time));
+  memcpy(time,buf+MotorsCount() * sizeof(float),sizeof(Time));
 
-  for (int i = 0; i < MotorsCount(); i++)
+  for (int i = 0; i < MotorsCount(); i++) {
     value[i] = values[i];
+  }
 }
 
Index: /trunk/lib/FlairSensorActuator/src/SimuBldc.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuBldc.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/SimuBldc.h	(revision 214)
@@ -20,5 +20,5 @@
 class SharedMem;
 class IODevice;
-class cvmatrix;
+class Matrix;
 }
 namespace gui {
@@ -78,6 +78,7 @@
   *
   * \param value array to store motors speeds
+  * \param time time when shared memory was written
   */
-  void GetSpeeds(float *value) const;
+  void GetSpeeds(float *value,core::Time* time) const;
 
   /*!
@@ -113,4 +114,6 @@
   core::SharedMem *shmem;
   gui::DoubleSpinBox *k;
+  char *buf;
+
 };
 } // end namespace actuator
Index: /trunk/lib/FlairSensorActuator/src/SimuGps.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuGps.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/SimuGps.cpp	(revision 214)
@@ -25,5 +25,5 @@
 #include <GroupBox.h>
 #include <Euler.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <sstream>
 #include "geodesie.h"
@@ -80,5 +80,5 @@
 void SimuGps::UpdateFrom(const io_data *data) {
   if (data != NULL) {
-    cvmatrix *input = (cvmatrix *)data;
+    Matrix *input = (Matrix *)data;
     gps_states_t state;
 
@@ -109,4 +109,6 @@
   vtg.spk_k='K';
   vtg.spn_n='N';
+  gga.elv_units='M';
+  gga.diff_units='M';
 
   if (dataRate == NULL) {
@@ -152,13 +154,11 @@
     gga.satinuse=numberOfSatellites->Value();
 
-    nmea_gen_GPGGA(buf,sizeof(buf),&gga);
-    Printf("1\n");
-    parseFrame(buf,sizeof(buf));
-
+    int size=nmea_gen_GPGGA(buf,sizeof(buf),&gga);
+    parseFrame(buf,size);
+    
     vtg.dir=90-Euler::ToDegree(atan2f(state.vn,state.ve));
     vtg.spk=sqrtf(state.ve*state.ve+state.vn*state.vn)*3600./1000.;
-    nmea_gen_GPVTG(buf,sizeof(buf),&vtg);
-    Printf("2\n");
-    parseFrame(buf,sizeof(buf));
+    size=nmea_gen_GPVTG(buf,sizeof(buf),&vtg);
+    parseFrame(buf,size);
   }
 
Index: /trunk/lib/FlairSensorActuator/src/SimuImu.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuImu.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/SimuImu.cpp	(revision 214)
@@ -21,5 +21,5 @@
 #include <SpinBox.h>
 #include <GroupBox.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <SharedMem.h>
 #include <AhrsData.h>
@@ -70,5 +70,5 @@
 void SimuImu::UpdateFrom(const io_data *data) {
   if (data != NULL) {
-    cvmatrix *input = (cvmatrix *)data;
+    Matrix *input = (Matrix *)data;
     imu_states_t state;
 
Index: /trunk/lib/FlairSensorActuator/src/SimuLaser.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuLaser.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/SimuLaser.cpp	(revision 214)
@@ -20,5 +20,5 @@
 #include <SpinBox.h>
 #include <GroupBox.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <SharedMem.h>
 #include <sstream>
Index: /trunk/lib/FlairSensorActuator/src/SimuUs.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuUs.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/SimuUs.cpp	(revision 214)
@@ -20,5 +20,5 @@
 #include <SpinBox.h>
 #include <GroupBox.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <SharedMem.h>
 #include <sstream>
Index: /trunk/lib/FlairSensorActuator/src/Srf08.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/Srf08.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/Srf08.cpp	(revision 214)
@@ -21,5 +21,5 @@
 #include <GroupBox.h>
 #include <SpinBox.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <string.h>
 #include <errno.h>
Index: /trunk/lib/FlairSensorActuator/src/TargetController.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/TargetController.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/TargetController.cpp	(revision 214)
@@ -20,5 +20,5 @@
 #include <Tab.h>
 #include <FrameworkManager.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 
 #include <cstring>
@@ -122,7 +122,7 @@
   } else {
 
-    axis = new cvmatrix((IODevice *)this, axisNumber, 1, floatType);
+    axis = new Matrix((IODevice *)this, axisNumber, 1, floatType);
     button =
-        new cvmatrix((IODevice *)this, buttonNumber, 1, SignedIntegerType(8));
+        new Matrix((IODevice *)this, buttonNumber, 1, SignedIntegerType(8));
 
     while (!ToBeStopped()) {
Index: /trunk/lib/FlairSensorActuator/src/TargetController.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/TargetController.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/TargetController.h	(revision 214)
@@ -27,5 +27,5 @@
 namespace core {
 class FrameworkManager;
-class cvmatrix;
+class Matrix;
 class Socket;
 class io_data;
@@ -82,6 +82,6 @@
   // axis stuff
   unsigned int axisNumber;
-  core::cvmatrix *axis = NULL;
-  virtual void AcquireAxisData(core::cvmatrix &axis) = 0; // responsible for
+  core::Matrix *axis = NULL;
+  virtual void AcquireAxisData(core::Matrix &axis) = 0; // responsible for
                                                           // getting the axis
                                                           // data from the
@@ -90,6 +90,6 @@
   // button stuff
   unsigned int buttonNumber;
-  core::cvmatrix *button = NULL;
-  virtual void AcquireButtonData(core::cvmatrix &button) = 0; // responsible for
+  core::Matrix *button = NULL;
+  virtual void AcquireButtonData(core::Matrix &button) = 0; // responsible for
                                                               // getting the
                                                               // button data
Index: /trunk/lib/FlairSensorActuator/src/TargetEthController.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/TargetEthController.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/TargetEthController.cpp	(revision 214)
@@ -24,5 +24,5 @@
 #include <cstring>
 #include <string>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <stdexcept>
 
@@ -150,5 +150,5 @@
 }
 
-void TargetEthController::AcquireAxisData(core::cvmatrix &axis) {
+void TargetEthController::AcquireAxisData(core::Matrix &axis) {
   axis.GetMutex();
   // char testFrameBuffer[3]={(char)0x09,(char)0x59,(char)0xB8};
@@ -166,5 +166,5 @@
 }
 
-void TargetEthController::AcquireButtonData(core::cvmatrix &button) {
+void TargetEthController::AcquireButtonData(core::Matrix &button) {
   uint8_t buttonValue;
   int currentButton = 0;
Index: /trunk/lib/FlairSensorActuator/src/TargetEthController.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/TargetEthController.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/TargetEthController.h	(revision 214)
@@ -27,5 +27,5 @@
 namespace core {
 class FrameworkManager;
-class cvmatrix;
+class Matrix;
 class TcpSocket;
 class UdpSocket;
@@ -62,7 +62,7 @@
 
   bool IsDataFrameReady();
-  void AcquireAxisData(core::cvmatrix &axis);     // responsible for getting the
+  void AcquireAxisData(core::Matrix &axis);     // responsible for getting the
                                                   // axis data from the hardware
-  void AcquireButtonData(core::cvmatrix &button); // responsible for getting the
+  void AcquireButtonData(core::Matrix &button); // responsible for getting the
                                                   // button data from the
                                                   // hardware
Index: /trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp	(revision 214)
@@ -23,5 +23,5 @@
 #include <Layout.h>
 #include <DataPlot1D.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 
 using std::string;
@@ -38,5 +38,5 @@
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
   desc->SetElementName(0, 0, name);
-  output = new cvmatrix(this, desc, floatType);
+  output = new Matrix(this, desc, floatType);
   delete desc;
   AddDataToLog(output);
Index: /trunk/lib/FlairSensorActuator/src/UsRangeFinder.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/UsRangeFinder.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/UsRangeFinder.h	(revision 214)
@@ -17,14 +17,14 @@
 
 namespace flair {
-namespace core {
-class cvmatrix;
-}
-namespace gui {
-class Tab;
-class TabWidget;
-class GroupBox;
-class Layout;
-class DataPlot1D;
-}
+  namespace core {
+    class Matrix;
+  }
+  namespace gui {
+    class Tab;
+    class TabWidget;
+    class GroupBox;
+    class Layout;
+    class DataPlot1D;
+  }
 }
 
@@ -119,5 +119,5 @@
   * \return output matrix
   */
-  core::cvmatrix *output;
+  core::Matrix *output;
 
   /*!
Index: /trunk/lib/FlairSensorActuator/src/VrpnObject.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/VrpnObject.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/VrpnObject.cpp	(revision 214)
@@ -20,6 +20,5 @@
 #include "VrpnClient.h"
 #include <string.h>
-
-#include <cvmatrix.h>
+#include <Matrix.h>
 
 using std::string;
@@ -53,7 +52,7 @@
 }
 
-cvmatrix *VrpnObject::Output(void) const { return pimpl_->output; }
+Matrix *VrpnObject::Output(void) const { return pimpl_->output; }
 
-cvmatrix *VrpnObject::State(void) const { return pimpl_->state; }
+Matrix *VrpnObject::State(void) const { return pimpl_->state; }
 
 Tab *VrpnObject::GetPlotTab(void) const { return pimpl_->plot_tab; }
Index: /trunk/lib/FlairSensorActuator/src/VrpnObject.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/VrpnObject.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/VrpnObject.h	(revision 214)
@@ -21,5 +21,5 @@
 namespace flair {
 	namespace core {
-		class cvmatrix;
+		class Matrix;
 		class Quaternion;
 	}
@@ -126,5 +126,5 @@
   * \return Output matrix
   */
-  core::cvmatrix *Output(void) const;
+  core::Matrix *Output(void) const;
 
   /*!
@@ -139,5 +139,5 @@
   * \return State matrix
   */
-  core::cvmatrix *State(void) const;
+  core::Matrix *State(void) const;
 
   /*!
Index: /trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp	(revision 214)
@@ -25,5 +25,5 @@
 #include <unistd.h>
 #include <vrpn_Connection.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Tab.h>
 #include <TabWidget.h>
@@ -65,5 +65,5 @@
   desc->SetElementName(5, 0, "y");
   desc->SetElementName(6, 0, "z");
-  output = new cvmatrix(self, desc, floatType);
+  output = new Matrix(self, desc, floatType);
   delete desc;
 
@@ -72,5 +72,5 @@
   desc->SetElementName(1, 0, "pitch");
   desc->SetElementName(2, 0, "yaw");
-  state = new cvmatrix(self, desc, floatType);
+  state = new Matrix(self, desc, floatType);
   delete desc;
 
Index: /trunk/lib/FlairSensorActuator/src/XBldc_impl.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/XBldc_impl.cpp	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/XBldc_impl.cpp	(revision 214)
@@ -19,5 +19,5 @@
 #include "XBldc.h"
 #include <I2cPort.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <string.h>
 
Index: /trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h	(revision 213)
+++ /trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h	(revision 214)
@@ -28,5 +28,5 @@
 namespace flair {
 	namespace core {
-		class cvmatrix;
+		class Matrix;
 	}
 	namespace gui {
@@ -58,5 +58,5 @@
   flair::gui::DataPlot1D *y_plot;
   flair::gui::DataPlot1D *z_plot;
-  flair::core::cvmatrix *output, *state;
+  flair::core::Matrix *output, *state;
 
   static void VRPN_CALLBACK handle_pos(void *userdata, const vrpn_TRACKERCB t);
Index: /trunk/lib/FlairSimulator/src/Model_impl.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/Model_impl.cpp	(revision 213)
+++ /trunk/lib/FlairSimulator/src/Model_impl.cpp	(revision 214)
@@ -25,5 +25,5 @@
 #include "SpinBox.h"
 #include "CheckBox.h"
-#include "cvmatrix.h"
+#include "Matrix.h"
 #include "Euler.h"
 #include <math.h>
@@ -134,5 +134,5 @@
   desc->SetElementName(17, 0, "my");
   desc->SetElementName(18, 0, "mz");
-  output = new cvmatrix(this, desc, floatType, "state");
+  output = new Matrix(this, desc, floatType, "state");
   delete desc;
 
Index: /trunk/lib/FlairSimulator/src/SimuLaserGL.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/SimuLaserGL.cpp	(revision 213)
+++ /trunk/lib/FlairSimulator/src/SimuLaserGL.cpp	(revision 214)
@@ -20,5 +20,5 @@
 #include "Model.h"
 #include "Gui.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <SharedMem.h>
 #include <TabWidget.h>
Index: /trunk/lib/FlairSimulator/src/SimuUsGL.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/SimuUsGL.cpp	(revision 213)
+++ /trunk/lib/FlairSimulator/src/SimuUsGL.cpp	(revision 214)
@@ -17,5 +17,5 @@
 #include "SimuUsGL.h"
 #include "Model.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <SharedMem.h>
 #include <TabWidget.h>
@@ -54,5 +54,5 @@
 #endif
     // todo: utiliser le placement de l'us dans le drone et sa portée
-    cvmatrix *input = (cvmatrix *)data;
+    Matrix *input = (Matrix *)data;
     value = input->Value(9, 0);
     shmem->Write((char *)&value, sizeof(float));
Index: /trunk/lib/FlairSimulator/src/X4.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/X4.cpp	(revision 213)
+++ /trunk/lib/FlairSimulator/src/X4.cpp	(revision 214)
@@ -20,4 +20,5 @@
 #include <Tab.h>
 #include <DoubleSpinBox.h>
+#include <SpinBox.h>
 #include <GroupBox.h>
 #include <math.h>
@@ -73,4 +74,6 @@
   j_yaw = new DoubleSpinBox(setup_tab->LastRowLastCol(), "j_yaw:", 0, 1, 0.001,
                             5); // moment d'inertie d'un axe (N.m.s²/rad)
+                            
+  motorTimeout = new SpinBox(setup_tab->NewRow(), "motor timeout:","ms", 0, 1000, 100,100);
 
   motors = new SimuBldc(this, name, 4, modelId,0);
@@ -199,11 +202,22 @@
   float fl_speed, fr_speed, rl_speed, rr_speed;
   float u_roll, u_pitch, u_yaw, u_thrust;
+  Time motorTime;
 #ifdef GL
   motor_speed_mutex->GetMutex();
 #endif // GL
-  motors->GetSpeeds(motor_speed);
+  motors->GetSpeeds(motor_speed,&motorTime);
+  if((GetTime()-motorTime)/1000000>motorTimeout->Value()) {
+    for(int i=0;i<4;i++) {
+      if(motor_speed[i]!=0) {
+         //Printf("timout\n");
+        for(int i=0;i<4;i++) motor_speed[i]=0;
+        break;
+      }
+    }
+  }
 #ifdef GL
   motor_speed_mutex->ReleaseMutex();
 #endif // GL
+  
   fl_speed = motor_speed[0];
   fr_speed = motor_speed[1];
@@ -212,9 +226,9 @@
 
   /*
-      ** ===================================================================
-      **    u roll: roll torque
-      **
-      ** ===================================================================
-      */
+  ** ===================================================================
+  **    u roll: roll torque
+  **
+  ** ===================================================================
+  */
   u_roll = arm_length->Value() * k_mot->Value() *
            (fl_speed * fl_speed + rl_speed * rl_speed - fr_speed * fr_speed -
Index: /trunk/lib/FlairSimulator/src/X4.h
===================================================================
--- /trunk/lib/FlairSimulator/src/X4.h	(revision 213)
+++ /trunk/lib/FlairSimulator/src/X4.h	(revision 214)
@@ -26,4 +26,5 @@
 namespace gui {
 class DoubleSpinBox;
+class SpinBox;
 }
 namespace actuator {
@@ -63,4 +64,5 @@
   gui::DoubleSpinBox *f_air_vert, *f_air_lat;
   gui::DoubleSpinBox *j_roll, *j_pitch, *j_yaw;
+  gui::SpinBox *motorTimeout;
 };
 } // end namespace simulator
Index: /trunk/lib/FlairSimulator/src/X8.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/X8.cpp	(revision 213)
+++ /trunk/lib/FlairSimulator/src/X8.cpp	(revision 214)
@@ -20,4 +20,5 @@
 #include <Tab.h>
 #include <DoubleSpinBox.h>
+#include <SpinBox.h>
 #include <GroupBox.h>
 #include <math.h>
@@ -81,4 +82,6 @@
       setup_tab->LastRowLastCol(), "S:", 1, 2,
       0.1); // coefficient de forme des helices 1<S=1+Ss/Sprop<2 (sans unite)
+      
+  motorTimeout = new SpinBox(setup_tab->NewRow(), "motor timeout:","ms", 0, 1000, 100,100);
 
   motors = new SimuBldc(this, name, 8, modelId,0);
@@ -231,8 +234,18 @@
   float u_roll, u_pitch, u_yaw, u_thrust;
   float omega;
+  Time motorTime;
 #ifdef GL
   motor_speed_mutex->GetMutex();
 #endif // GL
-  motors->GetSpeeds(motor_speed);
+  motors->GetSpeeds(motor_speed,&motorTime);
+  if((GetTime()-motorTime)/1000000>motorTimeout->Value()) {
+    for(int i=0;i<8;i++) {
+      if(motor_speed[i]!=0) {
+         //Printf("timout\n");
+        for(int i=0;i<8;i++) motor_speed[i]=0;
+        break;
+      }
+    }
+  }
 #ifdef GL
   motor_speed_mutex->ReleaseMutex();
Index: /trunk/lib/FlairSimulator/src/X8.h
===================================================================
--- /trunk/lib/FlairSimulator/src/X8.h	(revision 213)
+++ /trunk/lib/FlairSimulator/src/X8.h	(revision 214)
@@ -26,4 +26,5 @@
 namespace gui {
 class DoubleSpinBox;
+class SpinBox;
 }
 namespace actuator {
@@ -65,4 +66,5 @@
   gui::DoubleSpinBox *j_roll, *j_pitch, *j_yaw;
   gui::DoubleSpinBox *j_r, *sigma, *S;
+  gui::SpinBox *motorTimeout;
 };
 } // end namespace simulator
Index: /trunk/lib/FlairSimulator/src/unexported/Model_impl.h
===================================================================
--- /trunk/lib/FlairSimulator/src/unexported/Model_impl.h	(revision 213)
+++ /trunk/lib/FlairSimulator/src/unexported/Model_impl.h	(revision 214)
@@ -25,5 +25,5 @@
 namespace flair {
 namespace core {
-class cvmatrix;
+class Matrix;
 class Mutex;
 class ConditionVariable;
@@ -101,5 +101,5 @@
   flair::gui::CheckBox *enable_opti;
   flair::simulator::Model *self;
-  flair::core::cvmatrix *output;
+  flair::core::Matrix *output;
   flair::core::Mutex *states_mutex;
 
Index: /trunk/lib/FlairVisionFilter/src/HoughLines.cpp
===================================================================
--- /trunk/lib/FlairVisionFilter/src/HoughLines.cpp	(revision 213)
+++ /trunk/lib/FlairVisionFilter/src/HoughLines.cpp	(revision 214)
@@ -14,5 +14,5 @@
 #include "HoughLines.h"
 #include <cvimage.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Layout.h>
 #include <GroupBox.h>
@@ -49,5 +49,5 @@
     desc->SetElementName(2,0,"orientation deg");
     desc->SetElementName(3,0,"line_detected");
-    output=new cvmatrix(this,desc,floatType,name);
+    output=new Matrix(this,desc,floatType,name);
     delete desc;
 
@@ -90,5 +90,5 @@
 }
 
-cvmatrix *HoughLines::Output(void) const {
+Matrix *HoughLines::Output(void) const {
     return output;
 }
Index: /trunk/lib/FlairVisionFilter/src/HoughLines.h
===================================================================
--- /trunk/lib/FlairVisionFilter/src/HoughLines.h	(revision 213)
+++ /trunk/lib/FlairVisionFilter/src/HoughLines.h	(revision 214)
@@ -17,5 +17,5 @@
     namespace core {
         class cvimage;
-        class cvmatrix;
+        class Matrix;
     }
     namespace gui {
@@ -56,5 +56,5 @@
             float GetOrientation(void) const;
             float GetDistance(void) const;
-            core::cvmatrix *Output(void) const;
+            core::Matrix *Output(void) const;
 
         private:
@@ -69,5 +69,5 @@
             float distance,orientation;
             CvMat* linesStorage;
-            core::cvmatrix *output;
+            core::Matrix *output;
     };
 } // end namespace filter
Index: /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp
===================================================================
--- /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp	(revision 213)
+++ /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp	(revision 214)
@@ -14,5 +14,5 @@
 #include "OpticalFlowSpeed.h"
 #include "OpticalFlowData.h"
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Object.h>
 
@@ -30,5 +30,5 @@
   desc->SetElementName(0,0,"vx");
   desc->SetElementName(1,0,"vy");
-  output=new cvmatrix(this,desc,floatType,name);
+  output=new Matrix(this,desc,floatType,name);
   delete desc;
 
@@ -81,5 +81,5 @@
 }
 
-core::cvmatrix *OpticalFlowSpeed::Output() const
+core::Matrix *OpticalFlowSpeed::Output() const
 {
     return output;
Index: /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.h
===================================================================
--- /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.h	(revision 213)
+++ /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.h	(revision 214)
@@ -17,5 +17,5 @@
     namespace core
     {
-        class cvmatrix;
+        class Matrix;
     }
 }
@@ -71,5 +71,5 @@
             * Second line is speed along y axis. \n
             */
-            core::cvmatrix *Output() const;
+            core::Matrix *Output() const;
 
         private:
@@ -83,5 +83,5 @@
             void UpdateFrom(const core::io_data *data);
 
-            core::cvmatrix *output;
+            core::Matrix *output;
     };
 } // end namespace filter
Index: /trunk/tools/Controller/DualShock3/src/DualShock3.cpp
===================================================================
--- /trunk/tools/Controller/DualShock3/src/DualShock3.cpp	(revision 213)
+++ /trunk/tools/Controller/DualShock3/src/DualShock3.cpp	(revision 214)
@@ -18,5 +18,5 @@
 #include "DualShock3.h"
 #include <Controller.h>
-#include <cvmatrix.h>
+#include <Matrix.h>
 #include <Tab.h>
 #include <TabWidget.h>
@@ -96,5 +96,5 @@
     axisDescriptor->SetElementName(i, 0, GetAxisDescription(i));
   }
-  axis = new cvmatrix((IODevice *)this, axisDescriptor, Int16Type);
+  axis = new Matrix((IODevice *)this, axisDescriptor, Int16Type);
   delete axisDescriptor;
   AddDataToLog(axis);
@@ -107,5 +107,5 @@
     buttonDescriptor->SetElementName(i, 0, GetButtonDescription(i));
   }
-  button = new cvmatrix((IODevice *)this, buttonDescriptor, Int8Type);
+  button = new Matrix((IODevice *)this, buttonDescriptor, Int8Type);
   AddDataToLog(button);
 
Index: /trunk/tools/FlairGCS/src/file_ui.cpp
===================================================================
--- /trunk/tools/FlairGCS/src/file_ui.cpp	(revision 213)
+++ /trunk/tools/FlairGCS/src/file_ui.cpp	(revision 214)
@@ -193,4 +193,12 @@
         uint8_t *value = (uint8_t *)(data + offset);
         offset += sizeof(uint8_t);
+        out << "," << *value;
+      } else if (data_type.at(i) == "int16_t)") {
+        int16_t *value = (int16_t *)(data + offset);
+        offset += sizeof(int16_t);
+        out << "," << *value;
+      } else if (data_type.at(i) == "uint16_t)") {
+        uint16_t *value = (uint16_t *)(data + offset);
+        offset += sizeof(uint16_t);
         out << "," << *value;
       } else {
