Index: trunk/demos/CircleFollower/simulator/build_core2_64/bin/simulator_x4.sh
===================================================================
--- trunk/demos/CircleFollower/simulator/build_core2_64/bin/simulator_x4.sh	(revision 282)
+++ trunk/demos/CircleFollower/simulator/build_core2_64/bin/simulator_x4.sh	(revision 286)
@@ -8,3 +8,3 @@
 . $FLAIR_ROOT/flair-dev/scripts/distribution_specific_hack.sh
 
-$EXEC -n x4_0 -t x4 -p 9000 -a 127.0.0.1 -x setup_x4.xml -o 100 -m $FLAIR_ROOT/flair-bin/models -s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml
+$EXEC -n x4_0 -t x4 -p 9000 -a 127.0.0.1 -x setup_x4.xml -o 10 -m $FLAIR_ROOT/flair-bin/models -s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml
Index: trunk/lib/FlairFilter/src/SimuAhrs.cpp
===================================================================
--- trunk/lib/FlairFilter/src/SimuAhrs.cpp	(revision 282)
+++ 	(revision )
@@ -1,56 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-//  created:    2014/02/07
-//  filename:   SimuAhrs.cpp
-//
-//  author:     Guillaume Sanahuja
-//              Copyright Heudiasyc UMR UTC/CNRS 7253
-//
-//  version:    $Id: $
-//
-//  purpose:    Class for a simulation ahrs
-//
-//
-/*********************************************************************/
-#ifdef CORE2_64
-
-#include "SimuAhrs.h"
-#include "SimuImu.h"
-#include <AhrsData.h>
-
-using std::string;
-using namespace flair::core;
-using namespace flair::sensor;
-
-namespace flair {
-namespace filter {
-
-SimuAhrs::SimuAhrs(string name, uint32_t modelId,uint32_t deviceId,
-                   uint8_t priority)
-    : Ahrs(new SimuImu("imu", modelId,deviceId, priority), name) {
-  SetIsReady(true);
-}
-
-SimuAhrs::~SimuAhrs() {}
-
-// datas from SimuImu are AhrsData!
-void SimuAhrs::UpdateFrom(const io_data *data) {
-  AhrsData *input = (AhrsData *)data;
-  AhrsData *output;
-  GetDatas(&output);
-
-  Quaternion quaternion;
-  Vector3Df filteredAngRates;
-  input->GetQuaternionAndAngularRates(quaternion, filteredAngRates);
-  output->SetQuaternionAndAngularRates(quaternion, filteredAngRates);
-  output->SetDataTime(input->DataTime());
-
-  ProcessUpdate(output);
-}
-
-} // end namespace filter
-} // end namespace flair
-
-#endif
Index: trunk/lib/FlairFilter/src/SimuAhrs.h
===================================================================
--- trunk/lib/FlairFilter/src/SimuAhrs.h	(revision 282)
+++ 	(revision )
@@ -1,60 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-/*!
- * \file SimuAhrs.h
- * \brief Class for a simulation Ahrs
- * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
- * \date 2014/02/07
- * \version 4.0
- */
-
-#ifndef SIMUAHRS_H
-#define SIMUAHRS_H
-
-#include <Ahrs.h>
-#include <stdint.h>
-
-namespace flair {
-namespace filter {
-/*! \class SimuAhrs
-*
-* \brief Class for a simulation Ahrs
-*
-* This class constructs a SimuImu as Imu of this Ahrs.
-*/
-class SimuAhrs : public filter::Ahrs {
-public:
-  /*!
-  * \brief Constructor
-  *
-  * Construct a simulation Ahrs. It will be child of the FrameworkManager.
-  *
-  * \param name name
-  * \param modelId Model id
-  * \param deviceId Ahrs id of the Model
-  * \param priority priority of the SimuImu Thread
-  */
-  SimuAhrs(std::string name,
-           uint32_t modelId,uint32_t deviceId, uint8_t priority);
-
-  /*!
-  * \brief Destructor
-  *
-  */
-  ~SimuAhrs();
-
-private:
-  /*!
-  * \brief Update using provided datas
-  *
-  * Reimplemented from IODevice.
-  *
-  * \param data data from the parent to process
-  */
-  void UpdateFrom(const core::io_data *data);
-};
-} // end namespace filter
-} // end namespace flair
-#endif // SIMUAHRS_H
Index: trunk/lib/FlairFilter/src/SimulatedAhrs.cpp
===================================================================
--- trunk/lib/FlairFilter/src/SimulatedAhrs.cpp	(revision 286)
+++ trunk/lib/FlairFilter/src/SimulatedAhrs.cpp	(revision 286)
@@ -0,0 +1,56 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2014/02/07
+//  filename:   SimulatedAhrs.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    Class for a simulation ahrs
+//
+//
+/*********************************************************************/
+#ifdef CORE2_64
+
+#include "SimulatedAhrs.h"
+#include "SimulatedImu.h"
+#include <AhrsData.h>
+
+using std::string;
+using namespace flair::core;
+using namespace flair::sensor;
+
+namespace flair {
+namespace filter {
+
+SimulatedAhrs::SimulatedAhrs(string name, uint32_t modelId,uint32_t deviceId,
+                   uint8_t priority)
+    : Ahrs(new SimulatedImu("imu", modelId,deviceId, priority), name) {
+  SetIsReady(true);
+}
+
+SimulatedAhrs::~SimulatedAhrs() {}
+
+// datas from SimulatedImu are AhrsData!
+void SimulatedAhrs::UpdateFrom(const io_data *data) {
+  AhrsData *input = (AhrsData *)data;
+  AhrsData *output;
+  GetDatas(&output);
+
+  Quaternion quaternion;
+  Vector3Df filteredAngRates;
+  input->GetQuaternionAndAngularRates(quaternion, filteredAngRates);
+  output->SetQuaternionAndAngularRates(quaternion, filteredAngRates);
+  output->SetDataTime(input->DataTime());
+
+  ProcessUpdate(output);
+}
+
+} // end namespace filter
+} // end namespace flair
+
+#endif
Index: trunk/lib/FlairFilter/src/SimulatedAhrs.h
===================================================================
--- trunk/lib/FlairFilter/src/SimulatedAhrs.h	(revision 286)
+++ trunk/lib/FlairFilter/src/SimulatedAhrs.h	(revision 286)
@@ -0,0 +1,60 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+/*!
+ * \file SimulatedAhrs.h
+ * \brief Class for a simulation Ahrs
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2014/02/07
+ * \version 4.0
+ */
+
+#ifndef SIMUAHRS_H
+#define SIMUAHRS_H
+
+#include <Ahrs.h>
+#include <stdint.h>
+
+namespace flair {
+namespace filter {
+/*! \class SimulatedAhrs
+*
+* \brief Class for a simulation Ahrs
+*
+* This class constructs a SimulatedImu as Imu of this Ahrs.
+*/
+class SimulatedAhrs : public filter::Ahrs {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a simulation Ahrs. It will be child of the FrameworkManager.
+  *
+  * \param name name
+  * \param modelId Model id
+  * \param deviceId Ahrs id of the Model
+  * \param priority priority of the SimulatedImu Thread
+  */
+  SimulatedAhrs(std::string name,
+           uint32_t modelId,uint32_t deviceId, uint8_t priority);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimulatedAhrs();
+
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data);
+};
+} // end namespace filter
+} // end namespace flair
+#endif // SIMUAHRS_H
Index: trunk/lib/FlairMeta/src/MetaVrpnObject.cpp
===================================================================
--- trunk/lib/FlairMeta/src/MetaVrpnObject.cpp	(revision 282)
+++ trunk/lib/FlairMeta/src/MetaVrpnObject.cpp	(revision 286)
@@ -18,5 +18,4 @@
 
 #include "MetaVrpnObject.h"
-#include "VrpnClient.h"
 #include <EulerDerivative.h>
 #include <LowPassFilter.h>
@@ -38,16 +37,15 @@
 namespace meta {
 
-MetaVrpnObject::MetaVrpnObject(string name)
-    : VrpnObject( name, GetVrpnClient()->GetTabWidget()) {
-  ConstructorCommon(name);
+MetaVrpnObject::MetaVrpnObject(string name,VrpnClient *client)
+    : VrpnObject( name, client->GetTabWidget(),client) {
+  ConstructorCommon(name,client);
 }
 
-MetaVrpnObject::MetaVrpnObject(std::string name,
-                               uint8_t id)
-    : VrpnObject(name, id, GetVrpnClient()->GetTabWidget()) {
-  ConstructorCommon( name);
+MetaVrpnObject::MetaVrpnObject(std::string name,uint8_t id,VrpnClient *client)
+    : VrpnObject(name, id, client->GetTabWidget(),client) {
+  ConstructorCommon( name,client);
 }
 
-void MetaVrpnObject::ConstructorCommon(string name) {
+void MetaVrpnObject::ConstructorCommon(string name,VrpnClient *client) {
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(7, 1);
   for (int i = 0; i < desc->Rows(); i++) {
@@ -57,5 +55,5 @@
   delete desc;
 
-  pbas = new LowPassFilter(this, GetVrpnClient()->GetLayout()->NewRow(),
+  pbas = new LowPassFilter(this, client->GetLayout()->NewRow(),
                            name + " Passe bas", prev_value);
   delete prev_value;
@@ -68,5 +66,5 @@
   delete desc;
 
-  euler = new EulerDerivative(pbas, GetVrpnClient()->GetLayout()->NewRow(),
+  euler = new EulerDerivative(pbas, client->GetLayout()->NewRow(),
                               name + "_euler", prev_value);
   delete prev_value;
@@ -79,5 +77,5 @@
   vz_opti_plot->AddCurve(euler->GetMatrix()->Element(6));
 
-  plot_tab = new Tab(GetVrpnClient()->GetTabWidget(), "Mesures (xy) " + name);
+  plot_tab = new Tab(client->GetTabWidget(), "Mesures (xy) " + name);
   xy_plot = new DataPlot2D(plot_tab->NewRow(), "xy", "y", -5, 5, "x", -5, 5);
   xy_plot->AddCurve(Output()->Element(5, 0), Output()->Element(4, 0));
Index: trunk/lib/FlairMeta/src/MetaVrpnObject.h
===================================================================
--- trunk/lib/FlairMeta/src/MetaVrpnObject.h	(revision 282)
+++ trunk/lib/FlairMeta/src/MetaVrpnObject.h	(revision 286)
@@ -15,4 +15,5 @@
 
 #include <VrpnObject.h>
+#include <VrpnClient.h>
 #include <io_data.h>
 #include <Vector3D.h>
@@ -41,6 +42,6 @@
 class MetaVrpnObject : public sensor::VrpnObject {
 public:
-  MetaVrpnObject(std::string name);
-  MetaVrpnObject(std::string name,uint8_t id);
+  MetaVrpnObject(std::string name,sensor::VrpnClient *client=sensor::GetVrpnClient());
+  MetaVrpnObject(std::string name,uint8_t id,sensor::VrpnClient *client=sensor::GetVrpnClient());
   ~MetaVrpnObject();
   gui::DataPlot1D *VxPlot(void) const; // 1,0
@@ -51,5 +52,5 @@
 
 private:
-  void ConstructorCommon(std::string name);
+  void ConstructorCommon(std::string name,sensor::VrpnClient *client);
   filter::LowPassFilter *pbas;
   filter::EulerDerivative *euler;
Index: trunk/lib/FlairMeta/src/SimuX4.cpp
===================================================================
--- trunk/lib/FlairMeta/src/SimuX4.cpp	(revision 282)
+++ trunk/lib/FlairMeta/src/SimuX4.cpp	(revision 286)
@@ -20,12 +20,12 @@
 #include <FrameworkManager.h>
 #include <X4X8Multiplex.h>
-#include <SimuImu.h>
-#include <SimuAhrs.h>
-#include <SimuBldc.h>
-#include <SimuUs.h>
-#include <SimuCamera.h>
-#include <SimuPressureSensor.h>
+#include <SimulatedImu.h>
+#include <SimulatedAhrs.h>
+#include <SimulatedBldc.h>
+#include <SimulatedUs.h>
+#include <SimulatedCamera.h>
+#include <SimulatedPressureSensor.h>
 #include <BatteryMonitor.h>
-#include <SimuGps.h>
+#include <SimulatedGps.h>
 #include <Tab.h>
 #include <FindArgument.h>
@@ -48,8 +48,8 @@
     SetMultiplex(new X4X8Multiplex("motors", X4X8Multiplex::X4));
 
-  SetBldc(new SimuBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
+  SetBldc(new SimulatedBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
                        "motors", GetUavMultiplex()->MotorsCount(), simu_id,0));
-  SetUsRangeFinder(new SimuUs("us", simu_id,0, 60));
-  SetAhrs(new SimuAhrs("ahrs", simu_id, 0,70));
+  SetUsRangeFinder(new SimulatedUs("us", simu_id,0, 60));
+  SetAhrs(new SimulatedAhrs("ahrs", simu_id, 0,70));
   Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery");
   SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
@@ -59,19 +59,19 @@
 	ReadCameraResolutionOption(options,"camv",camvWidth,camvHeight);
   Info("using vertical camera resolution: %ix%i\n",camvWidth, camvHeight);
-  SetVerticalCamera(new SimuCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));
+  SetVerticalCamera(new SimulatedCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));
   
   uint16_t camhWidth=320,camhHeight=240;
   ReadCameraResolutionOption(options,"camh",camhWidth,camhHeight);
   Info("using horizontal camera resolution: %ix%i\n",camhWidth, camhHeight);
-  SetHorizontalCamera(new SimuCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));
+  SetHorizontalCamera(new SimulatedCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));
   
   string useGps=FindArgument(options,"use_gps=",false);
   if(useGps=="true") {
-    SetGps(new SimuGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40));
+    SetGps(new SimulatedGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40));
   }
   
   string usePressureSensor=FindArgument(options,"use_pressure_sensor=",false);
   if(usePressureSensor=="true") {
-    SetPressureSensor(new SimuPressureSensor("pressuresensor", 0,0, 10));
+    SetPressureSensor(new SimulatedPressureSensor("pressuresensor", 0,0, 10));
   } 
 }
@@ -80,10 +80,10 @@
 
 void SimuX4::StartSensors(void) {
-  ((SimuImu *)(GetAhrs()->GetImu()))->Start();
-  ((SimuUs *)GetUsRangeFinder())->Start();
-  ((SimuCamera *)GetVerticalCamera())->Start();
-  ((SimuCamera *)GetHorizontalCamera())->Start();
-  if(GetGps()) ((SimuGps *)GetGps())->Start();
-  if(GetPressureSensor()) ((SimuPressureSensor *)GetPressureSensor())->Start();
+  ((SimulatedImu *)(GetAhrs()->GetImu()))->Start();
+  ((SimulatedUs *)GetUsRangeFinder())->Start();
+  ((SimulatedCamera *)GetVerticalCamera())->Start();
+  ((SimulatedCamera *)GetHorizontalCamera())->Start();
+  if(GetGps()) ((SimulatedGps *)GetGps())->Start();
+  if(GetPressureSensor()) ((SimulatedPressureSensor *)GetPressureSensor())->Start();
 }
 
Index: trunk/lib/FlairMeta/src/SimuX8.cpp
===================================================================
--- trunk/lib/FlairMeta/src/SimuX8.cpp	(revision 282)
+++ trunk/lib/FlairMeta/src/SimuX8.cpp	(revision 286)
@@ -20,12 +20,12 @@
 #include <FrameworkManager.h>
 #include <X4X8Multiplex.h>
-#include <SimuImu.h>
-#include <SimuAhrs.h>
-#include <SimuBldc.h>
-#include <SimuUs.h>
-#include <SimuCamera.h>
-#include <SimuPressureSensor.h>
+#include <SimulatedImu.h>
+#include <SimulatedAhrs.h>
+#include <SimulatedBldc.h>
+#include <SimulatedUs.h>
+#include <SimulatedCamera.h>
+#include <SimulatedPressureSensor.h>
 #include <BatteryMonitor.h>
-#include <SimuGps.h>
+#include <SimulatedGps.h>
 #include <Tab.h>
 #include <FindArgument.h>
@@ -48,8 +48,8 @@
     SetMultiplex(new X4X8Multiplex("motors", X4X8Multiplex::X8));
 
-  SetBldc(new SimuBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
+  SetBldc(new SimulatedBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
                        "motors", GetUavMultiplex()->MotorsCount(), simu_id,0));
-  SetUsRangeFinder(new SimuUs("us", simu_id,0, 60));
-  SetAhrs(new SimuAhrs("ahrs", simu_id, 0,70));
+  SetUsRangeFinder(new SimulatedUs("us", simu_id,0, 60));
+  SetAhrs(new SimulatedAhrs("ahrs", simu_id, 0,70));
   Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery");
   SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
@@ -59,19 +59,19 @@
 	ReadCameraResolutionOption(options,"camv",camvWidth,camvHeight);
   Info("using vertical camera resolution: %ix%i\n",camvWidth, camvHeight);
-  SetVerticalCamera(new SimuCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));
+  SetVerticalCamera(new SimulatedCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));
   
   uint16_t camhWidth=320,camhHeight=240;
   ReadCameraResolutionOption(options,"camh",camhWidth,camhHeight);
   Info("using horizontal camera resolution: %ix%i\n",camhWidth, camhHeight);
