Index: /trunk/demos/TwoWheelRobotCircleFollower/CMakeLists.txt
===================================================================
--- /trunk/demos/TwoWheelRobotCircleFollower/CMakeLists.txt	(revision 375)
+++ /trunk/demos/TwoWheelRobotCircleFollower/CMakeLists.txt	(revision 376)
@@ -2,4 +2,14 @@
 include($ENV{FLAIR_ROOT}/flair-src/cmake-modules/GlobalCmakeFlair.cmake)
 
+if("${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE}" MATCHES "core2-64")
+
 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/simulator)
-#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/uav)
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ugv)
+
+else()
+    if(DEFINED CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE)
+        warn("${PROJECT_NAME} will not be built for ${CMAKE_SYSTEM_PROCESSOR_DEFAULTTUNE} architecture")
+    else()
+        warn("${PROJECT_NAME} will not be built for ${CMAKE_SYSTEM_PROCESSOR} architecture")
+    endif()
+endif()
Index: /trunk/demos/TwoWheelRobotCircleFollower/ugv/CMakeLists.txt
===================================================================
--- /trunk/demos/TwoWheelRobotCircleFollower/ugv/CMakeLists.txt	(revision 376)
+++ /trunk/demos/TwoWheelRobotCircleFollower/ugv/CMakeLists.txt	(revision 376)
@@ -0,0 +1,19 @@
+PROJECT(TwoWheelRobotCircleFollower_ugv)
+cmake_minimum_required(VERSION 2.8)
+
+SET(FLAIR_USE_FILTER TRUE)
+SET(FLAIR_USE_SENSOR_ACTUATOR TRUE)
+SET(FLAIR_USE_META TRUE)
+SET(FLAIR_USE_VRPN TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-src/cmake-modules/GlobalCmakeFlair.cmake)
+
+SET(SRC_FILES
+	src/main.cpp
+	src/CircleFollower.cpp
+)
+
+FLAIR_DEMO(${PROJECT_NAME} "${SRC_FILES}"
+           DEST_DIR TwoWheelRobotCircleFollower
+           COPY_RESOURCES
+)
Index: /trunk/demos/TwoWheelRobotCircleFollower/ugv/resources/core2-64/ugv.sh
===================================================================
--- /trunk/demos/TwoWheelRobotCircleFollower/ugv/resources/core2-64/ugv.sh	(revision 376)
+++ /trunk/demos/TwoWheelRobotCircleFollower/ugv/resources/core2-64/ugv.sh	(revision 376)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+if [ -f /proc/xenomai/version ];then
+	EXEC=./TwoWheelRobotCircleFollower_ugv_rt
+else
+	EXEC=.TwoWheelRobotCircleFollower_ugv_nrt
+fi
+
+. $FLAIR_ROOT/flair-src/scripts/distribution_specific_hack.sh
+
+$EXEC -n ugv_0 -a 127.0.0.1 -p 9000 -l /tmp -x setup.xml
Index: /trunk/demos/TwoWheelRobotCircleFollower/ugv/src/CircleFollower.cpp
===================================================================
--- /trunk/demos/TwoWheelRobotCircleFollower/ugv/src/CircleFollower.cpp	(revision 376)
+++ /trunk/demos/TwoWheelRobotCircleFollower/ugv/src/CircleFollower.cpp	(revision 376)
@@ -0,0 +1,125 @@
+//  created:    2020/12/09
+//  filename:   CircleFollower.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    demo cercle avec optitrack
+//
+//
+/*********************************************************************/
+
+#include "CircleFollower.h"
+#include <TargetController.h>
+#include <GridLayout.h>
+#include <PushButton.h>
+#include <DataPlot1D.h>
+#include <DataPlot2D.h>
+#include <FrameworkManager.h>
+#include <VrpnClient.h>
+#include <MetaVrpnObject.h>
+#include <TrajectoryGenerator2DCircle.h>
+#include <Matrix.h>
+#include <Tab.h>
+#include <Pid.h>
+
+using namespace std;
+using namespace flair::core;
+using namespace flair::gui;
+using namespace flair::sensor;
+using namespace flair::filter;
+using namespace flair::meta;
+
+CircleFollower::CircleFollower(string name,TargetController *controller): Thread(getFrameworkManager(),"CircleFollower",50), behaviourMode(BehaviourMode_t::Default), vrpnLost(false) {
+   this->controller=controller;
+    controller->Start();
+	
+    VrpnClient* vrpnclient=new VrpnClient("vrpn", "127.0.0.1:3883",80);
+    
+    if(vrpnclient->ConnectionType()==VrpnClient::Xbee) {
+        uavVrpn = new MetaVrpnObject(name,(uint8_t)0);
+        targetVrpn=new MetaVrpnObject("target",1);
+    } else if (vrpnclient->ConnectionType()==VrpnClient::Vrpn) {
+        uavVrpn = new MetaVrpnObject(name);
+        targetVrpn=new MetaVrpnObject("target");
+    }
+    
+    getFrameworkManager()->AddDeviceToLog(uavVrpn);
+    getFrameworkManager()->AddDeviceToLog(targetVrpn);
+    vrpnclient->Start();
+	
+	Tab *ugvTab = new Tab(getFrameworkManager()->GetTabWidget(), "ugv", 0);
+    GridLayout* buttonslayout = new GridLayout(ugvTab->NewRow(), "buttons");
+	button_kill = new PushButton(buttonslayout->NewRow(), "kill");
+    startCircle=new PushButton(buttonslayout->NewRow(),"start_circle");
+    stopCircle=new PushButton(buttonslayout->LastRowLastCol(),"stop_circle");
+    
+    circle=new TrajectoryGenerator2DCircle(vrpnclient->GetLayout()->NewRow(),"circle");
+    uavVrpn->xPlot()->AddCurve(circle->GetMatrix()->Element(0,0),DataPlot::Blue);
+    uavVrpn->yPlot()->AddCurve(circle->GetMatrix()->Element(0,1),DataPlot::Blue);
+    uavVrpn->VxPlot()->AddCurve(circle->GetMatrix()->Element(1,0),DataPlot::Blue);
+    uavVrpn->VyPlot()->AddCurve(circle->GetMatrix()->Element(1,1),DataPlot::Blue);
+    uavVrpn->XyPlot()->AddCurve(circle->GetMatrix()->Element(0,1),circle->GetMatrix()->Element(0,0),DataPlot::Blue,"circle");
+/*
+    uX=new Pid(setupLawTab->At(1,0),"u_x");
+    uX->UseDefaultPlot(graphLawTab->NewRow());
+    uY=new Pid(setupLawTab->At(1,1),"u_y");
+    uY->UseDefaultPlot(graphLawTab->LastRowLastCol());*/
+}
+
+CircleFollower::~CircleFollower() {
+}
+
+void CircleFollower::Run(void) {
+    WarnUponSwitches(true);
+    SetPeriodMS(100);
+    
+    if (getFrameworkManager()->ErrorOccured() == true) {
+        SafeStop();
+    }
+
+    while (!ToBeStopped()) {/*
+        float x=-controller->GetAxisValue(3)*forwardCoef->Value();
+        float rot=controller->GetAxisValue(0)*turnCoef->Value();
+        
+        sumoControl->move(x, rot);
+        
+        if (button_kill->Clicked() == true)
+            SafeStop();
+        */
+        WaitPeriod();
+    }
+}
+
+void CircleFollower::StartCircle(void) {/*
+    if (SetOrientationMode(OrientationMode_t::Custom)) {
+        Thread::Info("CircleFollower: start circle\n");
+    } else {
+        Thread::Warn("CircleFollower: could not start circle\n");
+        return;
+    }
+    Vector3Df uav_pos,target_pos;
+    Vector2Df uav_2Dpos,target_2Dpos;
+
+    targetVrpn->GetPosition(target_pos);
+    target_pos.To2Dxy(target_2Dpos);
+    circle->SetCenter(target_2Dpos);
+
+    uavVrpn->GetPosition(uav_pos);
+    uav_pos.To2Dxy(uav_2Dpos);
+    circle->StartTraj(uav_2Dpos);
+
+    uX->Reset();
+    uY->Reset();
+    behaviourMode=BehaviourMode_t::Circle;*/
+}
+
+void CircleFollower::StopCircle(void) {
+	/*
+    circle->FinishTraj();
+    //GetJoystick()->Rumble(0x70);
+    Thread::Info("CircleFollower: finishing circle\n");*/
+}
+
Index: /trunk/demos/TwoWheelRobotCircleFollower/ugv/src/CircleFollower.h
===================================================================
--- /trunk/demos/TwoWheelRobotCircleFollower/ugv/src/CircleFollower.h	(revision 376)
+++ /trunk/demos/TwoWheelRobotCircleFollower/ugv/src/CircleFollower.h	(revision 376)
@@ -0,0 +1,62 @@
+//  created:    2020/12/09
+//  filename:   CircleFollower.h
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    demo cercle avec optitrack
+//
+//
+/*********************************************************************/
+
+#ifndef CIRCLEFOLLOWER_H
+#define CIRCLEFOLLOWER_H
+
+#include <Thread.h>
+
+namespace flair {
+    namespace gui {
+        class PushButton;
+    }
+    namespace filter {
+        class TrajectoryGenerator2DCircle;
+		class Pid;
+    }
+    namespace meta {
+        class MetaVrpnObject;
+    }
+    namespace sensor {
+        class TargetController;
+    }
+}
+
+class CircleFollower : public flair::core::Thread {
+    public:
+        CircleFollower(std::string name,flair::sensor::TargetController *controller);
+        ~CircleFollower();
+
+    private:
+
+	enum class BehaviourMode_t {
+            Default,
+            Circle
+        };
+
+        BehaviourMode_t behaviourMode;
+        bool vrpnLost;
+		flair::sensor::TargetController *controller;
+
+		void Run(void);
+        void StartCircle(void);
+        void StopCircle(void);
+
+        flair::filter::Pid *uX, *uY;
+
+        flair::gui::PushButton *startCircle,*stopCircle,*button_kill;
+        flair::meta::MetaVrpnObject *targetVrpn,*uavVrpn;
+        flair::filter::TrajectoryGenerator2DCircle *circle;
+};
+
+#endif // CIRCLEFOLLOWER_H
Index: /trunk/demos/TwoWheelRobotCircleFollower/ugv/src/main.cpp
===================================================================
--- /trunk/demos/TwoWheelRobotCircleFollower/ugv/src/main.cpp	(revision 376)
+++ /trunk/demos/TwoWheelRobotCircleFollower/ugv/src/main.cpp	(revision 376)
@@ -0,0 +1,91 @@
+//  created:    2020/12/09
+//  filename:   main.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    exemple de code ugv
+//
+//
+/*********************************************************************/
+
+#include "CircleFollower.h"
+#include <FrameworkManager.h>
+#include <stdio.h>
+#include <tclap/CmdLine.h>
+#include <TargetEthController.h>
+
+using namespace TCLAP;
+using namespace std;
+using namespace flair::core;
+using namespace flair::meta;
+using namespace flair::sensor;
+
+string log_path;
+int port;
+int ds3port;
+string xml_file;
+string name;
+string address;
+
+void parseOptions(int argc, char** argv);
+
+
+int main(int argc, char* argv[]) {
+    parseOptions(argc,argv);
+
+    FrameworkManager *manager;
+    manager= new FrameworkManager(name);
+    manager->SetupConnection(address,port);
+    manager->SetupUserInterface(xml_file);
+    manager->SetupLogger(log_path);
+
+    TargetEthController *controller=new TargetEthController("Dualshock3",ds3port);
+    CircleFollower* demo=new CircleFollower(name,controller);
+
+    demo->Start();
+    demo->Join();
+
+    delete manager;
+}
+
+void parseOptions(int argc, char** argv) {
+	try {
+
+        CmdLine cmd("Command description message", ' ', "0.1");
+
+        ValueArg<string> nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
+        cmd.add( nameArg );
+
+        ValueArg<string> xmlArg("x","xml","fichier xml",true,"./reglages.xml","string");
+        cmd.add( xmlArg );
+
+        ValueArg<string> logsArg("l","logs","repertoire des logs",true,"/media/ram","string");
+        cmd.add( logsArg );
+
+        ValueArg<int> portArg("p","port","port pour station sol",true,9000,"int");
+        cmd.add( portArg );
+
+        ValueArg<string> addressArg("a","address","adresse station sol",true,"127.0.0.1","string");
+        cmd.add( addressArg );
+
+        ValueArg<int> ds3portArg("d","ds3_port","port pour ds3",false,20000,"int");
+        cmd.add( ds3portArg );
+
+        cmd.parse( argc, argv );
+
+        // Get the value parsed by each arg.
+        log_path = logsArg.getValue();
+        port=portArg.getValue();
+        ds3port=ds3portArg.getValue();
+        xml_file = xmlArg.getValue();
+        name=nameArg.getValue();
+        address=addressArg.getValue();
+
+	} catch (ArgException &e) { // catch any exceptions
+        cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+        exit(EXIT_FAILURE);
+	}
+}
Index: /trunk/lib/FlairSensorActuator/src/Bldc.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/Bldc.cpp	(revision 375)
+++ /trunk/lib/FlairSensorActuator/src/Bldc.cpp	(revision 376)
@@ -96,4 +96,4 @@
 }
 
