Index: /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp
===================================================================
--- /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp	(revision 164)
+++ /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp	(revision 165)
@@ -15,4 +15,5 @@
 #include <Uav.h>
 #include <Camera.h>
+#include <V4LCamera.h>
 #include <CvtColor.h>
 #include <OpticalFlow.h>
@@ -123,4 +124,6 @@
   uav->GetAhrs()->AddPlot(customReferenceOrientation,DataPlot::Yellow);
   AddDataToControlLawLog(customReferenceOrientation);
+  
+  flagCameraLost=false;
 }
 
@@ -196,4 +199,15 @@
 }
 
+void DemoOpticalFlow::ExtraSecurityCheck(void) {
+  if(GetUav()->GetType()=="hds_x8") {
+    if(((V4LCamera*)GetUav()->GetVerticalCamera())->HasProblems() && !flagCameraLost) {
+      flagCameraLost = true;
+      Thread::Err("Camera lost\n");
+      SafeStop();
+      Land();
+    }
+  }
+}
+
 DemoOpticalFlow::~DemoOpticalFlow() {
 }
Index: /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.h
===================================================================
--- /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.h	(revision 164)
+++ /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.h	(revision 165)
@@ -50,4 +50,5 @@
         void ExtraCheckJoystick(void);
     void ExtraCheckPushButton(void);
+    void ExtraSecurityCheck(void);
         const flair::core::AhrsData *GetReferenceOrientation(void);
 
@@ -69,4 +70,5 @@
         flair::filter::LowPassFilter* opticalFlowSpeed;
         flair::filter::LowPassFilter* opticalFlowAcceleration;
+        bool flagCameraLost;
 };
 
Index: /trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp	(revision 164)
+++ /trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp	(revision 165)
@@ -79,5 +79,5 @@
       for(uint32_t j=0;j<nbCol;j++) {
         f[i*nbCol+j]->setup(1. / T->Value(), cutoff->Value());
-        settingsChanged(f[i*nbCol+j],input->Value(i, j));
+        //settingsChanged(f[i*nbCol+j],input->Value(i, j));
       }
     }
@@ -103,5 +103,5 @@
       for(uint32_t j=0;j<nbCol;j++) {
         f[i*nbCol+j]->setup(1. / delta_t, cutoff->Value());
-        settingsChanged(f[i*nbCol+j],input->ValueNoMutex(i, j));
+        //settingsChanged(f[i*nbCol+j],input->ValueNoMutex(i, j));
       }
     }
Index: /trunk/lib/FlairMeta/src/HdsX8.h
===================================================================
--- /trunk/lib/FlairMeta/src/HdsX8.h	(revision 164)
+++ /trunk/lib/FlairMeta/src/HdsX8.h	(revision 165)
@@ -30,4 +30,5 @@
 	std::string GetDefaultVrpnAddress(void) const{return "192.168.147.197:3883";}
   bool isReadyToFly(void) const;
+  virtual std::string GetType(void) const{return "hds_x8";}
 
 private:
Index: /trunk/lib/FlairMeta/src/SimuX4.h
===================================================================
--- /trunk/lib/FlairMeta/src/SimuX4.h	(revision 164)
+++ /trunk/lib/FlairMeta/src/SimuX4.h	(revision 165)
@@ -31,4 +31,5 @@
     ~SimuX4();
     void StartSensors(void);
+    virtual std::string GetType(void) const{return "x4_simu";}
 
   private:
Index: /trunk/lib/FlairMeta/src/SimuX8.h
===================================================================
--- /trunk/lib/FlairMeta/src/SimuX8.h	(revision 164)
+++ /trunk/lib/FlairMeta/src/SimuX8.h	(revision 165)
@@ -30,4 +30,5 @@
     ~SimuX8();
     void StartSensors(void);
+    virtual std::string GetType(void) const{return "simu_x8";}
   
   private:
Index: /trunk/lib/FlairMeta/src/Uav.h
===================================================================
--- /trunk/lib/FlairMeta/src/Uav.h	(revision 164)
+++ /trunk/lib/FlairMeta/src/Uav.h	(revision 165)
@@ -64,4 +64,5 @@
 	virtual std::string GetDefaultVrpnAddress(void) const{return "127.0.0.1:3883";}
   virtual bool isReadyToFly(void) const { return true;}