-  SetHorizontalCamera(new SimuCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));
+  SetHorizontalCamera(new SimulatedCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));
   
   string useGps=FindArgument(options,"use_gps=",false);
   if(useGps=="true") {
-    SetGps(new SimuGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40));
+    SetGps(new SimulatedGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40));
   } 
   
   string usePressureSensor=FindArgument(options,"use_pressure_sensor=",false);
   if(usePressureSensor=="true") {
-    SetPressureSensor(new SimuPressureSensor("pressuresensor", 0,0, 10));
+    SetPressureSensor(new SimulatedPressureSensor("pressuresensor", 0,0, 10));
   } 
 }
@@ -80,10 +80,10 @@
 
 void SimuX8::StartSensors(void) {
-  ((SimuImu *)(GetAhrs()->GetImu()))->Start();
-  ((SimuUs *)GetUsRangeFinder())->Start();
-  ((SimuCamera *)GetVerticalCamera())->Start();
-  ((SimuCamera *)GetHorizontalCamera())->Start();
-  if(GetGps()) ((SimuGps *)GetGps())->Start();
-  if(GetPressureSensor()) ((SimuPressureSensor *)GetPressureSensor())->Start();
+  ((SimulatedImu *)(GetAhrs()->GetImu()))->Start();
+  ((SimulatedUs *)GetUsRangeFinder())->Start();
+  ((SimulatedCamera *)GetVerticalCamera())->Start();
+  ((SimulatedCamera *)GetHorizontalCamera())->Start();
+  if(GetGps()) ((SimulatedGps *)GetGps())->Start();
+  if(GetPressureSensor()) ((SimulatedPressureSensor *)GetPressureSensor())->Start();
 }
 
