Index: trunk/lib/FlairSimulator/src/SimuPressureSensor.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/SimuPressureSensor.cpp	(revision 245)
+++ trunk/lib/FlairSimulator/src/SimuPressureSensor.cpp	(revision 245)
@@ -0,0 +1,64 @@
+// %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
+//
+//
+/*********************************************************************/
+#include "SimuPressureSensor.h"
+#include <SharedMem.h>
+#include <Tab.h>
+#include <DoubleSpinBox.h>
+#include <Matrix.h>
+#include "Model.h"
+#include <sstream>
+#include <math.h>
+
+using std::string;
+using std::ostringstream;
+using namespace flair::core;
+using namespace flair::simulator;
+using namespace flair::gui;
+
+namespace flair {
+namespace sensor {
+
+SimuPressureSensor::SimuPressureSensor(const Model *parent, string name,uint32_t modelId,uint32_t deviceId)
+    : IODevice(parent,name) {
+  Tab *setup_tab = new Tab(parent->GetTabWidget(), name);
+  seaPressure = new DoubleSpinBox(setup_tab->NewRow(), "pressure at sea level:","Pa", 0, 200000, 1000,0,101325);
+  
+  shmem = new SharedMem(this, ShMemName(modelId, deviceId), sizeof(float));
+  
+  SetIsReady(true);
+}
+
+SimuPressureSensor::~SimuPressureSensor() {
+}
+
+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::UpdateFrom(const io_data *data) {
+  if (data != NULL) {
+    Matrix *input = (Matrix *)data;
+    float z_feet = -input->Value(6, 0)*3.28084;
+    float p = seaPressure->Value() *pow(1 - 6.87535*1e-6*z_feet,5.2561);//from https://www.brisbanehotairballooning.com.au/pressure-and-altitude-conversion/
+    shmem->Write((char *)&p, sizeof(float));
+  }
+}
+
+} // end namespace sensor
+} // end namespace flair
Index: trunk/lib/FlairSimulator/src/SimuPressureSensor.h
===================================================================
--- trunk/lib/FlairSimulator/src/SimuPressureSensor.h	(revision 245)
+++ trunk/lib/FlairSimulator/src/SimuPressureSensor.h	(revision 245)
@@ -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}
+/*!
+ * \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 <IODevice.h>
+
+namespace flair {
+namespace core {
+class SharedMem;
+}
+namespace gui {
+class SpinBox;
+class DoubleSpinBox;
+}
+namespace simulator {
+class Model;
+}
+}
+
+namespace flair {
+namespace sensor {
+/*! \class SimuPressureSensor
+*
+* \brief Class for a simulation PressureSensor
+*/
+class SimuPressureSensor : public core::IODevice {
+public:
+  /*!
+  * \brief Constructor
+  *
+  * Construct a SimuPressureSensor
+  *
+  * \param parent parent
+  * \param name name
+  * \param modelId Model id
+  * \param deviceId PressureSensor id of the Model
+  */
+  SimuPressureSensor(const simulator::Model *parent, std::string name, uint32_t modelId,uint32_t deviceId);
+
+  /*!
+  * \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);
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
+  gui::SpinBox *data_rate;
+  gui::DoubleSpinBox *seaPressure;
+};
+} // end namespace sensor
+} // end namespace flair
+#endif // SIMUPRESSURESENSOR_H
Index: trunk/lib/FlairSimulator/src/SimuUs.h
===================================================================
--- trunk/lib/FlairSimulator/src/SimuUs.h	(revision 238)
+++ trunk/lib/FlairSimulator/src/SimuUs.h	(revision 245)
@@ -67,12 +67,4 @@
   */
   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);
Index: trunk/lib/FlairSimulator/src/SimuUsGL.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/SimuUsGL.cpp	(revision 238)
+++ trunk/lib/FlairSimulator/src/SimuUsGL.cpp	(revision 245)
@@ -55,5 +55,5 @@
     // todo: utiliser le placement de l'us dans le drone et sa portée
     Matrix *input = (Matrix *)data;
-    value = input->Value(9, 0);
+    value = input->Value(6, 0);
     shmem->Write((char *)&value, sizeof(float));
 #ifdef GL
