Index: /trunk/ReleaseNotes
===================================================================
--- /trunk/ReleaseNotes	(revision 121)
+++ /trunk/ReleaseNotes	(revision 122)
@@ -3,4 +3,9 @@
 - added fixed cameras in simulator, see $FLAIR_ROOT/flair-bin/models/indoor_fligh
 t_arena.xml for an exemple
+- added lib/FlairVisionFilter: some basic vision algorithms using opencv. Note that this lib can be remplaced by HdsVisionFilter if you have access to it, in order to use the DSP in HDS UAV's.
+See also https://devel.hds.utc.fr/software/flair/wiki/hds_users
+- added demos/OpticalFlow: stabilization using optical flow (vertical camera)
+- Uav class is now a singleton
+- VrpnClient class is now a singleton
 
 -----------------------------------------------------------
Index: /trunk/demos/CircleFollower/uav/src/CircleFollower.cpp
===================================================================
--- /trunk/demos/CircleFollower/uav/src/CircleFollower.cpp	(revision 121)
+++ /trunk/demos/CircleFollower/uav/src/CircleFollower.cpp	(revision 122)
@@ -39,24 +39,29 @@
 using namespace flair::meta;
 
-CircleFollower::CircleFollower(Uav* uav,TargetController *controller): UavStateMachine(uav,controller), behaviourMode(BehaviourMode_t::Default), vrpnLost(false) {
-    uav->SetupVRPNAutoIP(uav->ObjectName());
-
+CircleFollower::CircleFollower(TargetController *controller): UavStateMachine(controller), behaviourMode(BehaviourMode_t::Default), vrpnLost(false) {
+    Uav* uav=GetUav();
+		
+		VrpnClient* vrpnclient=new VrpnClient("vrpn", uav->GetDefaultVrpnAddress(),10000, 80);
+		uavVrpn = new MetaVrpnObject(uav->ObjectName());
+		getFrameworkManager()->AddDeviceToLog(uavVrpn);
+		uav->GetAhrs()->YawPlot()->AddCurve(uavVrpn->State()->Element(2),DataPlot::Green);
+																 
     startCircle=new PushButton(GetButtonsLayout()->NewRow(),"start_circle");
     stopCircle=new PushButton(GetButtonsLayout()->LastRowLastCol(),"stop_circle");
 
-    if(uav->GetVrpnClient()->UseXbee()==true) {
-        targetVrpn=new MetaVrpnObject(uav->GetVrpnClient(),"target",1);
+    if(vrpnclient->UseXbee()==true) {
+        targetVrpn=new MetaVrpnObject("target",1);
     } else {
-        targetVrpn=new MetaVrpnObject(uav->GetVrpnClient(),"target");
+        targetVrpn=new MetaVrpnObject("target");
     }
 
     getFrameworkManager()->AddDeviceToLog(targetVrpn);
 
-    circle=new TrajectoryGenerator2DCircle(uav->GetVrpnClient()->GetLayout()->NewRow(),"circle");
-    uav->GetVrpnObject()->xPlot()->AddCurve(circle->Matrix()->Element(0,0),DataPlot::Blue);
-    uav->GetVrpnObject()->yPlot()->AddCurve(circle->Matrix()->Element(0,1),DataPlot::Blue);
-    uav->GetVrpnObject()->VxPlot()->AddCurve(circle->Matrix()->Element(1,0),DataPlot::Blue);
-    uav->GetVrpnObject()->VyPlot()->AddCurve(circle->Matrix()->Element(1,1),DataPlot::Blue);
-    uav->GetVrpnObject()->XyPlot()->AddCurve(circle->Matrix()->Element(0,1),circle->Matrix()->Element(0,0),DataPlot::Blue,"circle");
+    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");
 
     uX=new Pid(setupLawTab->At(1,0),"u_x");
@@ -79,5 +84,5 @@
     //get yaw from vrpn
     Euler vrpnEuler;
-    GetUav()->GetVrpnObject()->GetEuler(vrpnEuler);
+    uavVrpn->GetEuler(vrpnEuler);
 
     //get roll, pitch and w from imu
@@ -98,6 +103,6 @@
     Vector3D uav_pos,uav_vel;
 
-    GetUav()->GetVrpnObject()->GetPosition(uav_pos);
-    GetUav()->GetVrpnObject()->GetSpeed(uav_vel);
+    uavVrpn->GetPosition(uav_pos);
+    uavVrpn->GetSpeed(uav_vel);
     //z and dz must be in uav's frame
     z=-uav_pos.z;
@@ -131,6 +136,6 @@
     Vector2D uav_2Dpos,uav_2Dvel; // in VRPN coordinate system
 
-    GetUav()->GetVrpnObject()->GetPosition(uav_pos);
-    GetUav()->GetVrpnObject()->GetSpeed(uav_vel);
+    uavVrpn->GetPosition(uav_pos);
+    uavVrpn->GetSpeed(uav_vel);
 
     uav_pos.To2Dxy(uav_2Dpos);
@@ -195,5 +200,5 @@
             Land();
         }
-        if (!GetUav()->GetVrpnObject()->IsTracked(500)) {
+        if (!uavVrpn->IsTracked(500)) {
             Thread::Err("VRPN, uav lost\n");
             vrpnLost=true;
@@ -239,5 +244,5 @@
     circle->SetCenter(target_2Dpos);
 
-    GetUav()->GetVrpnObject()->GetPosition(uav_pos);
+    uavVrpn->GetPosition(uav_pos);
     uav_pos.To2Dxy(uav_2Dpos);
     circle->StartTraj(uav_2Dpos);
@@ -258,8 +263,8 @@
     Vector3D vrpn_pos;
 
-    GetUav()->GetVrpnObject()->GetEuler(vrpn_euler);
+    uavVrpn->GetEuler(vrpn_euler);
     yawHold=vrpn_euler.yaw;
 
-    GetUav()->GetVrpnObject()->GetPosition(vrpn_pos);
+    uavVrpn->GetPosition(vrpn_pos);
     vrpn_pos.To2Dxy(posHold);
 
Index: /trunk/demos/CircleFollower/uav/src/CircleFollower.h
===================================================================
--- /trunk/demos/CircleFollower/uav/src/CircleFollower.h	(revision 121)
+++ /trunk/demos/CircleFollower/uav/src/CircleFollower.h	(revision 122)
@@ -34,5 +34,5 @@
 class CircleFollower : public flair::meta::UavStateMachine {
     public:
-        CircleFollower(flair::meta::Uav* uav,flair::sensor::TargetController *controller);
+        CircleFollower(flair::sensor::TargetController *controller);
         ~CircleFollower();
 
@@ -65,5 +65,5 @@
 
         flair::gui::PushButton *startCircle,*stopCircle;
-        flair::meta::MetaVrpnObject *targetVrpn;
+        flair::meta::MetaVrpnObject *targetVrpn,*uavVrpn;
         flair::filter::TrajectoryGenerator2DCircle *circle;
         flair::core::AhrsData *customReferenceOrientation,*customOrientation;
Index: /trunk/demos/CircleFollower/uav/src/main.cpp
===================================================================
--- /trunk/demos/CircleFollower/uav/src/main.cpp	(revision 121)
+++ /trunk/demos/CircleFollower/uav/src/main.cpp	(revision 122)
@@ -45,7 +45,7 @@
     manager->SetupLogger(log_path);
 
-    Uav* drone=CreateUav(manager,name,uav_type);
+    Uav* drone=CreateUav(name,uav_type);
     TargetEthController *controller=new TargetEthController(manager,"Dualshock3",ds3port);
-    CircleFollower* demo=new CircleFollower(drone,controller);
+    CircleFollower* demo=new CircleFollower(controller);
 
     demo->Start();
Index: /trunk/demos/Gps/uav/CMakeLists.txt
===================================================================
--- /trunk/demos/Gps/uav/CMakeLists.txt	(revision 121)
+++ /trunk/demos/Gps/uav/CMakeLists.txt	(revision 122)
@@ -6,5 +6,4 @@
 SET(FLAIR_USE_SENSOR_ACTUATOR TRUE)
 SET(FLAIR_USE_META TRUE)
-SET(FLAIR_USE_VRPN TRUE)
 SET(FLAIR_USE_GPS TRUE)
 
Index: /trunk/demos/Gps/uav/src/DemoGps.cpp
===================================================================
--- /trunk/demos/Gps/uav/src/DemoGps.cpp	(revision 121)
+++ /trunk/demos/Gps/uav/src/DemoGps.cpp	(revision 122)
@@ -39,6 +39,6 @@
 using namespace flair::meta;
 
-DemoGps::DemoGps(Uav* uav,TargetController *controller): UavStateMachine(uav,controller), behaviourMode(BehaviourMode_t::Default) {
-
+DemoGps::DemoGps(TargetController *controller): UavStateMachine(controller), behaviourMode(BehaviourMode_t::Default) {
+		Uav* uav=GetUav();
     startCircle=new PushButton(GetButtonsLayout()->NewRow(),"start_circle");
     stopCircle=new PushButton(GetButtonsLayout()->LastRowLastCol(),"stop_circle");
Index: /trunk/demos/Gps/uav/src/DemoGps.h
===================================================================
--- /trunk/demos/Gps/uav/src/DemoGps.h	(revision 121)
+++ /trunk/demos/Gps/uav/src/DemoGps.h	(revision 122)
@@ -33,5 +33,5 @@
 class DemoGps : public flair::meta::UavStateMachine {
     public:
-        DemoGps(flair::meta::Uav* uav,flair::sensor::TargetController *controller);
+        DemoGps(flair::sensor::TargetController *controller);
         ~DemoGps();
 
Index: /trunk/demos/Gps/uav/src/main.cpp
===================================================================
--- /trunk/demos/Gps/uav/src/main.cpp	(revision 121)
+++ /trunk/demos/Gps/uav/src/main.cpp	(revision 122)
@@ -45,7 +45,7 @@
     manager->SetupLogger(log_path);
 
-    Uav* drone=CreateUav(manager,name,uav_type);
+    Uav* drone=CreateUav(name,uav_type);
     TargetEthController *controller=new TargetEthController(manager,"Dualshock3",ds3port);
-    DemoGps* demo=new DemoGps(drone,controller);
+    DemoGps* demo=new DemoGps(controller);
 
     demo->Start();
Index: /trunk/demos/OpticalFlow/simulator/CMakeLists.txt
===================================================================
--- /trunk/demos/OpticalFlow/simulator/CMakeLists.txt	(revision 122)
+++ /trunk/demos/OpticalFlow/simulator/CMakeLists.txt	(revision 122)
@@ -0,0 +1,35 @@
+PROJECT(OpticalFlow_simulator)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_SIMULATOR TRUE)
+SET(FLAIR_USE_SIMULATOR_GL TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+	${CMAKE_SOURCE_DIR}/src/main.cpp
+)
+
+LINK_DIRECTORIES (
+	${FLAIR_LIBRARY_DIR}
+)
+
+INCLUDE_DIRECTORIES(
+	${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+	${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+	${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: /trunk/demos/OpticalFlow/simulator/build_x86_64/bin/setup_x4.xml
===================================================================
--- /trunk/demos/OpticalFlow/simulator/build_x86_64/bin/setup_x4.xml	(revision 122)
+++ /trunk/demos/OpticalFlow/simulator/build_x86_64/bin/setup_x4.xml	(revision 122)
@@ -0,0 +1,64 @@
+<?xml version="1.0"?>
+<!DOCTYPE remote_ui_xml>
+<root name="interface">
+  <TabWidget name="Main_TabWidget">
+ <Tab name="x4_0">
+  <TabWidget name="tabs">
+   <Tab name="sampling">
+    <DoubleSpinBox value="0.001" name="Tech (s):"/>
+   </Tab>
+   <Tab name="optitrack">
+    <CheckBox value="1" name="enabled"/>
+   </Tab>
+   <Tab name="init">
+    <DoubleSpinBox value="-1.5" name="x:"/>
+    <DoubleSpinBox value="0" name="y:"/>
+    <DoubleSpinBox value="-3.5" name="z:"/>
+    <SpinBox value="0" name="yaw (deg):"/>
+   <Vector3DSpinBox name="position" value_x="0.00" value_y="0.00" value_z="-1.00"/></Tab>
+   <Tab name="model">
+    <DoubleSpinBox value="1.2" name="mass (kg):"/>
+    <DoubleSpinBox value="0.2" name="arm length (m):"/>
+    <DoubleSpinBox value="0.001" name="k_mot:"/>
+    <DoubleSpinBox value="0.001" name="c_mot:"/>
+    <DoubleSpinBox value="0.01" name="f_air_vert:"/>
+    <DoubleSpinBox value="0.4" name="f_air_lat:"/>
+    <DoubleSpinBox value="0.006" name="j_roll:"/>
+    <DoubleSpinBox value="0.006" name="j_pitch:"/>
+    <DoubleSpinBox value="0.1" name="j_yaw:"/>
+   </Tab>
+   <Tab name="us">
+    <GroupBox name="position">
+     <DoubleSpinBox value="0" name="x:"/>
+     <DoubleSpinBox value="0" name="y:"/>
+     <DoubleSpinBox value="0.04" name="z:"/>
+    </GroupBox>
+    <GroupBox name="direction">
+     <DoubleSpinBox value="0" name="x:"/>
+     <DoubleSpinBox value="0" name="y:"/>
+     <DoubleSpinBox value="1" name="z:"/>
+    </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>
+   <Tab name="bottom camera">
+    <GroupBox name="position">
+     <DoubleSpinBox value="0" name="x:"/>
+     <DoubleSpinBox value="0" name="y:"/>
+     <DoubleSpinBox value="0" name="z:"/>
+    </GroupBox>
+    <GroupBox name="direction">
+     <DoubleSpinBox value="0" name="x:"/>
+     <DoubleSpinBox value="0" name="y:"/>
+     <DoubleSpinBox value="1" name="z:"/>
+    </GroupBox>
+    <GroupBox name="up">
+     <DoubleSpinBox value="1" name="x:"/>
+     <DoubleSpinBox value="0" name="y:"/>
+     <DoubleSpinBox value="0" name="z:"/>
+    </GroupBox>
+    <DoubleSpinBox value="70" name="fov:"/>
+   <Vector3DSpinBox name="position" value_x="0" value_y="0" value_z="0"/><Vector3DSpinBox name="direction" value_x="0.00" value_y="0.00" value_z="1.00"/><Vector3DSpinBox name="up" value_x="1.00" value_y="0.00" value_z="0.00"/></Tab>
+  </TabWidget>
+ </Tab>
+  </TabWidget>
+<TabWidget name="App_TabWidget"><Tab name="simulator"><PushButton name="save config on target" value="1"/></Tab></TabWidget><PushButton name="save config on target (simulator)" value="1"/></root>
Index: /trunk/demos/OpticalFlow/simulator/build_x86_64/bin/setup_x8.xml
===================================================================
--- /trunk/demos/OpticalFlow/simulator/build_x86_64/bin/setup_x8.xml	(revision 122)
+++ /trunk/demos/OpticalFlow/simulator/build_x86_64/bin/setup_x8.xml	(revision 122)
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!DOCTYPE remote_ui_xml>
+<root name="interface">
+  <TabWidget name="Main_TabWidget">
+ <Tab name="x8_0">
+  <TabWidget name="tabs">
+   <Tab name="sampling">
+    <DoubleSpinBox value="0.001" name="Tech (s):"/>
+   </Tab>
+   <Tab name="optitrack">
+    <CheckBox value="1" name="enabled"/>
+   </Tab>
+   <Tab name="init">
+    <DoubleSpinBox value="-1.5" name="x:"/>
+    <DoubleSpinBox value="0" name="y:"/>
+    <DoubleSpinBox value="-1.2" name="z:"/>
+    <SpinBox value="20" name="yaw (deg):"/>
+   <Vector3DSpinBox name="position" value_x="0.00" value_y="0.00" value_z="-1.00"/></Tab>
+   <Tab name="model">
+    <DoubleSpinBox value="1.6" name="mass (kg):"/>
+    <DoubleSpinBox value="0.2" name="arm length (m):"/>
+    <DoubleSpinBox value="0" name="position G (m):"/>
+    <DoubleSpinBox value="0.001" name="k_mot:"/>
+    <DoubleSpinBox value="0.001" name="c_mot:"/>
+    <DoubleSpinBox value="0.01" name="f_air_vert:"/>
+    <DoubleSpinBox value="0.4" name="f_air_lat:"/>
+    <DoubleSpinBox value="0.006" name="j_roll:"/>
+    <DoubleSpinBox value="0.006" name="j_pitch:"/>
+    <DoubleSpinBox value="0.1" name="j_yaw:"/>
+    <DoubleSpinBox value="0" name="j_r:"/>
+    <DoubleSpinBox value="0.72" name="sigma:"/>
+    <DoubleSpinBox value="1" name="S:"/>
+   </Tab>
+   <Tab name="us">
+    <GroupBox name="position">
+     <DoubleSpinBox value="0" name="x:"/>
+     <DoubleSpinBox value="0" name="y:"/>
+     <DoubleSpinBox value="0.04" name="z:"/>
+    </GroupBox>
+    <GroupBox name="direction">
+     <DoubleSpinBox value="0" name="x:"/>
+     <DoubleSpinBox value="0" name="y:"/>
+     <DoubleSpinBox value="1" name="z:"/>
+    </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>
+   <Tab name="bottom camera">
+    <GroupBox name="position">
+     <DoubleSpinBox value="0" name="x:"/>
+     <DoubleSpinBox value="0" name="y:"/>
+     <DoubleSpinBox value="0" name="z:"/>
+    </GroupBox>
+    <GroupBox name="direction">
+     <DoubleSpinBox value="0" name="x:"/>
+     <DoubleSpinBox value="0" name="y:"/>
+     <DoubleSpinBox value="1" name="z:"/>
+    </GroupBox>
+    <GroupBox name="up">
+     <DoubleSpinBox value="1" name="x:"/>
+     <DoubleSpinBox value="0" name="y:"/>
+     <DoubleSpinBox value="0" name="z:"/>
+    </GroupBox>
+    <DoubleSpinBox value="70" name="fov:"/>
+   <Vector3DSpinBox name="position" value_x="0" value_y="0" value_z="0"/><Vector3DSpinBox name="direction" value_x="0.00" value_y="0.00" value_z="1.00"/><Vector3DSpinBox name="up" value_x="1.00" value_y="0.00" value_z="0.00"/></Tab>
+  </TabWidget>
+ </Tab>
+</TabWidget>
+<TabWidget name="App_TabWidget"><Tab name="simulator"><PushButton name="save config on target" value="1"/></Tab></TabWidget><PushButton name="save config on target (simulator)" value="1"/></root>
Index: /trunk/demos/OpticalFlow/simulator/build_x86_64/bin/simulator_x4.sh
===================================================================
--- /trunk/demos/OpticalFlow/simulator/build_x86_64/bin/simulator_x4.sh	(revision 122)
+++ /trunk/demos/OpticalFlow/simulator/build_x86_64/bin/simulator_x4.sh	(revision 122)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+	EXEC=./OpticalFlow_simulator_rt
+else
+	EXEC=./OpticalFlow_simulator_nrt
+fi
+
+$EXEC -n x4_0 -t x4 -a 127.0.0.1 -p 9000 -x setup_x4.xml -o 10 -m $FLAIR_ROOT/flair-bin/models -s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml
Index: /trunk/demos/OpticalFlow/simulator/build_x86_64/bin/simulator_x8.sh
===================================================================
--- /trunk/demos/OpticalFlow/simulator/build_x86_64/bin/simulator_x8.sh	(revision 122)
+++ /trunk/demos/OpticalFlow/simulator/build_x86_64/bin/simulator_x8.sh	(revision 122)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+	EXEC=./OpticalFlow_simulator_rt
+else
+	EXEC=./OpticalFlow_simulator_nrt
+fi
+
+$EXEC -n x8_0 -t x8 -a 127.0.0.1 -p 9000 -x setup_x8.xml -o 10 -m $FLAIR_ROOT/flair-bin/models -s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml
Index: /trunk/demos/OpticalFlow/simulator/src/main.cpp
===================================================================
--- /trunk/demos/OpticalFlow/simulator/src/main.cpp	(revision 122)
+++ /trunk/demos/OpticalFlow/simulator/src/main.cpp	(revision 122)
@@ -0,0 +1,134 @@
+//  created:    2012/04/18
+//  filename:   main.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 6599
+//
+//  version:    $Id: $
+//
+//  purpose:    main simulateur
+//
+//
+/*********************************************************************/
+
+#include <tclap/CmdLine.h>
+#include <Simulator.h>
+#include <X4.h>
+#include <X8.h>
+#include <SimuImu.h>
+#ifdef GL
+#include <SimuCameraGL.h>
+#include <Parser.h>
+#include <SimuUsGL.h>
+#endif
+
+
+using namespace TCLAP;
+using namespace std;
+using namespace flair::simulator;
+using namespace flair::sensor;
+
+int port;
+int opti_time;
+string xml_file;
+string media_path;
+string scene_file;
+string type;
+string name;
+string address;
+
+void parseOptions(int argc, char** argv)
+{
+	try
+	{
+        CmdLine cmd("Command description message", ' ', "0.1");
+
+        ValueArg<string> nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
+        cmd.add( nameArg );
+
+        ValueArg<string> xmlArg("x","xml","xml file",true,"./reglages.xml","string");
+        cmd.add( xmlArg );
+
+        ValueArg<int> portArg("p","port","ground station port",true,9002,"int");
+        cmd.add( portArg );
+
+        ValueArg<string> addressArg("a","address","ground station address",true,"127.0.0.1","string");
+        cmd.add( addressArg );
+
+        ValueArg<string> typeArg("t","type","uav type, x4 or x8",true,"x4","string");
+        cmd.add( typeArg );
+
+
+        ValueArg<int> optiArg("o","opti","optitrack time ms",false,0,"int");
+        cmd.add( optiArg );
+
+#ifdef GL
+        ValueArg<string> mediaArg("m","media","path to media files",true,"./","string");
+        cmd.add( mediaArg );
+
+        ValueArg<string> sceneArg("s","scene","path to scene file",true,"./voliere.xml","string");
+        cmd.add( sceneArg );
+#endif
+
+        cmd.parse( argc, argv );
+
+        // Get the value parsed by each arg.
+        port=portArg.getValue();
+        xml_file = xmlArg.getValue();
+        opti_time = optiArg.getValue();
+        type = typeArg.getValue();
+        name=nameArg.getValue();
+        address=addressArg.getValue();
+#ifdef GL
+        media_path=mediaArg.getValue();
+        scene_file=sceneArg.getValue();
+#endif
+
+	} catch (ArgException &e)  // catch any exceptions
+	{ cerr << "error: " << e.error() << " for arg " << e.argId() << endl; }
+}
+
+
+int main(int argc, char* argv[])
+{
+    Simulator *simu;
+    Model *drone;
+    SimuImu* imu;
+#ifdef GL
+    SimuUsGL* us_gl;
+
+    SimuCameraGL *cam_bas;
+    Parser *gui;
+#endif
+    parseOptions(argc,argv);
+
+    simu= new Simulator("simulator",opti_time,90);
+    simu->SetupConnection(address,port);
+    simu->SetupUserInterface(xml_file);
+
+#ifdef GL
+    gui=new Parser(simu,960,480,640,480,media_path,scene_file);
+#endif
+
+    if(type=="x4")
+    {
+        drone=new X4(simu,name,0);
+    }
+    else
+    {
+        drone=new X8(simu,name,0);
+    }
+    imu=new SimuImu(drone,"imu",0);
+
+#ifdef GL
+    us_gl=new SimuUsGL(drone,"us",0);
+    cam_bas=new SimuCameraGL(drone,"bottom camera",320,240,640,0,0);
+#endif
+
+    simu->RunSimu();
+
+    delete simu;
+
+	return 0;
+}
+
Index: /trunk/demos/OpticalFlow/uav/CMakeLists.txt
===================================================================
--- /trunk/demos/OpticalFlow/uav/CMakeLists.txt	(revision 122)
+++ /trunk/demos/OpticalFlow/uav/CMakeLists.txt	(revision 122)
@@ -0,0 +1,34 @@
+PROJECT(OpticalFlow)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_FILTER TRUE)
+#SET(FLAIR_USE_VISION_FILTER TRUE)
+SET(FLAIR_USE_SENSOR_ACTUATOR TRUE)
+SET(FLAIR_USE_META TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+	${CMAKE_SOURCE_DIR}/src/main.cpp
+	${CMAKE_SOURCE_DIR}/src/DemoOpticalFlow.cpp
+)
+
+INCLUDE_DIRECTORIES(
+	${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+	${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+	${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: /trunk/demos/OpticalFlow/uav/build_arm/bin/OpticalFlow_ardrone2.sh
===================================================================
--- /trunk/demos/OpticalFlow/uav/build_arm/bin/OpticalFlow_ardrone2.sh	(revision 122)
+++ /trunk/demos/OpticalFlow/uav/build_arm/bin/OpticalFlow_ardrone2.sh	(revision 122)
@@ -0,0 +1,1 @@
+./demo_fo_nrt -a 192.168.147.193 -p 9000 -l /tmp -x OpticalFlow_ardrone2.xml -n Drone_0 -t ardrone2 -d ./dspcv_dsp.out
Index: /trunk/demos/OpticalFlow/uav/build_arm/bin/OpticalFlow_ardrone2.xml
===================================================================
--- /trunk/demos/OpticalFlow/uav/build_arm/bin/OpticalFlow_ardrone2.xml	(revision 122)
+++ /trunk/demos/OpticalFlow/uav/build_arm/bin/OpticalFlow_ardrone2.xml	(revision 122)
@@ -0,0 +1,267 @@
+<?xml version="1.0"?>
+<root name="FrameworkManager">
+  <TabWidget name="Main_TabWidget">
+    <Tab name="x4-multiplex">
+      <TabWidget name="UavMultiplex">
+        <Tab name="Setup">
+          <GroupBox name="x4 multiplex">
+            <ComboBox name="front left blade pitch:" value="1"/>
+          </GroupBox>
+          <GroupBox name="motor attribution">
+            <ComboBox name="front left" value="0"/>
+            <ComboBox name="front rigth" value="1"/>
+            <ComboBox name="rear left" value="2"/>
+            <ComboBox name="rear rigth" value="3"/>
+          </GroupBox>
+          <GroupBox name="bldc">
+            <Label name="flight time"/>
+            <DoubleSpinBox name="min value:" value="0.4"/>
+            <DoubleSpinBox name="max value:" value="1"/>
+            <DoubleSpinBox name="test value:" value="0.2"/>
+            <PushButton name="test motor 0"/>
+            <PushButton name="test motor 1"/>
+            <PushButton name="test motor 2"/>
+            <PushButton name="test motor 3"/>
+          </GroupBox>
+        </Tab>
+        <Tab name="Values">
+          <DataPlot1D name="front left" period="100" enabled="0"/>
+          <DataPlot1D name="front right" period="100" enabled="0"/>
+          <DataPlot1D name="rear left" period="100" enabled="0"/>
+          <DataPlot1D name="rear right" period="100" enabled="0"/>
+        </Tab>
+      </TabWidget>
+    </Tab>
+    <Tab name="parrot-us">
+      <TabWidget name="parrot-us">
+        <Tab name="Reglages">
+          <GroupBox name="parrot-us"/>
+          <GroupBox name="Passe bas">
+            <DoubleSpinBox name="period, 0 for auto" value="0"/>
+            <DoubleSpinBox name="cutoff frequency" value="5"/>
+          </GroupBox>
+          <GroupBox name="Vz">
+            <DoubleSpinBox name="period, 0 for auto:" value="0"/>
+          </GroupBox>
+          <GroupBox name="Passe bas v">
+            <DoubleSpinBox name="period, 0 for auto" value="0"/>
+            <DoubleSpinBox name="cutoff frequency" value="10"/>
+          </GroupBox>
+        </Tab>
+        <Tab name="Mesures">
+          <DataPlot1D name="parrot-us" period="100" enabled="0"/>
+          <DataPlot1D name="vz" period="100" enabled="0"/>
+        </Tab>
+      </TabWidget>
+    </Tab>
+    <Tab name="parrot-imu">
+      <TabWidget name="parrot-imu">
+        <Tab name="Reglages">
+          <GroupBox name="parrot-imu"/>
+          <GroupBox name="post rotation">
+            <DoubleSpinBox name="value" value="0"/>
+            <ComboBox name="axis" value="0"/>
+          </GroupBox>
+          <DoubleSpinBox name="k_a[0]:" value="0.5"/>
+          <DoubleSpinBox name="k_a[1]:" value="0.5"/>
+          <DoubleSpinBox name="k_a[2]:" value="0"/>
+          <DoubleSpinBox name="k_b[0]:" value="0.01"/>
+          <DoubleSpinBox name="k_b[1]:" value="0.01"/>
+          <DoubleSpinBox name="k_b[2]:" value="0.01"/>
+        </Tab>
+        <Tab name="AHRS">
+          <DataPlot1D name="roll" period="100" enabled="0"/>
+          <DataPlot1D name="pitch" period="100" enabled="0"/>
+          <DataPlot1D name="yaw" period="100" enabled="0"/>
+          <DataPlot1D name="w_x" period="100" enabled="0"/>
+          <DataPlot1D name="w_y" period="100" enabled="0"/>
+          <DataPlot1D name="w_z" period="100" enabled="0"/>
+        </Tab>
+        <Tab name="IMU">
+          <DataPlot1D name="acc_x" period="100" enabled="0"/>
+          <DataPlot1D name="acc_y" period="100" enabled="0"/>
+          <DataPlot1D name="acc_z" period="100" enabled="0"/>
+          <DataPlot1D name="gyr_x" period="100" enabled="0"/>
+          <DataPlot1D name="gyr_y" period="100" enabled="0"/>
+          <DataPlot1D name="gyr_z" period="100" enabled="0"/>
+          <DataPlot1D name="mag_x" period="100" enabled="0"/>
+          <DataPlot1D name="mag_y" period="100" enabled="0"/>
+          <DataPlot1D name="mag_z" period="100" enabled="0"/>
+        </Tab>
+      </TabWidget>
+    </Tab>
+    <Tab name="battery">
+      <GroupBox name="battery">
+        <Label name="battery"/>
+        <DoubleSpinBox name="threshold" value="10.5"/>
+      </GroupBox>
+    </Tab>
+    <Tab name="camv">
+      <TabWidget name="camv">
+        <Tab name="Setup">
+          <GroupBox name="camv">
+            <DoubleSpinBox name="gain:" value="0.5"/>
+            <DoubleSpinBox name="exposure:" value="0.5"/>
+            <DoubleSpinBox name="bright:" value="0.5"/>
+            <DoubleSpinBox name="contrast:" value="0.5"/>
+            <DoubleSpinBox name="hue:" value="0.5"/>
+            <DoubleSpinBox name="sharpness:" value="0.5"/>
+            <DoubleSpinBox name="saturation:" value="0.5"/>
+            <CheckBox name="autogain:" value="1"/>
+            <CheckBox name="autoexposure:" value="1"/>
+            <CheckBox name="awb:" value="1"/>
+          <Label name="fps"/></GroupBox>
+          <GridLayout name="setup">
+            <GroupBox name="flux optique">
+              <GroupBox name="post rotation">
+                <DoubleSpinBox name="value" value="90"/>
+                <ComboBox name="axis" value="2"/>
+              </GroupBox>
+              <SpinBox name="max features:" value="64"/>
+            </GroupBox>
+            <GroupBox name="passe bas">
+              <DoubleSpinBox name="period, 0 for auto" value="0"/>
+              <DoubleSpinBox name="cutoff frequency" value="2"/>
+            </GroupBox>
+            <GroupBox name="sobel along x">
+              <SpinBox name="dx:" value="1"/>
+              <SpinBox name="dy:" value="0"/>
+            </GroupBox>
+            <GroupBox name="threshold">
+              <SpinBox name="threshold:" value="127"/>
+            </GroupBox>
+            <GroupBox name="houghlines">
+              <SpinBox name="full rho step:" value="4"/>
+              <DoubleSpinBox name="full theta step:" value="4"/>
+              <SpinBox name="tracking rho step:" value="4"/>
+              <DoubleSpinBox name="tracking theta step:" value="1"/>
+              <DoubleSpinBox name="tracking delta theta:" value="10"/>
+              <SpinBox name="nb points:" value="100"/>
+            </GroupBox>
+          </GridLayout>
+        </Tab>
+        <Tab name="Picture">
+          <Picture name="camv" period="500" enabled="0"/>
+          <Picture name="sobel along x" period="500" enabled="0"/>
+          <Picture name="threshold" period="500" enabled="0"/>
+          <GridLayout name="hough">
+            <DataPlot1D name="distance" period="100" enabled="1"/>
+            <DataPlot1D name="orientation" period="100" enabled="1"/>
+            <DataPlot1D name="line detected" period="100" enabled="1"/>
+          </GridLayout>
+        <DataPlot1D name="distance" period="100" enabled="1"/><DataPlot1D name="orientation" period="100" enabled="1"/><DataPlot1D name="line detected" period="100" enabled="1"/></Tab>
+      </TabWidget>
+    </Tab>
+    <Tab name="uav">
+      <GridLayout name="buttons">
+        <PushButton name="kill"/>
+        <PushButton name="start_log"/>
+        <PushButton name="stop_log"/>
+        <PushButton name="take_off"/>
+        <PushButton name="land"/>
+      </GridLayout>
+      <GroupBox name="takeoff/landing">
+        <DoubleSpinBox name="desired takeoff altitude" value="0.7"/>
+        <DoubleSpinBox name="desired landing altitude" value="0"/>
+      </GroupBox>
+      <GroupBox name="alt cons">
+        <DoubleSpinBox name="period, 0 for auto:" value="0"/>
+        <DoubleSpinBox name="velocity max (absolute):" value="1"/>
+        <DoubleSpinBox name="acceleration (absolute):" value="0.8"/>
+      </GroupBox>
+    </Tab>
+    <Tab name="control laws">
+      <TabWidget name="laws">
+        <Tab name="Setup">
+          <GroupBox name="u_roll">
+            <DoubleSpinBox name="sat ref:" value="20"/>
+            <DoubleSpinBox name="kp:" value="12"/>
+            <DoubleSpinBox name="sat dref:" value="1000"/>
+            <DoubleSpinBox name="kd:" value="0.2"/>
+            <DoubleSpinBox name="sat u:" value="0.4"/>
+          </GroupBox>
+          <GroupBox name="u_pitch">
+            <DoubleSpinBox name="sat ref:" value="20"/>
+            <DoubleSpinBox name="kp:" value="12"/>
+            <DoubleSpinBox name="sat dref:" value="1000"/>
+            <DoubleSpinBox name="kd:" value="0.2"/>
+            <DoubleSpinBox name="sat u:" value="0.4"/>
+          </GroupBox>
+          <GroupBox name="u_yaw">
+            <DoubleSpinBox name="period, 0 for auto" value="0"/>
+            <DoubleSpinBox name="kp:" value="0.6"/>
+            <DoubleSpinBox name="ki:" value="0.1"/>
+            <DoubleSpinBox name="sat i:" value="0.2"/>
+            <DoubleSpinBox name="kd:" value="0.2"/>
+            <DoubleSpinBox name="sat:" value="0.5"/>
+          </GroupBox>
+          <GroupBox name="u_z">
+            <DoubleSpinBox name="period, 0 for auto" value="0"/>
+            <DoubleSpinBox name="kp:" value="0.6"/>
+            <DoubleSpinBox name="ki:" value="0.2"/>
+            <DoubleSpinBox name="sat i:" value="0.4"/>
+            <DoubleSpinBox name="kd:" value="0.4"/>
+            <DoubleSpinBox name="offset g:" value="0.6"/>
+            <DoubleSpinBox name="sat:" value="1"/>
+            <DoubleSpinBox name="offset step:" value="0.0002"/>
+          </GroupBox>
+          <GroupBox name="u_x">
+            <DoubleSpinBox name="period, 0 for auto" value="0"/>
+            <DoubleSpinBox name="kp:" value="0.015"/>
+            <DoubleSpinBox name="ki:" value="0.02"/>
+            <DoubleSpinBox name="sat i:" value="0.15"/>
+            <DoubleSpinBox name="kd:" value="0"/>
+            <DoubleSpinBox name="sat:" value="0.3"/>
+          </GroupBox>
+          <GroupBox name="u_y">
+            <DoubleSpinBox name="period, 0 for auto" value="0"/>
+            <DoubleSpinBox name="kp:" value="0.015"/>
+            <DoubleSpinBox name="ki:" value="0.02"/>
+            <DoubleSpinBox name="sat i:" value="0.15"/>
+            <DoubleSpinBox name="kd:" value="0"/>
+            <DoubleSpinBox name="sat:" value="0.3"/>
+          </GroupBox>
+        </Tab>
+        <Tab name="Graphes">
+          <DataPlot1D name="u_roll" period="100" enabled="0"/>
+          <DataPlot1D name="u_pitch" period="100" enabled="0"/>
+          <DataPlot1D name="u_yaw" period="100" enabled="0"/>
+          <DataPlot1D name="u_z" period="100" enabled="1"/>
+          <DataPlot1D name="u_x" period="100" enabled="1"/>
+          <DataPlot1D name="u_y" period="100" enabled="0"/>
+        </Tab>
+      </TabWidget>
+    </Tab>
+    <Tab name="Dualshock3">
+      <TabWidget name="Dualshock3">
+        <Tab name="Reglages">
+          <GroupBox name="consignes joy">
+            <DoubleSpinBox name="debattement roll" value="-15"/>
+            <DoubleSpinBox name="debattement pitch" value="-15"/>
+            <DoubleSpinBox name="debattement wz" value="90"/>
+            <DoubleSpinBox name="debattement dz" value="-0.5"/>
+            <DoubleSpinBox name="trim" value="0.02"/>
+            <Label name="trim roll"/>
+            <PushButton name="reset roll trim"/>
+            <Label name="trim pitch"/>
+            <PushButton name="reset pitch trim"/>
+          </GroupBox>
+          <GroupBox name="consignes fo">
+            <DoubleSpinBox name="debattement x" value="0"/>
+            <DoubleSpinBox name="debattement y" value="0"/>
+            <DoubleSpinBox name="speed step" value="5"/>
+          </GroupBox>
+        </Tab>
+      </TabWidget>
+    </Tab>
+    <Tab name="flux optique">
+      <DataPlot1D name="x_velocity" period="100" enabled="1"/>
+      <DataPlot1D name="y_velocity" period="100" enabled="1"/>
+    </Tab>
+  </TabWidget>
+  <TabWidget name="App_TabWidget">
+    <Tab name="demo_line">
+      <PushButton name="save config on target" value="1"/>
+    </Tab>
+  <Tab name="Drone_0"><PushButton name="save config on target" value="1"/></Tab></TabWidget>
+</root>
Index: /trunk/demos/OpticalFlow/uav/build_x86_64/bin/setup_x4.xml
===================================================================
--- /trunk/demos/OpticalFlow/uav/build_x86_64/bin/setup_x4.xml	(revision 122)
+++ /trunk/demos/OpticalFlow/uav/build_x86_64/bin/setup_x4.xml	(revision 122)
@@ -0,0 +1,287 @@
+<?xml version="1.0"?>
+<!DOCTYPE remote_ui_xml>
+<root name="interface">
+  <TabWidget name="Main_TabWidget">
+ <Tab name="Dualshock3">
+  <TabWidget name="Dualshock3">
+   <Tab name="Reglages">
+    <GroupBox name="dualshock3">
+     <SpinBox value="10" name="dead zone:"/>
+     <Label name="batterie"/>
+    </GroupBox>
+    <GroupBox name="consignes joy">
+     <DoubleSpinBox value="-20" name="debattement roll"/>
+     <DoubleSpinBox value="-20" name="debattement pitch"/>
+     <DoubleSpinBox value="90" name="debattement wz"/>
+     <DoubleSpinBox value="-0.7" name="debattement dz"/>
+     <DoubleSpinBox value="0" name="trim"/>
+     <Label name="trim roll"/>
+     <PushButton value="0" name="reset roll trim"/>
+     <Label name="trim pitch"/>
+     <PushButton value="0" name="reset pitch trim"/>
+    </GroupBox>
+   <GroupBox name="consignes fo"><DoubleSpinBox name="debattement x" value="-1"/><DoubleSpinBox name="debattement y" value="1"/></GroupBox></Tab>
+   <Tab name="Mesures">
+    <DataPlot1D name="roll">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="pitch">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="yaw">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="gaz">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+   </Tab>
+  </TabWidget>
+ </Tab>
+ <Tab name="motors">
+  <TabWidget name="UavMultiplex">
+   <Tab name="Setup">
+    <GroupBox name="x4 multiplex">
+     <ComboBox value="0" name="front left blade pitch:"/>
+    </GroupBox>
+    <GroupBox name="motor attribution">
+     <ComboBox value="0" name="front left"/>
+     <ComboBox value="1" name="front rigth"/>
+     <ComboBox value="2" name="rear left"/>
+     <ComboBox value="3" name="rear rigth"/>
+    </GroupBox>
+    <GroupBox name="bldc">
+     <Label name="flight time"/>
+     <DoubleSpinBox value="0.4" name="min value:"/>
+     <DoubleSpinBox value="1" name="max value:"/>
+     <DoubleSpinBox value="0.1" name="test value:"/>
+     <PushButton value="0" name="test motor 0"/>
+     <PushButton value="0" name="test motor 1"/>
+     <PushButton value="0" name="test motor 2"/>
+     <PushButton value="0" name="test motor 3"/>
+    </GroupBox>
+    <GroupBox name="simubldc">
+     <DoubleSpinBox value="86" name="k driver:"/>
+    </GroupBox>
+   </Tab>
+   <Tab name="Values">
+    <DataPlot1D name="front left" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="front right" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="rear left" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="rear right" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+   </Tab>
+   <Tab name="Speeds">
+    <DataPlot1D name="front left" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="front right" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="rear left" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="rear right" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+   </Tab>
+  </TabWidget>
+ </Tab>
+ <Tab name="us">
+  <TabWidget name="us">
+   <Tab name="Reglages">
+    <GroupBox name="us">
+     <SpinBox value="50" name="data rate"/>
+    </GroupBox>
+    <GroupBox name="Passe bas">
+     <DoubleSpinBox value="0" name="period, 0 for auto"/>
+     <DoubleSpinBox value="5" name="cutoff frequency"/>
+    </GroupBox>
+    <GroupBox name="Vz">
+     <DoubleSpinBox value="0" name="period, 0 for auto:"/>
+    </GroupBox>
+    <GroupBox name="Passe bas v">
+     <DoubleSpinBox value="0" name="period, 0 for auto"/>
+     <DoubleSpinBox value="5" name="cutoff frequency"/>
+    </GroupBox>
+   </Tab>
+   <Tab name="Mesures">
+    <DataPlot1D name="us" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="vz" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+   </Tab>
+  </TabWidget>
+ </Tab>
+ <Tab name="imu">
+  <TabWidget name="imu">
+   <Tab name="Reglages">
+    <GroupBox name="imu">
+     <SpinBox value="200" name="data rate"/>
+    </GroupBox>
+    <GroupBox name="post rotation">
+     <DoubleSpinBox value="0" name="value"/>
+     <ComboBox value="0" name="axis"/>
+    </GroupBox>
+   </Tab>
+   <Tab name="AHRS">
+    <DataPlot1D name="roll" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="pitch" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="yaw" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="w_x" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="w_y" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="w_z" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+   </Tab>
+  </TabWidget>
+ </Tab>
+ <Tab name="battery">
+  <GroupBox name="battery">
+   <Label name="battery"/>
+   <DoubleSpinBox value="0" name="threshold"/>
+  </GroupBox>
+ </Tab>
+ <Tab name="simu_cam_v">
+  <TabWidget name="simu_cam_v">
+   <Tab name="Setup">
+    <GroupBox name="simu_cam_v">
+     <SpinBox value="50" name="data rate"/>
+    </GroupBox>
+    <GridLayout name="setup">
+     <GroupBox name="flux optique">
+      <SpinBox value="64" name="max features:"/>
+     <GroupBox name="post rotation"><DoubleSpinBox name="value" value="90"/><ComboBox name="axis" value="2"/></GroupBox></GroupBox>
+     <GroupBox name="passe bas">
+      <DoubleSpinBox value="0" name="period, 0 for auto"/>
+      <DoubleSpinBox value="1" name="cutoff frequency"/>
+     </GroupBox>
+    </GridLayout>
+   </Tab>
+   <Tab name="Picture">
+    <Picture name="simu_cam_v">
+     <Setup period="50" enabled="1"/>
+    </Picture>
+   </Tab>
+  </TabWidget>
+ </Tab>
+ <Tab name="uav">
+  <GridLayout name="buttons">
+   <PushButton value="0" name="kill"/>
+   <PushButton value="0" name="start_log"/>
+   <PushButton value="0" name="stop_log"/>
+   <PushButton value="1" name="take_off"/>
+   <PushButton value="0" name="land"/>
+  </GridLayout>
+  <GroupBox name="takeoff/landing">
+   <DoubleSpinBox value="1" name="desired takeoff altitude"/>
+   <DoubleSpinBox value="0" name="desired landing altitude"/>
+  </GroupBox>
+  <GroupBox name="alt cons">
+   <DoubleSpinBox value="0" name="period, 0 for auto:"/>
+   <DoubleSpinBox value="0.5" name="velocity max (absolute):"/>
+   <DoubleSpinBox value="0.2" name="acceleration (absolute):"/>
+  </GroupBox>
+ </Tab>
+ <Tab name="control laws">
+  <TabWidget name="laws">
+   <Tab name="Setup">
+    <GroupBox name="u_roll">
+     <DoubleSpinBox value="15" name="sat ref:"/>
+     <DoubleSpinBox value="5" name="kp:"/>
+     <DoubleSpinBox value="100" name="sat dref:"/>
+     <DoubleSpinBox value="0.1" name="kd:"/>
+     <DoubleSpinBox value="0.5" name="sat u:"/>
+    </GroupBox>
+    <GroupBox name="u_pitch">
+     <DoubleSpinBox value="15" name="sat ref:"/>
+     <DoubleSpinBox value="5" name="kp:"/>
+     <DoubleSpinBox value="100" name="sat dref:"/>
+     <DoubleSpinBox value="0.1" name="kd:"/>
+     <DoubleSpinBox value="0.5" name="sat u:"/>
+    </GroupBox>
+    <GroupBox name="u_yaw">
+     <DoubleSpinBox value="0" name="period, 0 for auto"/>
+     <DoubleSpinBox value="1" name="kp:"/>
+     <DoubleSpinBox value="0" name="ki:"/>
+     <DoubleSpinBox value="0" name="sat i:"/>
+     <DoubleSpinBox value="0.1" name="kd:"/>
+     <DoubleSpinBox value="0.2" name="sat:"/>
+    </GroupBox>
+    <GroupBox name="u_z">
+     <DoubleSpinBox value="0" name="period, 0 for auto"/>
+     <DoubleSpinBox value="0.3" name="kp:"/>
+     <DoubleSpinBox value="0.2" name="ki:"/>
+     <DoubleSpinBox value="0.5" name="sat i:"/>
+     <DoubleSpinBox value="0.1" name="kd:"/>
+     <DoubleSpinBox value="0.6" name="offset g:"/>
+     <DoubleSpinBox value="1" name="sat:"/>
+     <DoubleSpinBox value="0.0002" name="offset step:"/>
+    </GroupBox>
+    <GroupBox name="u_x">
+     <DoubleSpinBox value="0" name="period, 0 for auto"/>
+     <DoubleSpinBox value="0.030" name="kp:"/>
+     <DoubleSpinBox value="0.020" name="ki:"/>
+     <DoubleSpinBox value="0.20" name="sat i:"/>
+     <DoubleSpinBox value="0.1" name="kd:"/>
+     <DoubleSpinBox value="1" name="sat:"/>
+    </GroupBox>
+    <GroupBox name="u_y">
+     <DoubleSpinBox value="0" name="period, 0 for auto"/>
+     <DoubleSpinBox value="0.03" name="kp:"/>
+     <DoubleSpinBox value="0.020" name="ki:"/>
+     <DoubleSpinBox value="0.20" name="sat i:"/>
+     <DoubleSpinBox value="0.2" name="kd:"/>
+     <DoubleSpinBox value="1" name="sat:"/>
+    </GroupBox>
+   </Tab>
+   <Tab name="Graphes">
+    <DataPlot1D name="u_roll" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="u_pitch" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="u_yaw" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="u_z" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="u_x" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="u_y" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+   </Tab>
+  </TabWidget>
+ </Tab>
+ <Tab name="flux optique">
+  <DataPlot1D name="x_velocity" period="100" enabled="1">
+   <Setup period="100" enabled="1"/>
+  </DataPlot1D>
+  <DataPlot1D name="y_velocity" period="100" enabled="1">
+   <Setup period="100" enabled="1"/>
+  </DataPlot1D>
+ </Tab>
+  </TabWidget>
+<TabWidget name="App_TabWidget"><Tab name="x4_0"><PushButton name="save config on target" value="1"/></Tab></TabWidget></root>
Index: /trunk/demos/OpticalFlow/uav/build_x86_64/bin/setup_x8.xml
===================================================================
--- /trunk/demos/OpticalFlow/uav/build_x86_64/bin/setup_x8.xml	(revision 122)
+++ /trunk/demos/OpticalFlow/uav/build_x86_64/bin/setup_x8.xml	(revision 122)
@@ -0,0 +1,287 @@
+<?xml version="1.0"?>
+<!DOCTYPE remote_ui_xml>
+<root name="interface">
+  <TabWidget name="Main_TabWidget">
+ <Tab name="Dualshock3">
+  <TabWidget name="Dualshock3">
+   <Tab name="Reglages">
+    <GroupBox name="dualshock3">
+     <SpinBox value="10" name="dead zone:"/>
+     <Label name="batterie"/>
+    </GroupBox>
+    <GroupBox name="consignes joy">
+     <DoubleSpinBox value="-20" name="debattement roll"/>
+     <DoubleSpinBox value="-20" name="debattement pitch"/>
+     <DoubleSpinBox value="90" name="debattement wz"/>
+     <DoubleSpinBox value="-0.7" name="debattement dz"/>
+     <DoubleSpinBox value="0" name="trim"/>
+     <Label name="trim roll"/>
+     <PushButton value="0" name="reset roll trim"/>
+     <Label name="trim pitch"/>
+     <PushButton value="0" name="reset pitch trim"/>
+    </GroupBox>
+   <GroupBox name="consignes fo"><DoubleSpinBox name="debattement x" value="-1"/><DoubleSpinBox name="debattement y" value="1"/></GroupBox></Tab>
+   <Tab name="Mesures">
+    <DataPlot1D name="roll">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="pitch">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="yaw">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="gaz">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+   </Tab>
+  </TabWidget>
+ </Tab>
+ <Tab name="motors">
+  <TabWidget name="UavMultiplex">
+   <Tab name="Setup">
+    <GroupBox name="x4 multiplex">
+     <ComboBox value="0" name="front left blade pitch:"/>
+    </GroupBox>
+    <GroupBox name="motor attribution">
+     <ComboBox value="0" name="front left"/>
+     <ComboBox value="1" name="front rigth"/>
+     <ComboBox value="2" name="rear left"/>
+     <ComboBox value="3" name="rear rigth"/>
+    <ComboBox name="top front left" value="0"/><ComboBox name="top front rigth" value="1"/><ComboBox name="top rear left" value="2"/><ComboBox name="top rear rigth" value="3"/><ComboBox name="bottom front left" value="4"/><ComboBox name="bottom front rigth" value="5"/><ComboBox name="bottom rear left" value="6"/><ComboBox name="bottom rear rigth" value="7"/></GroupBox>
+    <GroupBox name="bldc">
+     <Label name="flight time"/>
+     <DoubleSpinBox value="0.4" name="min value:"/>
+     <DoubleSpinBox value="1" name="max value:"/>
+     <DoubleSpinBox value="0.1" name="test value:"/>
+     <PushButton value="0" name="test motor 0"/>
+     <PushButton value="0" name="test motor 1"/>
+     <PushButton value="0" name="test motor 2"/>
+     <PushButton value="0" name="test motor 3"/>
+    <PushButton name="test motor 4"/><PushButton name="test motor 5"/><PushButton name="test motor 6"/><PushButton name="test motor 7"/></GroupBox>
+    <GroupBox name="simubldc">
+     <DoubleSpinBox value="86" name="k driver:"/>
+    </GroupBox>
+   <GroupBox name="x8 multiplex"><ComboBox name="top front left blade pitch:" value="0"/></GroupBox></Tab>
+   <Tab name="Values">
+    <DataPlot1D name="front left" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="front right" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="rear left" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="rear right" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+   </Tab>
+   <Tab name="Speeds">
+    <DataPlot1D name="front left" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="front right" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="rear left" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="rear right" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+   </Tab>
+  </TabWidget>
+ </Tab>
+ <Tab name="us">
+  <TabWidget name="us">
+   <Tab name="Reglages">
+    <GroupBox name="us">
+     <SpinBox value="50" name="data rate"/>
+    </GroupBox>
+    <GroupBox name="Passe bas">
+     <DoubleSpinBox value="0" name="period, 0 for auto"/>
+     <DoubleSpinBox value="5" name="cutoff frequency"/>
+    </GroupBox>
+    <GroupBox name="Vz">
+     <DoubleSpinBox value="0" name="period, 0 for auto:"/>
+    </GroupBox>
+    <GroupBox name="Passe bas v">
+     <DoubleSpinBox value="0" name="period, 0 for auto"/>
+     <DoubleSpinBox value="5" name="cutoff frequency"/>
+    </GroupBox>
+   </Tab>
+   <Tab name="Mesures">
+    <DataPlot1D name="us" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="vz" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+   </Tab>
+  </TabWidget>
+ </Tab>
+ <Tab name="imu">
+  <TabWidget name="imu">
+   <Tab name="Reglages">
+    <GroupBox name="imu">
+     <SpinBox value="200" name="data rate"/>
+    </GroupBox>
+    <GroupBox name="post rotation">
+     <DoubleSpinBox value="0" name="value"/>
+     <ComboBox value="0" name="axis"/>
+    </GroupBox>
+   </Tab>
+   <Tab name="AHRS">
+    <DataPlot1D name="roll" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="pitch" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="yaw" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="w_x" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="w_y" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="w_z" period="100" enabled="0">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+   </Tab>
+  </TabWidget>
+ </Tab>
+ <Tab name="battery">
+  <GroupBox name="battery">
+   <Label name="battery"/>
+   <DoubleSpinBox value="0" name="threshold"/>
+  </GroupBox>
+ </Tab>
+ <Tab name="simu_cam_v">
+  <TabWidget name="simu_cam_v">
+   <Tab name="Setup">
+    <GroupBox name="simu_cam_v">
+     <SpinBox value="50" name="data rate"/>
+    </GroupBox>
+    <GridLayout name="setup">
+     <GroupBox name="flux optique">
+      <SpinBox value="64" name="max features:"/>
+     <GroupBox name="post rotation"><DoubleSpinBox name="value" value="90"/><ComboBox name="axis" value="2"/></GroupBox></GroupBox>
+     <GroupBox name="passe bas">
+      <DoubleSpinBox value="0" name="period, 0 for auto"/>
+      <DoubleSpinBox value="1" name="cutoff frequency"/>
+     </GroupBox>
+    </GridLayout>
+   </Tab>
+   <Tab name="Picture">
+    <Picture name="simu_cam_v">
+     <Setup period="50" enabled="1"/>
+    </Picture>
+   </Tab>
+  </TabWidget>
+ </Tab>
+ <Tab name="uav">
+  <GridLayout name="buttons">
+   <PushButton value="0" name="kill"/>
+   <PushButton value="0" name="start_log"/>
+   <PushButton value="0" name="stop_log"/>
+   <PushButton value="1" name="take_off"/>
+   <PushButton value="0" name="land"/>
+  </GridLayout>
+  <GroupBox name="takeoff/landing">
+   <DoubleSpinBox value="1" name="desired takeoff altitude"/>
+   <DoubleSpinBox value="0" name="desired landing altitude"/>
+  </GroupBox>
+  <GroupBox name="alt cons">
+   <DoubleSpinBox value="0" name="period, 0 for auto:"/>
+   <DoubleSpinBox value="0.5" name="velocity max (absolute):"/>
+   <DoubleSpinBox value="0.2" name="acceleration (absolute):"/>
+  </GroupBox>
+ </Tab>
+ <Tab name="control laws">
+  <TabWidget name="laws">
+   <Tab name="Setup">
+    <GroupBox name="u_roll">
+     <DoubleSpinBox value="15" name="sat ref:"/>
+     <DoubleSpinBox value="5" name="kp:"/>
+     <DoubleSpinBox value="100" name="sat dref:"/>
+     <DoubleSpinBox value="0.1" name="kd:"/>
+     <DoubleSpinBox value="0.5" name="sat u:"/>
+    </GroupBox>
+    <GroupBox name="u_pitch">
+     <DoubleSpinBox value="15" name="sat ref:"/>
+     <DoubleSpinBox value="5" name="kp:"/>
+     <DoubleSpinBox value="100" name="sat dref:"/>
+     <DoubleSpinBox value="0.1" name="kd:"/>
+     <DoubleSpinBox value="0.5" name="sat u:"/>
+    </GroupBox>
+    <GroupBox name="u_yaw">
+     <DoubleSpinBox value="0" name="period, 0 for auto"/>
+     <DoubleSpinBox value="1" name="kp:"/>
+     <DoubleSpinBox value="0" name="ki:"/>
+     <DoubleSpinBox value="0" name="sat i:"/>
+     <DoubleSpinBox value="0.1" name="kd:"/>
+     <DoubleSpinBox value="0.2" name="sat:"/>
+    </GroupBox>
+    <GroupBox name="u_z">
+     <DoubleSpinBox value="0" name="period, 0 for auto"/>
+     <DoubleSpinBox value="0.3" name="kp:"/>
+     <DoubleSpinBox value="0.2" name="ki:"/>
+     <DoubleSpinBox value="0.5" name="sat i:"/>
+     <DoubleSpinBox value="0.1" name="kd:"/>
+     <DoubleSpinBox value="0.6" name="offset g:"/>
+     <DoubleSpinBox value="1" name="sat:"/>
+     <DoubleSpinBox value="0.0002" name="offset step:"/>
+    </GroupBox>
+    <GroupBox name="u_x">
+     <DoubleSpinBox value="0" name="period, 0 for auto"/>
+     <DoubleSpinBox value="0.03" name="kp:"/>
+     <DoubleSpinBox value="0.020" name="ki:"/>
+     <DoubleSpinBox value="0.2" name="sat i:"/>
+     <DoubleSpinBox value="0.1" name="kd:"/>
+     <DoubleSpinBox value="1" name="sat:"/>
+    </GroupBox>
+    <GroupBox name="u_y">
+     <DoubleSpinBox value="0" name="period, 0 for auto"/>
+     <DoubleSpinBox value="0.03" name="kp:"/>
+     <DoubleSpinBox value="0.020" name="ki:"/>
+     <DoubleSpinBox value="0.2" name="sat i:"/>
+     <DoubleSpinBox value="0.1" name="kd:"/>
+     <DoubleSpinBox value="1" name="sat:"/>
+    </GroupBox>
+   </Tab>
+   <Tab name="Graphes">
+    <DataPlot1D name="u_roll" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="u_pitch" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="u_yaw" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="u_z" period="100" enabled="0">
+     <Setup period="100" enabled="0"/>
+    </DataPlot1D>
+    <DataPlot1D name="u_x" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+    <DataPlot1D name="u_y" period="100" enabled="1">
+     <Setup period="100" enabled="1"/>
+    </DataPlot1D>
+   </Tab>
+  </TabWidget>
+ </Tab>
+ <Tab name="flux optique">
+  <DataPlot1D name="x_velocity" period="100" enabled="1">
+   <Setup period="100" enabled="1"/>
+  </DataPlot1D>
+  <DataPlot1D name="y_velocity" period="100" enabled="1">
+   <Setup period="100" enabled="1"/>
+  </DataPlot1D>
+ </Tab>
+  </TabWidget>
+<TabWidget name="App_TabWidget"><Tab name="x4_0"><PushButton name="save config on target" value="1"/></Tab><Tab name="x8_0"><PushButton name="save config on target" value="1"/></Tab></TabWidget></root>
Index: /trunk/demos/OpticalFlow/uav/build_x86_64/bin/x4.sh
===================================================================
--- /trunk/demos/OpticalFlow/uav/build_x86_64/bin/x4.sh	(revision 122)
+++ /trunk/demos/OpticalFlow/uav/build_x86_64/bin/x4.sh	(revision 122)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+	EXEC=./OpticalFlow_rt
+else
+	EXEC=./OpticalFlow_nrt
+fi
+
+$EXEC -n x4_0 -a 127.0.0.1 -p 9000 -l /tmp -x setup_x4.xml -t x4_simu -v dsp_stub
Index: /trunk/demos/OpticalFlow/uav/build_x86_64/bin/x8.sh
===================================================================
--- /trunk/demos/OpticalFlow/uav/build_x86_64/bin/x8.sh	(revision 122)
+++ /trunk/demos/OpticalFlow/uav/build_x86_64/bin/x8.sh	(revision 122)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+	EXEC=./OpticalFlow_rt
+else
+	EXEC=./OpticalFlow_nrt
+fi
+
+$EXEC -n x8_0 -a 127.0.0.1 -p 9000 -l /tmp -x setup_x8.xml -t x8_simu -v dsp_stub
Index: /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp
===================================================================
--- /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp	(revision 122)
+++ /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp	(revision 122)
@@ -0,0 +1,160 @@
+//  created:    2011/05/01
+//  filename:   DemoOpticalFlow.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    demo optical flow
+//
+//
+/*********************************************************************/
+
+#include "DemoOpticalFlow.h"
+#include <Uav.h>
+#include <Camera.h>
+#include <CvtColor.h>
+#include <OpticalFlow.h>
+#include <OpticalFlowSpeed.h>
+#include <LowPassFilter.h>
+#include <cvmatrix.h>
+#include <GridLayout.h>
+#include <DataPlot1D.h>
+#include <Tab.h>
+#include <TabWidget.h>
+#include <GroupBox.h>
+#include <DoubleSpinBox.h>
+#include <FrameworkManager.h>
+#include <MetaDualShock3.h>
+#include <Vector2D.h>
+#include <AhrsData.h>
+#include <Ahrs.h>
+#include <Pid.h>
+
+#include <stdio.h>
+
+using namespace std;
+using namespace flair::core;
+using namespace flair::gui;
+using namespace flair::filter;
+using namespace flair::meta;
+using namespace flair::sensor;
+
+DemoOpticalFlow::DemoOpticalFlow(TargetController *controller): UavStateMachine(controller) {
+  Uav* uav=GetUav();
+	if (uav->GetVerticalCamera() == NULL) {
+        exit(1);
+    }
+uav->GetVerticalCamera()->SetLogFormat(Camera::LogFormat::JPG);
+getFrameworkManager()->AddDeviceToLog(uav->GetVerticalCamera());
+    greyCameraImage=new CvtColor(uav->GetVerticalCamera(),"gray",CvtColor::Conversion_t::GRAY);
+
+    uav->GetVerticalCamera()->UseDefaultPlot(greyCameraImage->Output()); // Le defaultPlot de la caméra peut afficher n'importe quoi?
+
+    //optical flow stack
+    opticalFlow=new OpticalFlow(greyCameraImage,uav->GetVerticalCamera()->GetLayout()->NewRow(),"flux optique");
+    opticalFlowSpeed=new OpticalFlowSpeed(opticalFlow,"vitesse du flux optique");
+
+    cvmatrix_descriptor* desc=new cvmatrix_descriptor(2,1);
+    for(int i=0;i<2;i++) {
+        desc->SetElementName(i,0,opticalFlowSpeed->Output()->Name(i,0));
+    }
+    cvmatrix* prev_value=new cvmatrix((const Thread*)this,desc,floatType,uav->ObjectName()); // diamond inheritance
+    for(int i=0;i<2;i++) {
+        prev_value->SetValue(i,0,0);
+    }
+
+    opticalFlowSpeedFiltered=new LowPassFilter(opticalFlowSpeed,uav->GetVerticalCamera()->GetLayout()->NewRow(),"passe bas",prev_value);
+// delete prev_value?
+
+    getFrameworkManager()->AddDeviceToLog(opticalFlowSpeed);
+
+    Tab* opticalFlowTab=new Tab(getFrameworkManager()->GetTabWidget(),"flux optique");
+    DataPlot1D* xVelocityPlot=new DataPlot1D(opticalFlowTab->NewRow(),"x_velocity",-5,5);
+    DataPlot1D* yVelocityPlot=new DataPlot1D(opticalFlowTab->LastRowLastCol(),"y_velocity",-5,5);
+
+    xVelocityPlot->AddCurve(opticalFlowSpeed->Output()->Element(0,0));
+    xVelocityPlot->AddCurve(opticalFlowSpeedFiltered->Matrix()->Element(0,0),DataPlot::Blue);
+    yVelocityPlot->AddCurve(opticalFlowSpeed->Output()->Element(1,0));
+    yVelocityPlot->AddCurve(opticalFlowSpeedFiltered->Matrix()->Element(1,0),DataPlot::Blue);
+
+    u_x=new Pid(setupLawTab->At(1,0),"u_x");
+    u_x->UseDefaultPlot(graphLawTab->NewRow());
+    u_y=new Pid(setupLawTab->At(1,1),"u_y");
+    u_y->UseDefaultPlot(graphLawTab->LastRowLastCol());
+
+    opticalFlowGroupBox=new GroupBox(GetJoystick()->GetTab()->NewRow(),"consignes fo");
+    maxXSpeed=new DoubleSpinBox(opticalFlowGroupBox->NewRow(),"debattement x"," m/s",-5,5,0.1,1);
+    maxYSpeed=new DoubleSpinBox(opticalFlowGroupBox->LastRowLastCol(),"debattement y"," m/s",-5,5,0.1,1);
+
+    opticalFlowReference=new cvmatrix((const Thread*)this,2,1,floatType);
+    xVelocityPlot->AddCurve(opticalFlowReference->Element(0,0),DataPlot::Green,"consigne");
+    yVelocityPlot->AddCurve(opticalFlowReference->Element(1,0),DataPlot::Green,"consigne");
+
+    customReferenceOrientation= new AhrsData(this,"reference");
+    uav->GetAhrs()->AddPlot(customReferenceOrientation,DataPlot::Yellow);
+    AddDataToControlLawLog(customReferenceOrientation);
+}
+
+void DemoOpticalFlow::SignalEvent(Event_t event) {
+    switch(event) {
+    case Event_t::EnteringControlLoop:
+        opticalFlowReference->SetValue(0,0,GetJoystick()->GetAxisValue(1)*maxXSpeed->Value());//joy axis 0 maps to x displacement
+        opticalFlowReference->SetValue(1,0,GetJoystick()->GetAxisValue(0)*maxYSpeed->Value());//joy axis 1 maps to y displacement
+        break;
+    }
+}
+
+void DemoOpticalFlow::ExtraCheckJoystick(void) {
+    static bool wasOpticalFlowModeButtonPressed=false;
+    // controller button R1 enters optical flow mode
+    if(GetJoystick()->IsButtonPressed(9)) { // R1
+        if (!wasOpticalFlowModeButtonPressed) {
+            wasOpticalFlowModeButtonPressed=true;
+            if (SetOrientationMode(OrientationMode_t::Custom)) {
+                Thread::Info("(Re)entering optical flow mode\n");
+                u_x->Reset();
+                u_y->Reset();
+            } else {
+                Thread::Warn("Could not enter optical flow mode\n");
+            }
+        }
+    } else {
+        wasOpticalFlowModeButtonPressed=false;
+    }
+}
+
+const AhrsData *DemoOpticalFlow::GetReferenceOrientation(void) {
+    Euler refAngles=GetDefaultReferenceOrientation()->GetQuaternion().ToEuler();//to keep default yaw reference
+
+    // /!\ in this demo, the target value is a speed (in pixel/s). As a consequence the error is the difference between the current speed and the target speed
+    Vector2D error, errorVariation; // in Uav coordinate system
+
+    //opticalFlow= matrice de déplacements en pixels entre 2 images consécutives
+    //opticalFlowSpeed=vitesse de déplacement en pixel par seconde (moyenne sur tous les points et division par le delta T)
+    error.x=opticalFlowSpeedFiltered->Output(0,0)-opticalFlowReference->Value(0,0);
+    error.y=opticalFlowSpeedFiltered->Output(1,0)-opticalFlowReference->Value(1,0);
+
+    //la dérivée est à la fréquence de la loi de commande ("rapide") alors que le flux optique est à la fréquence de la caméra
+    // fréquemment la dérivée car le signal n'a pas bougé -> dérivée super crade
+    //gsanahuj: brancher un eulerderivative derriere le opticalFlowSpeedFiltered pour avoir la derivee
+    //opticalFlowSpeed doit etre renomme car finalement ce n'est pas une vitesse mais un deplacement
+    errorVariation.x=0;
+    errorVariation.y=0;
+
+    u_x->SetValues(error.x, errorVariation.x);
+    u_x->Update(GetTime());
+    refAngles.pitch=u_x->Output();
+
+    u_y->SetValues(error.y, errorVariation.y);
+    u_y->Update(GetTime());
+    refAngles.roll=-u_y->Output();
+
+    customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D(0,0,0));
+
+    return customReferenceOrientation;
+}
+
+DemoOpticalFlow::~DemoOpticalFlow() {
+}
Index: /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.h
===================================================================
--- /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.h	(revision 122)
+++ /trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.h	(revision 122)
@@ -0,0 +1,63 @@
+//  created:    2011/05/01
+//  filename:   DemoOpticalFlow.h
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    demo optical flow
+//
+//
+/*********************************************************************/
+//------------
+
+#ifndef DEMOOPTICALFLOW_H
+#define DEMOOPTICALFLOW_H
+
+#include <UavStateMachine.h>
+
+namespace flair {
+    namespace core {
+        class cvmatrix;
+    }
+    namespace gui {
+        class GroupBox;
+        class DoubleSpinBox;
+    }
+    namespace filter {
+        class OpticalFlow;
+        class OpticalFlowSpeed;
+        class LowPassFilter;
+        class CvtColor;
+    }
+    namespace sensor {
+        class TargetController;
+    }
+}
+
+class DemoOpticalFlow : public flair::meta::UavStateMachine {
+
+    public:
+        DemoOpticalFlow(flair::sensor::TargetController *controller);
+        ~DemoOpticalFlow();
+
+    protected:
+        void SignalEvent(Event_t event);
+        void ExtraCheckJoystick(void);
+        const flair::core::AhrsData *GetReferenceOrientation(void);
+
+        flair::gui::GroupBox* opticalFlowGroupBox;
+        flair::gui::DoubleSpinBox *maxXSpeed,*maxYSpeed;
+        flair::core::cvmatrix *opticalFlowReference;
+        flair::filter::Pid *u_x, *u_y;
+        flair::filter::LowPassFilter* opticalFlowSpeedFiltered;
+        flair::filter::CvtColor* greyCameraImage;
+        flair::core::AhrsData *customReferenceOrientation;
+
+    private:
+        flair::filter::OpticalFlow *opticalFlow;
+        flair::filter::OpticalFlowSpeed *opticalFlowSpeed;
+};
+
+#endif // DEMOOPTICALFLOW_H
Index: /trunk/demos/OpticalFlow/uav/src/main.cpp
===================================================================
--- /trunk/demos/OpticalFlow/uav/src/main.cpp	(revision 122)
+++ /trunk/demos/OpticalFlow/uav/src/main.cpp	(revision 122)
@@ -0,0 +1,107 @@
+//  created:    2011/05/01
+//  filename:   main.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    exemple de code x4
+//
+//
+/*********************************************************************/
+
+#include "DemoOpticalFlow.h"
+#include <UavFactory.h>
+#include <FrameworkManager.h>
+#include <stdio.h>
+#include <tclap/CmdLine.h>
+#include <TargetEthController.h>
+#include <init.h>
+
+using namespace TCLAP;
+using namespace std;
+using namespace flair::core;
+using namespace flair::meta;
+using namespace flair::sensor;
+
+string uav_type;
+string dsp_file;
+string log_path;
+int port;
+int ds3port;
+string xml_file;
+string name;
+string address;
+
+void parseOptions(int argc, char** argv);
+
+
+int main(int argc, char* argv[]) {
+    parseOptions(argc,argv);
+
+    FrameworkManager *manager;
+    manager= new FrameworkManager(name);
+    manager->SetupConnection(address,port);
+    manager->SetupUserInterface(xml_file);
+    manager->SetupLogger(log_path);
+    SetupDSP(dsp_file);
+
+    Uav* drone=CreateUav(name,uav_type);
+    TargetEthController *controller=new TargetEthController(manager,"Dualshock3",ds3port);
+    DemoOpticalFlow* demo=new DemoOpticalFlow(controller);
+
+    demo->Start();
+    demo->Join();
+
+    delete manager;
+
+    CloseDSP();
+}
+
+void parseOptions(int argc, char** argv)
+{
+	try
+	{
+
+        CmdLine cmd("Command description message", ' ', "0.1");
+
+        ValueArg<string> nameArg("n","name","uav name",true,"x4","string");
+        cmd.add( nameArg );
+
+        ValueArg<string> typeArg("t","type","uav type: ardrone2, hds_x4, hds_x8, hds_xufo, hds_simu or hds_simux (with x the number of the simulated uav)",true,"hds_x4","string");
+        cmd.add( typeArg );
+
+        ValueArg<string> dspArg("v","dsp","executable dsp",true,"./dspcv_dsp.out","string");
+        cmd.add( dspArg );
+
+        ValueArg<string> xmlArg("x","xml","fichier xml",true,"./reglages.xml","string");
+        cmd.add( xmlArg );
+
+        ValueArg<string> logsArg("l","logs","repertoire des logs",true,"/media/ram","string");
+        cmd.add( logsArg );
+
+        ValueArg<int> portArg("p","port","port pour station sol",true,9000,"int");
+        cmd.add( portArg );
+
+        ValueArg<string> addressArg("a","address","addresse station sol",true,"127.0.0.1","string");
+        cmd.add( addressArg );
+
+        ValueArg<int> ds3portArg("d","ds3_port","port pour ds3",false,20000,"int");
+        cmd.add( ds3portArg );
+
+        cmd.parse( argc, argv );
+
+        // Get the value parsed by each arg.
+        uav_type=typeArg.getValue();
+        dsp_file = dspArg.getValue();
+        log_path = logsArg.getValue();
+        port=portArg.getValue();
+        ds3port=ds3portArg.getValue();
+        xml_file = xmlArg.getValue();
+        name=nameArg.getValue();
+        address=addressArg.getValue();
+
+	} catch (ArgException &e)  // catch any exceptions
+	{ cerr << "error: " << e.error() << " for arg " << e.argId() << endl; }
+}
Index: /trunk/demos/SimpleFleet/uav/src/SimpleFleet.cpp
===================================================================
--- /trunk/demos/SimpleFleet/uav/src/SimpleFleet.cpp	(revision 121)
+++ /trunk/demos/SimpleFleet/uav/src/SimpleFleet.cpp	(revision 122)
@@ -50,16 +50,21 @@
 
 
-SimpleFleet::SimpleFleet(flair::meta::Uav* uav,string broadcast,TargetController *controller): UavStateMachine(uav,controller), behaviourMode(BehaviourMode_t::Default), vrpnLost(false) {
-    uav->SetupVRPNAutoIP(uav->ObjectName());
-
-    circle=new TrajectoryGenerator2DCircle(uav->GetVrpnClient()->GetLayout()->NewRow(),"circle");
-    uav->GetVrpnObject()->xPlot()->AddCurve(circle->Matrix()->Element(0,0),0,0,255);
-    uav->GetVrpnObject()->yPlot()->AddCurve(circle->Matrix()->Element(0,1),0,0,255);
-    uav->GetVrpnObject()->VxPlot()->AddCurve(circle->Matrix()->Element(1,0),0,0,255);
-    uav->GetVrpnObject()->VyPlot()->AddCurve(circle->Matrix()->Element(1,1),0,0,255);
-
-    xCircleCenter=new DoubleSpinBox(uav->GetVrpnClient()->GetLayout()->NewRow(),"x circle center"," m",-5,5,0.1,1,0);
-    yCircleCenter=new DoubleSpinBox(uav->GetVrpnClient()->GetLayout()->NewRow(),"y circle center"," m",-5,5,0.1,1,0);
-    yDisplacement=new DoubleSpinBox(uav->GetVrpnClient()->GetLayout()->NewRow(),"y displacement"," m",0,2,0.1,1,0);
+SimpleFleet::SimpleFleet(string broadcast,TargetController *controller): UavStateMachine(controller), behaviourMode(BehaviourMode_t::Default), vrpnLost(false) {
+    Uav* uav=GetUav();
+		
+		VrpnClient* vrpnclient=new VrpnClient("vrpn", uav->GetDefaultVrpnAddress(),10000, 80);
+		uavVrpn = new MetaVrpnObject(uav->ObjectName());
+		getFrameworkManager()->AddDeviceToLog(uavVrpn);
+		uav->GetAhrs()->YawPlot()->AddCurve(uavVrpn->State()->Element(2),DataPlot::Green);
+
+    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);
+
+    xCircleCenter=new DoubleSpinBox(vrpnclient->GetLayout()->NewRow(),"x circle center"," m",-5,5,0.1,1,0);
+    yCircleCenter=new DoubleSpinBox(vrpnclient->GetLayout()->NewRow(),"y circle center"," m",-5,5,0.1,1,0);
+    yDisplacement=new DoubleSpinBox(vrpnclient->GetLayout()->NewRow(),"y displacement"," m",0,2,0.1,1,0);
 
     //parent->AddDeviceToLog(Uz());
@@ -101,5 +106,5 @@
     //get yaw from vrpn
     Euler vrpnEuler;
-    GetUav()->GetVrpnObject()->GetEuler(vrpnEuler);
+    uavVrpn->GetEuler(vrpnEuler);
 
     //get roll, pitch and w from imu
@@ -120,6 +125,6 @@
     Vector3D uav_pos,uav_vel;
 
-    GetUav()->GetVrpnObject()->GetPosition(uav_pos);
-    GetUav()->GetVrpnObject()->GetSpeed(uav_vel);
+    uavVrpn->GetPosition(uav_pos);
+    uavVrpn->GetSpeed(uav_vel);
     //z and dz must be in uav's frame
     z=-uav_pos.z;
@@ -154,7 +159,7 @@
     Euler vrpn_euler; // in VRPN coordinate system
 
-    GetUav()->GetVrpnObject()->GetPosition(uav_pos);
-    GetUav()->GetVrpnObject()->GetSpeed(uav_vel);
-    GetUav()->GetVrpnObject()->GetEuler(vrpn_euler);
+    uavVrpn->GetPosition(uav_pos);
+    uavVrpn->GetSpeed(uav_vel);
+    uavVrpn->GetEuler(vrpn_euler);
 
     uav_pos.To2Dxy(uav_2Dpos);
@@ -294,5 +299,5 @@
 void SimpleFleet::ExtraSecurityCheck(void) {
     if (!vrpnLost && behaviourMode!=BehaviourMode_t::Default) {
-        if (!GetUav()->GetVrpnObject()->IsTracked(500)) {
+        if (!uavVrpn->IsTracked(500)) {
             Thread::Err("Optitrack, uav lost\n");
             vrpnLost=true;
@@ -322,5 +327,5 @@
     circle->SetCenter(target_2Dpos);
 
-    GetUav()->GetVrpnObject()->GetPosition(uav_pos);
+    uavVrpn->GetPosition(uav_pos);
     uav_pos.To2Dxy(uav_2Dpos);
     circle->StartTraj(uav_2Dpos,1);
@@ -347,8 +352,8 @@
     }
 
-    GetUav()->GetVrpnObject()->GetEuler(vrpn_euler);
+    uavVrpn->GetEuler(vrpn_euler);
     yaw_hold=vrpn_euler.yaw;
 
-    GetUav()->GetVrpnObject()->GetPosition(vrpn_pos);
+    uavVrpn->GetPosition(vrpn_pos);
     vrpn_pos.To2Dxy(pos_hold);
 
Index: /trunk/demos/SimpleFleet/uav/src/SimpleFleet.h
===================================================================
--- /trunk/demos/SimpleFleet/uav/src/SimpleFleet.h	(revision 121)
+++ /trunk/demos/SimpleFleet/uav/src/SimpleFleet.h	(revision 122)
@@ -26,4 +26,7 @@
         class TrajectoryGenerator2DCircle;
     }
+		namespace meta {
+        class MetaVrpnObject;
+    }
     namespace gui {
         class DoubleSpinBox;
@@ -34,5 +37,5 @@
 class SimpleFleet : public flair::meta::UavStateMachine {
     public:
-        SimpleFleet(flair::meta::Uav* uav,std::string broadcast,flair::sensor::TargetController *controller);
+        SimpleFleet(std::string broadcast,flair::sensor::TargetController *controller);
         ~SimpleFleet();
 
@@ -75,4 +78,5 @@
         flair::gui::DoubleSpinBox *xCircleCenter,*yCircleCenter,*yDisplacement;
         flair::core::AhrsData *customReferenceOrientation,*customOrientation;
+				flair::meta::MetaVrpnObject *uavVrpn;
 };
 
Index: /trunk/demos/SimpleFleet/uav/src/main.cpp
===================================================================
--- /trunk/demos/SimpleFleet/uav/src/main.cpp	(revision 121)
+++ /trunk/demos/SimpleFleet/uav/src/main.cpp	(revision 122)
@@ -46,7 +46,7 @@
     manager->SetupUserInterface(xml_file);
 
-    Uav* drone=CreateUav(manager,name,uav_type);
+    Uav* drone=CreateUav(name,uav_type);
     TargetEthController *controller=new TargetEthController(manager,"Dualshock3",ds3port);
-    SimpleFleet* demo=new SimpleFleet(drone,broadcast,controller);
+    SimpleFleet* demo=new SimpleFleet(broadcast,controller);
 
     demo->Start();
Index: /trunk/demos/Skeletons/CustomReferenceAngles/CMakeLists.txt
===================================================================
--- /trunk/demos/Skeletons/CustomReferenceAngles/CMakeLists.txt	(revision 121)
+++ /trunk/demos/Skeletons/CustomReferenceAngles/CMakeLists.txt	(revision 122)
@@ -6,5 +6,4 @@
 SET(FLAIR_USE_SENSOR_ACTUATOR TRUE)
 SET(FLAIR_USE_META TRUE)
-SET(FLAIR_USE_VRPN TRUE)
 
 include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
Index: /trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.cpp
===================================================================
--- /trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.cpp	(revision 121)
+++ /trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.cpp	(revision 122)
@@ -29,10 +29,10 @@
 using namespace flair::sensor;
 
-MyApp::MyApp(Uav* uav,TargetController *controller): UavStateMachine(uav,controller), behaviourMode(BehaviourMode_t::Default) {
+MyApp::MyApp(TargetController *controller): UavStateMachine(controller), behaviourMode(BehaviourMode_t::Default) {
     start_CustomAngles=new PushButton(GetButtonsLayout()->NewRow(),"start CustomReferenceAngles");
     stop_CustomAngles=new PushButton(GetButtonsLayout()->NewRow(),"stop CustomReferenceAngles");
 
     customReferenceOrientation= new AhrsData(this,"reference");
-    uav->GetAhrs()->AddPlot(customReferenceOrientation,DataPlot::Yellow);
+    GetUav()->GetAhrs()->AddPlot(customReferenceOrientation,DataPlot::Yellow);
     AddDataToControlLawLog(customReferenceOrientation);
 }
Index: /trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.h
===================================================================
--- /trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.h	(revision 121)
+++ /trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.h	(revision 122)
@@ -31,5 +31,5 @@
 class MyApp : public flair::meta::UavStateMachine {
     public:
-        MyApp(flair::meta::Uav* uav,flair::sensor::TargetController *controller);
+        MyApp(flair::sensor::TargetController *controller);
         ~MyApp();
 
Index: /trunk/demos/Skeletons/CustomReferenceAngles/src/main.cpp
===================================================================
--- /trunk/demos/Skeletons/CustomReferenceAngles/src/main.cpp	(revision 121)
+++ /trunk/demos/Skeletons/CustomReferenceAngles/src/main.cpp	(revision 122)
@@ -44,7 +44,7 @@
     manager->SetupLogger(log_path);
 
-    Uav* drone=CreateUav(manager,name,uav_type);
+    Uav* drone=CreateUav(name,uav_type);
     TargetEthController *controller=new TargetEthController(manager,"Dualshock3",ds3port);
-    MyApp* app=new MyApp(drone,controller);
+    MyApp* app=new MyApp(controller);
 
     app->Start();
Index: /trunk/demos/Skeletons/CustomTorques/CMakeLists.txt
===================================================================
--- /trunk/demos/Skeletons/CustomTorques/CMakeLists.txt	(revision 121)
+++ /trunk/demos/Skeletons/CustomTorques/CMakeLists.txt	(revision 122)
@@ -6,5 +6,4 @@
 SET(FLAIR_USE_SENSOR_ACTUATOR TRUE)
 SET(FLAIR_USE_META TRUE)
-SET(FLAIR_USE_VRPN TRUE)
 
 include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
Index: /trunk/demos/Skeletons/CustomTorques/src/MyApp.cpp
===================================================================
--- /trunk/demos/Skeletons/CustomTorques/src/MyApp.cpp	(revision 121)
+++ /trunk/demos/Skeletons/CustomTorques/src/MyApp.cpp	(revision 122)
@@ -26,5 +26,5 @@
 using namespace flair::sensor;
 
-MyApp::MyApp(Uav* uav,TargetController *controller): UavStateMachine(uav,controller), behaviourMode(BehaviourMode_t::Default) {
+MyApp::MyApp(TargetController *controller): UavStateMachine(controller), behaviourMode(BehaviourMode_t::Default) {
     start_CustomTorques=new PushButton(GetButtonsLayout()->NewRow(),"start CustomTorques");
     stop_CustomTorques=new PushButton(GetButtonsLayout()->NewRow(),"stop CustomTorques");
Index: /trunk/demos/Skeletons/CustomTorques/src/MyApp.h
===================================================================
--- /trunk/demos/Skeletons/CustomTorques/src/MyApp.h	(revision 121)
+++ /trunk/demos/Skeletons/CustomTorques/src/MyApp.h	(revision 122)
@@ -28,5 +28,5 @@
 class MyApp : public flair::meta::UavStateMachine {
     public:
-        MyApp(flair::meta::Uav* uav,flair::sensor::TargetController *controller);
+        MyApp(flair::sensor::TargetController *controller);
         ~MyApp();
 
Index: /trunk/demos/Skeletons/CustomTorques/src/main.cpp
===================================================================
--- /trunk/demos/Skeletons/CustomTorques/src/main.cpp	(revision 121)
+++ /trunk/demos/Skeletons/CustomTorques/src/main.cpp	(revision 122)
@@ -45,7 +45,7 @@
     manager->SetupLogger(log_path);
 
-    Uav* drone=CreateUav(manager,name,uav_type);
+    Uav* drone=CreateUav(name,uav_type);
     TargetEthController *controller=new TargetEthController(manager,"Dualshock3",ds3port);
-    MyApp* app=new MyApp(drone,controller);
+    MyApp* app=new MyApp(controller);
 
     app->Start();
Index: unk/lib/FlairCore/src/Buffer.cpp
===================================================================
--- /trunk/lib/FlairCore/src/Buffer.cpp	(revision 121)
+++ 	(revision )
@@ -1,36 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-//  created:    2016/12/22
-//  filename:   Buffer.cpp
-//
-//  author:     Guillaume Sanahuja
-//              Copyright Heudiasyc UMR UTC/CNRS 7253
-//
-//  version:    $Id: $
-//
-//  purpose:    Class defining a buffer, not for real time use
-//
-/*********************************************************************/
-
-#include "Buffer.h"
-
-using std::string;
-
-namespace flair {
-namespace core {
-
-Buffer::Buffer(const Object *parent, string name)
-    : io_data(parent, name, 1), dataType() {
- 
-}
-
-Buffer::~Buffer() {
- 
-}
-
-void Buffer::CopyDatas(char *dst) const { Warn("non implementé\n"); }
-
-} // end namespace core
-} // end namespace flair
Index: unk/lib/FlairCore/src/Buffer.h
===================================================================
--- /trunk/lib/FlairCore/src/Buffer.h	(revision 121)
+++ 	(revision )
@@ -1,79 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-/*!
- * \file Buffer.h
- * \brief Class defining a buffer, not for real time use
- * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
- * \date 2016/12/22
- * \version 4.0
- */
-
-#ifndef BUFFER_H
-#define BUFFER_H
-
-#include <io_data.h>
-#include <stdint.h>
-
-namespace flair {
-namespace core {
-/*! \class Buffer
-*
-* \brief Class defining a buffer, not for real time use
-*
-*
-*/
-class Buffer : public io_data {
-public:
-  class Type : public DataType {
-  public:
-    Type() {}
-
-    size_t GetSize() const {
-    }
-		
-    std::string GetDescription() const { return "buffer"; };
-
-  private:
-  };
-
-  /*!
-  * \brief Constructor
-  *
-  * Construct a buffer.
-  *
-  * \param parent parent
-  * \param name name
-	* 
-  */
-  Buffer(const Object *parent, std::string name = "");
-
-  /*!
-  * \brief Destructor
-  *
-  */
-  ~Buffer();
-
- 
-
-  Type const &GetDataType() const { return dataType; };
-
-private:
-  /*!
-  * \brief Copy datas
-  *
-  * Reimplemented from io_data. \n
-  * See io_data::CopyDatas.
-  *
-  * \param dst destination buffer
-  */
-  void CopyDatas(char *dst) const;
-
-  Type dataType;
-};
-
-} // end namespace core
-} // end namespace flair
-
-#endif // BUFFER_H
Index: /trunk/lib/FlairCore/src/FrameworkManager.cpp
===================================================================
--- /trunk/lib/FlairCore/src/FrameworkManager.cpp	(revision 121)
+++ /trunk/lib/FlairCore/src/FrameworkManager.cpp	(revision 122)
@@ -178,4 +178,8 @@
 }
 
+bool FrameworkManager::IsDeviceLogged(const IODevice *device) const {
+	return pimpl_->IsDeviceLogged(device);
+}
+
 void FrameworkManager::StartLog(void) { pimpl_->StartLog(); }
 
Index: /trunk/lib/FlairCore/src/FrameworkManager.h
===================================================================
--- /trunk/lib/FlairCore/src/FrameworkManager.h	(revision 121)
+++ /trunk/lib/FlairCore/src/FrameworkManager.h	(revision 122)
@@ -121,4 +121,14 @@
   */
   void AddDeviceToLog(IODevice *device);
+	
+	/*!
+  * \brief Is device logged
+  *
+  * Check if AddDeviceToLog was called for an IODevice
+  *
+  * \param device IODevice to check
+  * \return true if AddDeviceToLog was called for this IODevice
+  */
+  bool IsDeviceLogged(const IODevice *device) const;
 
   /*!
Index: /trunk/lib/FlairCore/src/FrameworkManager_impl.cpp
===================================================================
--- /trunk/lib/FlairCore/src/FrameworkManager_impl.cpp	(revision 121)
+++ /trunk/lib/FlairCore/src/FrameworkManager_impl.cpp	(revision 122)
@@ -630,5 +630,6 @@
 
   if (is_logging == false) {
-    if (device->pimpl_->SetToBeLogged()) {
+    if (!device->pimpl_->IsSetToBeLogged()) {
+			device->pimpl_->SetToBeLogged();
       log_desc_t tmp;
       tmp.device = device;
@@ -640,4 +641,8 @@
     Err("impossible while logging\n");
   }
+}
+
+bool FrameworkManager_impl::IsDeviceLogged(const IODevice *device) const {
+	return device->pimpl_->IsSetToBeLogged();
 }
 
Index: /trunk/lib/FlairCore/src/IODevice_impl.cpp
===================================================================
--- /trunk/lib/FlairCore/src/IODevice_impl.cpp	(revision 121)
+++ /trunk/lib/FlairCore/src/IODevice_impl.cpp	(revision 122)
@@ -106,16 +106,19 @@
 }
 
-bool IODevice_impl::SetToBeLogged(void) {
+bool IODevice_impl::IsSetToBeLogged(void) const{
+	return tobelogged;
+}
+
+void IODevice_impl::SetToBeLogged(void) {
   if (!tobelogged) {
     tobelogged = true;
-    return true;
   } else {
     self->Warn("already added to log\n");
-    return false;
   }
 }
 
 void IODevice_impl::WriteLogsDescriptors(fstream &desc_file, int *index) {
-  // own descriptor
+  //Printf("WriteLogsDescriptors %s\n",self->ObjectName().c_str());
+	// own descriptor
   for (size_t i = 0; i < datasToLog.size(); i++)
     datasToLog.at(i)->pimpl_->WriteLogDescriptor(desc_file, index);
@@ -127,4 +130,5 @@
   for (size_t i = 0; i < devicesToLog.size(); i++)
     devicesToLog.at(i)->pimpl_->WriteLogsDescriptors(desc_file, index);
+	//Printf("WriteLogsDescriptors %s ok\n",self->ObjectName().c_str());
 }
 
@@ -194,9 +198,9 @@
 
 void IODevice_impl::AppendLog(char **ptr) {
-  // Printf("AppendLog %s %x\n",self->ObjectName().c_str(),*ptr);
+   //Printf("AppendLog %s %x\n",self->ObjectName().c_str(),*ptr);
 
   // copy state to buf
   for (size_t i = 0; i < datasToLog.size(); i++) {
-    // printf("copy\n");
+    // printf("copy %s\n",datasToLog.at(i)->ObjectName().c_str());
     datasToLog.at(i)->CopyDatas(*ptr);
     (*ptr) += datasToLog.at(i)->GetDataType().GetSize();
Index: /trunk/lib/FlairCore/src/io_data_impl.cpp
===================================================================
--- /trunk/lib/FlairCore/src/io_data_impl.cpp	(revision 121)
+++ /trunk/lib/FlairCore/src/io_data_impl.cpp	(revision 122)
@@ -42,4 +42,5 @@
 
 void io_data_impl::WriteLogDescriptor(std::fstream &desc_file, int *index) {
+	if(descriptors.size()==0) self->Warn("AppendLogDescription was not called for this object.\n");
   for (size_t i = 0; i < descriptors.size(); i++) {
     desc_file << (*index)++ << ": " << self->ObjectName() << " - "
Index: /trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h
===================================================================
--- /trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h	(revision 121)
+++ /trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h	(revision 122)
@@ -48,4 +48,5 @@
   void SetupLogger(std::string log_path);
   void AddDeviceToLog(flair::core::IODevice *device);
+	bool IsDeviceLogged(const flair::core::IODevice *device) const;
   void StartLog();
   void StopLog();
Index: /trunk/lib/FlairCore/src/unexported/IODevice_impl.h
===================================================================
--- /trunk/lib/FlairCore/src/unexported/IODevice_impl.h	(revision 121)
+++ /trunk/lib/FlairCore/src/unexported/IODevice_impl.h	(revision 122)
@@ -42,5 +42,6 @@
   void WriteLog(flair::core::Time time);
   void AddDeviceToLog(const flair::core::IODevice *device);
-  bool SetToBeLogged(void); // return true if possible
+  void SetToBeLogged(void); 
+	bool IsSetToBeLogged(void) const;
   void OutputToShMem(bool enabled);
   void WriteToShMem(void);
Index: /trunk/lib/FlairMeta/src/HdsX8.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/HdsX8.cpp	(revision 121)
+++ /trunk/lib/FlairMeta/src/HdsX8.cpp	(revision 122)
@@ -35,32 +35,20 @@
 namespace meta {
 
-HdsX8::HdsX8(FrameworkManager *parent, string uav_name,
+HdsX8::HdsX8(string name,
              filter::UavMultiplex *multiplex)
-    : Uav(parent, uav_name, multiplex) {
-  RTDM_I2cPort *i2cport = new RTDM_I2cPort(parent, "rtdm_i2c", "rti2c3");
-  RTDM_SerialPort *imu_port = new RTDM_SerialPort(parent, "imu_port", "rtser1");
+    : Uav(name, multiplex) {
+  RTDM_I2cPort *i2cport = new RTDM_I2cPort(getFrameworkManager(), "rtdm_i2c", "rti2c3");
+  RTDM_SerialPort *imu_port = new RTDM_SerialPort(getFrameworkManager(), "imu_port", "rtser1");
 
   if (multiplex == NULL)
-    SetMultiplex(new X4X8Multiplex(parent, "motors", X4X8Multiplex::X8));
+    SetMultiplex(new X4X8Multiplex(getFrameworkManager(), "motors", X4X8Multiplex::X8));
 
   SetBldc(new BlCtrlV2(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
                        "motors", GetUavMultiplex()->MotorsCount(), i2cport));
-  SetUsRangeFinder(new Srf08(parent, "SRF08", i2cport, 0x70, 60));
-  SetAhrs(new Gx3_25_ahrs(parent, "imu", imu_port,
+  SetUsRangeFinder(new Srf08(getFrameworkManager(), "SRF08", i2cport, 0x70, 60));
+  SetAhrs(new Gx3_25_ahrs(getFrameworkManager(), "imu", imu_port,
                           Gx3_25_imu::AccelerationAngularRateAndOrientationMatrix, 70));
   SetBatteryMonitor(((BlCtrlV2 *)GetBldc())->GetBatteryMonitor());
-
-  /*
-          if(VRPNType==Auto || VRPNType==AutoSerialPort)
-          {
-              RTDM_SerialPort* vrpn_port=new
-     RTDM_SerialPort(parent,"vrpn_port","rtser3");
-
-              vrpnclient=new VrpnClient(parent,"vrpn",vrpn_port,10000,80);
-              uav_vrpn=new
-     MetaVrpnObject(vrpnclient,uav_name,VRPNSerialObjectId);
-          }
-  */
-  SetVerticalCamera(new Ps3Eye(parent, "camv", 0, 50));
+  SetVerticalCamera(new Ps3Eye(getFrameworkManager(), "camv", 0, 50));
 }
 
@@ -71,5 +59,4 @@
   ((Srf08 *)GetUsRangeFinder())->Start();
   ((Ps3Eye *)GetVerticalCamera())->Start();
-  Uav::StartSensors();
 }
 
Index: /trunk/lib/FlairMeta/src/HdsX8.h
===================================================================
--- /trunk/lib/FlairMeta/src/HdsX8.h	(revision 121)
+++ /trunk/lib/FlairMeta/src/HdsX8.h	(revision 122)
@@ -24,8 +24,9 @@
 class HdsX8 : public Uav {
 public:
-  HdsX8(core::FrameworkManager *parent, std::string uav_name,
+  HdsX8(std::string name,
         filter::UavMultiplex *multiplex = NULL);
   ~HdsX8();
   void StartSensors(void);
+	std::string GetDefaultVrpnAddress(void) const{return "192.168.147.197:3883";}
 
 private:
Index: /trunk/lib/FlairMeta/src/MetaVrpnObject.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/MetaVrpnObject.cpp	(revision 121)
+++ /trunk/lib/FlairMeta/src/MetaVrpnObject.cpp	(revision 122)
@@ -39,16 +39,16 @@
 namespace meta {
 
-MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent, string name)
-    : VrpnObject(parent, name, parent->GetTabWidget()) {
-  ConstructorCommon(parent, name);
+MetaVrpnObject::MetaVrpnObject(string name)
+    : VrpnObject( name, GetVrpnClient()->GetTabWidget()) {
+  ConstructorCommon(name);
 }
 
-MetaVrpnObject::MetaVrpnObject(const VrpnClient *parent, std::string name,
+MetaVrpnObject::MetaVrpnObject(std::string name,
                                uint8_t id)
-    : VrpnObject(parent, name, id, parent->GetTabWidget()) {
-  ConstructorCommon(parent, name);
+    : VrpnObject(name, id, GetVrpnClient()->GetTabWidget()) {
+  ConstructorCommon( name);
 }
 
-void MetaVrpnObject::ConstructorCommon(const VrpnClient *parent, string name) {
+void MetaVrpnObject::ConstructorCommon(string name) {
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(6, 1);
   for (int i = 0; i < 6; i++) {
@@ -60,5 +60,5 @@
   }
 
-  pbas = new LowPassFilter(this, parent->GetLayout()->NewRow(),
+  pbas = new LowPassFilter(this, GetVrpnClient()->GetLayout()->NewRow(),
                            name + " Passe bas", prev_value);
 
@@ -72,5 +72,5 @@
   }
 
-  euler = new EulerDerivative(pbas, parent->GetLayout()->NewRow(),
+  euler = new EulerDerivative(pbas, GetVrpnClient()->GetLayout()->NewRow(),
                               name + "_euler", prev_value);
 
@@ -82,5 +82,5 @@
   vz_opti_plot->AddCurve(euler->Matrix()->Element(5));
 
-  plot_tab = new Tab(parent->GetTabWidget(), "Mesures (xy) " + name);
+  plot_tab = new Tab(GetVrpnClient()->GetTabWidget(), "Mesures (xy) " + name);
   xy_plot = new DataPlot2D(plot_tab->NewRow(), "xy", "y", -5, 5, "x", -5, 5);
   xy_plot->AddCurve(Output()->Element(4, 0), Output()->Element(3, 0));
Index: /trunk/lib/FlairMeta/src/MetaVrpnObject.h
===================================================================
--- /trunk/lib/FlairMeta/src/MetaVrpnObject.h	(revision 121)
+++ /trunk/lib/FlairMeta/src/MetaVrpnObject.h	(revision 122)
@@ -18,20 +18,17 @@
 
 namespace flair {
-namespace core {
-class Vector3D;
-class FloatType;
-}
-namespace gui {
-class DataPlot1D;
-class DataPlot2D;
-class Tab;
-}
-namespace filter {
-class EulerDerivative;
-class LowPassFilter;
-}
-namespace sensor {
-class VrpnClient;
-}
+	namespace core {
+		class Vector3D;
+		class FloatType;
+	}
+	namespace gui {
+		class DataPlot1D;
+		class DataPlot2D;
+		class Tab;
+	}
+	namespace filter {
+		class EulerDerivative;
+		class LowPassFilter;
+	}
 }
 
@@ -47,7 +44,6 @@
 class MetaVrpnObject : public sensor::VrpnObject {
 public:
-  MetaVrpnObject(const sensor::VrpnClient *parent, std::string name);
-  MetaVrpnObject(const sensor::VrpnClient *parent, std::string name,
-                 uint8_t id);
+  MetaVrpnObject(std::string name);
+  MetaVrpnObject(std::string name,uint8_t id);
   ~MetaVrpnObject();
   gui::DataPlot1D *VxPlot(void) const; // 1,0
@@ -58,5 +54,5 @@
 
 private:
-  void ConstructorCommon(const sensor::VrpnClient *parent, std::string name);
+  void ConstructorCommon(std::string name);
   filter::LowPassFilter *pbas;
   filter::EulerDerivative *euler;
Index: /trunk/lib/FlairMeta/src/SimuX4.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/SimuX4.cpp	(revision 121)
+++ /trunk/lib/FlairMeta/src/SimuX4.cpp	(revision 122)
@@ -37,20 +37,20 @@
 namespace meta {
 
-SimuX4::SimuX4(FrameworkManager *parent, string uav_name, int simu_id,
+SimuX4::SimuX4(string name, int simu_id,
                filter::UavMultiplex *multiplex)
-    : Uav(parent, uav_name, multiplex) {
+    : Uav(name, multiplex) {
 
   if (multiplex == NULL)
-    SetMultiplex(new X4X8Multiplex(parent, "motors", X4X8Multiplex::X4));
+    SetMultiplex(new X4X8Multiplex(getFrameworkManager(), "motors", X4X8Multiplex::X4));
 
   SetBldc(new SimuBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
                        "motors", GetUavMultiplex()->MotorsCount(), simu_id));
-  SetUsRangeFinder(new SimuUs(parent, "us", simu_id, 60));
-  SetAhrs(new SimuAhrs(parent, "imu", simu_id, 70));
-  Tab *bat_tab = new Tab(parent->GetTabWidget(), "battery");
+  SetUsRangeFinder(new SimuUs(getFrameworkManager(), "us", simu_id, 60));
+  SetAhrs(new SimuAhrs(getFrameworkManager(), "imu", simu_id, 70));
+  Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery");
   SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
   GetBatteryMonitor()->SetBatteryValue(12);
   SetVerticalCamera(
-      new SimuCamera(parent, "simu_cam_v", 320, 240, 3, simu_id, 10));
+      new SimuCamera(getFrameworkManager(), "simu_cam_v", 320, 240, 3, simu_id, 10));
 }
 
@@ -61,8 +61,5 @@
   ((SimuUs *)GetUsRangeFinder())->Start();
   ((SimuCamera *)GetVerticalCamera())->Start();
-  Uav::StartSensors();
 }
-
-void SimuX4::SetupVRPNAutoIP(string name) { SetupVRPN("127.0.0.1:3883", name); }
 
 } // end namespace meta
Index: /trunk/lib/FlairMeta/src/SimuX4.h
===================================================================
--- /trunk/lib/FlairMeta/src/SimuX4.h	(revision 121)
+++ /trunk/lib/FlairMeta/src/SimuX4.h	(revision 122)
@@ -26,9 +26,8 @@
   // simu_id: 0 if simulating only one UAV
   //>0 otherwise
-  SimuX4(core::FrameworkManager *parent, std::string uav_name, int simu_id = 0,
+  SimuX4(std::string name, int simu_id = 0,
          filter::UavMultiplex *multiplex = NULL);
   ~SimuX4();
   void StartSensors(void);
-  void SetupVRPNAutoIP(std::string name);
 };
 } // end namespace meta
Index: /trunk/lib/FlairMeta/src/SimuX8.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/SimuX8.cpp	(revision 121)
+++ /trunk/lib/FlairMeta/src/SimuX8.cpp	(revision 122)
@@ -37,20 +37,20 @@
 namespace meta {
 
-SimuX8::SimuX8(FrameworkManager *parent, string uav_name, int simu_id,
+SimuX8::SimuX8(string name, int simu_id,
                filter::UavMultiplex *multiplex)
-    : Uav(parent, uav_name, multiplex) {
+    : Uav(name, multiplex) {
 
   if (multiplex == NULL)
-    SetMultiplex(new X4X8Multiplex(parent, "motors", X4X8Multiplex::X8));
+    SetMultiplex(new X4X8Multiplex(getFrameworkManager(), "motors", X4X8Multiplex::X8));
 
   SetBldc(new SimuBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
                        "motors", GetUavMultiplex()->MotorsCount(), simu_id));
-  SetUsRangeFinder(new SimuUs(parent, "us", simu_id, 60));
-  SetAhrs(new SimuAhrs(parent, "imu", simu_id, 70));
-  Tab *bat_tab = new Tab(parent->GetTabWidget(), "battery");
+  SetUsRangeFinder(new SimuUs(getFrameworkManager(), "us", simu_id, 60));
+  SetAhrs(new SimuAhrs(getFrameworkManager(), "imu", simu_id, 70));
+  Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery");
   SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
   GetBatteryMonitor()->SetBatteryValue(12);
   SetVerticalCamera(
-      new SimuCamera(parent, "simu_cam_v", 320, 240, 3, simu_id, 10));
+      new SimuCamera(getFrameworkManager(), "simu_cam_v", 320, 240, 3, simu_id, 10));
 }
 
@@ -61,8 +61,5 @@
   ((SimuUs *)GetUsRangeFinder())->Start();
   ((SimuCamera *)GetVerticalCamera())->Start();
-  Uav::StartSensors();
 }
-
-void SimuX8::SetupVRPNAutoIP(string name) { SetupVRPN("127.0.0.1:3883", name); }
 
 } // end namespace meta
Index: /trunk/lib/FlairMeta/src/SimuX8.h
===================================================================
--- /trunk/lib/FlairMeta/src/SimuX8.h	(revision 121)
+++ /trunk/lib/FlairMeta/src/SimuX8.h	(revision 122)
@@ -26,9 +26,8 @@
   // simu_id: 0 if simulating only one UAV
   //>0 otherwise
-  SimuX8(core::FrameworkManager *parent, std::string uav_name, int simu_id = 0,
+  SimuX8(std::string name, int simu_id = 0,
          filter::UavMultiplex *multiplex = NULL);
   ~SimuX8();
   void StartSensors(void);
-  void SetupVRPNAutoIP(std::string name);
 };
 } // end namespace meta
Index: /trunk/lib/FlairMeta/src/Uav.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/Uav.cpp	(revision 121)
+++ /trunk/lib/FlairMeta/src/Uav.cpp	(revision 122)
@@ -38,11 +38,21 @@
 using namespace flair::actuator;
 
+namespace {
+  flair::meta::Uav *uavSingleton = NULL;
+}
+
 namespace flair {
 namespace meta {
 
-Uav::Uav(FrameworkManager *parent, string name, UavMultiplex *multiplex)
-    : Object(parent, name) {
-  vrpnclient = NULL;
-  uav_vrpn = NULL;
+Uav *GetUav(void) { return uavSingleton; }
+	
+Uav::Uav(string name, UavMultiplex *multiplex)
+    : Object(getFrameworkManager(), name) {
+	if (uavSingleton != NULL) {
+    Err("Uav must be instanced only one time\n");
+    return;
+  }
+
+  uavSingleton = this;
   verticalCamera = NULL;
   horizontalCamera = NULL;
@@ -82,35 +92,5 @@
   horizontalCamera = (Camera *)inHorizontalCamera;
 }
-/*
-void Uav::SetupVRPNSerial(SerialPort *vrpn_port,string name,int
-VRPNSerialObjectId) {
-    vrpnclient=new VrpnClient(getFrameworkManager(),"vrpn",vrpn_port,10000,80);
-    uav_vrpn=new MetaVrpnObject(vrpnclient,name,VRPNSerialObjectId);
 
-    getFrameworkManager()->AddDeviceToLog(uav_vrpn);
-}
-*/
-void Uav::SetupVRPNAutoIP(string name) {
-  SetupVRPN("192.168.147.197:3883", name);
-}
-
-void Uav::SetupVRPN(string optitrack_address, string name) {
-  vrpnclient = new VrpnClient(getFrameworkManager(), "vrpn", optitrack_address,
-                              10000, 80);
-  uav_vrpn = new MetaVrpnObject(vrpnclient, name);
-
-  getFrameworkManager()->AddDeviceToLog(uav_vrpn);
-
-  GetAhrs()->YawPlot()->AddCurve(uav_vrpn->State()->Element(2),
-                                 DataPlot::Green);
-  // GetAhrs()->RollPlot()->AddCurve(uav_vrpn->State()->Element(0),DataPlot::Green);
-  // GetAhrs()->PitchPlot()->AddCurve(uav_vrpn->State()->Element(1),DataPlot::Green);
-}
-
-void Uav::StartSensors(void) {
-  if (vrpnclient != NULL) {
-    vrpnclient->Start();
-  }
-}
 void Uav::UseDefaultPlot(void) {
   multiplex->UseDefaultPlot();
@@ -184,12 +164,4 @@
 BatteryMonitor *Uav::GetBatteryMonitor(void) const { return battery; }
 
-VrpnClient *Uav::GetVrpnClient(void) const {
-  if (vrpnclient == NULL)
-    Err("vrpn is not setup, call SetupVRPN before\n");
-  return vrpnclient;
-}
-
-MetaVrpnObject *Uav::GetVrpnObject(void) const { return uav_vrpn; }
-
 Camera *Uav::GetVerticalCamera(void) const { return verticalCamera; }
 
Index: /trunk/lib/FlairMeta/src/Uav.h
===================================================================
--- /trunk/lib/FlairMeta/src/Uav.h	(revision 121)
+++ /trunk/lib/FlairMeta/src/Uav.h	(revision 122)
@@ -17,21 +17,17 @@
 
 namespace flair {
-namespace core {
-class FrameworkManager;
-}
-namespace filter {
-class Ahrs;
-class UavMultiplex;
-}
-namespace actuator {
-class Bldc;
-}
-namespace sensor {
-class UsRangeFinder;
-class BatteryMonitor;
-class VrpnClient;
-class Imu;
-class Camera;
-}
+	namespace filter {
+		class Ahrs;
+		class UavMultiplex;
+	}
+	namespace actuator {
+		class Bldc;
+	}
+	namespace sensor {
+		class UsRangeFinder;
+		class BatteryMonitor;
+		class Imu;
+		class Camera;
+	}
 }
 
@@ -39,32 +35,20 @@
 namespace meta {
 class MetaUsRangeFinder;
-class MetaVrpnObject;
 
 /*! \class Uav
 *
-* \brief Base class to construct sensors/actuators depending on uav type
+* \brief Base class to construct sensors/actuators depending on uav type.
+* The Object is created with 
+*  the FrameworkManager as parent. FrameworkManager must be created before.
+* Only one instance of this class is allowed by program.
 */
 class Uav : public core::Object {
 public:
-  /*
-      typedef enum {
-          None,
-          Auto,//rt serial if hds x4 ou x8, auto ip sinon
-          AutoIP,
-          UserDefinedIP,
-          AutoSerialPort,
-          } VRPNType_t;
-*/
-  // uav_name: for optitrack
-  Uav(core::FrameworkManager *parent, std::string name,
+
+  Uav(std::string name,
       filter::UavMultiplex *multiplex = NULL);
   ~Uav();
-  void SetupVRPN(std::string optitrack_address, std::string name);
-  // vrpn serial: broken, need to add serial port in uav specific code
-  // void SetupVRPNSerial(core::SerialPort *vrpn_port,std::string name,int
-  // VRPNSerialObjectId);
-  virtual void SetupVRPNAutoIP(std::string name);
 
-  virtual void StartSensors(void);
+  virtual void StartSensors(void)=0;
   void UseDefaultPlot(void);
   actuator::Bldc *GetBldc(void) const;
@@ -75,8 +59,7 @@
   sensor::UsRangeFinder *GetUsRangeFinder(void) const;
   sensor::BatteryMonitor *GetBatteryMonitor(void) const;
-  sensor::VrpnClient *GetVrpnClient(void) const;
-  meta::MetaVrpnObject *GetVrpnObject(void) const;
   sensor::Camera *GetVerticalCamera(void) const;
   sensor::Camera *GetHorizontalCamera(void) const;
+	virtual std::string GetDefaultVrpnAddress(void) const{return "127.0.0.1:3883";}
 
 protected:
@@ -96,9 +79,15 @@
   sensor::UsRangeFinder *us;
   MetaUsRangeFinder *meta_us;
-  sensor::VrpnClient *vrpnclient;
-  MetaVrpnObject *uav_vrpn;
   sensor::BatteryMonitor *battery;
   sensor::Camera *verticalCamera,*horizontalCamera;
 };
+
+/*!
+* \brief get Uav
+*
+* \return the Uav
+*/
+Uav *GetUav(void);
+
 } // end namespace meta
 } // end namespace flair
Index: /trunk/lib/FlairMeta/src/UavFactory.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/UavFactory.cpp	(revision 121)
+++ /trunk/lib/FlairMeta/src/UavFactory.cpp	(revision 122)
@@ -30,5 +30,5 @@
 
 namespace { // anonymous
-     vector<flair::meta::Uav* (*)(FrameworkManager*,string,string,UavMultiplex*)> *vectoroffunctions=NULL;
+     vector<flair::meta::Uav* (*)(string,string,UavMultiplex*)> *vectoroffunctions=NULL;
 }
 
@@ -41,5 +41,5 @@
 
 
-Uav *CreateUav(FrameworkManager *parent, string uav_name, string uav_type,
+Uav *CreateUav(string name, string uav_type,
                UavMultiplex *multiplex) {
 
@@ -48,5 +48,5 @@
   if(vectoroffunctions!=NULL) {
     for(int i=0;i<vectoroffunctions->size();i++) {
-      uav=vectoroffunctions->at(i)(parent, uav_name, uav_type,multiplex);
+      uav=vectoroffunctions->at(i)(name,uav_type,multiplex);
       if(uav!=NULL) {
         free(vectoroffunctions);
@@ -58,12 +58,12 @@
 
   if (uav_type == "hds_x4") {
-    parent->Err("UAV type %s not yet implemented\n", uav_type.c_str());
+    getFrameworkManager()->Err("UAV type %s not yet implemented\n", uav_type.c_str());
     return NULL;
   } else if (uav_type == "hds_x8") {
-    return new HdsX8(parent, uav_name, multiplex);
+    return new HdsX8(name, multiplex);
   } else if (uav_type == "xair") {
-    return new XAir(parent, uav_name, multiplex);
+    return new XAir(name, multiplex);
   } else if (uav_type == "hds_xufo") {
-    parent->Err("UAV type %s not yet implemented\n", uav_type.c_str());
+    getFrameworkManager()->Err("UAV type %s not yet implemented\n", uav_type.c_str());
     return NULL;
   } else if (uav_type.compare(0, 7, "x4_simu") == 0) {
@@ -72,5 +72,5 @@
       simu_id = atoi(uav_type.substr(7, uav_type.size() - 7).c_str());
     }
-    return new SimuX4(parent, uav_name, simu_id, multiplex);
+    return new SimuX4(name, simu_id, multiplex);
   } else if (uav_type.compare(0, 7, "x8_simu") == 0) {
     int simu_id = 0;
@@ -78,14 +78,14 @@
       simu_id = atoi(uav_type.substr(7, uav_type.size() - 7).c_str());
     }
-    return new SimuX8(parent, uav_name, simu_id, multiplex);
+    return new SimuX8(name, simu_id, multiplex);
   } else {
-    parent->Err("UAV type %s unknown\n", uav_type.c_str());
+    getFrameworkManager()->Err("UAV type %s unknown\n", uav_type.c_str());
     return NULL;
   }
 }
 
-void RegisterUavCreator(flair::meta::Uav*(*func)(FrameworkManager *parent, string uav_name, string uav_type,
+void RegisterUavCreator(flair::meta::Uav*(*func)(string name, string type,
                UavMultiplex *multiplex)) {
-  if(vectoroffunctions==NULL) vectoroffunctions=(vector<flair::meta::Uav* (*)(FrameworkManager*,string,string,UavMultiplex*)>*)malloc(sizeof(vector<flair::meta::Uav* (*)(FrameworkManager*,string,string,UavMultiplex*)>));
+  if(vectoroffunctions==NULL) vectoroffunctions=(vector<flair::meta::Uav* (*)(string,string,UavMultiplex*)>*)malloc(sizeof(vector<flair::meta::Uav* (*)(string,string,UavMultiplex*)>));
 
   vectoroffunctions->push_back(func);
Index: /trunk/lib/FlairMeta/src/UavFactory.h
===================================================================
--- /trunk/lib/FlairMeta/src/UavFactory.h	(revision 121)
+++ /trunk/lib/FlairMeta/src/UavFactory.h	(revision 122)
@@ -21,10 +21,8 @@
 #include <Uav.h>
 
-flair::meta::Uav *CreateUav(flair::core::FrameworkManager *parent,
-                            std::string uav_name, std::string uav_type,
+flair::meta::Uav *CreateUav(std::string name, std::string type,
                             flair::filter::UavMultiplex *multiplex = NULL);
 
-void RegisterUavCreator(flair::meta::Uav*(*func)(flair::core::FrameworkManager *parent,
-                                   std::string uav_name, std::string uav_type,
+void RegisterUavCreator(flair::meta::Uav*(*func)(std::string name, std::string type,
                                    flair::filter::UavMultiplex *multiplex));
 #endif // UAVFACTORY
Index: /trunk/lib/FlairMeta/src/UavStateMachine.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/UavStateMachine.cpp	(revision 121)
+++ /trunk/lib/FlairMeta/src/UavStateMachine.cpp	(revision 122)
@@ -52,7 +52,7 @@
 using namespace flair::meta;
 
-UavStateMachine::UavStateMachine(Uav* inUav,TargetController *controller):
+UavStateMachine::UavStateMachine(TargetController *controller):
         Thread(getFrameworkManager(),"UavStateMachine",50),
-        uav(inUav),controller(controller),failSafeMode(true),flagConnectionLost(false),flagBatteryLow(false),flagCriticalSensorLost(false),flagZTrajectoryFinished(false),safeToFly(true){
+        uav(GetUav()),controller(controller),failSafeMode(true),flagConnectionLost(false),flagBatteryLow(false),flagCriticalSensorLost(false),flagZTrajectoryFinished(false),safeToFly(true){
     altitudeState=AltitudeState_t::Stopped;
     uav->UseDefaultPlot();
@@ -135,6 +135,4 @@
   return currentAngularSpeed;
 }
-
-const Uav *UavStateMachine::GetUav(void) const { return uav; }
 
 void UavStateMachine::AltitudeValues(float &altitude,
Index: /trunk/lib/FlairMeta/src/UavStateMachine.h
===================================================================
--- /trunk/lib/FlairMeta/src/UavStateMachine.h	(revision 121)
+++ /trunk/lib/FlairMeta/src/UavStateMachine.h	(revision 122)
@@ -59,7 +59,8 @@
 *
 * \brief State machine for UAV
-*
-* thread synchronized with ahrs, unless a period is set with SetPeriodUS or
-*SetPeriodMS
+*  The Thread is created with 
+*  the FrameworkManager as parent. FrameworkManager must be created before.
+* The Thread is synchronized with Ahrs, unless a period is set with SetPeriodUS or
+* SetPeriodMS
 */
 
@@ -101,5 +102,5 @@
   };
 
-        UavStateMachine(meta::Uav* uav, sensor::TargetController* controller);
+        UavStateMachine(sensor::TargetController* controller);
         ~UavStateMachine();
 
@@ -107,6 +108,4 @@
 
   const core::Vector3D &GetCurrentAngularSpeed(void) const;
-
-  const meta::Uav *GetUav(void) const;
 
         void Land(void);
Index: /trunk/lib/FlairMeta/src/XAir.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/XAir.cpp	(revision 121)
+++ /trunk/lib/FlairMeta/src/XAir.cpp	(revision 122)
@@ -38,34 +38,22 @@
 namespace meta {
 
-XAir::XAir(FrameworkManager *parent, string uav_name,
+XAir::XAir(string name,
            filter::UavMultiplex *multiplex)
-    : Uav(parent, uav_name, multiplex) {
-  RTDM_I2cPort *i2cport = new RTDM_I2cPort(parent, "rtdm_i2c", "rti2c3");
-  RTDM_SerialPort *imu_port = new RTDM_SerialPort(parent, "imu_port", "rtser1");
+    : Uav(name, multiplex) {
+  RTDM_I2cPort *i2cport = new RTDM_I2cPort(getFrameworkManager(), "rtdm_i2c", "rti2c3");
+  RTDM_SerialPort *imu_port = new RTDM_SerialPort(getFrameworkManager(), "imu_port", "rtser1");
 
   if (multiplex == NULL)
-    SetMultiplex(new X4X8Multiplex(parent, "motors", X4X8Multiplex::X8));
+    SetMultiplex(new X4X8Multiplex(getFrameworkManager(), "motors", X4X8Multiplex::X8));
 
   SetBldc(new AfroBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
                        "motors", GetUavMultiplex()->MotorsCount(), i2cport));
-  SetUsRangeFinder(new Srf08(parent, "SRF08", i2cport, 0x70, 60));
-  SetAhrs(new Gx3_25_ahrs(parent, "imu", imu_port,
+  SetUsRangeFinder(new Srf08(getFrameworkManager(), "SRF08", i2cport, 0x70, 60));
+  SetAhrs(new Gx3_25_ahrs(getFrameworkManager(), "imu", imu_port,
                           Gx3_25_imu::AccelerationAngularRateAndOrientationMatrix, 70));
-  Tab *bat_tab = new Tab(parent->GetTabWidget(), "battery");
+  Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery");
   SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
   GetBatteryMonitor()->SetBatteryValue(12);
-
-  /*
-          if(VRPNType==Auto || VRPNType==AutoSerialPort)
-          {
-              RTDM_SerialPort* vrpn_port=new
-     RTDM_SerialPort(parent,"vrpn_port","rtser3");
-
-              vrpnclient=new VrpnClient(parent,"vrpn",vrpn_port,10000,80);
-              uav_vrpn=new
-     MetaVrpnObject(vrpnclient,uav_name,VRPNSerialObjectId);
-          }
-  */
-  SetVerticalCamera(new Ps3Eye(parent, "camv", 0, 50));
+  SetVerticalCamera(new Ps3Eye(getFrameworkManager(), "camv", 0, 50));
 }
 
@@ -76,5 +64,4 @@
   ((Srf08 *)GetUsRangeFinder())->Start();
   ((Ps3Eye *)GetVerticalCamera())->Start();
-  Uav::StartSensors();
 }
 
Index: /trunk/lib/FlairMeta/src/XAir.h
===================================================================
--- /trunk/lib/FlairMeta/src/XAir.h	(revision 121)
+++ /trunk/lib/FlairMeta/src/XAir.h	(revision 122)
@@ -24,8 +24,9 @@
 class XAir : public Uav {
 public:
-  XAir(core::FrameworkManager *parent, std::string uav_name,
+  XAir(std::string name,
        filter::UavMultiplex *multiplex = NULL);
   ~XAir();
   void StartSensors(void);
+	std::string GetDefaultVrpnAddress(void) const{return "192.168.147.197:3883";}
 
 private:
Index: /trunk/lib/FlairSensorActuator/src/Camera.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/Camera.cpp	(revision 121)
+++ /trunk/lib/FlairSensorActuator/src/Camera.cpp	(revision 122)
@@ -24,5 +24,4 @@
 #include <DataPlot1D.h>
 #include <Picture.h>
-#include <Buffer.h>
 #include <highgui.h>
 #include <fstream>
@@ -39,5 +38,4 @@
     : IODevice(parent, name) {
   plot_tab = NULL;
-	jpgBuffer=NULL;
 	logFormat=LogFormat::NONE;
 
@@ -63,5 +61,4 @@
 
   output = NULL;
-	jpgBuffer=NULL;
 	logFormat=LogFormat::NONE;
 }
@@ -80,11 +77,9 @@
 			break;
 		case LogFormat::JPG:
-			if(jpgBuffer==NULL) {
-				jpgBuffer=new Buffer(this,"jpg_bufer");
-				AddDataToLog(jpgBuffer);
-			}else{
-				Warn("log format already defined\n");
-			}
+				Warn("logging cvimage to jpeg\n");
+				Warn("jpeg are not included in classical dbt file, as dbt does not handle variable length\n");
 			break;
+		default:
+			Warn("LogFormat unknown\n");
 	}
 }
@@ -119,8 +114,11 @@
 
 void Camera::ProcessUpdate(core::io_data* data) {
-	switch(logFormat) {
-		case LogFormat::JPG:
-				ajouter compression jpg
-			break;
+	if(getFrameworkManager()->IsLogging() && getFrameworkManager()->IsDeviceLogged(this)) {
+		switch(logFormat) {
+			case LogFormat::JPG:
+					IplImage *img=((cvimage*)data)->img;
+					//dspSaveToJpeg(img,"toto");
+				break;
+		}
 	}
 	IODevice::ProcessUpdate(data);
Index: /trunk/lib/FlairSensorActuator/src/Camera.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/Camera.h	(revision 121)
+++ /trunk/lib/FlairSensorActuator/src/Camera.h	(revision 122)
@@ -25,7 +25,4 @@
 		class Picture;
 		class GridLayout;
-	}
-	namespace core {
-		class Buffer;
 	}
 }
@@ -163,5 +160,4 @@
   gui::GridLayout *setup_layout;
 	LogFormat logFormat;
-	core::Buffer *jpgBuffer;
 };
 } // end namespace sensor
Index: /trunk/lib/FlairSensorActuator/src/VrpnClient.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/VrpnClient.cpp	(revision 121)
+++ /trunk/lib/FlairSensorActuator/src/VrpnClient.cpp	(revision 122)
@@ -26,17 +26,36 @@
 using namespace flair::gui;
 
+namespace {
+  flair::sensor::VrpnClient *singleton = NULL;
+}
+
+
 namespace flair {
 namespace sensor {
 
-VrpnClient::VrpnClient(const FrameworkManager *parent, string name,
+VrpnClient *GetVrpnClient(void) { return singleton; }
+	
+VrpnClient::VrpnClient(string name,
                        string address, uint16_t us_period, uint8_t priority)
-    : Thread(parent, name, priority) {
+    : Thread(getFrameworkManager(), name, priority) {
+	if (singleton != NULL) {
+    Err("VrpnClient must be instanced only one time\n");
+    return;
+  }
+
+  singleton = this;
   pimpl_ = new VrpnClient_impl(this, name, address, us_period);
 }
 
-VrpnClient::VrpnClient(const FrameworkManager *parent, string name,
+VrpnClient::VrpnClient(string name,
                        SerialPort *serialport, uint16_t us_period,
                        uint8_t priority)
-    : Thread(parent, name, priority) {
+    : Thread(getFrameworkManager(), name, priority) {
+	if (singleton != NULL) {
+    Err("VrpnClient must be instanced only one time\n");
+    return;
+  }
+
+  singleton = this;
   pimpl_ = new VrpnClient_impl(this, name, serialport, us_period);
 }
Index: /trunk/lib/FlairSensorActuator/src/VrpnClient.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/VrpnClient.h	(revision 121)
+++ /trunk/lib/FlairSensorActuator/src/VrpnClient.h	(revision 122)
@@ -18,12 +18,11 @@
 
 namespace flair {
-namespace core {
-class FrameworkManager;
-class SerialPort;
-}
-namespace gui {
-class TabWidget;
-class Layout;
-}
+	namespace core {
+		class SerialPort;
+	}
+	namespace gui {
+		class TabWidget;
+		class Layout;
+	}
 }
 
@@ -35,5 +34,7 @@
 /*! \class VrpnClient
 *
-* \brief Class to connect to a Vrpn server
+* \brief Class to connect to a Vrpn server. The Thread is created with 
+*  the FrameworkManager as parent. FrameworkManager must be created before.
+* Only one instance of this class is allowed by program.
 */
 class VrpnClient : public core::Thread {
@@ -46,5 +47,4 @@
   * Construct a VrpnClient. Connection is done by IP.
   *
-  * \param parent parent
   * \param name name
   * \param address server address
@@ -52,5 +52,5 @@
   * \param priority priority of the Thread
   */
-  VrpnClient(const core::FrameworkManager *parent, std::string name,
+  VrpnClient(std::string name,
              std::string address, uint16_t us_period, uint8_t priority);
 
@@ -60,5 +60,4 @@
   * Construct a VrpnClient. Connection is done by XBee modem.
   *
-  * \param parent parent
   * \param name name
   * \param serialport SerialPort for XBee modem
@@ -66,5 +65,5 @@
   * \param priority priority of the Thread
   */
-  VrpnClient(const core::FrameworkManager *parent, std::string name,
+  VrpnClient(std::string name,
              core::SerialPort *serialport, uint16_t us_period,
              uint8_t priority);
@@ -108,4 +107,12 @@
   class VrpnClient_impl *pimpl_;
 };
+
+/*!
+* \brief get VrpnClient
+*
+* \return the VrpnClient
+*/
+VrpnClient *GetVrpnClient(void);
+
 } // end namespace sensor
 } // end namespace flair
Index: /trunk/lib/FlairSensorActuator/src/VrpnObject.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/VrpnObject.cpp	(revision 121)
+++ /trunk/lib/FlairSensorActuator/src/VrpnObject.cpp	(revision 122)
@@ -30,16 +30,16 @@
 namespace sensor {
 
-VrpnObject::VrpnObject(const VrpnClient *parent, string name,
+VrpnObject::VrpnObject(string name,
                        const TabWidget *tab)
-    : IODevice(parent, name) {
-  pimpl_ = new VrpnObject_impl(this, parent, name, -1, tab);
+    : IODevice(GetVrpnClient(), name) {
+  pimpl_ = new VrpnObject_impl(this, name, -1, tab);
   AddDataToLog(pimpl_->output);
 }
 
-VrpnObject::VrpnObject(const VrpnClient *parent, string name, uint8_t id,
+VrpnObject::VrpnObject(string name, uint8_t id,
                        const TabWidget *tab)
-    : IODevice(parent, name) {
+    : IODevice(GetVrpnClient(), name) {
   Warn("Creation of object %s with id %i\n", name.c_str(), id);
-  pimpl_ = new VrpnObject_impl(this, parent, name, id, tab);
+  pimpl_ = new VrpnObject_impl(this, name, id, tab);
   AddDataToLog(pimpl_->output);
 }
Index: /trunk/lib/FlairSensorActuator/src/VrpnObject.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/VrpnObject.h	(revision 121)
+++ /trunk/lib/FlairSensorActuator/src/VrpnObject.h	(revision 122)
@@ -19,15 +19,15 @@
 
 namespace flair {
-namespace core {
-class cvmatrix;
-class Vector3D;
-class Euler;
-class Quaternion;
-}
-namespace gui {
-class TabWidget;
-class Tab;
-class DataPlot1D;
-}
+	namespace core {
+		class cvmatrix;
+		class Vector3D;
+		class Euler;
+		class Quaternion;
+	}
+	namespace gui {
+		class TabWidget;
+		class Tab;
+		class DataPlot1D;
+	}
 }
 
@@ -41,5 +41,6 @@
 /*! \class VrpnObject
 *
-* \brief Class for VRPN object
+* \brief Class for VRPN object. The IODevice is created with 
+*  the VrpnClient as parent. VrpnClient must be created before.
 */
 class VrpnObject : public core::IODevice {
@@ -53,9 +54,8 @@
   * Construct a VrpnObject. Connection is done by IP.
   *
-  * \param parent parent
   * \param name VRPN object name, should be the same as defined in the server
   * \param tab Tab for the user interface
   */
-  VrpnObject(const VrpnClient *parent, std::string name,
+  VrpnObject(std::string name,
              const gui::TabWidget *tab);
 
@@ -65,10 +65,9 @@
   * Construct a VrpnObject. Connection is done by IP.
   *
-  * \param parent parent
   * \param name name
   * \param id VRPN object id, should be the same as defined in the server
   * \param tab Tab for the user interface
   */
-  VrpnObject(const VrpnClient *parent, std::string name, uint8_t id,
+  VrpnObject(std::string name, uint8_t id,
              const gui::TabWidget *tab);
 
Index: /trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp	(revision 121)
+++ /trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp	(revision 122)
@@ -39,9 +39,13 @@
 using namespace flair::sensor;
 
-VrpnObject_impl::VrpnObject_impl(VrpnObject *self, const VrpnClient *parent,
+VrpnObject_impl::VrpnObject_impl(VrpnObject *self,
                                  string name, int id, const TabWidget *tab) {
-  this->parent = parent;
+  parent = GetVrpnClient();
   this->self = self;
 
+	if(parent==NULL) {
+		self->Err("VrpnClient must be instanced before creating VrpnObject\n");
+		return;
+	}
   if (id == -1 && parent->UseXbee()) {
     self->Err("erreur aucun identifiant specifie pour la connexion Xbee\n");
Index: /trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h	(revision 121)
+++ /trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h	(revision 122)
@@ -26,18 +26,18 @@
 
 namespace flair {
-namespace core {
-class cvmatrix;
-class Vector3D;
-class Euler;
-}
-namespace gui {
-class TabWidget;
-class Tab;
-class DataPlot1D;
-}
-namespace sensor {
-class VrpnClient;
-class VrpnObject;
-}
+	namespace core {
+		class cvmatrix;
+		class Vector3D;
+		class Euler;
+	}
+	namespace gui {
+		class TabWidget;
+		class Tab;
+		class DataPlot1D;
+	}
+	namespace sensor {
+		class VrpnClient;
+		class VrpnObject;
+	}
 }
 
@@ -47,5 +47,5 @@
 public:
   VrpnObject_impl(flair::sensor::VrpnObject *self,
-                  const flair::sensor::VrpnClient *parent, std::string name,
+                  std::string name,
                   int id, const flair::gui::TabWidget *tab);
   ~VrpnObject_impl(void);
Index: /trunk/lib/FlairVisionFilter/CMakeLists.txt
===================================================================
--- /trunk/lib/FlairVisionFilter/CMakeLists.txt	(revision 122)
+++ /trunk/lib/FlairVisionFilter/CMakeLists.txt	(revision 122)
@@ -0,0 +1,48 @@
+PROJECT(FlairVisionFilter)
+cmake_minimum_required(VERSION 2.8)
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+
+find_package(LibXml2 REQUIRED)
+
+execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
+                OUTPUT_VARIABLE GCC_VERSION)
+
+if (GCC_VERSION VERSION_GREATER 4.3 OR GCC_VERSION VERSION_EQUAL 4.3)
+	if (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)
+		ADD_DEFINITIONS("-std=c++11")
+	else()
+		ADD_DEFINITIONS("-std=c++0x")
+	endif()
+else()
+	message(STATUS "GCC version < 4.3, c+11 is not supported!")
+endif()
+
+INCLUDE_DIRECTORIES(
+	${LIBXML2_INCLUDE_DIR}
+	${CMAKE_CURRENT_SOURCE_DIR}/src
+	$ENV{FLAIR_ROOT}/flair-src/lib/FlairCore/src
+	${CMAKE_SYSROOT}/usr/include/opencv
+)
+
+FILE(GLOB SRC_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
+
+SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+
+ADD_LIBRARY(${PROJECT_NAME}
+	${SRC_SRC}
+)
+
+INSTALL(TARGETS ${PROJECT_NAME}
+	LIBRARY DESTINATION $ENV{FLAIR_ROOT}/flair-bin/lib/${ARCH_DIR}
+	ARCHIVE DESTINATION $ENV{FLAIR_ROOT}/flair-bin/lib/${ARCH_DIR}
+)
+
+FILE(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h")
+INSTALL(FILES ${HEADER_FILES} DESTINATION $ENV{FLAIR_ROOT}/flair-dev/include/${PROJECT_NAME})
+
+add_custom_target(
+	compile_info
+	COMMAND $ENV{FLAIR_ROOT}/flair-dev/scripts/compile_info.sh ${CMAKE_C_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/unexported/compile_info.h
+)
+
+add_dependencies(${PROJECT_NAME} compile_info)
Index: /trunk/lib/FlairVisionFilter/src/CvtColor.cpp
===================================================================
--- /trunk/lib/FlairVisionFilter/src/CvtColor.cpp	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/CvtColor.cpp	(revision 122)
@@ -0,0 +1,90 @@
+//  created:    2014/07/17
+//  filename:   CvtColor.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    Image color conversion
+//
+//
+/*********************************************************************/
+
+#include "CvtColor.h"
+#include <cvimage.h>
+#include <typeinfo>
+
+using std::string;
+using namespace flair::core;
+
+namespace flair { namespace filter {
+
+CvtColor::CvtColor(const core::IODevice* parent,std::string name,Conversion_t conversion) : IODevice(parent,name),output(0) {
+    this->conversion=conversion;
+
+    switch(conversion) {
+    case Conversion_t::GRAY:
+        try{
+            cvimage::Type const &imageType=dynamic_cast<cvimage::Type const &>(parent->GetOutputDataType());
+            output=new cvimage(this,imageType.GetWidth(),imageType.GetHeight(),cvimage::Type::Format::GRAY,"conversion",true,2);
+
+        } catch(std::bad_cast& bc) {
+            Err("io type mismatch\n");
+        }
+        break;
+    default:
+        Err("conversion not supported\n");
+    }
+}
+
+CvtColor::~CvtColor(void) {}
+
+cvimage* CvtColor::Output(void) {
+    return output;
+
+}
+
+DataType const &CvtColor::GetOutputDataType() const {
+    if(output!=NULL) {
+        return output->GetDataType();
+    } else {
+        return dummyType;
+    }
+}
+
+void CvtColor::UpdateFrom(const io_data *data) {
+    IplImage *img=((cvimage*)data)->img;
+
+    data->GetMutex();
+    output->GetMutex();
+
+    switch(conversion) {
+    case Conversion_t::GRAY:
+        switch(((cvimage*)data)->GetDataType().GetFormat()) {
+        case cvimage::Type::Format::YUYV:
+            //dspCvtColor(img,output->img,DSP_YUYV2GRAY);
+            break;
+        case cvimage::Type::Format::UYVY:
+            //dspCvtColor(img,output->img,DSP_UYVY2GRAY);
+            break;
+        case cvimage::Type::Format::BGR:
+            //dspCvtColor(img,output->img,DSP_BGR2GRAY);
+            break;
+        default:
+            Err("input format not supported\n");
+        }
+        break;
+    default:
+        Err("conversion not supported\n");
+    }
+
+    output->ReleaseMutex();
+    data->ReleaseMutex();
+
+    output->SetDataTime(data->DataTime());
+    ProcessUpdate(output);
+}
+
+} // end namespace filter
+} // end namespace flair
Index: /trunk/lib/FlairVisionFilter/src/CvtColor.h
===================================================================
--- /trunk/lib/FlairVisionFilter/src/CvtColor.h	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/CvtColor.h	(revision 122)
@@ -0,0 +1,89 @@
+/*!
+ * \file CvtColor.h
+ * \brief Image color conversion
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2014/07/17
+ * \version 4.0
+ */
+
+
+#ifndef CVTCOLOR_H
+#define CVTCOLOR_H
+
+#include <IODevice.h>
+
+namespace flair
+{
+    namespace core
+    {
+        class cvimage;
+    }
+}
+
+namespace flair
+{
+namespace filter
+{
+    /*! \class CvtColor
+    *
+    * \brief Image color conversion
+    *
+    * The conversion is done using the DSP of the DM3730.
+    */
+    class CvtColor : public core::IODevice
+    {
+        public:
+            /*!
+            \enum Conversion_t
+            \brief Conversion formats
+            */
+            enum class Conversion_t {
+                BGR,/*!< BGR 24 bits */
+                GRAY,/*!< gray 8 bits */
+                } ;
+
+            /*!
+            * \brief Constructor
+            *
+            * Construct an Ahrs.
+            *
+            * \param parent parent
+            * \param name name
+            * \param conversion conversion format
+            */
+            CvtColor(const core::IODevice* parent,std::string name,Conversion_t conversion);
+
+            /*!
+            * \brief Destructor
+            *
+            */
+            ~CvtColor();
+
+            /*!
+            * \brief Output image
+            *
+            * Output matrix is of the same size as declared in constructor. \n
+            * Its type depends of the conversion type.
+            *
+            * \return the output image
+            */
+            core::cvimage* Output(void);
+
+            core::DataType const &GetOutputDataType() const;
+
+        private:
+            /*!
+            * \brief Update using provided datas
+            *
+            * Reimplemented from IODevice.
+            *
+            * \param data data from the parent to process
+            */
+            void UpdateFrom(const core::io_data *data);
+
+            core::cvimage *output;
+            Conversion_t conversion;
+    };
+} // end namespace filter
+} // end namespace flair
+#endif // CVTCOLOR_H
Index: /trunk/lib/FlairVisionFilter/src/HoughLines.cpp
===================================================================
--- /trunk/lib/FlairVisionFilter/src/HoughLines.cpp	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/HoughLines.cpp	(revision 122)
@@ -0,0 +1,92 @@
+//  created:    2015/10/07
+//  filename:   HoughLines.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    HoughLines
+//
+//
+/*********************************************************************/
+
+#include "HoughLines.h"
+#include <cvimage.h>
+#include <cvmatrix.h>
+#include <Layout.h>
+#include <GroupBox.h>
+#include <SpinBox.h>
+#include <DoubleSpinBox.h>
+#include <typeinfo>
+
+#define MAX_LINES 100
+
+using std::string;
+using namespace flair::core;
+using namespace flair::gui;
+
+namespace flair { namespace filter {
+
+HoughLines::HoughLines(const IODevice* parent,const LayoutPosition* position,string name) : IODevice(parent,name) {
+    GroupBox* reglages_groupbox=new GroupBox(position,name);
+    fullRhoStep=new SpinBox(reglages_groupbox->NewRow(),"full rho step:","pixels",0,255,1,1);
+    fullThetaStep=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"full theta step:","degrees",0,90,1,1);
+    trackingRhoStep=new SpinBox(reglages_groupbox->NewRow(),"tracking rho step:","pixels",0,255,1,1);
+    trackingThetaStep=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"tracking theta step:","degrees",0,90,1,1);
+    trackingDeltaTheta=new DoubleSpinBox(reglages_groupbox->LastRowLastCol(),"tracking delta theta:","degrees",0,90,1,1);
+    nbPoints=new SpinBox(reglages_groupbox->NewRow(),"nb points:",0,10000,10,100);
+
+    isTracking=false;
+    lostLine=false;
+    initLine=false;
+    linesStorage = cvCreateMat(MAX_LINES, 1, CV_32FC2);
+
+    //init output matrix of same size as init
+    cvmatrix_descriptor* desc=new cvmatrix_descriptor(4,1);
+    desc->SetElementName(0,0,"distance");
+    desc->SetElementName(1,0,"orientation rad");
+    desc->SetElementName(2,0,"orientation deg");
+    desc->SetElementName(3,0,"line_detected");
+    output=new cvmatrix(this,desc,floatType,name);
+
+    try{
+        cvimage::Type const &imageType=dynamic_cast<cvimage::Type const &>(parent->GetOutputDataType());
+        if(imageType.GetFormat()!=cvimage::Type::Format::GRAY) {
+            Err("input image is not grey\n");
+        }
+    } catch(std::bad_cast& bc) {
+        Err("io type mismatch\n");
+    }
+}
+
+HoughLines::~HoughLines(void) {
+    cvReleaseMat(&linesStorage);
+}
+
+void HoughLines::UpdateFrom(const io_data *data) {
+ 
+}
+
+bool HoughLines::isLineDetected() const {
+    if(output->Value(3,0)==1) {
+        return true;
+    } else {
+        return false;
+    }
+}
+
+float HoughLines::GetOrientation(void) const {
+    return output->Value(1,0);
+}
+
+float HoughLines::GetDistance(void) const {
+    return output->Value(0,0);
+}
+
+cvmatrix *HoughLines::Output(void) const {
+    return output;
+}
+
+} // end namespace filter
+} // end namespace flair
Index: /trunk/lib/FlairVisionFilter/src/HoughLines.h
===================================================================
--- /trunk/lib/FlairVisionFilter/src/HoughLines.h	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/HoughLines.h	(revision 122)
@@ -0,0 +1,75 @@
+/*!
+ * \file HoughLines.h
+ * \brief HoughLines algorithm
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2015/10/07
+ * \version 4.0
+ */
+
+
+#ifndef HOUGHLINES_H
+#define HOUGHLINES_H
+
+#include <IODevice.h>
+#include <cv.h>
+
+namespace flair {
+    namespace core {
+        class cvimage;
+        class cvmatrix;
+    }
+    namespace gui {
+        class LayoutPosition;
+        class SpinBox;
+        class DoubleSpinBox;
+    }
+}
+
+namespace flair { namespace filter {
+    /*! \class HoughLines
+    *
+    * \brief HoughLines algorithm
+    *
+    * HoughLines is done using the DSP of the DM3730.
+    */
+    class HoughLines : public core::IODevice {
+        public:
+            /*!
+            * \brief Constructor
+            *
+            * Construct an OpticalFlow filter at given position. \n
+            * After calling this function, position will be deleted as it is no longer usefull. \n
+            *
+            * \param parent parent
+            * \param position position
+            * \param name name
+            */
+            HoughLines(const core::IODevice* parent,const gui::LayoutPosition* position,std::string name);
+
+            /*!
+            * \brief Destructor
+            *
+            */
+            ~HoughLines();
+
+            bool isLineDetected(void) const;
+            float GetOrientation(void) const;
+            float GetDistance(void) const;
+            core::cvmatrix *Output(void) const;
+
+        private:
+            void UpdateFrom(const core::io_data *data);
+            gui::SpinBox *fullRhoStep,*trackingRhoStep,*nbPoints;
+            gui::DoubleSpinBox *fullThetaStep,*trackingThetaStep,*trackingDeltaTheta;
+            bool isTracking,lostLine,initLine,noLine;
+            int nbLines;
+            float yawMean,prevYawMean;
+            float prevRhoMean,rhoMean;
+            float prevThetaMean,thetaMean;
+            float distance,orientation;
+            CvMat* linesStorage;
+            core::cvmatrix *output;
+    };
+} // end namespace filter
+} // end namespace flair
+#endif // HOUGHLINES_H
Index: /trunk/lib/FlairVisionFilter/src/ImgThreshold.cpp
===================================================================
--- /trunk/lib/FlairVisionFilter/src/ImgThreshold.cpp	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/ImgThreshold.cpp	(revision 122)
@@ -0,0 +1,74 @@
+//  created:    2015/10/07
+//  filename:   ImgThreshold.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    ImgThreshold
+//
+//
+/*********************************************************************/
+
+#include "ImgThreshold.h"
+#include <cvimage.h>
+#include <Layout.h>
+#include <GroupBox.h>
+#include <SpinBox.h>
+#include <typeinfo>
+
+using std::string;
+using namespace flair::core;
+using namespace flair::gui;
+
+namespace flair { namespace filter {
+
+ImgThreshold::ImgThreshold(const IODevice* parent,const LayoutPosition* position,string name) : IODevice(parent,name),output(0) {
+    GroupBox* reglages_groupbox=new GroupBox(position,name);
+    threshold=new SpinBox(reglages_groupbox->NewRow(),"threshold:",0,255,1,127);
+
+    Printf("todo: pouvoir reutiliser la meme image en sortie\n");
+    try{
+        cvimage::Type const &imageType=dynamic_cast<cvimage::Type const &>(parent->GetOutputDataType());
+        if(imageType.GetFormat()==cvimage::Type::Format::GRAY) {
+            output=new cvimage(this,imageType.GetWidth(),imageType.GetHeight(),imageType.GetFormat(),"threshold");
+        } else {
+            Err("input image is not grey\n");
+        }
+    } catch(std::bad_cast& bc) {
+        Err("io type mismatch\n");
+    }
+}
+
+ImgThreshold::~ImgThreshold(void) {
+}
+
+cvimage* ImgThreshold::Output(void) {
+    return output;
+}
+
+void ImgThreshold::UpdateFrom(const io_data *data) {
+    cvimage *cvImage=(cvimage*)data;
+    IplImage *gimg=cvImage->img;
+/*
+    data->GetMutex();
+    output->GetMutex();
+    dspThreshold(gimg, output->img, threshold->Value(), 255, CV_THRESH_BINARY);
+    output->ReleaseMutex();
+    data->ReleaseMutex();
+*/
+    output->SetDataTime(data->DataTime());
+    ProcessUpdate(output);
+}
+
+DataType const &ImgThreshold::GetOutputDataType() const {
+    if(output!=NULL) {
+        return output->GetDataType();
+    } else {
+        return dummyType;
+    }
+}
+
+} // end namespace filter
+} // end namespace flair
Index: /trunk/lib/FlairVisionFilter/src/ImgThreshold.h
===================================================================
--- /trunk/lib/FlairVisionFilter/src/ImgThreshold.h	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/ImgThreshold.h	(revision 122)
@@ -0,0 +1,71 @@
+/*!
+ * \file ImgThreshold.h
+ * \brief ImgThreshold algorithm
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2015/10/07
+ * \version 4.0
+ */
+
+
+#ifndef IMGTHRESHOLD_H
+#define IMGTHRESHOLD_H
+
+#include <IODevice.h>
+#include <cv.h>
+
+namespace flair {
+    namespace core {
+        class cvimage;
+    }
+    namespace gui {
+        class LayoutPosition;
+        class SpinBox;
+    }
+}
+
+namespace flair { namespace filter {
+    /*! \class ImgThreshold
+    *
+    * \brief ImgThreshold algorithm
+    *
+    * ImgThreshold is done using the DSP of the DM3730.
+    */
+    class ImgThreshold : public core::IODevice {
+        public:
+            /*!
+            * \brief Constructor
+            *
+            * Construct an OpticalFlow filter at given position. \n
+            * After calling this function, position will be deleted as it is no longer usefull. \n
+            *
+            * \param parent parent
+            * \param position position
+            * \param name name
+            */
+            ImgThreshold(const core::IODevice* parent,const gui::LayoutPosition* position,std::string name);
+
+            /*!
+            * \brief Destructor
+            *
+            */
+            ~ImgThreshold();
+
+            /*!
+            * \brief Output image
+            *
+            * Output matrix is of the same size as the input image. \n
+            *
+            * \return the output image
+            */
+            core::cvimage* Output(void);
+
+            core::DataType const &GetOutputDataType() const;
+
+        private:
+            void UpdateFrom(const core::io_data *data);
+            core::cvimage *output;
+            gui::SpinBox *threshold;
+    };
+} // end namespace filter
+} // end namespace flair
+#endif // IMGTHRESHOLD_H
Index: /trunk/lib/FlairVisionFilter/src/OpticalFlow.cpp
===================================================================
--- /trunk/lib/FlairVisionFilter/src/OpticalFlow.cpp	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/OpticalFlow.cpp	(revision 122)
@@ -0,0 +1,167 @@
+//  created:    2012/04/12
+//  filename:   OpticalFlow.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    calcul flux optique lk
+//
+//
+/*********************************************************************/
+
+#include "OpticalFlow.h"
+#include "OpticalFlowData.h"
+#include <cvimage.h>
+#include <Layout.h>
+#include <GroupBox.h>
+#include <SpinBox.h>
+//#include <algorithm>
+#include <OneAxisRotation.h>
+#include <Vector3D.h>
+#include <typeinfo>
+
+#define LEVEL_PYR 2
+
+using std::string;
+using std::swap;
+using namespace flair::core;
+using namespace flair::gui;
+
+namespace flair
+{
+namespace filter
+{
+
+OpticalFlow::OpticalFlow(const IODevice* parent,const LayoutPosition* position,string name) : IODevice(parent,name)
+{
+    Printf("optical flow: voir pour faire du multiple output\n");//pour pts A et B, found et error
+
+    try{
+        cvimage::Type const &imageType=dynamic_cast<cvimage::Type const &>(parent->GetOutputDataType());
+        pyr=cvCreateImage(cvSize(imageType.GetWidth(),imageType.GetHeight()),IPL_DEPTH_8U,1);
+        pyr_old=cvCreateImage(cvSize(imageType.GetWidth(),imageType.GetHeight()),IPL_DEPTH_8U,1);
+
+    } catch(std::bad_cast& bc) {
+        Err("io type mismatch\n");
+        pyr=NULL;
+        pyr_old=NULL;
+    }
+
+    is_init=false;
+
+    GroupBox* reglages_groupbox=new GroupBox(position,name);
+        rotation=new OneAxisRotation(reglages_groupbox->NewRow(),"post rotation");
+        max_features=new SpinBox(reglages_groupbox->NewRow(),"max features:",1,65535,1,1);
+
+    output=new OpticalFlowData(parent,max_features->Value());
+
+    pointsA=(CvPoint *)cvAlloc(max_features->Value()*sizeof(CvPoint));
+    pointsB=(CvPoint *)cvAlloc(max_features->Value()*sizeof(CvPoint));
+
+    found_feature=(char *)cvAlloc(max_features->Value()*sizeof(char));
+    feature_error=(unsigned int *)cvAlloc(max_features->Value()*sizeof(unsigned int));
+}
+
+OpticalFlow::~OpticalFlow(void)
+{
+    cvReleaseImage(&pyr);
+    cvReleaseImage(&pyr_old);
+    cvFree(&pointsA);
+    cvFree(&pointsB);
+    cvFree(&found_feature);
+    cvFree(&feature_error);
+}
+
+void OpticalFlow::UpdateFrom(const io_data *data)
+{
+    IplImage *gimg=((cvimage*)data)->img;
+    IplImage *gimg_old=((cvimage*)data->Prev(1))->img;
+
+    unsigned int count;
+    CvSize window = cvSize(3,3);
+    CvTermCriteria termination_criteria = cvTermCriteria( CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 20, .3 );
+    unsigned int i;
+
+    if(max_features->ValueChanged()==true)
+    {
+        cvFree(&pointsA);
+        cvFree(&pointsB);
+        cvFree(&found_feature);
+        cvFree(&feature_error);
+        pointsA=(CvPoint *)cvAlloc(max_features->Value()*sizeof(CvPoint));
+        pointsB=(CvPoint *)cvAlloc(max_features->Value()*sizeof(CvPoint));
+        found_feature=(char *)cvAlloc(max_features->Value()*sizeof(char));
+        feature_error=(unsigned int *)cvAlloc(max_features->Value()*sizeof(unsigned int));
+
+        output->Resize(max_features->Value());
+    }
+/*
+    if(is_init==false)
+    {
+        data->GetMutex();
+        //init image old
+        dspPyrDown(gimg,pyr_old,LEVEL_PYR);
+        data->ReleaseMutex();
+        is_init=true;
+        printf("ajouter mise a 0 des points\n");
+        return;
+    }
+
+    data->GetMutex();
+    data->Prev(1)->GetMutex();
+
+    //select good features
+    count=max_features->Value();
+    dspGoodFeaturesToTrack(gimg_old,pointsA,&count,0.08,5);
+    //pyramide
+    dspPyrDown(gimg,pyr,LEVEL_PYR);
+    //lk
+    dspCalcOpticalFlowPyrLK(gimg_old,gimg,pyr_old,pyr,pointsA,pointsB,count,window,LEVEL_PYR,found_feature,feature_error,termination_criteria,0) ;
+
+    data->Prev(1)->ReleaseMutex();
+    data->ReleaseMutex();
+*/
+    //apply rotation
+    for(i=0;i<count;i++)
+    {
+        Vector3D tmp;
+        tmp.x=pointsA[i].x;
+        tmp.y=pointsA[i].y;
+        tmp.z=0;
+        rotation->ComputeRotation(tmp);
+        pointsA[i].x=tmp.x;
+        pointsA[i].y=tmp.y;
+
+        tmp.x=pointsB[i].x;
+        tmp.y=pointsB[i].y;
+        tmp.z=0;
+        rotation->ComputeRotation(tmp);
+        pointsB[i].x=tmp.x;
+        pointsB[i].y=tmp.y;
+    }
+
+    output->GetMutex();
+    CvPoint2D32f* pointsBf= output->PointsB();
+    for(i=0;i<count;i++)
+    {
+        pointsBf[i].x=pointsA[i].x+((float)pointsB[i].x)/256;
+        pointsBf[i].y=pointsA[i].y+((float)pointsB[i].y)/256;
+    }
+    output->ReleaseMutex();
+
+    output->SetPointsA(pointsA);
+    output->SetFoundFeature(found_feature);
+    output->SetFeatureError(feature_error);
+    output->SetNbFeatures(count);
+
+    //rotation
+    swap(pyr,pyr_old);
+
+    output->SetDataTime(data->DataTime());
+    ProcessUpdate(output);
+}
+
+} // end namespace filter
+} // end namespace flair
Index: /trunk/lib/FlairVisionFilter/src/OpticalFlow.h
===================================================================
--- /trunk/lib/FlairVisionFilter/src/OpticalFlow.h	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/OpticalFlow.h	(revision 122)
@@ -0,0 +1,82 @@
+/*!
+ * \file OpticalFlow.h
+ * \brief Lucas and Kanade optical flow algorithm
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2012/04/12
+ * \version 4.0
+ */
+
+
+#ifndef OPTICALFLOW_H
+#define OPTICALFLOW_H
+
+#include <IODevice.h>
+#include <cv.h>
+
+namespace flair
+{
+    namespace core
+    {
+        class cvimage;
+        class OneAxisRotation;
+    }
+    namespace gui
+    {
+        class LayoutPosition;
+        class SpinBox;
+    }
+    namespace filter
+    {
+        class OpticalFlowData;
+    }
+}
+
+namespace flair
+{
+namespace filter
+{
+    /*! \class OpticalFlow
+    *
+    * \brief Lucas and Kanade optical flow algorithm
+    *
+    * Optical flow is done using the DSP of the DM3730.
+    */
+    class OpticalFlow : public core::IODevice
+    {
+
+        public:
+            /*!
+            * \brief Constructor
+            *
+            * Construct an OpticalFlow filter at given position. \n
+            * After calling this function, position will be deleted as it is no longer usefull. \n
+            *
+            * \param parent parent
+            * \param position position
+            * \param name name
+            */
+            OpticalFlow(const core::IODevice* parent,const gui::LayoutPosition* position,std::string name);
+
+            /*!
+            * \brief Destructor
+            *
+            */
+            ~OpticalFlow();
+
+        private:
+            void UpdateFrom(const core::io_data *data);
+            OpticalFlowData *output;
+            gui::SpinBox *max_features;
+            core::OneAxisRotation* rotation;
+
+            CvPoint* pointsA;
+            CvPoint* pointsB;
+            char *found_feature;
+            unsigned int *feature_error;
+            IplImage *pyr,*pyr_old;
+
+            bool is_init;
+    };
+} // end namespace filter
+} // end namespace flair
+#endif // OPTICALFLOW_H
Index: /trunk/lib/FlairVisionFilter/src/OpticalFlowData.cpp
===================================================================
--- /trunk/lib/FlairVisionFilter/src/OpticalFlowData.cpp	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/OpticalFlowData.cpp	(revision 122)
@@ -0,0 +1,156 @@
+//  created:    2012/04/12
+//  filename:   OpticalFlowData.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    classe pour les données du flux optique
+//
+/*********************************************************************/
+
+#include "OpticalFlowData.h"
+
+using std::string;
+
+namespace flair
+{
+namespace filter
+{
+
+OpticalFlowData::OpticalFlowData(const Object* parent,uint32_t max_features,string name,uint32_t n): io_data(parent,name,n)
+{
+    this->max_features=max_features;
+    nb_features=0;
+
+    pointsA=(CvPoint *)cvAlloc(max_features*sizeof(CvPoint));
+    pointsB=(CvPoint2D32f *)cvAlloc(max_features*sizeof(CvPoint2D32f));
+
+    found_features=(char *)cvAlloc(max_features*sizeof(char));
+    features_error=(uint32_t*)cvAlloc(max_features*sizeof(uint32_t));
+}
+
+OpticalFlowData::~OpticalFlowData()
+{
+    cvFree(&pointsA);
+    cvFree(&pointsB);
+
+    cvFree(&found_features);
+    cvFree(&features_error);
+}
+
+CvPoint* OpticalFlowData::PointsA(void) const
+{
+    return pointsA;
+}
+
+CvPoint2D32f* OpticalFlowData::PointsB(void) const
+{
+    return pointsB;
+}
+
+char *OpticalFlowData::FoundFeature(void) const
+{
+    return found_features;
+}
+
+uint32_t *OpticalFlowData::FeatureError(void) const
+{
+    return features_error;
+}
+
+// value is new max_features value
+void OpticalFlowData::Resize(uint32_t value) {
+    CvPoint *new_pointsA;
+    CvPoint2D32f *new_pointsB;
+    char *new_found_features;
+    uint32_t *new_features_error;
+
+    new_pointsA=(CvPoint *)cvAlloc(value*sizeof(CvPoint));
+    new_pointsB=(CvPoint2D32f *)cvAlloc(value*sizeof(CvPoint2D32f));
+    new_found_features=(char *)cvAlloc(value*sizeof(char));
+    new_features_error=(uint32_t *)cvAlloc(value*sizeof(uint32_t));
+
+    GetMutex();
+    if(value>max_features)
+    {
+        memcpy(new_pointsA,pointsA,max_features*sizeof(CvPoint));
+        memcpy(new_pointsB,pointsB,max_features*sizeof(CvPoint2D32f));
+        memcpy(new_found_features,found_features,max_features*sizeof(char));
+        memcpy(new_features_error,features_error,max_features*sizeof(uint32_t));
+    }
+    else
+    {
+        memcpy(new_pointsA,pointsA,value*sizeof(CvPoint));
+        memcpy(new_pointsB,pointsB,value*sizeof(CvPoint2D32f));
+        memcpy(new_found_features,found_features,value*sizeof(char));
+        memcpy(new_features_error,features_error,value*sizeof(uint32_t));
+        if(nb_features>value) nb_features=value; //si nb_features est le nombre de point qui ont effectivement une correspondande, ça me parait louche. Sauf si les points sont classés et que ceux qui ont une correpondance sont toujours au début
+    }
+    max_features=value;
+    ReleaseMutex();
+
+    cvFree(&pointsA);
+    cvFree(&pointsB);
+    cvFree(&found_features);
+    cvFree(&features_error);
+
+    pointsA=new_pointsA;
+    pointsB=new_pointsB;
+    found_features=new_found_features;
+    features_error=new_features_error;
+}
+
+void OpticalFlowData::CopyDatas(char* dst) const
+{
+    Warn("non implementé\n");
+}
+
+void OpticalFlowData::SetPointsA(const CvPoint* points)
+{
+    GetMutex();
+    memcpy(pointsA,points,max_features*sizeof(CvPoint));
+    ReleaseMutex();
+}
+
+void OpticalFlowData::SetPointsB(const CvPoint2D32f* points)
+{
+    GetMutex();
+    memcpy(pointsB,points,max_features*sizeof(CvPoint2D32f));
+    ReleaseMutex();
+}
+
+void OpticalFlowData::SetFoundFeature(const char *found_features)
+{
+    GetMutex();
+    memcpy(this->found_features,found_features,max_features*sizeof(char));
+    ReleaseMutex();
+}
+
+void OpticalFlowData::SetFeatureError(const uint32_t *features_error)
+{
+    GetMutex();
+    memcpy(this->features_error,features_error,max_features*sizeof(uint32_t));
+    ReleaseMutex();
+}
+
+uint32_t OpticalFlowData::MaxFeatures(void) const
+{
+    return max_features;
+}
+
+uint32_t OpticalFlowData::NbFeatures(void) const
+{
+    return nb_features;
+}
+
+void OpticalFlowData::SetNbFeatures(uint32_t value)
+{
+    GetMutex();
+    nb_features=value;
+    ReleaseMutex();
+}
+
+} // end namespace filter
+} // end namespace flair
Index: /trunk/lib/FlairVisionFilter/src/OpticalFlowData.h
===================================================================
--- /trunk/lib/FlairVisionFilter/src/OpticalFlowData.h	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/OpticalFlowData.h	(revision 122)
@@ -0,0 +1,144 @@
+/*!
+ * \file OpticalFlowData.h
+ * \brief Class defining pptical flow datas
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2012/04/12
+ * \version 4.0
+ */
+
+#ifndef OPTICALFLOWDATA_H
+#define OPTICALFLOWDATA_H
+
+#include <cxcore.h>
+#include <io_data.h>
+
+namespace flair { namespace filter {
+    /*! \class OpticalFlowData
+    *
+    * \brief Class defining optical flow datas
+    *
+    * Optical flow datas are composed of the following: \n
+    * PointsA: tracked points on first image
+    * PointsB: tracked points on second image
+    * FoundFeature: array representing if a point on first image is found on second image
+    * FeatureError: array representing correlation error for each point (confidence)
+    */
+    class OpticalFlowData: public core::io_data {
+    public:
+        class Type: public core::DataType {
+            size_t GetSize() const {return 0;} //TODO
+            std::string GetDescription() const {return "optical flow";}
+        };
+
+        /*!
+        * \brief Constructor
+        *
+        * Construct OpticalFlowData.
+        *
+        * \param parent parent
+        * \param max_features maximum number of features to track
+        * \param name name
+        * \param n number of samples for the io_data
+        */
+        OpticalFlowData(const core::Object* parent,uint32_t max_features,std::string name="",uint32_t n=1);
+
+        /*!
+        * \brief Destructor
+        *
+        */
+        ~OpticalFlowData();
+
+        /*!
+        * \brief Points on first image
+        *
+    */
+        CvPoint* PointsA(void) const;
+
+        /*!
+        * \brief Points on second image
+        *
+        */
+        CvPoint2D32f* PointsB(void) const;
+
+        /*!
+        * \brief Features found
+        *
+        * value of the array is one if feature is found
+        */
+        char *FoundFeature(void) const;
+
+        /*!
+        * \brief Correlation error
+        *
+        */
+        uint32_t *FeatureError(void) const;
+
+        /*!
+        * \brief Set points of interest of frst image
+        *
+        * \param points points
+        */
+        void SetPointsA(const CvPoint *points);
+
+        /*!
+        * \brief Set points of interest of second image
+        *
+        * \param points points
+        */
+        void SetPointsB(const CvPoint2D32f *points);
+
+        /*!
+        * \brief Set found features
+        *
+        * \param found_features found features
+        */
+        void SetFoundFeature(const char *found_features);
+
+        /*!
+        * \brief Set features error
+        *
+        * \param features_error features error
+        */
+        void SetFeatureError(const unsigned int *features_error);
+
+        /*!
+        * \brief Number of maximum features
+        *
+        */
+        uint32_t MaxFeatures(void) const;
+
+        /*!
+        * \brief Number of tracked features
+        *
+        */
+        uint32_t NbFeatures(void) const;
+
+        /*!
+        * \brief Set number of tracked features
+        *
+        * \param value number of tracked features
+        */
+        void SetNbFeatures(uint32_t value);
+
+        /*!
+        * \brief Change number of maximum features
+        *
+        * \param value new number of maximum tracked features
+        */
+        void Resize(uint32_t value);
+
+        OpticalFlowData::Type const &GetDataType() const {return dataType;}
+
+    private:
+        uint32_t max_features;
+        uint32_t nb_features;
+        CvPoint* pointsA;
+        CvPoint2D32f* pointsB;
+        char *found_features;
+        uint32_t *features_error;
+        void CopyDatas(char* dst) const;
+        Type dataType;
+    };
+} // end namespace filter
+} // end namespace flair
+#endif // OPTICALFLOWDATA_H
Index: /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp
===================================================================
--- /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp	(revision 122)
@@ -0,0 +1,87 @@
+//  created:    2012/04/12
+//  filename:   OpticalFlowSpeed.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    calcul de la vitesse à partir du flux optique
+//
+//
+/*********************************************************************/
+
+#include "OpticalFlowSpeed.h"
+#include "OpticalFlowData.h"
+#include <cvmatrix.h>
+#include <Object.h>
+
+using std::string;
+using namespace flair::core;
+
+namespace flair
+{
+namespace filter
+{
+
+OpticalFlowSpeed::OpticalFlowSpeed(const IODevice* parent,string name) : IODevice(parent,name)
+{
+    cvmatrix_descriptor* desc=new cvmatrix_descriptor(2,1);
+    desc->SetElementName(0,0,"vx");
+	desc->SetElementName(1,0,"vy");
+    output=new cvmatrix(this,desc,floatType,name);
+
+	AddDataToLog(output);
+}
+
+OpticalFlowSpeed::~OpticalFlowSpeed(void)
+{
+}
+
+void OpticalFlowSpeed::UpdateFrom(const io_data *data)
+{
+    OpticalFlowData *input=(OpticalFlowData*)data;
+    float deplx,deply;
+    int nb_depl=0;
+
+    deplx=0;
+    deply=0;
+
+    input->GetMutex();
+    for(int i=0;i<input->NbFeatures();i++)
+    {
+        if(input->FoundFeature()[i]!=0)
+        {
+            deplx+=input->PointsB()[i].x-input->PointsA()[i].x;
+            deply+=input->PointsB()[i].y-input->PointsA()[i].y;
+            nb_depl++;
+        }
+    }
+    input->ReleaseMutex();
+
+    if(nb_depl!=0)
+    {
+        output->SetValue(0,0,deplx/nb_depl);
+        output->SetValue(1,0,deply/nb_depl);
+    }
+
+    output->SetDataTime(data->DataTime());
+    ProcessUpdate(output);
+}
+
+float OpticalFlowSpeed::Vx(void) const
+{
+    return output->Value(0,0);
+}
+
+float OpticalFlowSpeed::Vy(void) const
+{
+    return output->Value(1,0);
+}
+
+core::cvmatrix *OpticalFlowSpeed::Output() const
+{
+    return output;
+}
+} // end namespace filter
+} // end namespace flair
Index: /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.h
===================================================================
--- /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.h	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.h	(revision 122)
@@ -0,0 +1,89 @@
+/*!
+ * \file OpticalFlowSpeed.h
+ * \brief Optical flow speed calculation
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2012/04/12
+ * \version 4.0
+ */
+
+
+#ifndef OPTICALFLOWSPEED_H
+#define OPTICALFLOWSPEED_H
+
+#include <IODevice.h>
+
+namespace flair
+{
+    namespace core
+    {
+        class cvmatrix;
+    }
+}
+
+namespace flair
+{
+namespace filter
+{
+    class OpticalFlow;
+
+    /*! \class OpticalFlowSpeed
+    *
+    * \brief Optical flow speed calculation
+    *
+    * Speed is the mean of all optical flow values.
+    */
+    class OpticalFlowSpeed : public core::IODevice
+    {
+        public:
+            /*!
+            * \brief Constructor
+            *
+            * Construct OpticalFlowSpeed.
+            *
+            * \param parent parent
+            * \param name name
+            */
+            OpticalFlowSpeed(const core::IODevice* parent,std::string name);
+
+            /*!
+            * \brief Destructor
+            *
+            */
+            ~OpticalFlowSpeed();
+
+            /*!
+            * \brief Speed along x axis
+            *
+            */
+            float Vx(void) const;
+
+            /*!
+            * \brief Speed along y axis
+            *
+            */
+            float Vy(void) const;
+
+            /*!
+            * \brief Output matrix
+            *
+            * Matrix is of sze (2,1). \n
+            * First line is speed along x axis. \n
+            * Second line is speed along y axis. \n
+            */
+            core::cvmatrix *Output() const;
+
+        private:
+            /*!
+            * \brief Update using provided datas
+            *
+            * Reimplemented from IODevice.
+            *
+            * \param data data from the parent to process
+            */
+            void UpdateFrom(const core::io_data *data);
+
+            core::cvmatrix *output;
+    };
+} // end namespace filter
+} // end namespace flair
+#endif // OPTICALFLOWSPEED_H
Index: /trunk/lib/FlairVisionFilter/src/Sobel.cpp
===================================================================
--- /trunk/lib/FlairVisionFilter/src/Sobel.cpp	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/Sobel.cpp	(revision 122)
@@ -0,0 +1,77 @@
+//  created:    2015/10/07
+//  filename:   Sobel.cpp
+//
+//  author:     Gildas Bayard
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    Sobel
+//
+//
+/*********************************************************************/
+
+#include "Sobel.h"
+#include <cvimage.h>
+#include <Layout.h>
+#include <GroupBox.h>
+#include <SpinBox.h>
+#include <typeinfo>
+
+using std::string;
+using namespace flair::core;
+using namespace flair::gui;
+
+namespace flair { namespace filter {
+
+Sobel::Sobel(const IODevice* parent,const LayoutPosition* position,string name) : IODevice(parent,name),output(0) {
+    GroupBox* reglages_groupbox=new GroupBox(position,name);
+    dx=new SpinBox(reglages_groupbox->NewRow(),"dx:",0,1,1,1);
+    dy=new SpinBox(reglages_groupbox->NewRow(),"dy:",0,1,1,1);
+
+    Printf("TODO: IODevice doit faire un check de GetInputDataType et GetOutputDataType\n");
+    //cvimage devrait accepter un type dans son constructeur pour construire un type identique
+    try{
+        cvimage::Type const &imageType=dynamic_cast<cvimage::Type const &>(parent->GetOutputDataType());
+        if(imageType.GetFormat()==cvimage::Type::Format::GRAY) {
+            output=new cvimage(this,imageType.GetWidth(),imageType.GetHeight(),imageType.GetFormat(),"sobel");
+        } else {
+            Err("input image is not grey\n");
+        }
+
+    } catch(std::bad_cast& bc) {
+        Err("io type mismatch\n");
+    }
+}
+
+Sobel::~Sobel(void) {
+}
+
+cvimage* Sobel::Output(void) {
+    return output;
+}
+
+void Sobel::UpdateFrom(const io_data *data) {
+    cvimage *cvImage=(cvimage*)data;
+    IplImage *gimg=cvImage->img;
+/*
+    data->GetMutex();
+    output->GetMutex();
+    dspSobel(gimg,output->img,dx->Value(),dy->Value());
+    output->ReleaseMutex();
+    data->ReleaseMutex();
+*/
+    output->SetDataTime(data->DataTime());
+    ProcessUpdate(output);
+}
+
+DataType const &Sobel::GetOutputDataType() const {
+    if(output!=NULL) {
+        return output->GetDataType();
+    } else {
+        return dummyType;
+    }
+}
+
+} // end namespace filter
+} // end namespace flair
Index: /trunk/lib/FlairVisionFilter/src/Sobel.h
===================================================================
--- /trunk/lib/FlairVisionFilter/src/Sobel.h	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/Sobel.h	(revision 122)
@@ -0,0 +1,72 @@
+/*!
+ * \file Sobel.h
+ * \brief Sobel algorithm
+ * \author Gildas Bayard, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2015/10/07
+ * \version 4.0
+ */
+
+
+#ifndef SOBEL_H
+#define SOBEL_H
+
+#include <IODevice.h>
+#include <cv.h>
+
+namespace flair {
+    namespace core {
+        class cvimage;
+    }
+    namespace gui {
+        class LayoutPosition;
+        class SpinBox;
+    }
+}
+
+namespace flair { namespace filter {
+    /*! \class Sobel
+    *
+    * \brief Sobel algorithm
+    *
+    * Sobel is done using the DSP of the DM3730.
+    */
+    class Sobel : public core::IODevice {
+        public:
+            /*!
+            * \brief Constructor
+            *
+            * Construct an OpticalFlow filter at given position. \n
+            * After calling this function, position will be deleted as it is no longer usefull. \n
+            *
+            * \param parent parent
+            * \param position position
+            * \param name name
+            */
+            Sobel(const core::IODevice* parent,const gui::LayoutPosition* position,std::string name);
+
+            /*!
+            * \brief Destructor
+            *
+            */
+            ~Sobel();
+
+            /*!
+            * \brief Output image
+            *
+            * Output matrix is of the same size as the input image. \n
+            *
+            * \return the output image
+            */
+            core::cvimage* Output(void);
+
+            core::DataType const &GetOutputDataType() const;
+
+        private:
+            void UpdateFrom(const core::io_data *data);
+            core::cvimage *output;
+            gui::SpinBox *dx;
+            gui::SpinBox *dy;
+    };
+} // end namespace filter
+} // end namespace flair
+#endif // SOBEL_H
Index: /trunk/lib/FlairVisionFilter/src/init.cpp
===================================================================
--- /trunk/lib/FlairVisionFilter/src/init.cpp	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/init.cpp	(revision 122)
@@ -0,0 +1,10 @@
+#include "init.h"
+
+
+void SetupDSP(std::string file,int globalTimeoutMs) {
+    
+}
+
+void CloseDSP(void) {
+  
+}
Index: /trunk/lib/FlairVisionFilter/src/init.h
===================================================================
--- /trunk/lib/FlairVisionFilter/src/init.h	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/init.h	(revision 122)
@@ -0,0 +1,16 @@
+#include <string>
+
+/*!
+* \brief DSP setup
+*
+* Setup DSP executable file. \n
+* If this method is not called, no DSP processing will be available. \n
+*
+* \param file DSP executable file
+* \param globalTimeoutMs timeout for all DSP functions, in ms (timeout is only
+* used to display a warning. -1 to disable timeout
+*/
+void SetupDSP(std::string file,int globalTimeoutMs=-1);
+
+
+void CloseDSP(void);
Index: /trunk/lib/FlairVisionFilter/src/unexported/compile_info.h
===================================================================
--- /trunk/lib/FlairVisionFilter/src/unexported/compile_info.h	(revision 122)
+++ /trunk/lib/FlairVisionFilter/src/unexported/compile_info.h	(revision 122)
@@ -0,0 +1,18 @@
+//file generated automatically by compile_info.sh script
+//do not edit it manually
+
+#include <string>
+
+#define USER "gsanahuj@gsanahuj-Latitude-E6420"
+#define DATE "vendredi 6 janvier 2017, 12:43:09 (UTC+0100)"
+#define GCC_REV "4.9.1"
+#define GCC_PATH "/opt/robomap3/1.7.3/armv7a-neon/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc"
+#define SVN_PATH "/home/gsanahuj/HDS/igep/flair-src_svn/trunk/lib/FlairVisionFilter"
+#define SVN_REV "Ajout, copie ou déplacement local non propagé"
+
+inline void compile_info(std::string name) { 
+	fprintf(stderr,"Using %s library:\n",name.c_str());
+	fprintf(stderr,"  -built by " USER " on " DATE "\n");
+	fprintf(stderr,"  -with GCC " GCC_REV " from " GCC_PATH "\n");
+	fprintf(stderr,"  -svnversion of " SVN_PATH " is " SVN_REV "\n\n");
+}
Index: unk/tools/Controller/DualShock3/cmake_codeblocks.sh
===================================================================
--- /trunk/tools/Controller/DualShock3/cmake_codeblocks.sh	(revision 121)
+++ 	(revision )
@@ -1,28 +1,0 @@
-DIR=build_$(uname -m)
-
-### IMPORTANT: We don't use standard cmake_codeblocks script since we don't compile in release mode due to optimization problem (-03) ###
-
-#verifie l'existence du lien symbolique build
-if [ -d build ];then
-	if ! readlink build > /dev/null ; then
-		#it is a directory, exit to do not erase anything
-		err "Error: build already exsits and is a directory; it should be a symlink."
-		exit 1
-	fi
-	if ! readlink build | grep -w $DIR >/dev/null; then
-		echo "Warning, build was pointing to another directory."
-	fi
-	rm build
-fi
-
-#creation du repertoire
-mkdir -p $DIR
-#creation du lien symbolique
-ln -s $DIR build
-
-#creation project x86
-cd build
-
-rm -f CMakeCache.txt
-rm -rf CMakeFiles
-${OECORE_HOST_NATIVE_SYSROOT}/usr/bin/cmake ../ -G "CodeBlocks - Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=${OECORE_CMAKE_HOST_TOOLCHAIN}
Index: unk/tools/Controller/Mavlink/.project
===================================================================
--- /trunk/tools/Controller/Mavlink/.project	(revision 121)
+++ 	(revision )
@@ -1,11 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>Mavlink</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-	</buildSpec>
-	<natures>
-	</natures>
-</projectDescription>
Index: unk/tools/Controller/Mavlink/cmake_codeblocks.sh
===================================================================
--- /trunk/tools/Controller/Mavlink/cmake_codeblocks.sh	(revision 121)
+++ 	(revision )
@@ -1,27 +1,0 @@
-DIR=build_$(uname -m)
-
-#verifie l'existence du lien symbolique build
-if [ -d build ];then
-	if ! readlink build > /dev/null ; then
-		#it is a directory, exit to do not erase anything
-		err "Error: build already exsits and is a directory; it should be a symlink."
-		exit 1
-	fi
-	if ! readlink build | grep -w $DIR >/dev/null; then
-		echo "Warning, build was pointing to another directory."
-	fi
-	rm build
-fi
-
-#creation du repertoire
-mkdir -p $DIR
-#creation du lien symbolique
-ln -s $DIR build
-
-#creation project x86
-cd build
-
-rm -f CMakeCache.txt
-rm -rf CMakeFiles
-${OECORE_HOST_NATIVE_SYSROOT}/usr/bin/cmake ../ -G "CodeBlocks - Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=${OECORE_CMAKE_HOST_TOOLCHAIN}
-
Index: unk/tools/Dbt2csv/cmake_codeblocks.sh
===================================================================
--- /trunk/tools/Dbt2csv/cmake_codeblocks.sh	(revision 121)
+++ 	(revision )
@@ -1,28 +1,0 @@
-DIR=build_$(uname -m)
-
-### IMPORTANT: We don't use standard cmake_codeblocks script since we don't compile in release mode due to optimization problem (-03) ###
-
-#verifie l'existence du lien symbolique build
-if [ -d build ];then
-	if ! readlink build > /dev/null ; then
-		#it is a directory, exit to do not erase anything
-		err "Error: build already exsits and is a directory; it should be a symlink."
-		exit 1
-	fi
-	if ! readlink build | grep -w $DIR >/dev/null; then
-		echo "Warning, build was pointing to another directory."
-	fi
-	rm build
-fi
-
-#creation du repertoire
-mkdir -p $DIR
-#creation du lien symbolique
-ln -s $DIR build
-
-#creation project x86
-cd build
-
-rm -f CMakeCache.txt
-rm -rf CMakeFiles
-${OECORE_HOST_NATIVE_SYSROOT}/usr/bin/cmake ../ -G "CodeBlocks - Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=${OECORE_CMAKE_HOST_TOOLCHAIN}
Index: unk/tools/FlairGCS/cmake_codeblocks.sh
===================================================================
--- /trunk/tools/FlairGCS/cmake_codeblocks.sh	(revision 121)
+++ 	(revision )
@@ -1,26 +1,0 @@
-DIR=build_$(uname -m)
-
-#verifie l'existence du lien symbolique build
-if [ -d build ];then
-	if ! readlink build > /dev/null ; then
-		#it is a directory, exit to do not erase anything
-		err "Error: build already exsits and is a directory; it should be a symlink."
-		exit 1
-	fi
-	if ! readlink build | grep -w $DIR >/dev/null; then
-		echo "Warnink, build was pointing to another directory."
-	fi
-	rm build
-fi
-
-#creation du repertoire
-mkdir -p $DIR
-#creation du lien symbolique
-ln -s $DIR build
-
-#creation project x86
-cd build
-
-rm -f CMakeCache.txt
-rm -rf CMakeFiles
-${OECORE_HOST_NATIVE_SYSROOT}/usr/bin/cmake ../ -G "CodeBlocks - Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=${OECORE_CMAKE_HOST_TOOLCHAIN}
Index: unk/tools/FlairGCS/cmake_mingw.bat
===================================================================
--- /trunk/tools/FlairGCS/cmake_mingw.bat	(revision 121)
+++ 	(revision )
@@ -1,3 +1,0 @@
-mkdir build_win32
-cd build_win32
-cmake ../ -G "CodeBlocks - MinGW Makefiles"