Index: trunk/lib/FlairSensorActuator/src/SimuBldc.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuBldc.cpp	(revision 282)
+++ 	(revision )
@@ -1,83 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-//  created:    2014/02/07
-//  filename:   SimuBldc.cpp
-//
-//  author:     Guillaume Sanahuja
-//              Copyright Heudiasyc UMR UTC/CNRS 7253
-//
-//  version:    $Id: $
-//
-//  purpose:    Class for a simulation bldc
-//
-//
-/*********************************************************************/
-#ifdef CORE2_64
-
-#include "SimuBldc.h"
-#include <FrameworkManager.h>
-#include <GridLayout.h>
-#include <DoubleSpinBox.h>
-#include <GroupBox.h>
-#include <SharedMem.h>
-#include <Matrix.h>
-#include <sstream>
-#include <string.h>
-
-using std::string;
-using std::ostringstream;
-using namespace flair::core;
-using namespace flair::gui;
-
-namespace flair {
-namespace actuator {
-
-SimuBldc::SimuBldc(const IODevice *parent, Layout *layout, string name,
-                   uint8_t motors_count, uint32_t modelId,uint32_t deviceId)
-    : Bldc(parent, layout, name, motors_count) {
-  shmem =
-      new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)+sizeof(Time));
-
-  GroupBox *groupbox = new GroupBox(layout->NewRow(), "simubldc");
-  k = new DoubleSpinBox(groupbox->NewRow(), "k driver:", 0, 10000, 1);
-  
-  buf=(char*)malloc(motors_count * sizeof(float)+sizeof(Time));
-  if(buf==NULL) {
-    Err("error creating buffer\n");
-    return;
-  }
-  SetIsReady(true);
-}
-
-SimuBldc::~SimuBldc() {
-  if(buf!=NULL) free(buf);
-}
-
-string SimuBldc::ShMemName(uint32_t modelId,uint32_t deviceId) {
-  ostringstream dev_name;
-  dev_name << "simu" <<  modelId << "_bldc_" << deviceId;
-  return dev_name.str().c_str();
-}
-
-void SimuBldc::SetMotors(float *value) {
-  float *values=(float*)buf;
-  for (int i = 0; i < MotorsCount(); i++) values[i] = k->Value() * value[i];
-  Time time=GetTime();
-  memcpy(buf+MotorsCount() * sizeof(float),&time,sizeof(Time));
-
-  shmem->Write(buf, MotorsCount() * sizeof(float)+sizeof(Time));
-
-  // on prend une fois pour toute le mutex et on fait des accès directs
-  output->GetMutex();
-  for (int i = 0; i < MotorsCount(); i++) {
-    output->SetValueNoMutex(i, 0, values[i]);
-  }
-  output->ReleaseMutex();
-}
-
-} // end namespace sensor
-} // end namespace flair
-
-#endif
Index: trunk/lib/FlairSensorActuator/src/SimuBldc.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuBldc.h	(revision 282)
+++ 	(revision )
@@ -1,97 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-/*!
- * \file SimuBldc.h
- * \brief Class for a simulation bldc
- * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
- * \date 2014/02/07
- * \version 4.0
- */
-
-#ifndef SIMUBLDC_H
-#define SIMUBLDC_H
-
-#include <Bldc.h>
-
-namespace flair {
-namespace core {
-class SharedMem;
-class IODevice;
-class Matrix;
-}
-namespace gui {
-class DoubleSpinBox;
-class Layout;
-}
-}
-
-namespace flair {
-namespace actuator {
-/*! \class SimuBldc
-*
-* \brief Class for a simulation bldc
-*
-*/
-class SimuBldc : public Bldc {
-public:
-  /*!
-  * \brief Constructor
-  *
-  * Construct a SimuBldc
-  *
-  * \param parent parent
-  * \param layout layout
-  * \param name name
-  * \param motors_count number of motors
-  * \param modelId Model id
-  * \param deviceId Bldc id of the Model
-  */
-  SimuBldc(const core::IODevice *parent, gui::Layout *layout, std::string name,
-           uint8_t motors_count, uint32_t modelId,uint32_t deviceId);
-
-  /*!
-  * \brief Destructor
-  *
-  */
-  ~SimuBldc();
-
-  /*!
-  * \brief Has speed measurement
-  *
-  * Reimplemented from Bldc. \n
-  *
-  * \return true if it has speed measurement
-  */
-  bool HasSpeedMeasurement(void) const { return false; };
-
-  /*!
-  * \brief Has current measurement
-  *
-  * Reimplemented from Bldc. \n
-  *
-  * \return true if it has current measurement
-  */
-  bool HasCurrentMeasurement(void) const { return false; };
-
-private:
-  /*!
-  * \brief Set motors values
-  *
-  * Reimplemented from Bldc. \n
-  * Values size must be the same as MotorsCount()
-  *
-  * \param values motor values
-  */
-  void SetMotors(float *value);
-  
-  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
-  core::SharedMem *shmem;
-  gui::DoubleSpinBox *k;
-  char *buf;
-
-};
-} // end namespace actuator
-} // end namespace flair
-#endif // SIMUBLDC_H
Index: trunk/lib/FlairSensorActuator/src/SimuCamera.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuCamera.cpp	(revision 282)
+++ 	(revision )
@@ -1,98 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-//  created:    2014/03/06
-//  filename:   SimuCamera.cpp
-//
-//  author:     Guillaume Sanahuja
-//              Copyright Heudiasyc UMR UTC/CNRS 7253
-//
-//  version:    $Id: $
-//
-//  purpose:    Class for a simulation camera
-//
-//
-/*********************************************************************/
-#ifdef CORE2_64
-
-#include "SimuCamera.h"
-#include <FrameworkManager.h>
-#include <GroupBox.h>
-#include <SharedMem.h>
-#include <sstream>
-
-using std::string;
-using std::ostringstream;
-using namespace flair::core;
-using namespace flair::gui;
-
-namespace flair {
-namespace sensor {
-
-SimuCamera::SimuCamera(string name,
-                       uint16_t width, uint16_t height, uint8_t channels,
-                       uint32_t modelId,uint32_t deviceId, uint8_t priority)
-    : Thread(getFrameworkManager(), name, priority),
-      Camera(name, width, height, cvimage::Type::Format::BGR) {
-
-  buf_size = width * height * channels+sizeof(Time);
-
-  shmemReadBuf=(char*)malloc(buf_size);
-  output->img->imageData = shmemReadBuf;
-
-  ostringstream dev_name;
-  dev_name << "simu" <<  modelId << "_cam_" << deviceId;
-  shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId), buf_size, SharedMem::Type::producerConsumer);
-  
-  SetIsReady(true);
-}
-
-
-SimuCamera::~SimuCamera() {
-  SafeStop();
-  Join();
-  if(shmemReadBuf!=NULL) delete shmemReadBuf;
-}
-
-string SimuCamera::ShMemName(uint32_t modelId,uint32_t deviceId) {
-  ostringstream dev_name;
-  dev_name << "simu" <<  modelId << "_cam_" << deviceId;
-  return dev_name.str().c_str();
-}
-
-void SimuCamera::Run(void) {
-  Time time;
-
-//  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
-  shmem->ReaderReady();
-
-  while (!ToBeStopped()) {
-//    WaitPeriod();
-
-//    if (data_rate->ValueChanged() == true) {
-//      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
-//    }
-
-    output->GetMutex();
-    //blocking read
-    if (shmem->Read(shmemReadBuf, buf_size, 1000000000)) { // remplacer copie par
-      // échange de pointeur sur
-      // double buffering
-
-      output->ReleaseMutex();
-      memcpy(&time, shmemReadBuf + buf_size - sizeof(Time), sizeof(Time));
-      output->SetDataTime(time);
-
-      ProcessUpdate(output);
-    } else {
-      output->ReleaseMutex();
-      //Thread::Warn("Read Timeout\n");
-    }
-  }
-}
-
-} // end namespace sensor
-} // end namespace flair
-
-#endif
Index: trunk/lib/FlairSensorActuator/src/SimuCamera.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuCamera.h	(revision 282)
+++ 	(revision )
@@ -1,91 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-/*!
- * \file SimuCamera.h
- * \brief Class for a simulation camera
- * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
- * \date 2014/03/06
- * \version 4.0
- */
-
-#ifndef SIMUCAMERA_H
-#define SIMUCAMERA_H
-
-#include <Camera.h>
-#include <Thread.h>
-#include <cxcore.h>
-
-namespace flair {
-  namespace core {
-    class SharedMem;
-  }
-}
-
-namespace flair {
-namespace sensor {
-/*! \class SimuCamera
-*
-* \brief Class for a simulation camera
-*/
-class SimuCamera : public core::Thread, public Camera {
-public:
-  /*!
-  * \brief Constructor
-  *
-  * Construct a SimuCamera.
-	* It will be child of the FrameworkManager.
-  *
-  * \param name name
-  * \param width width
-  * \param height height
-  * \param channels number of channels
-  * \param modelId Model id
-  * \param deviceId Camera id of the Model
-  * \param priority priority of the Thread
-  */
-  SimuCamera(std::string name,
-             uint16_t width, uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId,
-             uint8_t priority);
-
-
-  /*!
-  * \brief Destructor
-  *
-  */
-  ~SimuCamera();
-
-protected:
-  /*!
-  * \brief SharedMem to access datas
-  *
-  */
-  core::SharedMem *shmem;
-
-private:
-  /*!
-  * \brief Run function
-  *
-  * Reimplemented from Thread.
-  *
-  */
-  void Run(void);
-
-  /*!
-  * \brief Update using provided datas
-  *
-  * Reimplemented from IODevice.
-  *
-  * \param data data from the parent to process
-  */
-  void UpdateFrom(const core::io_data *data){};
-  
-  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
-
-  size_t buf_size;
-  char* shmemReadBuf;
-};
-} // end namespace sensor
-} // end namespace flair
-#endif // SIMUCAMERA_H
Index: trunk/lib/FlairSensorActuator/src/SimuGps.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuGps.cpp	(revision 282)
+++ 	(revision )
@@ -1,137 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-//  created:    2014/05/26
-//  filename:   SimuGps.cpp
-//
-//  author:     Guillaume Sanahuja
-//              Copyright Heudiasyc UMR UTC/CNRS 7253
-//
-//  version:    $Id: $
-//
-//  purpose:    Class for a simulation GPS
-//
-//
-/*********************************************************************/
-#ifdef CORE2_64
-
-#include "SimuGps.h"
-#include <FrameworkManager.h>
-#include <GpsData.h>
-#include <SharedMem.h>
-#include <SpinBox.h>
-#include <DoubleSpinBox.h>
-#include <GroupBox.h>
-#include <Euler.h>
-#include <Matrix.h>
-#include <sstream>
-#include "geodesie.h"
-
-using std::string;
-using std::ostringstream;
-using namespace flair::core;
-using namespace flair::gui;
-using namespace Geodesie;
-
-namespace flair {
-namespace sensor {
-
-SimuGps::SimuGps(string name,
-                 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority)
-    : NmeaGps(name, NMEAFlags),Thread(getFrameworkManager(), name, priority) {
-
-  dataRate = new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 200);
-  latitudeRef = new DoubleSpinBox(GetGroupBox()->NewRow(), "latitude ref", " deg", -90, 90, 1, 6,49.402313);
-  longitudeRef = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "longitude ref", " deg", -180, 180, 1, 6,2.795463);
-  altitudeRef= new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "altitude ref", " m", 0, 6000, 100, 1,0);
-  fixQuality = new SpinBox(GetGroupBox()->NewRow(), "fix quality", 1, 8, 1, 1);
-  numberOfSatellites = new SpinBox(GetGroupBox()->NewRow(), "number of satellites", 1, 15, 1, 5);
-  magneticDeclination= new DoubleSpinBox(GetGroupBox()->NewRow(), "magnetic declination", " deg", -180, 180, .1, 2,0);
-  
-  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),
-                        sizeof(gps_states_t));
-                        
-  SetIsReady(true);
-}
-
-
-SimuGps::~SimuGps() {
-  SafeStop();
-  Join();
-}
-
-string SimuGps::ShMemName(uint32_t modelId,uint32_t deviceId) {
-  ostringstream dev_name;
-  dev_name << "simu" <<  modelId << "_gps_" << deviceId;
-  return dev_name.str().c_str();
-}
-
-void SimuGps::Run(void) {
-  gps_states_t state;
-  char buf[512];
-  nmeaGPGGA gga;
-  nmeaGPVTG vtg;
-  nmeaPOS pos;
-  nmeaINFO info;
-
-  vtg.dir_t='T';
-  vtg.dec_m='M';
-  vtg.spk_k='K';
-  vtg.spn_n='N';
-  gga.elv_units='M';
-  gga.diff_units='M';
-
-  SetPeriodUS((uint32_t)(1000000. / dataRate->Value()));
-
-  WarnUponSwitches(true);
-
-
-  while (!ToBeStopped()) {
-    WaitPeriod();
-
-    if (dataRate->ValueChanged() == true) {
-      SetPeriodUS((uint32_t)(1000000. / dataRate->Value()));
-    }
-
-    shmem->Read((char *)&state, sizeof(gps_states_t));
-
-    double x, y, z;
-    ENU_2_ECEF(state.e, state.n, state.u, x,y,z, Euler::ToRadian(longitudeRef->Value()), Euler::ToRadian(latitudeRef->Value()), altitudeRef->Value());
-    ECEF_2_Geographique( x, y, z,pos.lon, pos.lat, gga.elv);
-    nmea_pos2info(&pos,&info);
-
-    if(pos.lat>0) {
-      gga.ns='N';
-      gga.lat=info.lat;
-    } else {
-      gga.ns='S';
-      gga.lat=-info.lat;
-    }
-    if(pos.lon>0) {
-      gga.ew='E';
-      gga.lon=info.lon;
-    } else {
-      gga.ew='W';
-      gga.lon=-info.lon;
-    }
-
-    gga.sig=fixQuality->Value();
-    gga.satinuse=numberOfSatellites->Value();
-
-    int size=nmea_gen_GPGGA(buf,sizeof(buf),&gga);
-    parseFrame(buf,size);
-    
-    vtg.dir=90-Euler::ToDegree(atan2f(state.vn,state.ve));
-    vtg.spk=sqrtf(state.ve*state.ve+state.vn*state.vn)*3600./1000.;
-    size=nmea_gen_GPVTG(buf,sizeof(buf),&vtg);
-    parseFrame(buf,size);
-  }
-
-  WarnUponSwitches(false);
-}
-
-} // end namespace sensor
-} // end namespace flair
-
-#endif
Index: trunk/lib/FlairSensorActuator/src/SimuGps.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuGps.h	(revision 282)
+++ 	(revision )
@@ -1,92 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-/*!
- * \file SimuGps.h
- * \brief Class for a simulation GPS
- * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
- * \date 2013/08/23
- * \version 4.0
- */
-
-#ifndef SIMUGPS_H
-#define SIMUGPS_H
-
-#include <Thread.h>
-#include <NmeaGps.h>
-
-namespace flair {
-  namespace core {
-    class SharedMem;
-  }
-  namespace gui {
-    class SpinBox;
-    class DoubleSpinBox;
-  }
-}
-
-namespace flair {
-namespace sensor {
-/*! \class SimuGps
-*
-* \brief Class for a simulation GPS
-*/
-class SimuGps : public core::Thread, public NmeaGps {
-public:
-  /*!
-  * \brief Constructor
-  *
-  * Construct a simulation GPS
-  * It will be child of the FrameworkManager.
-	* 
-  * \param name name
-  * \param NMEAFlags NMEA sentances to enable
-  * \param modelId Model id
-  * \param deviceId Gps id of the Model
-  * \param priority priority of the Thread
-  */
-  SimuGps(std::string name,
-          NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority);
-
-  /*!
-  * \brief Destructor
-  *
-  */
-  ~SimuGps();
-
-private:
-  /*!
-  * \brief Update using provided datas
-  *
-  * Reimplemented from IODevice.
-  *
-  * \param data data from the parent to process
-  */
-  void UpdateFrom(const core::io_data *data){};
-
-  /*!
-  * \brief Run function
-  *
-  * Reimplemented from Thread.
-  *
-  */
-  void Run(void);
-
-  typedef struct {
-    float e;
-    float n;
-    float u;
-    float ve;
-    float vn;
-  } gps_states_t;
-  
-  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
-
-  core::SharedMem *shmem;
-  gui::SpinBox *dataRate,*fixQuality,*numberOfSatellites;
-  gui::DoubleSpinBox *latitudeRef,*longitudeRef,*altitudeRef,*magneticDeclination;
-};
-} // end namespace sensor
-} // end namespace flair
-#endif // SIMUGPS_H
Index: trunk/lib/FlairSensorActuator/src/SimuImu.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuImu.cpp	(revision 282)
+++ 	(revision )
@@ -1,97 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-//  created:    2014/02/07
-//  filename:   SimuImu.cpp
-//
-//  author:     Guillaume Sanahuja
-//              Copyright Heudiasyc UMR UTC/CNRS 7253
-//
-//  version:    $Id: $
-//
-//  purpose:    Class for a simulation imu
-//
-//
-/*********************************************************************/
-#ifdef CORE2_64
-
-#include "SimuImu.h"
-#include <FrameworkManager.h>
-#include <ImuData.h>
-#include <SpinBox.h>
-#include <GroupBox.h>
-#include <Matrix.h>
-#include <SharedMem.h>
-#include <AhrsData.h>
-#include <sstream>
-
-using std::string;
-using std::ostringstream;
-using namespace flair::core;
-using namespace flair::gui;
-
-namespace flair {
-namespace sensor {
-
-SimuImu::SimuImu(string name, uint32_t modelId,uint32_t deviceId,
-                 uint8_t priority)
-    : Imu(name,false), Thread(getFrameworkManager(), name, priority) {
-  dataRate =
-      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 200);
-  ahrsData = new AhrsData((Imu *)this);
-  
-  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),
-                        sizeof(imu_states_t));
-  SetIsReady(true);
-}
-
-SimuImu::~SimuImu() {
-  SafeStop();
-  Join();
-}
-
-string SimuImu::ShMemName(uint32_t modelId,uint32_t deviceId) {
-  ostringstream dev_name;
-  dev_name << "simu" <<  modelId << "_imu_" << deviceId;
-  return dev_name.str().c_str();
-}
-
-void SimuImu::Run(void) {
-  imu_states_t state;
-  ImuData *imuData;
-  GetDatas(&imuData);
-
-  SetPeriodUS((uint32_t)(1000000. / dataRate->Value()));
-
-  while (!ToBeStopped()) {
-    WaitPeriod();
-
-    if (dataRate->ValueChanged() == true) {
-      SetPeriodUS((uint32_t)(1000000. / dataRate->Value()));
-    }
-    shmem->Read((char *)&state, sizeof(imu_states_t));
-    Quaternion quaternion(state.q0, state.q1, state.q2, state.q3);
-    Vector3Df angRate(state.wx, state.wy, state.wz);
-    Vector3Df rawAcc(state.ax, state.ay, state.az);
-    Vector3Df rawMag(state.mx, state.my, state.mz);
-    Vector3Df rawGyr(state.wx, state.wy, state.wz);
-    //we do not need rotation in simulation
-    /*
-    ApplyRotation(angRate);
-    ApplyRotation(quaternion);
-    ApplyRotation(rawAcc);
-    ApplyRotation(rawMag);
-    ApplyRotation(rawGyr);*/
-    ahrsData->SetQuaternionAndAngularRates(quaternion,angRate);
-    imuData->SetRawAccMagAndGyr(rawAcc,rawMag,rawGyr);
-    imuData->SetDataTime(GetTime());
-    ahrsData->SetDataTime(GetTime());
-    ProcessUpdate(ahrsData);
-  }
-}
-
-} // end namespace sensor
-} // end namespace flair
-
-#endif
Index: trunk/lib/FlairSensorActuator/src/SimuImu.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuImu.h	(revision 282)
+++ 	(revision )
@@ -1,99 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-/*!
- * \file SimuImu.h
- * \brief Class for a simulation Imu
- * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
- * \date 2014/02/07
- * \version 4.0
- */
-
-#ifndef SIMUIMU_H
-#define SIMUIMU_H
-
-#include <Imu.h>
-#include <Thread.h>
-
-namespace flair {
-  namespace core {
-    class SharedMem;
-    class AhrsData;
-  }
-  namespace gui {
-    class SpinBox;
-  }
-}
-
-namespace flair {
-namespace sensor {
-/*! \class SimuImu
-*
-* \brief Class for a simulation Imu
-*/
-class SimuImu : public Imu, public core::Thread {
-public:
-  /*!
-  * \brief Constructor
-  *
-  * Construct a SimuImu.
-	* It will be child of the FrameworkManager.
-  *
-  * \param name name
-  * \param modelId Model id
-  * \param deviceId Imu id of the Model
-  * \param priority priority of the Thread
-  */
-  SimuImu(std::string name,
-          uint32_t modelId,uint32_t deviceId, uint8_t priority);
-
-  /*!
-  * \brief Destructor
-  *
-  */
-  ~SimuImu();
-
-private:
-  /*!
-  * \brief Run function
-  *
-  * Reimplemented from Thread.
-  *
-  */
-  void Run(void);
-
-  /*!
-  * \brief Update using provided datas
-  *
-  * Reimplemented from IODevice.
-  *
-  * \param data data from the parent to process
-  */
-  void UpdateFrom(const core::io_data *data){};
-
-  typedef struct {
-    float q0;
-    float q1;
-    float q2;
-    float q3;
-    float wx;
-    float wy;
-    float wz;
-    float ax;
-    float ay;
-    float az;
-    float mx;
-    float my;
-    float mz;
-  } imu_states_t;
-  
-  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
-
-  gui::SpinBox *dataRate;
-  core::SharedMem *shmem;
-  core::AhrsData *ahrsData;
-};
-} // end namespace sensor
-} // end namespace flair
-#endif // SIMUIMU_H
Index: trunk/lib/FlairSensorActuator/src/SimuLaser.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuLaser.cpp	(revision 282)
+++ 	(revision )
@@ -1,81 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-//  created:    2014/02/07
-//  filename:   SimuUs.cpp
-//
-//  author:     Guillaume Sanahuja
-//              Copyright Heudiasyc UMR UTC/CNRS 7253
-//
-//  version:    $Id: $
-//
-//  purpose:    Class for a simulation us
-//
-//
-/*********************************************************************/
-#ifdef CORE2_64
-
-#include "SimuLaser.h"
-#include <FrameworkManager.h>
-#include <SpinBox.h>
-#include <GroupBox.h>
-#include <Matrix.h>
-#include <SharedMem.h>
-#include <sstream>
-
-using std::string;
-using std::ostringstream;
-using namespace flair::core;
-using namespace flair::gui;
-
-namespace flair {
-namespace sensor {
-
-SimuLaser::SimuLaser(string name,
-                     uint32_t modelId,uint32_t deviceId, uint8_t priority)
-    : Thread(getFrameworkManager(), name, priority), LaserRangeFinder(name) {
-  data_rate =
-      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50);
-
-  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),
-                        360 * sizeof(float));
-  SetIsReady(true);
-}
-
-SimuLaser::~SimuLaser() {
-  SafeStop();
-  Join();
-}
-
-string SimuLaser::ShMemName(uint32_t modelId,uint32_t deviceId) {
-  ostringstream dev_name;
-  dev_name << "simu" <<  modelId << "_laser_" << deviceId;
-  return dev_name.str().c_str();
-}
-
-void SimuLaser::Run(void) {
-  float z[360];
-
-  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
-
-  while (!ToBeStopped()) {
-    WaitPeriod();
-
-    shmem->Read((char *)z, 360 * sizeof(float));
-
-    if (data_rate->ValueChanged() == true) {
-      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
-    }
-    for (int i = 0; i < 360; i++) {
-      output->SetValue(i, 0, z[i]); //*******
-    }
-    output->SetDataTime(GetTime());
-    ProcessUpdate(output);
-  }
-}
-
-} // end namespace sensor
-} // end namespace flair
-
-#endif
Index: trunk/lib/FlairSensorActuator/src/SimuLaser.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuLaser.h	(revision 282)
+++ 	(revision )
@@ -1,85 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-/*!
- * \file SimuUs.h
- * \brief Class for a simulation UsRangeFinder
- * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
- * \date 2014/02/07
- * \version 4.0
- */
-
-#ifndef SIMULASER_H
-#define SIMULASER_H
-
-#include <LaserRangeFinder.h>
-#include <Thread.h>
-
-namespace flair {
-namespace core {
-class SharedMem;
-}
-namespace gui {
-class SpinBox;
-}
-}
-
-namespace flair {
-namespace sensor {
-/*! \class SimuUs
-*
-* \brief Class for a simulation UsRangeFinder
-*/
-class SimuLaser : public core::Thread, public LaserRangeFinder {
-public:
-  /*!
-  * \brief Constructor
-  *
-  * Construct a SimuUs.
-  *
-  * \param name name
-  * \param modelId Model id
-  * \param deviceId LaserRangeFinder id of the Model
-  * \param priority priority of the Thread
-  */
-  SimuLaser(std::string name,
-            uint32_t modelId,uint32_t deviceId, uint8_t priority);
-
-  /*!
-  * \brief Destructor
-  *
-  */
-  ~SimuLaser();
-
-protected:
-  /*!
-  * \brief SharedMem to access datas
-  *
-  */
-  core::SharedMem *shmem;
-
-private:
-  /*!
-  * \brief Update using provided datas
-  *
-  * Reimplemented from IODevice.
-  *
-  * \param data data from the parent to process
-  */
-  void UpdateFrom(const core::io_data *data){};
-
-  /*!
-  * \brief Run function
-  *
-  * Reimplemented from Thread.
-  *
-  */
-  void Run(void);
-  
-  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
-  gui::SpinBox *data_rate;
-};
-} // end namespace sensor
-} // end namespace flair
-#endif // SIMULASER_H
Index: trunk/lib/FlairSensorActuator/src/SimuPressureSensor.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuPressureSensor.cpp	(revision 282)
+++ 	(revision )
@@ -1,80 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-//  created:    2018/05/24
-//  filename:   SimuPressureSensor.cpp
-//
-//  author:     Guillaume Sanahuja
-//              Copyright Heudiasyc UMR UTC/CNRS 7253
-//
-//  version:    $Id: $
-//
-//  purpose:    Class for a simulation pressure sensor
-//
-//
-/*********************************************************************/
-#ifdef CORE2_64
-
-#include "SimuPressureSensor.h"
-#include <FrameworkManager.h>
-#include <SpinBox.h>
-#include <GroupBox.h>
-#include <Matrix.h>
-#include <SharedMem.h>
-#include <sstream>
-
-using std::string;
-using std::ostringstream;
-using namespace flair::core;
-using namespace flair::gui;
-
-namespace flair {
-namespace sensor {
-
-SimuPressureSensor::SimuPressureSensor(string name, uint32_t modelId,uint32_t deviceId,
-               uint8_t priority)
-    : Thread(getFrameworkManager(), name, priority), PressureSensor( name) {
-  data_rate =
-      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50);
-
-  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), sizeof(float));
-
-  SetIsReady(true);
-}
-
-SimuPressureSensor::~SimuPressureSensor() {
-  SafeStop();
-  Join();
-}
-
-string SimuPressureSensor::ShMemName(uint32_t modelId,uint32_t deviceId) {
-  ostringstream dev_name;
-  dev_name << "simu" <<  modelId << "_pressure_" << deviceId;
-  return dev_name.str().c_str();
-}
-
-void SimuPressureSensor::Run(void) {
-  float p;
-
-  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
-
-  while (!ToBeStopped()) {
-    WaitPeriod();
-
-    shmem->Read((char *)&p, sizeof(float));
-
-    if (data_rate->ValueChanged() == true) {
-      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
-    }
-
-    output->SetValue(0, 0, p);
-    output->SetDataTime(GetTime());
-    ProcessUpdate(output);
-  }
-}
-
-} // end namespace sensor
-} // end namespace flair
-
-#endif
Index: trunk/lib/FlairSensorActuator/src/SimuPressureSensor.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuPressureSensor.h	(revision 282)
+++ 	(revision )
@@ -1,86 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-/*!
- * \file SimuPressureSensor.h
- * \brief Class for a simulation PressureSensor
- * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
- * \date 2018/05/24
- * \version 4.0
- */
-
-#ifndef SIMUPRESSURESENSOR_H
-#define SIMUPRESSURESENSOR_H
-
-#include <PressureSensor.h>
-#include <Thread.h>
-
-namespace flair {
-namespace core {
-class SharedMem;
-}
-namespace gui {
-class SpinBox;
-}
-}
-
-namespace flair {
-namespace sensor {
-/*! \class SimuPressureSensor
-*
-* \brief Class for a simulation PressureSensor
-*/
-class SimuPressureSensor : public core::Thread, public PressureSensor {
-public:
-  /*!
-  * \brief Constructor
-  *
-  * Construct a SimuPressureSensor.
-	* It will be child of the FrameworkManager.
-  *
-  * \param name name
-  * \param modelId Model id
-  * \param deviceId PressureSensor id of the Model
-  * \param priority priority of the Thread
-  */
-  SimuPressureSensor(std::string name,
-         uint32_t modelId,uint32_t deviceId, uint8_t priority);
-
-  /*!
-  * \brief Destructor
-  *
-  */
-  ~SimuPressureSensor();
-
-protected:
-  /*!
-  * \brief SharedMem to access datas
-  *
-  */
-  core::SharedMem *shmem;
-
-private:
-  /*!
-  * \brief Update using provided datas
-  *
-  * Reimplemented from IODevice.
-  *
-  * \param data data from the parent to process
-  */
-  void UpdateFrom(const core::io_data *data){};
-
-  /*!
-  * \brief Run function
-  *
-  * Reimplemented from Thread.
-  *
-  */
-  void Run(void);
-  
-  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
-  gui::SpinBox *data_rate;
-};
-} // end namespace sensor
-} // end namespace flair
-#endif // SIMUPRESSURESENSOR_H
Index: trunk/lib/FlairSensorActuator/src/SimuUs.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuUs.cpp	(revision 282)
+++ 	(revision )
@@ -1,80 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-//  created:    2014/02/07
-//  filename:   SimuUs.cpp
-//
-//  author:     Guillaume Sanahuja
-//              Copyright Heudiasyc UMR UTC/CNRS 7253
-//
-//  version:    $Id: $
-//
-//  purpose:    Class for a simulation us
-//
-//
-/*********************************************************************/
-#ifdef CORE2_64
-
-#include "SimuUs.h"
-#include <FrameworkManager.h>
-#include <SpinBox.h>
-#include <GroupBox.h>
-#include <Matrix.h>
-#include <SharedMem.h>
-#include <sstream>
-
-using std::string;
-using std::ostringstream;
-using namespace flair::core;
-using namespace flair::gui;
-
-namespace flair {
-namespace sensor {
-
-SimuUs::SimuUs(string name, uint32_t modelId,uint32_t deviceId,
-               uint8_t priority)
-    : Thread(getFrameworkManager(), name, priority), UsRangeFinder( name) {
-  data_rate =
-      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50);
-
-  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), sizeof(float));
-
-  SetIsReady(true);
-}
-
-SimuUs::~SimuUs() {
-  SafeStop();
-  Join();
-}
-
-string SimuUs::ShMemName(uint32_t modelId,uint32_t deviceId) {
-  ostringstream dev_name;
-  dev_name << "simu" <<  modelId << "_us_" << deviceId;
-  return dev_name.str().c_str();
-}
-
-void SimuUs::Run(void) {
-  float z;
-  
-  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
-
-  while (!ToBeStopped()) {
-    WaitPeriod();
-
-    shmem->Read((char *)&z, sizeof(float));
-
-    if (data_rate->ValueChanged() == true) {
-      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
-    }
-
-    output->SetValue(0, 0, z);
-    output->SetDataTime(GetTime());
-    ProcessUpdate(output);
-  }
-}
-
-} // end namespace sensor
-} // end namespace flair
-
-#endif
Index: trunk/lib/FlairSensorActuator/src/SimuUs.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimuUs.h	(revision 282)
+++ 	(revision )
@@ -1,86 +1,0 @@
-// %flair:license{
-// This file is part of the Flair framework distributed under the
-// CECILL-C License, Version 1.0.
-// %flair:license}
-/*!
- * \file SimuUs.h
- * \brief Class for a simulation UsRangeFinder
- * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
- * \date 2014/02/07
- * \version 4.0
- */
-
-#ifndef SIMUUS_H
-#define SIMUUS_H
-
-#include <UsRangeFinder.h>
-#include <Thread.h>
-
-namespace flair {
-namespace core {
-class SharedMem;
-}
-namespace gui {
-class SpinBox;
-}
-}
-
-namespace flair {
-namespace sensor {
-/*! \class SimuUs
-*
-* \brief Class for a simulation UsRangeFinder
-*/
-class SimuUs : public core::Thread, public UsRangeFinder {
-public:
-  /*!
-  * \brief Constructor
-  *
-  * Construct a SimuUs.
-	* It will be child of the FrameworkManager.
-  *
-  * \param name name
-  * \param modelId Model id
-  * \param deviceId UsRangeFinder id of the Model
-  * \param priority priority of the Thread
-  */
-  SimuUs(std::string name,
-         uint32_t modelId,uint32_t deviceId, uint8_t priority);
-
-  /*!
-  * \brief Destructor
-  *
-  */
-  ~SimuUs();
-
-protected:
-  /*!
-  * \brief SharedMem to access datas
-  *
-  */
-  core::SharedMem *shmem;
-
-private:
-  /*!
-  * \brief Update using provided datas
-  *
-  * Reimplemented from IODevice.
-  *
-  * \param data data from the parent to process
-  */
-  void UpdateFrom(const core::io_data *data){};
-
-  /*!
-  * \brief Run function
-  *
-  * Reimplemented from Thread.
-  *
-  */
-  void Run(void);
-  
-  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
-  gui::SpinBox *data_rate;
-};
-} // end namespace sensor
-} // end namespace flair
-#endif // SIMUUS_H
Index: trunk/lib/FlairSensorActuator/src/SimulatedBldc.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedBldc.cpp	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedBldc.cpp	(revision 286)
@@ -0,0 +1,83 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2014/02/07
+//  filename:   SimulatedBldc.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    Class for a simulation bldc
+//
+//
+/*********************************************************************/
+#ifdef CORE2_64
+
+#include "SimulatedBldc.h"
+#include <FrameworkManager.h>
+#include <GridLayout.h>
+#include <DoubleSpinBox.h>
+#include <GroupBox.h>
+#include <SharedMem.h>
+#include <Matrix.h>
+#include <sstream>
+#include <string.h>
+
+using std::string;
+using std::ostringstream;
+using namespace flair::core;
+using namespace flair::gui;
+
+namespace flair {
+namespace actuator {
+
+SimulatedBldc::SimulatedBldc(const IODevice *parent, Layout *layout, string name,
+                   uint8_t motors_count, uint32_t modelId,uint32_t deviceId)
+    : Bldc(parent, layout, name, motors_count) {
+  shmem =
+      new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)+sizeof(Time));
+
+  GroupBox *groupbox = new GroupBox(layout->NewRow(), "simubldc");
+  k = new DoubleSpinBox(groupbox->NewRow(), "k driver:", 0, 10000, 1);
+  
+  buf=(char*)malloc(motors_count * sizeof(float)+sizeof(Time));
+  if(buf==NULL) {
+    Err("error creating buffer\n");
+    return;
+  }
+  SetIsReady(true);
+}
+
+SimulatedBldc::~SimulatedBldc() {
+  if(buf!=NULL) free(buf);
+}
+
+string SimulatedBldc::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_bldc_" << deviceId;
+  return dev_name.str().c_str();
+}
+
+void SimulatedBldc::SetMotors(float *value) {
+  float *values=(float*)buf;
+  for (int i = 0; i < MotorsCount(); i++) values[i] = k->Value() * value[i];
+  Time time=GetTime();
+  memcpy(buf+MotorsCount() * sizeof(float),&time,sizeof(Time));
+
+  shmem->Write(buf, MotorsCount() * sizeof(float)+sizeof(Time));
+
+  // on prend une fois pour toute le mutex et on fait des accès directs
+  output->GetMutex();
+  for (int i = 0; i < MotorsCount(); i++) {
+    output->SetValueNoMutex(i, 0, values[i]);
+  }
+  output->ReleaseMutex();
+}
+
+} // end namespace sensor
+} // end namespace flair
+
+#endif
Index: trunk/lib/FlairSensorActuator/src/SimulatedBldc.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedBldc.h	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedBldc.h	(revision 286)
@@ -0,0 +1,97 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+/*!
+ * \file SimulatedBldc.h
+ * \brief Class for a simulation bldc
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2014/02/07
+ * \version 4.0
+ */
+
+#ifndef SIMULATEDBLDC_H
+#define SIMULATEDBLDC_H
+
+#include <Bldc.h>
+
+namespace flair {
+namespace core {
+class SharedMem;
+class IODevice;
+class Matrix;
+}
+namespace gui {
+class DoubleSpinBox;
+class Layout;
+}
+}
+
+namespace flair {
+namespace actuator {
+/*! \class SimulatedBldc
+*
+* \brief Class for a simulation bldc
+*
+*/
+class SimulatedBldc : public Bldc {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimulatedBldc
+  *
+  * \param parent parent
+  * \param layout layout
+  * \param name name
+  * \param motors_count number of motors
+  * \param modelId Model id
+  * \param deviceId Bldc id of the Model
+  */
+  SimulatedBldc(const core::IODevice *parent, gui::Layout *layout, std::string name,
+           uint8_t motors_count, uint32_t modelId,uint32_t deviceId);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimulatedBldc();
+
+  /*!
+  * \brief Has speed measurement
+  *
+  * Reimplemented from Bldc. \n
+  *
+  * \return true if it has speed measurement
+  */
+  bool HasSpeedMeasurement(void) const { return false; };
+
+  /*!
+  * \brief Has current measurement
+  *
+  * Reimplemented from Bldc. \n
+  *
+  * \return true if it has current measurement
+  */
+  bool HasCurrentMeasurement(void) const { return false; };
+
+private:
+  /*!
+  * \brief Set motors values
+  *
+  * Reimplemented from Bldc. \n
+  * Values size must be the same as MotorsCount()
+  *
+  * \param values motor values
+  */
+  void SetMotors(float *value);
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
+  core::SharedMem *shmem;
+  gui::DoubleSpinBox *k;
+  char *buf;
+
+};
+} // end namespace actuator
+} // end namespace flair
+#endif // SIMULATEDBLDC_H
Index: trunk/lib/FlairSensorActuator/src/SimulatedCamera.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedCamera.cpp	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedCamera.cpp	(revision 286)
@@ -0,0 +1,96 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2014/03/06
+//  filename:   SimulatedCamera.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    Class for a simulation camera
+//
+//
+/*********************************************************************/
+#ifdef CORE2_64
+
+#include "SimulatedCamera.h"
+#include <FrameworkManager.h>
+#include <GroupBox.h>
+#include <SharedMem.h>
+#include <sstream>
+
+using std::string;
+using std::ostringstream;
+using namespace flair::core;
+using namespace flair::gui;
+
+namespace flair {
+namespace sensor {
+
+SimulatedCamera::SimulatedCamera(string name,
+                       uint16_t width, uint16_t height, uint8_t channels,
+                       uint32_t modelId,uint32_t deviceId, uint8_t priority)
+    : Thread(getFrameworkManager(), name, priority),
+      Camera(name, width, height, cvimage::Type::Format::BGR) {
+
+  buf_size = width * height * channels+sizeof(Time);
+
+  shmemReadBuf=(char*)malloc(buf_size);
+  output->img->imageData = shmemReadBuf;
+
+  shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId), buf_size, SharedMem::Type::producerConsumer);
+  
+  SetIsReady(true);
+}
+
+
+SimulatedCamera::~SimulatedCamera() {
+  SafeStop();
+  Join();
+  if(shmemReadBuf!=NULL) delete shmemReadBuf;
+}
+
+string SimulatedCamera::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_cam_" << deviceId;
+  return dev_name.str().c_str();
+}
+
+void SimulatedCamera::Run(void) {
+  Time time;
+
+//  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
+  shmem->ReaderReady();
+
+  while (!ToBeStopped()) {
+//    WaitPeriod();
+
+//    if (data_rate->ValueChanged() == true) {
+//      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
+//    }
+
+    output->GetMutex();
+    //blocking read
+    if (shmem->Read(shmemReadBuf, buf_size, 1000000000)) { // remplacer copie par
+      // échange de pointeur sur
+      // double buffering
+
+      output->ReleaseMutex();
+      memcpy(&time, shmemReadBuf + buf_size - sizeof(Time), sizeof(Time));
+      output->SetDataTime(time);
+
+      ProcessUpdate(output);
+    } else {
+      output->ReleaseMutex();
+      //Thread::Warn("Read Timeout\n");
+    }
+  }
+}
+
+} // end namespace sensor
+} // end namespace flair
+
+#endif
Index: trunk/lib/FlairSensorActuator/src/SimulatedCamera.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedCamera.h	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedCamera.h	(revision 286)
@@ -0,0 +1,91 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+/*!
+ * \file SimulatedCamera.h
+ * \brief Class for a simulation camera
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2014/03/06
+ * \version 4.0
+ */
+
+#ifndef SIMULATEDCAMERA_H
+#define SIMULATEDCAMERA_H
+
+#include <Camera.h>
+#include <Thread.h>
+#include <cxcore.h>
+
+namespace flair {
+  namespace core {
+    class SharedMem;
+  }
+}
+
+namespace flair {
+namespace sensor {
+/*! \class SimulatedCamera
+*
+* \brief Class for a simulation camera
+*/
+class SimulatedCamera : public core::Thread, public Camera {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimulatedCamera.
+	* It will be child of the FrameworkManager.
+  *
+  * \param name name
+  * \param width width
+  * \param height height
+  * \param channels number of channels
+  * \param modelId Model id
+  * \param deviceId Camera id of the Model
+  * \param priority priority of the Thread
+  */
+  SimulatedCamera(std::string name,
+             uint16_t width, uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId,
+             uint8_t priority);
+
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimulatedCamera();
+
+protected:
+  /*!
+  * \brief SharedMem to access datas
+  *
+  */
+  core::SharedMem *shmem;
+
+private:
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
+
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
+
+  size_t buf_size;
+  char* shmemReadBuf;
+};
+} // end namespace sensor
+} // end namespace flair
+#endif // SIMULATEDCAMERA_H
Index: trunk/lib/FlairSensorActuator/src/SimulatedGps.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedGps.cpp	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedGps.cpp	(revision 286)
@@ -0,0 +1,137 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2014/05/26
+//  filename:   SimulatedGps.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    Class for a simulation GPS
+//
+//
+/*********************************************************************/
+#ifdef CORE2_64
+
+#include "SimulatedGps.h"
+#include <FrameworkManager.h>
+#include <GpsData.h>
+#include <SharedMem.h>
+#include <SpinBox.h>
+#include <DoubleSpinBox.h>
+#include <GroupBox.h>
+#include <Euler.h>
+#include <Matrix.h>
+#include <sstream>
+#include "geodesie.h"
+
+using std::string;
+using std::ostringstream;
+using namespace flair::core;
+using namespace flair::gui;
+using namespace Geodesie;
+
+namespace flair {
+namespace sensor {
+
+SimulatedGps::SimulatedGps(string name,
+                 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority)
+    : NmeaGps(name, NMEAFlags),Thread(getFrameworkManager(), name, priority) {
+
+  dataRate = new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 200);
+  latitudeRef = new DoubleSpinBox(GetGroupBox()->NewRow(), "latitude ref", " deg", -90, 90, 1, 6,49.402313);
+  longitudeRef = new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "longitude ref", " deg", -180, 180, 1, 6,2.795463);
+  altitudeRef= new DoubleSpinBox(GetGroupBox()->LastRowLastCol(), "altitude ref", " m", 0, 6000, 100, 1,0);
+  fixQuality = new SpinBox(GetGroupBox()->NewRow(), "fix quality", 1, 8, 1, 1);
+  numberOfSatellites = new SpinBox(GetGroupBox()->NewRow(), "number of satellites", 1, 15, 1, 5);
+  magneticDeclination= new DoubleSpinBox(GetGroupBox()->NewRow(), "magnetic declination", " deg", -180, 180, .1, 2,0);
+  
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),
+                        sizeof(gps_states_t));
+                        
+  SetIsReady(true);
+}
+
+
+SimulatedGps::~SimulatedGps() {
+  SafeStop();
+  Join();
+}
+
+string SimulatedGps::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_gps_" << deviceId;
+  return dev_name.str().c_str();
+}
+
+void SimulatedGps::Run(void) {
+  gps_states_t state;
+  char buf[512];
+  nmeaGPGGA gga;
+  nmeaGPVTG vtg;
+  nmeaPOS pos;
+  nmeaINFO info;
+
+  vtg.dir_t='T';
+  vtg.dec_m='M';
+  vtg.spk_k='K';
+  vtg.spn_n='N';
+  gga.elv_units='M';
+  gga.diff_units='M';
+
+  SetPeriodUS((uint32_t)(1000000. / dataRate->Value()));
+
+  WarnUponSwitches(true);
+
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+
+    if (dataRate->ValueChanged() == true) {
+      SetPeriodUS((uint32_t)(1000000. / dataRate->Value()));
+    }
+
+    shmem->Read((char *)&state, sizeof(gps_states_t));
+
+    double x, y, z;
+    ENU_2_ECEF(state.e, state.n, state.u, x,y,z, Euler::ToRadian(longitudeRef->Value()), Euler::ToRadian(latitudeRef->Value()), altitudeRef->Value());
+    ECEF_2_Geographique( x, y, z,pos.lon, pos.lat, gga.elv);
+    nmea_pos2info(&pos,&info);
+
+    if(pos.lat>0) {
+      gga.ns='N';
+      gga.lat=info.lat;
+    } else {
+      gga.ns='S';
+      gga.lat=-info.lat;
+    }
+    if(pos.lon>0) {
+      gga.ew='E';
+      gga.lon=info.lon;
+    } else {
+      gga.ew='W';
+      gga.lon=-info.lon;
+    }
+
+    gga.sig=fixQuality->Value();
+    gga.satinuse=numberOfSatellites->Value();
+
+    int size=nmea_gen_GPGGA(buf,sizeof(buf),&gga);
+    parseFrame(buf,size);
+    
+    vtg.dir=90-Euler::ToDegree(atan2f(state.vn,state.ve));
+    vtg.spk=sqrtf(state.ve*state.ve+state.vn*state.vn)*3600./1000.;
+    size=nmea_gen_GPVTG(buf,sizeof(buf),&vtg);
+    parseFrame(buf,size);
+  }
+
+  WarnUponSwitches(false);
+}
+
+} // end namespace sensor
+} // end namespace flair
+
+#endif
Index: trunk/lib/FlairSensorActuator/src/SimulatedGps.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedGps.h	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedGps.h	(revision 286)
@@ -0,0 +1,92 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+/*!
+ * \file SimulatedGps.h
+ * \brief Class for a simulation GPS
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2013/08/23
+ * \version 4.0
+ */
+
+#ifndef SimulatedGPS_H
+#define SimulatedGPS_H
+
+#include <Thread.h>
+#include <NmeaGps.h>
+
+namespace flair {
+  namespace core {
+    class SharedMem;
+  }
+  namespace gui {
+    class SpinBox;
+    class DoubleSpinBox;
+  }
+}
+
+namespace flair {
+namespace sensor {
+/*! \class SimulatedGps
+*
+* \brief Class for a simulation GPS
+*/
+class SimulatedGps : public core::Thread, public NmeaGps {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a simulation GPS
+  * It will be child of the FrameworkManager.
+	* 
+  * \param name name
+  * \param NMEAFlags NMEA sentances to enable
+  * \param modelId Model id
+  * \param deviceId Gps id of the Model
+  * \param priority priority of the Thread
+  */
+  SimulatedGps(std::string name,
+          NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimulatedGps();
+
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
+
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
+
+  typedef struct {
+    float e;
+    float n;
+    float u;
+    float ve;
+    float vn;
+  } gps_states_t;
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
+
+  core::SharedMem *shmem;
+  gui::SpinBox *dataRate,*fixQuality,*numberOfSatellites;
+  gui::DoubleSpinBox *latitudeRef,*longitudeRef,*altitudeRef,*magneticDeclination;
+};
+} // end namespace sensor
+} // end namespace flair
+#endif // SIMULATEDGPS_H
Index: trunk/lib/FlairSensorActuator/src/SimulatedImu.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedImu.cpp	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedImu.cpp	(revision 286)
@@ -0,0 +1,97 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2014/02/07
+//  filename:   SimulatedImu.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    Class for a simulation imu
+//
+//
+/*********************************************************************/
+#ifdef CORE2_64
+
+#include "SimulatedImu.h"
+#include <FrameworkManager.h>
+#include <ImuData.h>
+#include <SpinBox.h>
+#include <GroupBox.h>
+#include <Matrix.h>
+#include <SharedMem.h>
+#include <AhrsData.h>
+#include <sstream>
+
+using std::string;
+using std::ostringstream;
+using namespace flair::core;
+using namespace flair::gui;
+
+namespace flair {
+namespace sensor {
+
+SimulatedImu::SimulatedImu(string name, uint32_t modelId,uint32_t deviceId,
+                 uint8_t priority)
+    : Imu(name,false), Thread(getFrameworkManager(), name, priority) {
+  dataRate =
+      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 200);
+  ahrsData = new AhrsData((Imu *)this);
+  
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),
+                        sizeof(imu_states_t));
+  SetIsReady(true);
+}
+
+SimulatedImu::~SimulatedImu() {
+  SafeStop();
+  Join();
+}
+
+string SimulatedImu::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_imu_" << deviceId;
+  return dev_name.str().c_str();
+}
+
+void SimulatedImu::Run(void) {
+  imu_states_t state;
+  ImuData *imuData;
+  GetDatas(&imuData);
+
+  SetPeriodUS((uint32_t)(1000000. / dataRate->Value()));
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+
+    if (dataRate->ValueChanged() == true) {
+      SetPeriodUS((uint32_t)(1000000. / dataRate->Value()));
+    }
+    shmem->Read((char *)&state, sizeof(imu_states_t));
+    Quaternion quaternion(state.q0, state.q1, state.q2, state.q3);
+    Vector3Df angRate(state.wx, state.wy, state.wz);
+    Vector3Df rawAcc(state.ax, state.ay, state.az);
+    Vector3Df rawMag(state.mx, state.my, state.mz);
+    Vector3Df rawGyr(state.wx, state.wy, state.wz);
+    //we do not need rotation in simulation
+    /*
+    ApplyRotation(angRate);
+    ApplyRotation(quaternion);
+    ApplyRotation(rawAcc);
+    ApplyRotation(rawMag);
+    ApplyRotation(rawGyr);*/
+    ahrsData->SetQuaternionAndAngularRates(quaternion,angRate);
+    imuData->SetRawAccMagAndGyr(rawAcc,rawMag,rawGyr);
+    imuData->SetDataTime(GetTime());
+    ahrsData->SetDataTime(GetTime());
+    ProcessUpdate(ahrsData);
+  }
+}
+
+} // end namespace sensor
+} // end namespace flair
+
+#endif
Index: trunk/lib/FlairSensorActuator/src/SimulatedImu.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedImu.h	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedImu.h	(revision 286)
@@ -0,0 +1,99 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+/*!
+ * \file SimulatedImu.h
+ * \brief Class for a simulation Imu
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2014/02/07
+ * \version 4.0
+ */
+
+#ifndef SIMULATEDIMU_H
+#define SIMULATEDIMU_H
+
+#include <Imu.h>
+#include <Thread.h>
+
+namespace flair {
+  namespace core {
+    class SharedMem;
+    class AhrsData;
+  }
+  namespace gui {
+    class SpinBox;
+  }
+}
+
+namespace flair {
+namespace sensor {
+/*! \class SimulatedImu
+*
+* \brief Class for a simulation Imu
+*/
+class SimulatedImu : public Imu, public core::Thread {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimulatedImu.
+	* It will be child of the FrameworkManager.
+  *
+  * \param name name
+  * \param modelId Model id
+  * \param deviceId Imu id of the Model
+  * \param priority priority of the Thread
+  */
+  SimulatedImu(std::string name,
+          uint32_t modelId,uint32_t deviceId, uint8_t priority);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimulatedImu();
+
+private:
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
+
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
+
+  typedef struct {
+    float q0;
+    float q1;
+    float q2;
+    float q3;
+    float wx;
+    float wy;
+    float wz;
+    float ax;
+    float ay;
+    float az;
+    float mx;
+    float my;
+    float mz;
+  } imu_states_t;
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
+
+  gui::SpinBox *dataRate;
+  core::SharedMem *shmem;
+  core::AhrsData *ahrsData;
+};
+} // end namespace sensor
+} // end namespace flair
+#endif // SIMULATEDIMU_H
Index: trunk/lib/FlairSensorActuator/src/SimulatedLaser.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedLaser.cpp	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedLaser.cpp	(revision 286)
@@ -0,0 +1,81 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2014/02/07
+//  filename:   SimulatedUs.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    Class for a simulation us
+//
+//
+/*********************************************************************/
+#ifdef CORE2_64
+
+#include "SimulatedLaser.h"
+#include <FrameworkManager.h>
+#include <SpinBox.h>
+#include <GroupBox.h>
+#include <Matrix.h>
+#include <SharedMem.h>
+#include <sstream>
+
+using std::string;
+using std::ostringstream;
+using namespace flair::core;
+using namespace flair::gui;
+
+namespace flair {
+namespace sensor {
+
+SimulatedLaser::SimulatedLaser(string name,
+                     uint32_t modelId,uint32_t deviceId, uint8_t priority)
+    : Thread(getFrameworkManager(), name, priority), LaserRangeFinder(name) {
+  data_rate =
+      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50);
+
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),
+                        360 * sizeof(float));
+  SetIsReady(true);
+}
+
+SimulatedLaser::~SimulatedLaser() {
+  SafeStop();
+  Join();
+}
+
+string SimulatedLaser::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_laser_" << deviceId;
+  return dev_name.str().c_str();
+}
+
+void SimulatedLaser::Run(void) {
+  float z[360];
+
+  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+
+    shmem->Read((char *)z, 360 * sizeof(float));
+
+    if (data_rate->ValueChanged() == true) {
+      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
+    }
+    for (int i = 0; i < 360; i++) {
+      output->SetValue(i, 0, z[i]); //*******
+    }
+    output->SetDataTime(GetTime());
+    ProcessUpdate(output);
+  }
+}
+
+} // end namespace sensor
+} // end namespace flair
+
+#endif
Index: trunk/lib/FlairSensorActuator/src/SimulatedLaser.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedLaser.h	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedLaser.h	(revision 286)
@@ -0,0 +1,85 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+/*!
+ * \file SimulatedUs.h
+ * \brief Class for a simulation UsRangeFinder
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2014/02/07
+ * \version 4.0
+ */
+
+#ifndef SIMULATEDLASER_H
+#define SIMULATEDLASER_H
+
+#include <LaserRangeFinder.h>
+#include <Thread.h>
+
+namespace flair {
+namespace core {
+class SharedMem;
+}
+namespace gui {
+class SpinBox;
+}
+}
+
+namespace flair {
+namespace sensor {
+/*! \class SimulatedUs
+*
+* \brief Class for a simulation UsRangeFinder
+*/
+class SimulatedLaser : public core::Thread, public LaserRangeFinder {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimulatedUs.
+  *
+  * \param name name
+  * \param modelId Model id
+  * \param deviceId LaserRangeFinder id of the Model
+  * \param priority priority of the Thread
+  */
+  SimulatedLaser(std::string name,
+            uint32_t modelId,uint32_t deviceId, uint8_t priority);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimulatedLaser();
+
+protected:
+  /*!
+  * \brief SharedMem to access datas
+  *
+  */
+  core::SharedMem *shmem;
+
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
+
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
+  gui::SpinBox *data_rate;
+};
+} // end namespace sensor
+} // end namespace flair
+#endif // SIMULATEDLASER_H
Index: trunk/lib/FlairSensorActuator/src/SimulatedPressureSensor.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedPressureSensor.cpp	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedPressureSensor.cpp	(revision 286)
@@ -0,0 +1,80 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2018/05/24
+//  filename:   SimulatedPressureSensor.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    Class for a simulation pressure sensor
+//
+//
+/*********************************************************************/
+#ifdef CORE2_64
+
+#include "SimulatedPressureSensor.h"
+#include <FrameworkManager.h>
+#include <SpinBox.h>
+#include <GroupBox.h>
+#include <Matrix.h>
+#include <SharedMem.h>
+#include <sstream>
+
+using std::string;
+using std::ostringstream;
+using namespace flair::core;
+using namespace flair::gui;
+
+namespace flair {
+namespace sensor {
+
+SimulatedPressureSensor::SimulatedPressureSensor(string name, uint32_t modelId,uint32_t deviceId,
+               uint8_t priority)
+    : Thread(getFrameworkManager(), name, priority), PressureSensor( name) {
+  data_rate =
+      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50);
+
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), sizeof(float));
+
+  SetIsReady(true);
+}
+
+SimulatedPressureSensor::~SimulatedPressureSensor() {
+  SafeStop();
+  Join();
+}
+
+string SimulatedPressureSensor::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_pressure_" << deviceId;
+  return dev_name.str().c_str();
+}
+
+void SimulatedPressureSensor::Run(void) {
+  float p;
+
+  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+
+    shmem->Read((char *)&p, sizeof(float));
+
+    if (data_rate->ValueChanged() == true) {
+      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
+    }
+
+    output->SetValue(0, 0, p);
+    output->SetDataTime(GetTime());
+    ProcessUpdate(output);
+  }
+}
+
+} // end namespace sensor
+} // end namespace flair
+
+#endif
Index: trunk/lib/FlairSensorActuator/src/SimulatedPressureSensor.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedPressureSensor.h	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedPressureSensor.h	(revision 286)
@@ -0,0 +1,86 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+/*!
+ * \file SimulatedPressureSensor.h
+ * \brief Class for a simulation PressureSensor
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2018/05/24
+ * \version 4.0
+ */
+
+#ifndef SIMULATEDPRESSURESENSOR_H
+#define SIMULATEDPRESSURESENSOR_H
+
+#include <PressureSensor.h>
+#include <Thread.h>
+
+namespace flair {
+namespace core {
+class SharedMem;
+}
+namespace gui {
+class SpinBox;
+}
+}
+
+namespace flair {
+namespace sensor {
+/*! \class SimulatedPressureSensor
+*
+* \brief Class for a simulation PressureSensor
+*/
+class SimulatedPressureSensor : public core::Thread, public PressureSensor {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimulatedPressureSensor.
+	* It will be child of the FrameworkManager.
+  *
+  * \param name name
+  * \param modelId Model id
+  * \param deviceId PressureSensor id of the Model
+  * \param priority priority of the Thread
+  */
+  SimulatedPressureSensor(std::string name,
+         uint32_t modelId,uint32_t deviceId, uint8_t priority);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimulatedPressureSensor();
+
+protected:
+  /*!
+  * \brief SharedMem to access datas
+  *
+  */
+  core::SharedMem *shmem;
+
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
+
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
+  gui::SpinBox *data_rate;
+};
+} // end namespace sensor
+} // end namespace flair
+#endif // SIMULATEDPRESSURESENSOR_H
Index: trunk/lib/FlairSensorActuator/src/SimulatedUs.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedUs.cpp	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedUs.cpp	(revision 286)
@@ -0,0 +1,80 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2014/02/07
+//  filename:   SimulatedUs.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    Class for a simulation us
+//
+//
+/*********************************************************************/
+#ifdef CORE2_64
+
+#include "SimulatedUs.h"
+#include <FrameworkManager.h>
+#include <SpinBox.h>
+#include <GroupBox.h>
+#include <Matrix.h>
+#include <SharedMem.h>
+#include <sstream>
+
+using std::string;
+using std::ostringstream;
+using namespace flair::core;
+using namespace flair::gui;
+
+namespace flair {
+namespace sensor {
+
+SimulatedUs::SimulatedUs(string name, uint32_t modelId,uint32_t deviceId,
+               uint8_t priority)
+    : Thread(getFrameworkManager(), name, priority), UsRangeFinder( name) {
+  data_rate =
+      new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50);
+
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), sizeof(float));
+
+  SetIsReady(true);
+}
+
+SimulatedUs::~SimulatedUs() {
+  SafeStop();
+  Join();
+}
+
+string SimulatedUs::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_us_" << deviceId;
+  return dev_name.str().c_str();
+}
+
+void SimulatedUs::Run(void) {
+  float z;
+  
+  SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
+
+  while (!ToBeStopped()) {
+    WaitPeriod();
+
+    shmem->Read((char *)&z, sizeof(float));
+
+    if (data_rate->ValueChanged() == true) {
+      SetPeriodUS((uint32_t)(1000000. / data_rate->Value()));
+    }
+
+    output->SetValue(0, 0, z);
+    output->SetDataTime(GetTime());
+    ProcessUpdate(output);
+  }
+}
+
+} // end namespace sensor
+} // end namespace flair
+
+#endif
Index: trunk/lib/FlairSensorActuator/src/SimulatedUs.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/SimulatedUs.h	(revision 286)
+++ trunk/lib/FlairSensorActuator/src/SimulatedUs.h	(revision 286)
@@ -0,0 +1,86 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+/*!
+ * \file SimulatedUs.h
+ * \brief Class for a simulation UsRangeFinder
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2014/02/07
+ * \version 4.0
+ */
+
+#ifndef SIMULATEDUS_H
+#define SIMULATEDUS_H
+
+#include <UsRangeFinder.h>
+#include <Thread.h>
+
+namespace flair {
+namespace core {
+class SharedMem;
+}
+namespace gui {
+class SpinBox;
+}
+}
+
+namespace flair {
+namespace sensor {
+/*! \class SimulatedUs
+*
+* \brief Class for a simulation UsRangeFinder
+*/
+class SimulatedUs : public core::Thread, public UsRangeFinder {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimulatedUs.
+	* It will be child of the FrameworkManager.
+  *
+  * \param name name
+  * \param modelId Model id
+  * \param deviceId UsRangeFinder id of the Model
+  * \param priority priority of the Thread
+  */
+  SimulatedUs(std::string name,
+         uint32_t modelId,uint32_t deviceId, uint8_t priority);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimulatedUs();
+
+protected:
+  /*!
+  * \brief SharedMem to access datas
+  *
+  */
+  core::SharedMem *shmem;
+
+private:
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const core::io_data *data){};
+
+  /*!
+  * \brief Run function
+  *
+  * Reimplemented from Thread.
+  *
+  */
+  void Run(void);
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
+  gui::SpinBox *data_rate;
+};
+} // end namespace sensor
+} // end namespace flair
+#endif // SIMULATEDUS_H
Index: trunk/lib/FlairSensorActuator/src/VrpnObject.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnObject.cpp	(revision 282)
+++ trunk/lib/FlairSensorActuator/src/VrpnObject.cpp	(revision 286)
@@ -18,5 +18,4 @@
 #include "VrpnObject.h"
 #include "VrpnObject_impl.h"