+  virtual std::string GetType(void) const=0;
 
 protected:
Index: /trunk/lib/FlairMeta/src/UavStateMachine.h
===================================================================
--- /trunk/lib/FlairMeta/src/UavStateMachine.h	(revision 164)
+++ /trunk/lib/FlairMeta/src/UavStateMachine.h	(revision 165)
@@ -227,4 +227,5 @@
 
   const sensor::TargetController *GetJoystick(void) const;
+  MetaDualShock3 *joy;
 
   gui::Tab *setupLawTab, *graphLawTab;
@@ -297,6 +298,4 @@
   filter::Pid *uYaw;
   filter::PidThrust *uZ;
-
-  MetaDualShock3 *joy;
   filter::TrajectoryGenerator1D *altitudeTrajectory;
 };
Index: /trunk/lib/FlairMeta/src/XAir.h
===================================================================
--- /trunk/lib/FlairMeta/src/XAir.h	(revision 164)
+++ /trunk/lib/FlairMeta/src/XAir.h	(revision 165)
@@ -30,4 +30,5 @@
 	std::string GetDefaultVrpnAddress(void) const{return "192.168.147.197:3883";}
   bool isReadyToFly(void) const;
+  virtual std::string GetType(void) const{return "xair";}
 
 private:
Index: /trunk/lib/FlairSensorActuator/src/V4LCamera.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/V4LCamera.cpp	(revision 164)
+++ /trunk/lib/FlairSensorActuator/src/V4LCamera.cpp	(revision 165)
@@ -75,4 +75,6 @@
   awb = new CheckBox(GetGroupBox()->LastRowLastCol(), "awb:");
   fps = new Label(GetGroupBox()->NewRow(), "fps");
+  
+  hasProblems=false;
 }
 
@@ -95,4 +97,10 @@
 
   while (!ToBeStopped()) {
+    //check for ps3eye deconnection in hds uav
+    if(cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH)<0) {
+      Thread::Warn("camera disconnected\n");
+      hasProblems=true;
+    }
+    
     // fps counter
     fpsCounter++;
@@ -100,5 +108,5 @@
       fpsNow = GetTime();
       fps->SetText("fps: %.1f",
-                   fpsCounter / ((float)(fpsNow - fpsPrev) / 1000000000.));
+       fpsCounter / ((float)(fpsNow - fpsPrev) / 1000000000.));
       fpsCounter = 0;
       fpsPrev = fpsNow;
@@ -147,4 +155,10 @@
     }
     new_time = GetTime();
+    
+    //check for ps3eye deconnection in hds uav
+    if(new_time-cam_time>100*1000*1000) {
+      Thread::Warn("delta trop grand\n");
+      hasProblems=true;
+    }
 
     output->GetMutex();
@@ -161,4 +175,8 @@
 }
 
+bool V4LCamera::HasProblems(void) {
+  return hasProblems;
+}
+
 void V4LCamera::SetAutoGain(bool value) {
   cvSetCaptureProperty(capture, CV_CAP_PROP_AUTOGAIN, value);
Index: /trunk/lib/FlairSensorActuator/src/V4LCamera.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/V4LCamera.h	(revision 164)
+++ /trunk/lib/FlairSensorActuator/src/V4LCamera.h	(revision 165)
@@ -59,4 +59,8 @@
   */
   ~V4LCamera();
+  
+    //hack for ps3eye in hds uav
+  //TODO: put this in ps3eye class
+  bool HasProblems(void);
 
 protected:
@@ -116,5 +120,5 @@
   */
   virtual void SetContrast(float value);
-
+  
 private:
   /*!
@@ -138,8 +142,8 @@
 
   gui::Tab *sensor_tab;
-  gui::DoubleSpinBox *bright, *exposure, *gain, *contrast, *hue, *sharpness,
-      *sat;
+  gui::DoubleSpinBox *bright, *exposure, *gain, *contrast, *hue, *sharpness,*sat;
   gui::CheckBox *autogain, *awb, *autoexposure;
   gui::Label *fps;
+  bool hasProblems;
 };
 } // end namespace sensor