-} // end namespace sensor
+} // end namespace actuator
 } // end namespace flair
Index: /trunk/lib/FlairSensorActuator/src/Bldc.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/Bldc.h	(revision 375)
+++ /trunk/lib/FlairSensorActuator/src/Bldc.h	(revision 376)
@@ -15,5 +15,4 @@
 
 #include <IODevice.h>
-#include <stdint.h>
 
 namespace flair {
Index: /trunk/lib/FlairSensorActuator/src/SimulatedUgvControls.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimulatedUgvControls.cpp	(revision 376)
+++ /trunk/lib/FlairSensorActuator/src/SimulatedUgvControls.cpp	(revision 376)
@@ -0,0 +1,78 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2020/&2/09
+//  filename:   SimulatedUgvControls.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    Class for a simulation ugv controls
+//
+//
+/*********************************************************************/
+#ifdef CORE2_64
+
+#include "SimulatedUgvControls.h"
+#include <FrameworkManager.h>
+#include <Matrix.h>
+#include <SharedMem.h>
+#include <sstream>
+#include <string.h>
+
+using std::string;
+using std::ostringstream;
+using namespace flair::core;
+
+namespace flair {
+namespace actuator {
+
+SimulatedUgvControls::SimulatedUgvControls(const IODevice *parent,string name, uint32_t modelId,uint32_t deviceId)
+    : UgvControls(parent,name) {
+  
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),2 * sizeof(float)+sizeof(Time));
+  
+  buf=(char*)malloc(2 * sizeof(float)+sizeof(Time));
+  if(buf==NULL) {
+    Err("error creating buffer\n");
+    return;
+  }
+  
+  SetIsReady(true);
+}
+
+SimulatedUgvControls::~SimulatedUgvControls() {
+  if(buf!=NULL) free(buf);
+}
+
+string SimulatedUgvControls::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_ugvcontrols_" << deviceId;
+  return dev_name.str().c_str();
+}
+
+void SimulatedUgvControls::SetControls(float speed,float turn) {
+  float *values=(float*)buf;
+  buf[0]=speed;
+  buf[1]=turn;
+  Time time=GetTime();
+  memcpy(buf+2 * sizeof(float),&time,sizeof(Time));
+
+  shmem->Write(buf, 2 * 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 < 2; i++) {
+    output->SetValueNoMutex(i, 0, buf[i]);
+  }
+  output->ReleaseMutex();
+}
+
+
+} // end namespace sensor
+} // end namespace flair
+
+#endif
Index: /trunk/lib/FlairSensorActuator/src/SimulatedUgvControls.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimulatedUgvControls.h	(revision 376)
+++ /trunk/lib/FlairSensorActuator/src/SimulatedUgvControls.h	(revision 376)
@@ -0,0 +1,70 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+/*!
+ * \file SimulatedUgvControls.h
+ * \brief Class for a simulation ugv controls
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2020/12/09
+ * \version 4.0
+ */
+
+#ifndef SIMULATEDUGVCONTROLS_H
+#define SIMULATEDUGVCONTROLS_H
+
+#include <UgvControls.h>
+#include <Thread.h>
+
+namespace flair {
+  namespace core {
+    class SharedMem;
+  }
+}
+
+namespace flair {
+namespace actuator {
+/*! \class SimulatedUgvControls
+*
+* \brief Class for a simulation ugv controls
+*/
+class SimulatedUgvControls : public UgvControls {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimulatedUgvControls.
+  *
+  * \param parent parent
+  * \param name name
+  * \param modelId Model id
+  * \param deviceId Imu id of the Model
+  */
+  SimulatedUgvControls(const core::IODevice *parent,std::string name,
+          uint32_t modelId,uint32_t deviceId);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~SimulatedUgvControls();
+
+private:
+ 
+  /*!
+  * \brief Set controls values
+  *
+  * Reimplemented from UgvControls. \n
+  *
+  * \param speed speed value
+  * \param turn turn value
+  */
+  void SetControls(float speed,float turn);
+  
+  char *buf;
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
+  core::SharedMem *shmem;
+};
+} // end namespace actuator
+} // end namespace flair
+#endif // SIMULATEDUGVCONTROLS_H
Index: /trunk/lib/FlairSensorActuator/src/UgvControls.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/UgvControls.cpp	(revision 376)
+++ /trunk/lib/FlairSensorActuator/src/UgvControls.cpp	(revision 376)
@@ -0,0 +1,53 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+//  created:    2020/12/09
+//  filename:   UgvControls.cpp
+//
+//  author:     Guillaume Sanahuja
+//              Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+//  version:    $Id: $
+//
+//  purpose:    Virtual class for igv controls
+//
+//
+/*********************************************************************/
+
+#include "UgvControls.h"
+#include <Matrix.h>
+
+using namespace flair::core;
+
+using std::string;
+
+namespace flair {
+namespace actuator {
+
+UgvControls::UgvControls(const IODevice *parent, string name)
+    : IODevice(parent, name) {
+  
+  MatrixDescriptor *desc = new MatrixDescriptor(2, 1);
+  desc->SetElementName(0, 0, "speed");
+  desc->SetElementName(1, 0, "turn");
+
+  output = new Matrix(this, desc, floatType);
+  delete desc;
+  AddDataToLog(output);
+}
+
+UgvControls::~UgvControls() {
+}
+
+void UgvControls::UseDefaultPlot(void) {
+  
+}
+
+Matrix *UgvControls::Output(void) const {
+ return output;
+}
+
+
+} // end namespace actuator
+} // end namespace flair
Index: /trunk/lib/FlairSensorActuator/src/UgvControls.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/UgvControls.h	(revision 376)
+++ /trunk/lib/FlairSensorActuator/src/UgvControls.h	(revision 376)
@@ -0,0 +1,90 @@
+// %flair:license{
+// This file is part of the Flair framework distributed under the
+// CECILL-C License, Version 1.0.
+// %flair:license}
+/*!
+ * \file UgvControls.h
+ * \brief Base class for ugv controls
+ * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2020/12/09
+ * \version 4.0
+ */
+
+#ifndef UGVCONTROLS_H
+#define UGVCONTROLS_H
+
+#include <IODevice.h>
+
+namespace flair {
+namespace core {
+class Matrix;
+}
+}
+
+
+namespace flair {
+namespace actuator {
+/*! \class UgvControls
+*
+* \brief Base class for ugv controls
+*/
+class UgvControls : public core::IODevice {
+  
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a UgvControls.
+  *
+  * \param parent parent
+  * \param name name
+  */
+  UgvControls(const core::IODevice *parent, std::string name);
+
+  /*!
+  * \brief Destructor
+  *
+  */
+  ~UgvControls();
+
+  /*!
+  * \brief Use default plot
+  *
+  */
+  void UseDefaultPlot(void);
+
+  /*!
+  * \brief Output from motors
+  *
+  * First column is real speed if available, secund column is current if
+  *available
+  *
+  */
+  core::Matrix *Output(void) const;
+  
+protected:
+  core::Matrix *output;
+
+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 Set controls values
+  *
+  * \param speed speed value
+  * \param turn turn value
+  */
+  virtual void SetControls(float speed,float turn)=0;
+  
+
+};
+} // end namespace actuator
+} // end namespace flair
+#endif // UGVCONTROLS_H
Index: /trunk/lib/FlairSimulator/src/TwoWheelRobot.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/TwoWheelRobot.cpp	(revision 375)
+++ /trunk/lib/FlairSimulator/src/TwoWheelRobot.cpp	(revision 376)
@@ -151,5 +151,5 @@
 // z down
 void TwoWheelRobot::CalcModel(void) {
-  float speed=0.4, turn=0;
+  float speed,turn;
   Time motorTime;
 