-#include "VrpnClient.h"
 #include <string.h>
 #include <Matrix.h>
@@ -30,7 +29,7 @@
 
 VrpnObject::VrpnObject(string name,
-                       const TabWidget *tab)
-    : IODevice(GetVrpnClient(), name) {
-  pimpl_ = new VrpnObject_impl(this, name, -1, tab);
+                       const TabWidget *tab,VrpnClient *client)
+    : IODevice(client, name) {
+  pimpl_ = new VrpnObject_impl(this, name, -1, tab,client);
   AddDataToLog(pimpl_->output);
   
@@ -39,8 +38,8 @@
 
 VrpnObject::VrpnObject(string name, uint8_t id,
-                       const TabWidget *tab)
-    : IODevice(GetVrpnClient(), name) {
+                       const TabWidget *tab,VrpnClient *client)
+    : IODevice(client, name) {
   Warn("Creation of object %s with id %i\n", name.c_str(), id);
-  pimpl_ = new VrpnObject_impl(this, name, id, tab);
+  pimpl_ = new VrpnObject_impl(this, name, id, tab,client);
   AddDataToLog(pimpl_->output);
   
Index: trunk/lib/FlairSensorActuator/src/VrpnObject.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnObject.h	(revision 282)
+++ trunk/lib/FlairSensorActuator/src/VrpnObject.h	(revision 286)
@@ -16,4 +16,5 @@
 
 #include <IODevice.h>
+#include <VrpnClient.h>
 #include <Vector3D.h>
 #include <stdint.h>
@@ -32,5 +33,4 @@
 
 class VrpnObject_impl;
-class VrpnClient_impl;
 
 namespace flair {
@@ -45,5 +45,4 @@
 class VrpnObject : public core::IODevice {
   friend class ::VrpnObject_impl;
-  friend class ::VrpnClient_impl;
 
 public:
@@ -55,19 +54,21 @@
   * \param name VRPN object name, should be the same as defined in the server
   * \param tab Tab for the user interface
+  * \param client VrpnClient of the connection, if unspecified, use the default one
   */
   VrpnObject(std::string name,
-             const gui::TabWidget *tab);
+             const gui::TabWidget *tab,sensor::VrpnClient *client=GetVrpnClient());
 
   /*!
   * \brief Constructor
   *
-  * Construct a VrpnObject. Connection is done by IP.
+  * Construct a VrpnObject. Connection is done by xbee.
   *
   * \param name name
-  * \param id VRPN object id, should be the same as defined in the server
+  * \param id VRPN object id, should be the same as defined in the xbee bridge
   * \param tab Tab for the user interface
+  * \param client VrpnClient of the connection, if unspecified, use the default one
   */
   VrpnObject(std::string name, uint8_t id,
-             const gui::TabWidget *tab);
+             const gui::TabWidget *tab,sensor::VrpnClient *client=GetVrpnClient());
 
   /*!
Index: trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp	(revision 282)
+++ trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp	(revision 286)
@@ -40,6 +40,6 @@
 
 VrpnObject_impl::VrpnObject_impl(VrpnObject *self,
-                                 string name, int id, const TabWidget *tab) {
-  parent = GetVrpnClient();
+                                 string name, int id, const TabWidget *tab,VrpnClient *client) {
+  parent = client;
   this->self = self;
 
Index: trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h
===================================================================
--- trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h	(revision 282)
+++ trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h	(revision 286)
@@ -47,5 +47,5 @@
   VrpnObject_impl(flair::sensor::VrpnObject *self,
                   std::string name,
-                  int id, const flair::gui::TabWidget *tab);
+                  int id, const flair::gui::TabWidget *tab,flair::sensor::VrpnClient *client);
   ~VrpnObject_impl(void);
 
Index: trunk/lib/FlairSimulator/src/Blade.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Blade.cpp	(revision 282)
+++ trunk/lib/FlairSimulator/src/Blade.cpp	(revision 286)
@@ -64,4 +64,32 @@
 }
 
+Blade::Blade(ISceneNode *parent, const vector3df &position, bool inverted, s32 id)
+    : ISceneNode(parent, getGui()->getSceneManager(), id,
+                 position) {
+  ISceneManager *mgr = getGui()->getSceneManager();
+
+  const IGeometryCreator *geo;
+  geo = mgr->getGeometryCreator();
+  pale = geo->createCubeMesh(vector3df(63.5, 0.5, 5));
+
+  float angle;
+  if (inverted == false) {
+    angle = 20;
+  } else {
+    angle = -20;
+  }
+
+  ITexture *texture = getGui()->getTexture("carbone.jpg");
+  pale_1 = new MeshSceneNode(parent, pale, vector3df(-30, 0, 0),
+                             vector3df(-angle + 90, 0, 0), texture);
+  pale_1->setParent(this);
+  pale_2 = new MeshSceneNode(parent, pale, vector3df(30, 0, 0),
+                             vector3df(angle + 90, 0, 0), texture);
+  pale_2->setParent(this);
+
+  anim = mgr->createRotationAnimator(vector3df(0.f, 0.f, 0.f));
+  addAnimator(anim);
+}
+
 void Blade::OnRegisterSceneNode() {
   if (IsVisible)
Index: trunk/lib/FlairSimulator/src/Blade.h
===================================================================
--- trunk/lib/FlairSimulator/src/Blade.h	(revision 282)
+++ trunk/lib/FlairSimulator/src/Blade.h	(revision 286)
@@ -36,4 +36,9 @@
         const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0),
         bool inverted = false, irr::s32 id = -1);
+
+  Blade(irr::scene::ISceneNode *parent,
+        const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0),
+        bool inverted = false, irr::s32 id = -1);
+  
   virtual void OnRegisterSceneNode(void);
   virtual void render(void);
Index: trunk/lib/FlairSimulator/src/FixedCamera.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/FixedCamera.cpp	(revision 282)
+++ trunk/lib/FlairSimulator/src/FixedCamera.cpp	(revision 286)
@@ -27,4 +27,5 @@
 #include <Euler.h>
 
+
 using namespace irr;
 using namespace gui;
@@ -51,5 +52,5 @@
 void FixedCamera::animateNode(ISceneNode *node, u32 timeMs) {
   ICameraSceneNode *camera = static_cast<ICameraSceneNode *>(node);
-
+  
   if (LMouseKey == true) {
     if (!Rotating) {
Index: trunk/lib/FlairSimulator/src/FollowMeCamera.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/FollowMeCamera.cpp	(revision 282)
+++ trunk/lib/FlairSimulator/src/FollowMeCamera.cpp	(revision 286)
@@ -63,5 +63,4 @@
 
 void FollowMeCamera::animateNode(ISceneNode *node, u32 timeMs) {
-
   float nRotY = RotY;
   float nRotZ = RotZ;
Index: trunk/lib/FlairSimulator/src/GenericObject.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/GenericObject.cpp	(revision 282)
+++ trunk/lib/FlairSimulator/src/GenericObject.cpp	(revision 286)
@@ -40,8 +40,8 @@
 {
 	meshSceneNode=getGui()->getSceneManager()->addMeshSceneNode(mesh);
-	
+	/*
   selector = getGui()->getSceneManager()->createTriangleSelector(mesh, meshSceneNode);
   meshSceneNode->setTriangleSelector(selector);
-	
+	*/
   meshSceneNode->setMaterialFlag(EMF_LIGHTING, false);
 
@@ -53,4 +53,7 @@
 ITriangleSelector *GenericObject::TriangleSelector(void) { return selector; }
 
+void GenericObject::setVisible(bool isVisible) {
+  meshSceneNode->setVisible(isVisible);
+}
 void GenericObject::setScale(float value) {
   meshSceneNode->setScale(vector3df(value, value, value));
Index: trunk/lib/FlairSimulator/src/Gui_impl.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Gui_impl.cpp	(revision 282)
+++ trunk/lib/FlairSimulator/src/Gui_impl.cpp	(revision 286)
@@ -94,5 +94,4 @@
   device->setResizable(false);
 
-  // font = device->getGUIEnvironment()->getBuiltInFont();
   driver = device->getVideoDriver();
   smgr = device->getSceneManager();
@@ -179,4 +178,14 @@
   int lastFPS = -1;
   int cam_id = 0;
+  ITexture* texture=0;
+  IGUIFont* font =0;
+  
+  if (!driver->queryFeature(video::EVDF_RENDER_TO_TARGET)) {
+    self->Warn("rendering to texture is not possible, axis will not be displayed\n");
+  } else {
+    texture= getGui()->getSceneManager()->getVideoDriver()->addRenderTargetTexture(dimension2d<u32>(128,128));
+    device->getGUIEnvironment()->addImage(texture,position2d<s32>(0,scene_height-texture->getSize().Height));
+    font = getGui()->getDevice()->getGUIEnvironment()->getFont((media_path+"/font/simu_axis_font.xml").c_str());
+  }
 
   receiver->SetModel(models.at(0));
@@ -242,19 +251,5 @@
     driver->setViewPort(core::rect<s32>(0, 0, scene_width, scene_height));
     smgr->drawAll(); // commente voir plus bas
-                     /*
-                 env->drawAll();
-                 if (font)
-                 {
-                                     font->draw(L"This demo shows that Irrlicht is also capable
-                 of drawing 2D graphics.",
-                                             core::rect<s32>(130,10,300,50),
-                                             video::SColor(255,255,255,255));
-                 }
-                 else
-                 {
-                 printf("err\n");
-                 }
-                 device->setWindowCaption(L"toto");*/
-
+                    
     if (dbtFile_r == NULL) {// mode normal
       for (size_t i = 0; i < models.size(); i++) {
@@ -263,8 +258,15 @@
     }
 
+    //render to texture for axis if possible
+    if (texture) {
+      cameras.at(cam_id)->renderAxisToTexture(texture);
+    }
+    
+    //process update for sensors (cam, us...)
+    //also draws embedded cameras (see SimuCameraGL::UpdateFrom) 
     for (size_t i = 0; i < models.size(); i++) {
       models.at(i)->ProcessUpdate(NULL);
     }
-
+    
     // on fait ca ici, devrait etre un peu plus haut
     // mais a priori souci avec models.at(i)->pimpl_->CheckCollision();
@@ -274,7 +276,16 @@
     driver->setViewPort(core::rect<s32>(0, 0, scene_width, scene_height));
     smgr->drawAll();
-
+    
+    driver->setViewPort(core::rect<s32>(0, 0, smgr->getVideoDriver()->getScreenSize().Width, smgr->getVideoDriver()->getScreenSize().Height));
+    if(font) {
+      font->draw(L"VRPN:",rect<s32>(10,scene_height-30,100,50),SColor(128,255,255,255));
+      font->draw(L"X",rect<s32>(60,scene_height-30,100,50),SColor(255,255,0,0));
+      font->draw(L"Y",rect<s32>(70,scene_height-30,100,50),SColor(255,0,255,0));
+      font->draw(L"Z",rect<s32>(80,scene_height-30,100,50),SColor(255,0,0,255));
+      
+    }
+    device->getGUIEnvironment()->drawAll();
     driver->endScene();
-
+    
     int fps = driver->getFPS();
 
Index: trunk/lib/FlairSimulator/src/MeshSceneNode.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/MeshSceneNode.cpp	(revision 282)
+++ trunk/lib/FlairSimulator/src/MeshSceneNode.cpp	(revision 286)
@@ -49,4 +49,22 @@
 }
 
+MeshSceneNode::MeshSceneNode(ISceneNode *parent, IMesh *mesh,
+                             const vector3df &position,
+                             const vector3df &rotation, ITexture *texture,
+                             s32 id)
+    : IMeshSceneNode(parent, getGui()->getSceneManager(), id,
+                     position, rotation) {
+  Material.Wireframe = false;
+  Material.Lighting = false;
+
+  setMesh(mesh);
+
+  if (texture != NULL) {
+    setMaterialTexture(0, texture);
+  }
+
+  //parent->getBoundingBox().addInternalBox(getTransformedBoundingBox());
+}
+
 void MeshSceneNode::OnRegisterSceneNode(void) {
   if (IsVisible)
Index: trunk/lib/FlairSimulator/src/MeshSceneNode.h
===================================================================
--- trunk/lib/FlairSimulator/src/MeshSceneNode.h	(revision 282)
+++ trunk/lib/FlairSimulator/src/MeshSceneNode.h	(revision 286)
@@ -31,4 +31,10 @@
       const irr::core::vector3df &rotation = irr::core::vector3df(0, 0, 0),
       irr::video::ITexture *texture = NULL, irr::s32 id = -1);
+  
+  MeshSceneNode(
+      irr::scene::ISceneNode *parent, irr::scene::IMesh *mesh,
+      const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0),
+      const irr::core::vector3df &rotation = irr::core::vector3df(0, 0, 0),
+      irr::video::ITexture *texture = NULL, irr::s32 id = -1);
 
   virtual void OnRegisterSceneNode(void);
Index: trunk/lib/FlairSimulator/src/SimuBldc.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/SimuBldc.cpp	(revision 282)
+++ trunk/lib/FlairSimulator/src/SimuBldc.cpp	(revision 286)
@@ -73,4 +73,4 @@
 }
 
-} // end namespace sensor
+} // end namespace actuator
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/Simulator.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Simulator.cpp	(revision 282)
+++ trunk/lib/FlairSimulator/src/Simulator.cpp	(revision 286)
@@ -36,10 +36,10 @@
 Simulator *getSimulator(void) { return simu; }
 
-Simulator::Simulator(string name, int optitrack_mstime, float yaw_deg)
+Simulator::Simulator(string name, int optitrack_mstime, float yaw_deg, int port)
     : FrameworkManager(name) {
   if (simu != NULL)
     Err("Simulator should be instanced only one time\n");
 
-  pimpl_ = new Simulator_impl(this, optitrack_mstime, yaw_deg);
+  pimpl_ = new Simulator_impl(this, optitrack_mstime, yaw_deg,port);
   simu = this;
 }
Index: trunk/lib/FlairSimulator/src/Simulator.h
===================================================================
--- trunk/lib/FlairSimulator/src/Simulator.h	(revision 282)
+++ trunk/lib/FlairSimulator/src/Simulator.h	(revision 286)
@@ -44,5 +44,5 @@
   // yaw_deg: rotation of the vrpn coordinate with respect to the earth
   // coordinate, around z axis
-  Simulator(std::string name, int optitrack_mstime = 10, float yaw_deg = 30);
+  Simulator(std::string name, int optitrack_mstime = 10, float yaw_deg = 30, int port=3883);
   ~Simulator();
   void RunSimu(void);
Index: trunk/lib/FlairSimulator/src/Simulator_impl.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Simulator_impl.cpp	(revision 282)
+++ trunk/lib/FlairSimulator/src/Simulator_impl.cpp	(revision 286)
@@ -31,6 +31,6 @@
 
 Simulator_impl::Simulator_impl(Simulator *self, int optitrack_mstime,
-                               float yaw_deg)
-    : vrpn_Connection_IP(), Thread(self, "simulator", 1) {
+                               float yaw_deg,int port)
+    : vrpn_Connection_IP(port), Thread(self, "simulator", 1) {
   this->self = self;
   this->optitrack_mstime = optitrack_mstime;
Index: trunk/lib/FlairSimulator/src/UavVrpnObject.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/UavVrpnObject.cpp	(revision 286)
+++ trunk/lib/FlairSimulator/src/UavVrpnObject.cpp	(revision 286)
@@ -0,0 +1,41 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2018/12/11
+//  filename:   UavVrpnObject.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    uav vrpn object, can display a real vrpn object in a simulated environment
+//
+/*********************************************************************/
+#ifdef GL
+
+#include "UavVrpnObject.h"
+#include "UavVrpnObject_impl.h"
+
+using namespace flair::sensor;
+  
+namespace flair {
+namespace simulator {
+
+UavVrpnObject::UavVrpnObject(std::string name,VrpnClient *client) 
+  : VrpnObject(name,client->GetTabWidget(),client){
+  
+  
+  pimpl_ = new UavVrpnObject_impl(this, name);
+  pimpl_->setPosition(irr::core::vector3df(4,4,100));
+}
+
+UavVrpnObject::~UavVrpnObject() {
+  delete pimpl_; 
+}
+
+} // end namespace simulator
+} // end namespace flair
+
+#endif // GL
Index: trunk/lib/FlairSimulator/src/UavVrpnObject.h
===================================================================
--- trunk/lib/FlairSimulator/src/UavVrpnObject.h	(revision 286)
+++ trunk/lib/FlairSimulator/src/UavVrpnObject.h	(revision 286)
@@ -0,0 +1,43 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2018/12/11
+//  filename:   UavVrpnObject.h
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    uav vrpn object, can display a real vrpn object in a simulated environment
+//
+/*********************************************************************/
+
+#ifndef UAVVRPNOBJECT_H
+#define UAVVRPNOBJECT_H
+
+#ifdef GL
+
+#include <VrpnObject.h>
+
+class UavVrpnObject_impl;
+
+namespace flair {
+namespace simulator {
+
+class UavVrpnObject :public sensor::VrpnObject {
+public:
+  UavVrpnObject(std::string name,sensor::VrpnClient *client=sensor::GetVrpnClient());
+  ~UavVrpnObject();
+
+private:
+  UavVrpnObject_impl *pimpl_;
+
+};
+} // end namespace simulator
+} // end namespace flair
+
+#endif // GL
+
+#endif // UAVVRPNOBJECT_H
Index: trunk/lib/FlairSimulator/src/UavVrpnObject_impl.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/UavVrpnObject_impl.cpp	(revision 286)
+++ trunk/lib/FlairSimulator/src/UavVrpnObject_impl.cpp	(revision 286)
@@ -0,0 +1,155 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2018/12/11
+//  filename:   UavVrpnObject_impl.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    uav vrpn object, can display a real vrpn object in a simulated environment
+//
+/*********************************************************************/
+#ifdef GL
+
+#include "UavVrpnObject_impl.h"
+#include "UavVrpnObject.h"
+#include <TabWidget.h>
+#include <Tab.h>
+#include <DoubleSpinBox.h>
+#include "Simulator.h"
+#include <ISceneManager.h>
+#include <IVideoDriver.h>
+#include "Blade.h"
+#include "MeshSceneNode.h"
+#include "Gui.h"
+#include "FollowMeCamera.h"
+#include <Matrix.h>
+#include <Quaternion.h>
+#include <Euler.h>
+
+#define MOTOR_SPEED 100
+
+using namespace irr::video;
+using namespace irr::scene;
+using namespace irr::core;
+using namespace flair::core;
+using namespace flair::simulator;
+using namespace flair::gui;
+  
+UavVrpnObject_impl::UavVrpnObject_impl(UavVrpnObject *self,std::string name) 
+  : IODevice(self,name),
+    ISceneNode(getGui()->getSceneManager()->getRootSceneNode(), getGui()->getSceneManager(), -1) {
+  this->self=self;
+  
+  // init user interface
+  Tab *tab = new Tab(getSimulator()->GetTabWidget(), ObjectName());
+  arm_length = new DoubleSpinBox(tab->LastRowLastCol(), "arm length (m):",0, 2, 0.1);
+
+  // camera
+  FollowMeCamera* camera = new FollowMeCamera(this,name);
+  
+  Draw();
+}
+
+UavVrpnObject_impl::~UavVrpnObject_impl() {
+  // les objets irrlicht seront automatiquement detruits (moteurs, helices,
+  // pales) par parenté
+}
+
+void UavVrpnObject_impl::UpdateFrom(const io_data *data) {
+  const Matrix* input = dynamic_cast<const Matrix*>(data);
+  if (!input) {
+      self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str());
+      return;
+  }
+  
+  Vector3Df vrpnPosition;
+  Quaternion vrpnQuaternion;
+  input->GetMutex();
+  vrpnQuaternion.q0=input->ValueNoMutex(0, 0);
+  vrpnQuaternion.q1=input->ValueNoMutex(1, 0);
+  vrpnQuaternion.q2=input->ValueNoMutex(2, 0);
+  vrpnQuaternion.q3=input->ValueNoMutex(3, 0);
+  vrpnPosition.x=input->ValueNoMutex(4, 0);
+  vrpnPosition.y=input->ValueNoMutex(5, 0);
+  vrpnPosition.z=input->ValueNoMutex(6, 0);
+  input->ReleaseMutex();
+  
+  vector3df nodePosition;
+  Quaternion nodeQuaternion;
+  Euler nodeEuler;
+
+  nodePosition = ToIrrlichtCoordinates(vrpnPosition);
+  setPosition(nodePosition);
+  nodeQuaternion = ToIrrlichtOrientation(vrpnQuaternion);
+  nodeQuaternion.ToEuler(nodeEuler);
+  setRotation(Euler::ToDegree(1) * vector3df(nodeEuler.roll,nodeEuler.pitch, nodeEuler.yaw));
+  
+  if (arm_length->ValueChanged() == true) {
+    setScale(vector3df(arm_length->Value(), arm_length->Value(), arm_length->Value()));
+  }
+}
+
+void UavVrpnObject_impl::render(void) {
+  IVideoDriver *driver = SceneManager->getVideoDriver();
+  driver->setTransform(ETS_WORLD, AbsoluteTransformation);
+}
+
+void UavVrpnObject_impl::OnRegisterSceneNode(void) {
+  if (IsVisible)
+    SceneManager->registerNodeForRendering(this);
+
+  ISceneNode::OnRegisterSceneNode();
+}
+
+void UavVrpnObject_impl::Draw(void) {
+  // create unite (1m=100cm) UAV; scale will be adapted according to arm_length
+  // parameter
+  // note that the frame used is irrlicht one:
+  // left handed, North East Up
+  const IGeometryCreator *geo;
+  geo = getGui()->getSceneManager()->getGeometryCreator();
+
+  // cylinders are aligned with y axis
+  IMesh *red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));
+  IMesh *black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));
+  IMesh *motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));
+  // geo->drop();
+
+  ITexture *texture = getGui()->getTexture("carbone.jpg");
+  MeshSceneNode *fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+                             vector3df(0, 0, -135));
+  MeshSceneNode *fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+                             vector3df(0, 0, -45));
+  MeshSceneNode *rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+                             vector3df(0, 0, 135), texture);
+  MeshSceneNode *rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+                             vector3df(0, 0, 45), texture);
+
+  texture = getGui()->getTexture("metal047.jpg");
+  MeshSceneNode *fl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),
+                               vector3df(90, 0, 0), texture);
+  MeshSceneNode *fr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),
+                               vector3df(90, 0, 0), texture);
+  MeshSceneNode *rl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),
+                               vector3df(90, 0, 0), texture);
+  MeshSceneNode *rr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),
+                               vector3df(90, 0, 0), texture);
+
+  fl_blade = new Blade(this, vector3df(70.71, -70.71, 17.5));
+  fr_blade = new Blade(this, vector3df(70.71, 70.71, 17.5), true);
+  rl_blade = new Blade(this, vector3df(-70.71, -70.71, 17.5), true);
+  rr_blade = new Blade(this, vector3df(-70.71, 70.71, 17.5));
+  
+  fl_blade->SetRotationSpeed(MOTOR_SPEED);
+  fr_blade->SetRotationSpeed(-MOTOR_SPEED);
+  rl_blade->SetRotationSpeed(-MOTOR_SPEED);
+  rr_blade->SetRotationSpeed(MOTOR_SPEED);
+  
+  setScale(vector3df(arm_length->Value(), arm_length->Value(), arm_length->Value()));
+}
+#endif // GL
Index: trunk/lib/FlairSimulator/src/VisualizationCamera.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/VisualizationCamera.cpp	(revision 282)
+++ trunk/lib/FlairSimulator/src/VisualizationCamera.cpp	(revision 286)
@@ -31,4 +31,5 @@
 using namespace core;
 using namespace scene;
+using namespace video;
 
 namespace flair {
@@ -40,5 +41,5 @@
   LMouseKey = false;
 
-   // camera
+  // camera for visualization
   camera = getGui()->getSceneManager()->addCameraSceneNode();
   camera->setAspectRatio(getGui()->getAspectRatio()); // on force a cause du view port
@@ -48,7 +49,49 @@
 
   getGui()->pimpl_->AddVisualizationCamera(this);
+  
+  // camera to draw axis, in a new dedicated scene manager
+  axis_scenemanager=getGui()->getSceneManager()->createNewSceneManager();
+  axis_camera = axis_scenemanager->addCameraSceneNode();
+  axis_camera->setAspectRatio(1);  // same as texture ratio, TODO: get it from texture in renderAxisToTexture
+  axis_camera->setUpVector(vector3df(0, 0, 1));
+  axis_camera->setFOV(PI / 2.5f);
+  axis_scenemanager->setActiveCamera(axis_camera);
+  prendre en compte le yaw monde/optitrack (rotation de axis_scenemanager?)
+  IAnimatedMesh* arrowMeshRed = axis_scenemanager->addArrowMesh( "x_axisArrow",video::SColor(255, 255, 0, 0),video::SColor(255, 255, 0, 0));
+  nodeX = axis_scenemanager->addMeshSceneNode(arrowMeshRed);
+  nodeX->setMaterialFlag(video::EMF_LIGHTING, false);
+  nodeX->setRotation(vector3df(0,0,-90));
+  nodeX->setScale(vector3df(1,3,1));
+  
+  IAnimatedMesh* arrowMeshGreen = axis_scenemanager->addArrowMesh( "y_axisArrow",video::SColor(255, 0, 255, 0),video::SColor(255, 0, 255, 0));
+  nodeY = axis_scenemanager->addMeshSceneNode(arrowMeshGreen);
+  nodeY->setMaterialFlag(video::EMF_LIGHTING, false);
+  nodeY->setScale(vector3df(1,3,1));
+  
+  IAnimatedMesh* arrowMeshBlue = axis_scenemanager->addArrowMesh( "z_axisArrow",video::SColor(255, 0, 0, 255),video::SColor(255, 0, 0, 255));
+  nodeZ = axis_scenemanager->addMeshSceneNode(arrowMeshBlue);
+  nodeZ->setMaterialFlag(video::EMF_LIGHTING, false);
+  nodeZ->setRotation(vector3df(-90,0,0));//irrlicht is left handed, draw a right handed axis
+  nodeZ->setScale(vector3df(1,3,1));
 }
 
 VisualizationCamera::~VisualizationCamera() {}
+
+void VisualizationCamera::renderAxisToTexture(ITexture* texture) {
+  //put axis at a "normalized" distance
+  vector3df direction=camera->getTarget()-camera->getPosition();
+  direction.normalize();
+  nodeX->setPosition(camera->getPosition()+direction*6);
+  nodeY->setPosition(camera->getPosition()+direction*6);
+  nodeZ->setPosition(camera->getPosition()+direction*6);
+
+  axis_camera->setPosition(camera->getPosition());
+  axis_camera->setRotation(camera->getRotation());
+  axis_camera->setTarget(camera->getTarget());
+  
+  axis_scenemanager->getVideoDriver()->setRenderTarget(texture, true, true, SColor(0,0,0,0));
+  axis_scenemanager->drawAll();
+  axis_scenemanager->getVideoDriver()->setRenderTarget(0, true, true, 0);
+}
 
 std::string VisualizationCamera::getName(void) {
Index: trunk/lib/FlairSimulator/src/VisualizationCamera.h
===================================================================
--- trunk/lib/FlairSimulator/src/VisualizationCamera.h	(revision 282)
+++ trunk/lib/FlairSimulator/src/VisualizationCamera.h	(revision 286)
@@ -27,4 +27,7 @@
     class ICameraSceneNode;
   }
+  namespace video {
+    class ITexture;
+  }
 }
 
@@ -42,11 +45,15 @@
   irr::scene::ICameraSceneNode *getCameraSceneNode(void);
   std::string getName(void);
+  void renderAxisToTexture(irr::video::ITexture* texture);
 
 private:
   virtual bool isEventReceiverEnabled(void) const { return true; }
-
+  irr::scene::ISceneNode *nodeX,*nodeY,*nodeZ;
+  irr::scene::ISceneManager *axis_scenemanager;
+  
 protected:
   bool LMouseKey;
   irr::scene::ICameraSceneNode *camera;
+  irr::scene::ICameraSceneNode *axis_camera;
   irr::core::position2df MousePos;
   float currentZoom;
Index: trunk/lib/FlairSimulator/src/X4.h
===================================================================
--- trunk/lib/FlairSimulator/src/X4.h	(revision 282)
+++ trunk/lib/FlairSimulator/src/X4.h	(revision 286)
@@ -43,10 +43,7 @@
 #ifdef GL
   virtual void Draw(void);
-  virtual void ExtraDraw(void){};
+  virtual void ExtraDraw(void){}; 
+#endif
 
-protected:
-  Blade *fl_blade, *fr_blade, *rl_blade, *rr_blade;
-  core::Mutex *motor_speed_mutex;
-#endif
 private:
   void CalcModel(void);
@@ -56,4 +53,6 @@
   void WritedbtBuf(char *dbtbuf);
   void ReaddbtBuf(char *dbtbuf);
+  Blade *fl_blade, *fr_blade, *rl_blade, *rr_blade;
+  core::Mutex *motor_speed_mutex;
 #endif
 
Index: trunk/lib/FlairSimulator/src/X8.h
===================================================================
--- trunk/lib/FlairSimulator/src/X8.h	(revision 282)
+++ trunk/lib/FlairSimulator/src/X8.h	(revision 286)
@@ -45,8 +45,5 @@
 
 protected:
-#ifdef GL
-  Blade *tfl_blade, *tfr_blade, *trl_blade, *trr_blade;
-  Blade *bfl_blade, *bfr_blade, *brl_blade, *brr_blade;
-#endif
+
 private:
   void CalcModel(void);
@@ -57,4 +54,6 @@
   void ReaddbtBuf(char *dbtbuf);
   core::Mutex *motor_speed_mutex;
+  Blade *tfl_blade, *tfr_blade, *trl_blade, *trr_blade;
+  Blade *bfl_blade, *bfr_blade, *brl_blade, *brr_blade;
 #endif
 
Index: trunk/lib/FlairSimulator/src/unexported/GenericObject.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/GenericObject.h	(revision 282)
+++ trunk/lib/FlairSimulator/src/unexported/GenericObject.h	(revision 286)
@@ -47,4 +47,5 @@
 	void setPosition(const irr::core::vector3df& position);
   void setRotation(const irr::core::vector3df& rotation);
+  void setVisible(bool isVisible);//visible by default at construction
  
 private:
Index: trunk/lib/FlairSimulator/src/unexported/Model_impl.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/Model_impl.h	(revision 282)
+++ trunk/lib/FlairSimulator/src/unexported/Model_impl.h	(revision 286)
@@ -72,9 +72,4 @@
   void OnRegisterSceneNode(void);
   void render(void);
-  void Draw(void) {
-    printf("CA MARCHE PAS PUNAISE\r\n");
-    ExtraDraw();
-  };
-  void ExtraDraw(void) { printf("nope\r\n"); };
 
   const irr::core::aabbox3d<irr::f32> &getBoundingBox(void) const {
Index: trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h	(revision 282)
+++ trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h	(revision 286)
@@ -37,5 +37,5 @@
 public:
   Simulator_impl(flair::simulator::Simulator *self, int optitrack_mstime = 10,
-                 float yaw_deg = 30);
+                 float yaw_deg = 30, int port=3883);
   ~Simulator_impl();
 
Index: trunk/lib/FlairSimulator/src/unexported/UavVrpnObject_impl.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/UavVrpnObject_impl.h	(revision 286)
+++ trunk/lib/FlairSimulator/src/unexported/UavVrpnObject_impl.h	(revision 286)
@@ -0,0 +1,73 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2018/12/11
+//  filename:   UavVrpnObject_impl.h
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    uav vrpn object, can display a real vrpn object in a simulated environment
+//
+/*********************************************************************/
+
+#ifndef UAVVRPNOBJECT_IMPL_H
+#define UAVVRPNOBJECT_IMPL_H
+
+#ifdef GL
+
+#include <IODevice.h>
+#include <IMeshSceneNode.h>
+
+namespace flair {
+  namespace gui {
+    class DoubleSpinBox;
+  }
+}
+
+namespace flair {
+  namespace simulator {
+    class Blade;
+    class UavVrpnObject;
+  }
+}
+
+class UavVrpnObject_impl : private flair::core::IODevice,
+                      public irr::scene::ISceneNode {
+public:
+  UavVrpnObject_impl(flair::simulator::UavVrpnObject *self,std::string name);
+  ~UavVrpnObject_impl();
+
+  void Draw(void);
+  
+  const irr::core::aabbox3d<irr::f32> &getBoundingBox(void) const {
+    return box;
+  }
+  
+ void render(void);
+
+private:
+  flair::simulator::Blade *fl_blade, *fr_blade, *rl_blade, *rr_blade;
+  flair::gui::DoubleSpinBox *arm_length;
+  irr::core::aabbox3d<irr::f32> box;
+  void OnRegisterSceneNode(void);
+  flair::simulator::UavVrpnObject *self;
+  
+  /*!
+  * \brief Update using provided datas
+  *
+  * Reimplemented from IODevice.
+  *
+  * \param data data from the parent to process
+  */
+  void UpdateFrom(const flair::core::io_data *data);
+
+};
+
+
+#endif // GL
+
+#endif // UAVVRPNOBJECT_IMPL_H
