Changeset 286 in flair-src


Ignore:
Timestamp:
Jan 8, 2019, 10:13:03 AM (22 months ago)
Author:
Sanahuja Guillaume
Message:

draw vrpn axis in simulator

Location:
trunk
Files:
4 added
28 edited
16 moved

Legend:

Unmodified
Added
Removed
  • trunk/demos/CircleFollower/simulator/build_core2_64/bin/simulator_x4.sh

    r234 r286  
    88. $FLAIR_ROOT/flair-dev/scripts/distribution_specific_hack.sh
    99
    10 $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
     10$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
  • trunk/lib/FlairFilter/src/SimulatedAhrs.cpp

    r285 r286  
    44// %flair:license}
    55//  created:    2014/02/07
    6 //  filename:   SimuAhrs.cpp
     6//  filename:   SimulatedAhrs.cpp
    77//
    88//  author:     Guillaume Sanahuja
     
    1717#ifdef CORE2_64
    1818
    19 #include "SimuAhrs.h"
    20 #include "SimuImu.h"
     19#include "SimulatedAhrs.h"
     20#include "SimulatedImu.h"
    2121#include <AhrsData.h>
    2222
     
    2828namespace filter {
    2929
    30 SimuAhrs::SimuAhrs(string name, uint32_t modelId,uint32_t deviceId,
     30SimulatedAhrs::SimulatedAhrs(string name, uint32_t modelId,uint32_t deviceId,
    3131                   uint8_t priority)
    32     : Ahrs(new SimuImu("imu", modelId,deviceId, priority), name) {
     32    : Ahrs(new SimulatedImu("imu", modelId,deviceId, priority), name) {
    3333  SetIsReady(true);
    3434}
    3535
    36 SimuAhrs::~SimuAhrs() {}
     36SimulatedAhrs::~SimulatedAhrs() {}
    3737
    38 // datas from SimuImu are AhrsData!
    39 void SimuAhrs::UpdateFrom(const io_data *data) {
     38// datas from SimulatedImu are AhrsData!
     39void SimulatedAhrs::UpdateFrom(const io_data *data) {
    4040  AhrsData *input = (AhrsData *)data;
    4141  AhrsData *output;
  • trunk/lib/FlairFilter/src/SimulatedAhrs.h

    r285 r286  
    44// %flair:license}
    55/*!
    6  * \file SimuAhrs.h
     6 * \file SimulatedAhrs.h
    77 * \brief Class for a simulation Ahrs
    88 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
     
    1919namespace flair {
    2020namespace filter {
    21 /*! \class SimuAhrs
     21/*! \class SimulatedAhrs
    2222*
    2323* \brief Class for a simulation Ahrs
    2424*
    25 * This class constructs a SimuImu as Imu of this Ahrs.
     25* This class constructs a SimulatedImu as Imu of this Ahrs.
    2626*/
    27 class SimuAhrs : public filter::Ahrs {
     27class SimulatedAhrs : public filter::Ahrs {
    2828public:
    2929  /*!
     
    3535  * \param modelId Model id
    3636  * \param deviceId Ahrs id of the Model
    37   * \param priority priority of the SimuImu Thread
     37  * \param priority priority of the SimulatedImu Thread
    3838  */
    39   SimuAhrs(std::string name,
     39  SimulatedAhrs(std::string name,
    4040           uint32_t modelId,uint32_t deviceId, uint8_t priority);
    4141
     
    4444  *
    4545  */
    46   ~SimuAhrs();
     46  ~SimulatedAhrs();
    4747
    4848private:
  • trunk/lib/FlairMeta/src/MetaVrpnObject.cpp

    r214 r286  
    1818
    1919#include "MetaVrpnObject.h"
    20 #include "VrpnClient.h"
    2120#include <EulerDerivative.h>
    2221#include <LowPassFilter.h>
     
    3837namespace meta {
    3938
    40 MetaVrpnObject::MetaVrpnObject(string name)
    41     : VrpnObject( name, GetVrpnClient()->GetTabWidget()) {
    42   ConstructorCommon(name);
     39MetaVrpnObject::MetaVrpnObject(string name,VrpnClient *client)
     40    : VrpnObject( name, client->GetTabWidget(),client) {
     41  ConstructorCommon(name,client);
    4342}
    4443
    45 MetaVrpnObject::MetaVrpnObject(std::string name,
    46                                uint8_t id)
    47     : VrpnObject(name, id, GetVrpnClient()->GetTabWidget()) {
    48   ConstructorCommon( name);
     44MetaVrpnObject::MetaVrpnObject(std::string name,uint8_t id,VrpnClient *client)
     45    : VrpnObject(name, id, client->GetTabWidget(),client) {
     46  ConstructorCommon( name,client);
    4947}
    5048
    51 void MetaVrpnObject::ConstructorCommon(string name) {
     49void MetaVrpnObject::ConstructorCommon(string name,VrpnClient *client) {
    5250  cvmatrix_descriptor *desc = new cvmatrix_descriptor(7, 1);
    5351  for (int i = 0; i < desc->Rows(); i++) {
     
    5755  delete desc;
    5856
    59   pbas = new LowPassFilter(this, GetVrpnClient()->GetLayout()->NewRow(),
     57  pbas = new LowPassFilter(this, client->GetLayout()->NewRow(),
    6058                           name + " Passe bas", prev_value);
    6159  delete prev_value;
     
    6866  delete desc;
    6967
    70   euler = new EulerDerivative(pbas, GetVrpnClient()->GetLayout()->NewRow(),
     68  euler = new EulerDerivative(pbas, client->GetLayout()->NewRow(),
    7169                              name + "_euler", prev_value);
    7270  delete prev_value;
     
    7977  vz_opti_plot->AddCurve(euler->GetMatrix()->Element(6));
    8078
    81   plot_tab = new Tab(GetVrpnClient()->GetTabWidget(), "Mesures (xy) " + name);
     79  plot_tab = new Tab(client->GetTabWidget(), "Mesures (xy) " + name);
    8280  xy_plot = new DataPlot2D(plot_tab->NewRow(), "xy", "y", -5, 5, "x", -5, 5);
    8381  xy_plot->AddCurve(Output()->Element(5, 0), Output()->Element(4, 0));
  • trunk/lib/FlairMeta/src/MetaVrpnObject.h

    r167 r286  
    1515
    1616#include <VrpnObject.h>
     17#include <VrpnClient.h>
    1718#include <io_data.h>
    1819#include <Vector3D.h>
     
    4142class MetaVrpnObject : public sensor::VrpnObject {
    4243public:
    43   MetaVrpnObject(std::string name);
    44   MetaVrpnObject(std::string name,uint8_t id);
     44  MetaVrpnObject(std::string name,sensor::VrpnClient *client=sensor::GetVrpnClient());
     45  MetaVrpnObject(std::string name,uint8_t id,sensor::VrpnClient *client=sensor::GetVrpnClient());
    4546  ~MetaVrpnObject();
    4647  gui::DataPlot1D *VxPlot(void) const; // 1,0
     
    5152
    5253private:
    53   void ConstructorCommon(std::string name);
     54  void ConstructorCommon(std::string name,sensor::VrpnClient *client);
    5455  filter::LowPassFilter *pbas;
    5556  filter::EulerDerivative *euler;
  • trunk/lib/FlairMeta/src/SimuX4.cpp

    r268 r286  
    2020#include <FrameworkManager.h>
    2121#include <X4X8Multiplex.h>
    22 #include <SimuImu.h>
    23 #include <SimuAhrs.h>
    24 #include <SimuBldc.h>
    25 #include <SimuUs.h>
    26 #include <SimuCamera.h>
    27 #include <SimuPressureSensor.h>
     22#include <SimulatedImu.h>
     23#include <SimulatedAhrs.h>
     24#include <SimulatedBldc.h>
     25#include <SimulatedUs.h>
     26#include <SimulatedCamera.h>
     27#include <SimulatedPressureSensor.h>
    2828#include <BatteryMonitor.h>
    29 #include <SimuGps.h>
     29#include <SimulatedGps.h>
    3030#include <Tab.h>
    3131#include <FindArgument.h>
     
    4848    SetMultiplex(new X4X8Multiplex("motors", X4X8Multiplex::X4));
    4949
    50   SetBldc(new SimuBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
     50  SetBldc(new SimulatedBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
    5151                       "motors", GetUavMultiplex()->MotorsCount(), simu_id,0));
    52   SetUsRangeFinder(new SimuUs("us", simu_id,0, 60));
    53   SetAhrs(new SimuAhrs("ahrs", simu_id, 0,70));
     52  SetUsRangeFinder(new SimulatedUs("us", simu_id,0, 60));
     53  SetAhrs(new SimulatedAhrs("ahrs", simu_id, 0,70));
    5454  Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery");
    5555  SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
     
    5959        ReadCameraResolutionOption(options,"camv",camvWidth,camvHeight);
    6060  Info("using vertical camera resolution: %ix%i\n",camvWidth, camvHeight);
    61   SetVerticalCamera(new SimuCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));
     61  SetVerticalCamera(new SimulatedCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));
    6262 
    6363  uint16_t camhWidth=320,camhHeight=240;
    6464  ReadCameraResolutionOption(options,"camh",camhWidth,camhHeight);
    6565  Info("using horizontal camera resolution: %ix%i\n",camhWidth, camhHeight);
    66   SetHorizontalCamera(new SimuCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));
     66  SetHorizontalCamera(new SimulatedCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));
    6767 
    6868  string useGps=FindArgument(options,"use_gps=",false);
    6969  if(useGps=="true") {
    70     SetGps(new SimuGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40));
     70    SetGps(new SimulatedGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40));
    7171  }
    7272 
    7373  string usePressureSensor=FindArgument(options,"use_pressure_sensor=",false);
    7474  if(usePressureSensor=="true") {
    75     SetPressureSensor(new SimuPressureSensor("pressuresensor", 0,0, 10));
     75    SetPressureSensor(new SimulatedPressureSensor("pressuresensor", 0,0, 10));
    7676  }
    7777}
     
    8080
    8181void SimuX4::StartSensors(void) {
    82   ((SimuImu *)(GetAhrs()->GetImu()))->Start();
    83   ((SimuUs *)GetUsRangeFinder())->Start();
    84   ((SimuCamera *)GetVerticalCamera())->Start();
    85   ((SimuCamera *)GetHorizontalCamera())->Start();
    86   if(GetGps()) ((SimuGps *)GetGps())->Start();
    87   if(GetPressureSensor()) ((SimuPressureSensor *)GetPressureSensor())->Start();
     82  ((SimulatedImu *)(GetAhrs()->GetImu()))->Start();
     83  ((SimulatedUs *)GetUsRangeFinder())->Start();
     84  ((SimulatedCamera *)GetVerticalCamera())->Start();
     85  ((SimulatedCamera *)GetHorizontalCamera())->Start();
     86  if(GetGps()) ((SimulatedGps *)GetGps())->Start();
     87  if(GetPressureSensor()) ((SimulatedPressureSensor *)GetPressureSensor())->Start();
    8888}
    8989
  • trunk/lib/FlairMeta/src/SimuX8.cpp

    r268 r286  
    2020#include <FrameworkManager.h>
    2121#include <X4X8Multiplex.h>
    22 #include <SimuImu.h>
    23 #include <SimuAhrs.h>
    24 #include <SimuBldc.h>
    25 #include <SimuUs.h>
    26 #include <SimuCamera.h>
    27 #include <SimuPressureSensor.h>
     22#include <SimulatedImu.h>
     23#include <SimulatedAhrs.h>
     24#include <SimulatedBldc.h>
     25#include <SimulatedUs.h>
     26#include <SimulatedCamera.h>
     27#include <SimulatedPressureSensor.h>
    2828#include <BatteryMonitor.h>
    29 #include <SimuGps.h>
     29#include <SimulatedGps.h>
    3030#include <Tab.h>
    3131#include <FindArgument.h>
     
    4848    SetMultiplex(new X4X8Multiplex("motors", X4X8Multiplex::X8));
    4949
    50   SetBldc(new SimuBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
     50  SetBldc(new SimulatedBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
    5151                       "motors", GetUavMultiplex()->MotorsCount(), simu_id,0));
    52   SetUsRangeFinder(new SimuUs("us", simu_id,0, 60));
    53   SetAhrs(new SimuAhrs("ahrs", simu_id, 0,70));
     52  SetUsRangeFinder(new SimulatedUs("us", simu_id,0, 60));
     53  SetAhrs(new SimulatedAhrs("ahrs", simu_id, 0,70));
    5454  Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery");
    5555  SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
     
    5959        ReadCameraResolutionOption(options,"camv",camvWidth,camvHeight);
    6060  Info("using vertical camera resolution: %ix%i\n",camvWidth, camvHeight);
    61   SetVerticalCamera(new SimuCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));
     61  SetVerticalCamera(new SimulatedCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));
    6262 
    6363  uint16_t camhWidth=320,camhHeight=240;
    6464  ReadCameraResolutionOption(options,"camh",camhWidth,camhHeight);
    6565  Info("using horizontal camera resolution: %ix%i\n",camhWidth, camhHeight);
    66   SetHorizontalCamera(new SimuCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));
     66  SetHorizontalCamera(new SimulatedCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));
    6767 
    6868  string useGps=FindArgument(options,"use_gps=",false);
    6969  if(useGps=="true") {
    70     SetGps(new SimuGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40));
     70    SetGps(new SimulatedGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40));
    7171  }
    7272 
    7373  string usePressureSensor=FindArgument(options,"use_pressure_sensor=",false);
    7474  if(usePressureSensor=="true") {
    75     SetPressureSensor(new SimuPressureSensor("pressuresensor", 0,0, 10));
     75    SetPressureSensor(new SimulatedPressureSensor("pressuresensor", 0,0, 10));
    7676  }
    7777}
     
    8080
    8181void SimuX8::StartSensors(void) {
    82   ((SimuImu *)(GetAhrs()->GetImu()))->Start();
    83   ((SimuUs *)GetUsRangeFinder())->Start();
    84   ((SimuCamera *)GetVerticalCamera())->Start();
    85   ((SimuCamera *)GetHorizontalCamera())->Start();
    86   if(GetGps()) ((SimuGps *)GetGps())->Start();
    87   if(GetPressureSensor()) ((SimuPressureSensor *)GetPressureSensor())->Start();
     82  ((SimulatedImu *)(GetAhrs()->GetImu()))->Start();
     83  ((SimulatedUs *)GetUsRangeFinder())->Start();
     84  ((SimulatedCamera *)GetVerticalCamera())->Start();
     85  ((SimulatedCamera *)GetHorizontalCamera())->Start();
     86  if(GetGps()) ((SimulatedGps *)GetGps())->Start();
     87  if(GetPressureSensor()) ((SimulatedPressureSensor *)GetPressureSensor())->Start();
    8888}
    8989
  • trunk/lib/FlairSensorActuator/src/SimulatedBldc.cpp

    r285 r286  
    44// %flair:license}
    55//  created:    2014/02/07
    6 //  filename:   SimuBldc.cpp
     6//  filename:   SimulatedBldc.cpp
    77//
    88//  author:     Guillaume Sanahuja
     
    1717#ifdef CORE2_64
    1818
    19 #include "SimuBldc.h"
     19#include "SimulatedBldc.h"
    2020#include <FrameworkManager.h>
    2121#include <GridLayout.h>
     
    3535namespace actuator {
    3636
    37 SimuBldc::SimuBldc(const IODevice *parent, Layout *layout, string name,
     37SimulatedBldc::SimulatedBldc(const IODevice *parent, Layout *layout, string name,
    3838                   uint8_t motors_count, uint32_t modelId,uint32_t deviceId)
    3939    : Bldc(parent, layout, name, motors_count) {
     
    5252}
    5353
    54 SimuBldc::~SimuBldc() {
     54SimulatedBldc::~SimulatedBldc() {
    5555  if(buf!=NULL) free(buf);
    5656}
    5757
    58 string SimuBldc::ShMemName(uint32_t modelId,uint32_t deviceId) {
     58string SimulatedBldc::ShMemName(uint32_t modelId,uint32_t deviceId) {
    5959  ostringstream dev_name;
    6060  dev_name << "simu" <<  modelId << "_bldc_" << deviceId;
     
    6262}
    6363
    64 void SimuBldc::SetMotors(float *value) {
     64void SimulatedBldc::SetMotors(float *value) {
    6565  float *values=(float*)buf;
    6666  for (int i = 0; i < MotorsCount(); i++) values[i] = k->Value() * value[i];
  • trunk/lib/FlairSensorActuator/src/SimulatedBldc.h

    r285 r286  
    44// %flair:license}
    55/*!
    6  * \file SimuBldc.h
     6 * \file SimulatedBldc.h
    77 * \brief Class for a simulation bldc
    88 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
     
    1111 */
    1212
    13 #ifndef SIMUBLDC_H
    14 #define SIMUBLDC_H
     13#ifndef SIMULATEDBLDC_H
     14#define SIMULATEDBLDC_H
    1515
    1616#include <Bldc.h>
     
    3030namespace flair {
    3131namespace actuator {
    32 /*! \class SimuBldc
     32/*! \class SimulatedBldc
    3333*
    3434* \brief Class for a simulation bldc
    3535*
    3636*/
    37 class SimuBldc : public Bldc {
     37class SimulatedBldc : public Bldc {
    3838public:
    3939  /*!
    4040  * \brief Constructor
    4141  *
    42   * Construct a SimuBldc
     42  * Construct a SimulatedBldc
    4343  *
    4444  * \param parent parent
     
    4949  * \param deviceId Bldc id of the Model
    5050  */
    51   SimuBldc(const core::IODevice *parent, gui::Layout *layout, std::string name,
     51  SimulatedBldc(const core::IODevice *parent, gui::Layout *layout, std::string name,
    5252           uint8_t motors_count, uint32_t modelId,uint32_t deviceId);
    5353
     
    5656  *
    5757  */
    58   ~SimuBldc();
     58  ~SimulatedBldc();
    5959
    6060  /*!
     
    9595} // end namespace actuator
    9696} // end namespace flair
    97 #endif // SIMUBLDC_H
     97#endif // SIMULATEDBLDC_H
  • trunk/lib/FlairSensorActuator/src/SimulatedCamera.cpp

    r285 r286  
    44// %flair:license}
    55//  created:    2014/03/06
    6 //  filename:   SimuCamera.cpp
     6//  filename:   SimulatedCamera.cpp
    77//
    88//  author:     Guillaume Sanahuja
     
    1717#ifdef CORE2_64
    1818
    19 #include "SimuCamera.h"
     19#include "SimulatedCamera.h"
    2020#include <FrameworkManager.h>
    2121#include <GroupBox.h>
     
    3131namespace sensor {
    3232
    33 SimuCamera::SimuCamera(string name,
     33SimulatedCamera::SimulatedCamera(string name,
    3434                       uint16_t width, uint16_t height, uint8_t channels,
    3535                       uint32_t modelId,uint32_t deviceId, uint8_t priority)
     
    4242  output->img->imageData = shmemReadBuf;
    4343
    44   ostringstream dev_name;
    45   dev_name << "simu" <<  modelId << "_cam_" << deviceId;
    4644  shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId), buf_size, SharedMem::Type::producerConsumer);
    4745 
     
    5048
    5149
    52 SimuCamera::~SimuCamera() {
     50SimulatedCamera::~SimulatedCamera() {
    5351  SafeStop();
    5452  Join();
     
    5654}
    5755
    58 string SimuCamera::ShMemName(uint32_t modelId,uint32_t deviceId) {
     56string SimulatedCamera::ShMemName(uint32_t modelId,uint32_t deviceId) {
    5957  ostringstream dev_name;
    6058  dev_name << "simu" <<  modelId << "_cam_" << deviceId;
     
    6260}
    6361
    64 void SimuCamera::Run(void) {
     62void SimulatedCamera::Run(void) {
    6563  Time time;
    6664
  • trunk/lib/FlairSensorActuator/src/SimulatedCamera.h

    r285 r286  
    44// %flair:license}
    55/*!
    6  * \file SimuCamera.h
     6 * \file SimulatedCamera.h
    77 * \brief Class for a simulation camera
    88 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
     
    1111 */
    1212
    13 #ifndef SIMUCAMERA_H
    14 #define SIMUCAMERA_H
     13#ifndef SIMULATEDCAMERA_H
     14#define SIMULATEDCAMERA_H
    1515
    1616#include <Camera.h>
     
    2626namespace flair {
    2727namespace sensor {
    28 /*! \class SimuCamera
     28/*! \class SimulatedCamera
    2929*
    3030* \brief Class for a simulation camera
    3131*/
    32 class SimuCamera : public core::Thread, public Camera {
     32class SimulatedCamera : public core::Thread, public Camera {
    3333public:
    3434  /*!
    3535  * \brief Constructor
    3636  *
    37   * Construct a SimuCamera.
     37  * Construct a SimulatedCamera.
    3838        * It will be child of the FrameworkManager.
    3939  *
     
    4646  * \param priority priority of the Thread
    4747  */
    48   SimuCamera(std::string name,
     48  SimulatedCamera(std::string name,
    4949             uint16_t width, uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId,
    5050             uint8_t priority);
     
    5555  *
    5656  */
    57   ~SimuCamera();
     57  ~SimulatedCamera();
    5858
    5959protected:
     
    8989} // end namespace sensor
    9090} // end namespace flair
    91 #endif // SIMUCAMERA_H
     91#endif // SIMULATEDCAMERA_H
  • trunk/lib/FlairSensorActuator/src/SimulatedGps.cpp

    r285 r286  
    44// %flair:license}
    55//  created:    2014/05/26
    6 //  filename:   SimuGps.cpp
     6//  filename:   SimulatedGps.cpp
    77//
    88//  author:     Guillaume Sanahuja
     
    1717#ifdef CORE2_64
    1818
    19 #include "SimuGps.h"
     19#include "SimulatedGps.h"
    2020#include <FrameworkManager.h>
    2121#include <GpsData.h>
     
    3838namespace sensor {
    3939
    40 SimuGps::SimuGps(string name,
     40SimulatedGps::SimulatedGps(string name,
    4141                 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority)
    4242    : NmeaGps(name, NMEAFlags),Thread(getFrameworkManager(), name, priority) {
     
    5757
    5858
    59 SimuGps::~SimuGps() {
     59SimulatedGps::~SimulatedGps() {
    6060  SafeStop();
    6161  Join();
    6262}
    6363
    64 string SimuGps::ShMemName(uint32_t modelId,uint32_t deviceId) {
     64string SimulatedGps::ShMemName(uint32_t modelId,uint32_t deviceId) {
    6565  ostringstream dev_name;
    6666  dev_name << "simu" <<  modelId << "_gps_" << deviceId;
     
    6868}
    6969
    70 void SimuGps::Run(void) {
     70void SimulatedGps::Run(void) {
    7171  gps_states_t state;
    7272  char buf[512];
  • trunk/lib/FlairSensorActuator/src/SimulatedGps.h

    r285 r286  
    44// %flair:license}
    55/*!
    6  * \file SimuGps.h
     6 * \file SimulatedGps.h
    77 * \brief Class for a simulation GPS
    88 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
     
    1111 */
    1212
    13 #ifndef SIMUGPS_H
    14 #define SIMUGPS_H
     13#ifndef SimulatedGPS_H
     14#define SimulatedGPS_H
    1515
    1616#include <Thread.h>
     
    2929namespace flair {
    3030namespace sensor {
    31 /*! \class SimuGps
     31/*! \class SimulatedGps
    3232*
    3333* \brief Class for a simulation GPS
    3434*/
    35 class SimuGps : public core::Thread, public NmeaGps {
     35class SimulatedGps : public core::Thread, public NmeaGps {
    3636public:
    3737  /*!
     
    4747  * \param priority priority of the Thread
    4848  */
    49   SimuGps(std::string name,
     49  SimulatedGps(std::string name,
    5050          NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority);
    5151
     
    5454  *
    5555  */
    56   ~SimuGps();
     56  ~SimulatedGps();
    5757
    5858private:
     
    9090} // end namespace sensor
    9191} // end namespace flair
    92 #endif // SIMUGPS_H
     92#endif // SIMULATEDGPS_H
  • trunk/lib/FlairSensorActuator/src/SimulatedImu.cpp

    r285 r286  
    44// %flair:license}
    55//  created:    2014/02/07
    6 //  filename:   SimuImu.cpp
     6//  filename:   SimulatedImu.cpp
    77//
    88//  author:     Guillaume Sanahuja
     
    1717#ifdef CORE2_64
    1818
    19 #include "SimuImu.h"
     19#include "SimulatedImu.h"
    2020#include <FrameworkManager.h>
    2121#include <ImuData.h>
     
    3535namespace sensor {
    3636
    37 SimuImu::SimuImu(string name, uint32_t modelId,uint32_t deviceId,
     37SimulatedImu::SimulatedImu(string name, uint32_t modelId,uint32_t deviceId,
    3838                 uint8_t priority)
    3939    : Imu(name,false), Thread(getFrameworkManager(), name, priority) {
     
    4747}
    4848
    49 SimuImu::~SimuImu() {
     49SimulatedImu::~SimulatedImu() {
    5050  SafeStop();
    5151  Join();
    5252}
    5353
    54 string SimuImu::ShMemName(uint32_t modelId,uint32_t deviceId) {
     54string SimulatedImu::ShMemName(uint32_t modelId,uint32_t deviceId) {
    5555  ostringstream dev_name;
    5656  dev_name << "simu" <<  modelId << "_imu_" << deviceId;
     
    5858}
    5959
    60 void SimuImu::Run(void) {
     60void SimulatedImu::Run(void) {
    6161  imu_states_t state;
    6262  ImuData *imuData;
  • trunk/lib/FlairSensorActuator/src/SimulatedImu.h

    r285 r286  
    44// %flair:license}
    55/*!
    6  * \file SimuImu.h
     6 * \file SimulatedImu.h
    77 * \brief Class for a simulation Imu
    88 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
     
    1111 */
    1212
    13 #ifndef SIMUIMU_H
    14 #define SIMUIMU_H
     13#ifndef SIMULATEDIMU_H
     14#define SIMULATEDIMU_H
    1515
    1616#include <Imu.h>
     
    2929namespace flair {
    3030namespace sensor {
    31 /*! \class SimuImu
     31/*! \class SimulatedImu
    3232*
    3333* \brief Class for a simulation Imu
    3434*/
    35 class SimuImu : public Imu, public core::Thread {
     35class SimulatedImu : public Imu, public core::Thread {
    3636public:
    3737  /*!
    3838  * \brief Constructor
    3939  *
    40   * Construct a SimuImu.
     40  * Construct a SimulatedImu.
    4141        * It will be child of the FrameworkManager.
    4242  *
     
    4646  * \param priority priority of the Thread
    4747  */
    48   SimuImu(std::string name,
     48  SimulatedImu(std::string name,
    4949          uint32_t modelId,uint32_t deviceId, uint8_t priority);
    5050
     
    5353  *
    5454  */
    55   ~SimuImu();
     55  ~SimulatedImu();
    5656
    5757private:
     
    9797} // end namespace sensor
    9898} // end namespace flair
    99 #endif // SIMUIMU_H
     99#endif // SIMULATEDIMU_H
  • trunk/lib/FlairSensorActuator/src/SimulatedLaser.cpp

    r285 r286  
    44// %flair:license}
    55//  created:    2014/02/07
    6 //  filename:   SimuUs.cpp
     6//  filename:   SimulatedUs.cpp
    77//
    88//  author:     Guillaume Sanahuja
     
    1717#ifdef CORE2_64
    1818
    19 #include "SimuLaser.h"
     19#include "SimulatedLaser.h"
    2020#include <FrameworkManager.h>
    2121#include <SpinBox.h>
     
    3333namespace sensor {
    3434
    35 SimuLaser::SimuLaser(string name,
     35SimulatedLaser::SimulatedLaser(string name,
    3636                     uint32_t modelId,uint32_t deviceId, uint8_t priority)
    3737    : Thread(getFrameworkManager(), name, priority), LaserRangeFinder(name) {
     
    4444}
    4545
    46 SimuLaser::~SimuLaser() {
     46SimulatedLaser::~SimulatedLaser() {
    4747  SafeStop();
    4848  Join();
    4949}
    5050
    51 string SimuLaser::ShMemName(uint32_t modelId,uint32_t deviceId) {
     51string SimulatedLaser::ShMemName(uint32_t modelId,uint32_t deviceId) {
    5252  ostringstream dev_name;
    5353  dev_name << "simu" <<  modelId << "_laser_" << deviceId;
     
    5555}
    5656
    57 void SimuLaser::Run(void) {
     57void SimulatedLaser::Run(void) {
    5858  float z[360];
    5959
  • trunk/lib/FlairSensorActuator/src/SimulatedLaser.h

    r285 r286  
    44// %flair:license}
    55/*!
    6  * \file SimuUs.h
     6 * \file SimulatedUs.h
    77 * \brief Class for a simulation UsRangeFinder
    88 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
     
    1111 */
    1212
    13 #ifndef SIMULASER_H
    14 #define SIMULASER_H
     13#ifndef SIMULATEDLASER_H
     14#define SIMULATEDLASER_H
    1515
    1616#include <LaserRangeFinder.h>
     
    2828namespace flair {
    2929namespace sensor {
    30 /*! \class SimuUs
     30/*! \class SimulatedUs
    3131*
    3232* \brief Class for a simulation UsRangeFinder
    3333*/
    34 class SimuLaser : public core::Thread, public LaserRangeFinder {
     34class SimulatedLaser : public core::Thread, public LaserRangeFinder {
    3535public:
    3636  /*!
    3737  * \brief Constructor
    3838  *
    39   * Construct a SimuUs.
     39  * Construct a SimulatedUs.
    4040  *
    4141  * \param name name
     
    4444  * \param priority priority of the Thread
    4545  */
    46   SimuLaser(std::string name,
     46  SimulatedLaser(std::string name,
    4747            uint32_t modelId,uint32_t deviceId, uint8_t priority);
    4848
     
    5151  *
    5252  */
    53   ~SimuLaser();
     53  ~SimulatedLaser();
    5454
    5555protected:
     
    8383} // end namespace sensor
    8484} // end namespace flair
    85 #endif // SIMULASER_H
     85#endif // SIMULATEDLASER_H
  • trunk/lib/FlairSensorActuator/src/SimulatedPressureSensor.cpp

    r285 r286  
    44// %flair:license}
    55//  created:    2018/05/24
    6 //  filename:   SimuPressureSensor.cpp
     6//  filename:   SimulatedPressureSensor.cpp
    77//
    88//  author:     Guillaume Sanahuja
     
    1717#ifdef CORE2_64
    1818
    19 #include "SimuPressureSensor.h"
     19#include "SimulatedPressureSensor.h"
    2020#include <FrameworkManager.h>
    2121#include <SpinBox.h>
     
    3333namespace sensor {
    3434
    35 SimuPressureSensor::SimuPressureSensor(string name, uint32_t modelId,uint32_t deviceId,
     35SimulatedPressureSensor::SimulatedPressureSensor(string name, uint32_t modelId,uint32_t deviceId,
    3636               uint8_t priority)
    3737    : Thread(getFrameworkManager(), name, priority), PressureSensor( name) {
     
    4444}
    4545
    46 SimuPressureSensor::~SimuPressureSensor() {
     46SimulatedPressureSensor::~SimulatedPressureSensor() {
    4747  SafeStop();
    4848  Join();
    4949}
    5050
    51 string SimuPressureSensor::ShMemName(uint32_t modelId,uint32_t deviceId) {
     51string SimulatedPressureSensor::ShMemName(uint32_t modelId,uint32_t deviceId) {
    5252  ostringstream dev_name;
    5353  dev_name << "simu" <<  modelId << "_pressure_" << deviceId;
     
    5555}
    5656
    57 void SimuPressureSensor::Run(void) {
     57void SimulatedPressureSensor::Run(void) {
    5858  float p;
    5959
  • trunk/lib/FlairSensorActuator/src/SimulatedPressureSensor.h

    r285 r286  
    44// %flair:license}
    55/*!
    6  * \file SimuPressureSensor.h
     6 * \file SimulatedPressureSensor.h
    77 * \brief Class for a simulation PressureSensor
    88 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
     
    1111 */
    1212
    13 #ifndef SIMUPRESSURESENSOR_H
    14 #define SIMUPRESSURESENSOR_H
     13#ifndef SIMULATEDPRESSURESENSOR_H
     14#define SIMULATEDPRESSURESENSOR_H
    1515
    1616#include <PressureSensor.h>
     
    2828namespace flair {
    2929namespace sensor {
    30 /*! \class SimuPressureSensor
     30/*! \class SimulatedPressureSensor
    3131*
    3232* \brief Class for a simulation PressureSensor
    3333*/
    34 class SimuPressureSensor : public core::Thread, public PressureSensor {
     34class SimulatedPressureSensor : public core::Thread, public PressureSensor {
    3535public:
    3636  /*!
    3737  * \brief Constructor
    3838  *
    39   * Construct a SimuPressureSensor.
     39  * Construct a SimulatedPressureSensor.
    4040        * It will be child of the FrameworkManager.
    4141  *
     
    4545  * \param priority priority of the Thread
    4646  */
    47   SimuPressureSensor(std::string name,
     47  SimulatedPressureSensor(std::string name,
    4848         uint32_t modelId,uint32_t deviceId, uint8_t priority);
    4949
     
    5252  *
    5353  */
    54   ~SimuPressureSensor();
     54  ~SimulatedPressureSensor();
    5555
    5656protected:
     
    8484} // end namespace sensor
    8585} // end namespace flair
    86 #endif // SIMUPRESSURESENSOR_H
     86#endif // SIMULATEDPRESSURESENSOR_H
  • trunk/lib/FlairSensorActuator/src/SimulatedUs.cpp

    r285 r286  
    44// %flair:license}
    55//  created:    2014/02/07
    6 //  filename:   SimuUs.cpp
     6//  filename:   SimulatedUs.cpp
    77//
    88//  author:     Guillaume Sanahuja
     
    1717#ifdef CORE2_64
    1818
    19 #include "SimuUs.h"
     19#include "SimulatedUs.h"
    2020#include <FrameworkManager.h>
    2121#include <SpinBox.h>
     
    3333namespace sensor {
    3434
    35 SimuUs::SimuUs(string name, uint32_t modelId,uint32_t deviceId,
     35SimulatedUs::SimulatedUs(string name, uint32_t modelId,uint32_t deviceId,
    3636               uint8_t priority)
    3737    : Thread(getFrameworkManager(), name, priority), UsRangeFinder( name) {
     
    4444}
    4545
    46 SimuUs::~SimuUs() {
     46SimulatedUs::~SimulatedUs() {
    4747  SafeStop();
    4848  Join();
    4949}
    5050
    51 string SimuUs::ShMemName(uint32_t modelId,uint32_t deviceId) {
     51string SimulatedUs::ShMemName(uint32_t modelId,uint32_t deviceId) {
    5252  ostringstream dev_name;
    5353  dev_name << "simu" <<  modelId << "_us_" << deviceId;
     
    5555}
    5656
    57 void SimuUs::Run(void) {
     57void SimulatedUs::Run(void) {
    5858  float z;
    5959 
  • trunk/lib/FlairSensorActuator/src/SimulatedUs.h

    r285 r286  
    44// %flair:license}
    55/*!
    6  * \file SimuUs.h
     6 * \file SimulatedUs.h
    77 * \brief Class for a simulation UsRangeFinder
    88 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
     
    1111 */
    1212
    13 #ifndef SIMUUS_H
    14 #define SIMUUS_H
     13#ifndef SIMULATEDUS_H
     14#define SIMULATEDUS_H
    1515
    1616#include <UsRangeFinder.h>
     
    2828namespace flair {
    2929namespace sensor {
    30 /*! \class SimuUs
     30/*! \class SimulatedUs
    3131*
    3232* \brief Class for a simulation UsRangeFinder
    3333*/
    34 class SimuUs : public core::Thread, public UsRangeFinder {
     34class SimulatedUs : public core::Thread, public UsRangeFinder {
    3535public:
    3636  /*!
    3737  * \brief Constructor
    3838  *
    39   * Construct a SimuUs.
     39  * Construct a SimulatedUs.
    4040        * It will be child of the FrameworkManager.
    4141  *
     
    4545  * \param priority priority of the Thread
    4646  */
    47   SimuUs(std::string name,
     47  SimulatedUs(std::string name,
    4848         uint32_t modelId,uint32_t deviceId, uint8_t priority);
    4949
     
    5252  *
    5353  */
    54   ~SimuUs();
     54  ~SimulatedUs();
    5555
    5656protected:
     
    8484} // end namespace sensor
    8585} // end namespace flair
    86 #endif // SIMUUS_H
     86#endif // SIMULATEDUS_H
  • trunk/lib/FlairSensorActuator/src/VrpnObject.cpp

    r214 r286  
    1818#include "VrpnObject.h"
    1919#include "VrpnObject_impl.h"
    20 #include "VrpnClient.h"
    2120#include <string.h>
    2221#include <Matrix.h>
     
    3029
    3130VrpnObject::VrpnObject(string name,
    32                        const TabWidget *tab)
    33     : IODevice(GetVrpnClient(), name) {
    34   pimpl_ = new VrpnObject_impl(this, name, -1, tab);
     31                       const TabWidget *tab,VrpnClient *client)
     32    : IODevice(client, name) {
     33  pimpl_ = new VrpnObject_impl(this, name, -1, tab,client);
    3534  AddDataToLog(pimpl_->output);
    3635 
     
    3938
    4039VrpnObject::VrpnObject(string name, uint8_t id,
    41                        const TabWidget *tab)
    42     : IODevice(GetVrpnClient(), name) {
     40                       const TabWidget *tab,VrpnClient *client)
     41    : IODevice(client, name) {
    4342  Warn("Creation of object %s with id %i\n", name.c_str(), id);
    44   pimpl_ = new VrpnObject_impl(this, name, id, tab);
     43  pimpl_ = new VrpnObject_impl(this, name, id, tab,client);
    4544  AddDataToLog(pimpl_->output);
    4645 
  • trunk/lib/FlairSensorActuator/src/VrpnObject.h

    r214 r286  
    1616
    1717#include <IODevice.h>
     18#include <VrpnClient.h>
    1819#include <Vector3D.h>
    1920#include <stdint.h>
     
    3233
    3334class VrpnObject_impl;
    34 class VrpnClient_impl;
    3535
    3636namespace flair {
     
    4545class VrpnObject : public core::IODevice {
    4646  friend class ::VrpnObject_impl;
    47   friend class ::VrpnClient_impl;
    4847
    4948public:
     
    5554  * \param name VRPN object name, should be the same as defined in the server
    5655  * \param tab Tab for the user interface
     56  * \param client VrpnClient of the connection, if unspecified, use the default one
    5757  */
    5858  VrpnObject(std::string name,
    59              const gui::TabWidget *tab);
     59             const gui::TabWidget *tab,sensor::VrpnClient *client=GetVrpnClient());
    6060
    6161  /*!
    6262  * \brief Constructor
    6363  *
    64   * Construct a VrpnObject. Connection is done by IP.
     64  * Construct a VrpnObject. Connection is done by xbee.
    6565  *
    6666  * \param name name
    67   * \param id VRPN object id, should be the same as defined in the server
     67  * \param id VRPN object id, should be the same as defined in the xbee bridge
    6868  * \param tab Tab for the user interface
     69  * \param client VrpnClient of the connection, if unspecified, use the default one
    6970  */
    7071  VrpnObject(std::string name, uint8_t id,
    71              const gui::TabWidget *tab);
     72             const gui::TabWidget *tab,sensor::VrpnClient *client=GetVrpnClient());
    7273
    7374  /*!
  • trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp

    r275 r286  
    4040
    4141VrpnObject_impl::VrpnObject_impl(VrpnObject *self,
    42                                  string name, int id, const TabWidget *tab) {
    43   parent = GetVrpnClient();
     42                                 string name, int id, const TabWidget *tab,VrpnClient *client) {
     43  parent = client;
    4444  this->self = self;
    4545
  • trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h

    r223 r286  
    4747  VrpnObject_impl(flair::sensor::VrpnObject *self,
    4848                  std::string name,
    49                   int id, const flair::gui::TabWidget *tab);
     49                  int id, const flair::gui::TabWidget *tab,flair::sensor::VrpnClient *client);
    5050  ~VrpnObject_impl(void);
    5151
  • trunk/lib/FlairSimulator/src/Blade.cpp

    r15 r286  
    6464}
    6565
     66Blade::Blade(ISceneNode *parent, const vector3df &position, bool inverted, s32 id)
     67    : ISceneNode(parent, getGui()->getSceneManager(), id,
     68                 position) {
     69  ISceneManager *mgr = getGui()->getSceneManager();
     70
     71  const IGeometryCreator *geo;
     72  geo = mgr->getGeometryCreator();
     73  pale = geo->createCubeMesh(vector3df(63.5, 0.5, 5));
     74
     75  float angle;
     76  if (inverted == false) {
     77    angle = 20;
     78  } else {
     79    angle = -20;
     80  }
     81
     82  ITexture *texture = getGui()->getTexture("carbone.jpg");
     83  pale_1 = new MeshSceneNode(parent, pale, vector3df(-30, 0, 0),
     84                             vector3df(-angle + 90, 0, 0), texture);
     85  pale_1->setParent(this);
     86  pale_2 = new MeshSceneNode(parent, pale, vector3df(30, 0, 0),
     87                             vector3df(angle + 90, 0, 0), texture);
     88  pale_2->setParent(this);
     89
     90  anim = mgr->createRotationAnimator(vector3df(0.f, 0.f, 0.f));
     91  addAnimator(anim);
     92}
     93
    6694void Blade::OnRegisterSceneNode() {
    6795  if (IsVisible)
  • trunk/lib/FlairSimulator/src/Blade.h

    r15 r286  
    3636        const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0),
    3737        bool inverted = false, irr::s32 id = -1);
     38
     39  Blade(irr::scene::ISceneNode *parent,
     40        const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0),
     41        bool inverted = false, irr::s32 id = -1);
     42 
    3843  virtual void OnRegisterSceneNode(void);
    3944  virtual void render(void);
  • trunk/lib/FlairSimulator/src/FixedCamera.cpp

    r167 r286  
    2727#include <Euler.h>
    2828
     29
    2930using namespace irr;
    3031using namespace gui;
     
    5152void FixedCamera::animateNode(ISceneNode *node, u32 timeMs) {
    5253  ICameraSceneNode *camera = static_cast<ICameraSceneNode *>(node);
    53 
     54 
    5455  if (LMouseKey == true) {
    5556    if (!Rotating) {
  • trunk/lib/FlairSimulator/src/FollowMeCamera.cpp

    r70 r286  
    6363
    6464void FollowMeCamera::animateNode(ISceneNode *node, u32 timeMs) {
    65 
    6665  float nRotY = RotY;
    6766  float nRotZ = RotZ;
  • trunk/lib/FlairSimulator/src/GenericObject.cpp

    r158 r286  
    4040{
    4141        meshSceneNode=getGui()->getSceneManager()->addMeshSceneNode(mesh);
    42        
     42        /*
    4343  selector = getGui()->getSceneManager()->createTriangleSelector(mesh, meshSceneNode);
    4444  meshSceneNode->setTriangleSelector(selector);
    45        
     45        */
    4646  meshSceneNode->setMaterialFlag(EMF_LIGHTING, false);
    4747
     
    5353ITriangleSelector *GenericObject::TriangleSelector(void) { return selector; }
    5454
     55void GenericObject::setVisible(bool isVisible) {
     56  meshSceneNode->setVisible(isVisible);
     57}
    5558void GenericObject::setScale(float value) {
    5659  meshSceneNode->setScale(vector3df(value, value, value));
  • trunk/lib/FlairSimulator/src/Gui_impl.cpp

    r166 r286  
    9494  device->setResizable(false);
    9595
    96   // font = device->getGUIEnvironment()->getBuiltInFont();
    9796  driver = device->getVideoDriver();
    9897  smgr = device->getSceneManager();
     
    179178  int lastFPS = -1;
    180179  int cam_id = 0;
     180  ITexture* texture=0;
     181  IGUIFont* font =0;
     182 
     183  if (!driver->queryFeature(video::EVDF_RENDER_TO_TARGET)) {
     184    self->Warn("rendering to texture is not possible, axis will not be displayed\n");
     185  } else {
     186    texture= getGui()->getSceneManager()->getVideoDriver()->addRenderTargetTexture(dimension2d<u32>(128,128));
     187    device->getGUIEnvironment()->addImage(texture,position2d<s32>(0,scene_height-texture->getSize().Height));
     188    font = getGui()->getDevice()->getGUIEnvironment()->getFont((media_path+"/font/simu_axis_font.xml").c_str());
     189  }
    181190
    182191  receiver->SetModel(models.at(0));
     
    242251    driver->setViewPort(core::rect<s32>(0, 0, scene_width, scene_height));
    243252    smgr->drawAll(); // commente voir plus bas
    244                      /*
    245                  env->drawAll();
    246                  if (font)
    247                  {
    248                                      font->draw(L"This demo shows that Irrlicht is also capable
    249                  of drawing 2D graphics.",
    250                                              core::rect<s32>(130,10,300,50),
    251                                              video::SColor(255,255,255,255));
    252                  }
    253                  else
    254                  {
    255                  printf("err\n");
    256                  }
    257                  device->setWindowCaption(L"toto");*/
    258 
     253                   
    259254    if (dbtFile_r == NULL) {// mode normal
    260255      for (size_t i = 0; i < models.size(); i++) {
     
    263258    }
    264259
     260    //render to texture for axis if possible
     261    if (texture) {
     262      cameras.at(cam_id)->renderAxisToTexture(texture);
     263    }
     264   
     265    //process update for sensors (cam, us...)
     266    //also draws embedded cameras (see SimuCameraGL::UpdateFrom)
    265267    for (size_t i = 0; i < models.size(); i++) {
    266268      models.at(i)->ProcessUpdate(NULL);
    267269    }
    268 
     270   
    269271    // on fait ca ici, devrait etre un peu plus haut
    270272    // mais a priori souci avec models.at(i)->pimpl_->CheckCollision();
     
    274276    driver->setViewPort(core::rect<s32>(0, 0, scene_width, scene_height));
    275277    smgr->drawAll();
    276 
     278   
     279    driver->setViewPort(core::rect<s32>(0, 0, smgr->getVideoDriver()->getScreenSize().Width, smgr->getVideoDriver()->getScreenSize().Height));
     280    if(font) {
     281      font->draw(L"VRPN:",rect<s32>(10,scene_height-30,100,50),SColor(128,255,255,255));
     282      font->draw(L"X",rect<s32>(60,scene_height-30,100,50),SColor(255,255,0,0));
     283      font->draw(L"Y",rect<s32>(70,scene_height-30,100,50),SColor(255,0,255,0));
     284      font->draw(L"Z",rect<s32>(80,scene_height-30,100,50),SColor(255,0,0,255));
     285     
     286    }
     287    device->getGUIEnvironment()->drawAll();
    277288    driver->endScene();
    278 
     289   
    279290    int fps = driver->getFPS();
    280291
  • trunk/lib/FlairSimulator/src/MeshSceneNode.cpp

    r15 r286  
    4949}
    5050
     51MeshSceneNode::MeshSceneNode(ISceneNode *parent, IMesh *mesh,
     52                             const vector3df &position,
     53                             const vector3df &rotation, ITexture *texture,
     54                             s32 id)
     55    : IMeshSceneNode(parent, getGui()->getSceneManager(), id,
     56                     position, rotation) {
     57  Material.Wireframe = false;
     58  Material.Lighting = false;
     59
     60  setMesh(mesh);
     61
     62  if (texture != NULL) {
     63    setMaterialTexture(0, texture);
     64  }
     65
     66  //parent->getBoundingBox().addInternalBox(getTransformedBoundingBox());
     67}
     68
    5169void MeshSceneNode::OnRegisterSceneNode(void) {
    5270  if (IsVisible)
  • trunk/lib/FlairSimulator/src/MeshSceneNode.h

    r15 r286  
    3131      const irr::core::vector3df &rotation = irr::core::vector3df(0, 0, 0),
    3232      irr::video::ITexture *texture = NULL, irr::s32 id = -1);
     33 
     34  MeshSceneNode(
     35      irr::scene::ISceneNode *parent, irr::scene::IMesh *mesh,
     36      const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0),
     37      const irr::core::vector3df &rotation = irr::core::vector3df(0, 0, 0),
     38      irr::video::ITexture *texture = NULL, irr::s32 id = -1);
    3339
    3440  virtual void OnRegisterSceneNode(void);
  • trunk/lib/FlairSimulator/src/SimuBldc.cpp

    r224 r286  
    7373}
    7474
    75 } // end namespace sensor
     75} // end namespace actuator
    7676} // end namespace flair
  • trunk/lib/FlairSimulator/src/Simulator.cpp

    r167 r286  
    3636Simulator *getSimulator(void) { return simu; }
    3737
    38 Simulator::Simulator(string name, int optitrack_mstime, float yaw_deg)
     38Simulator::Simulator(string name, int optitrack_mstime, float yaw_deg, int port)
    3939    : FrameworkManager(name) {
    4040  if (simu != NULL)
    4141    Err("Simulator should be instanced only one time\n");
    4242
    43   pimpl_ = new Simulator_impl(this, optitrack_mstime, yaw_deg);
     43  pimpl_ = new Simulator_impl(this, optitrack_mstime, yaw_deg,port);
    4444  simu = this;
    4545}
  • trunk/lib/FlairSimulator/src/Simulator.h

    r167 r286  
    4444  // yaw_deg: rotation of the vrpn coordinate with respect to the earth
    4545  // coordinate, around z axis
    46   Simulator(std::string name, int optitrack_mstime = 10, float yaw_deg = 30);
     46  Simulator(std::string name, int optitrack_mstime = 10, float yaw_deg = 30, int port=3883);
    4747  ~Simulator();
    4848  void RunSimu(void);
  • trunk/lib/FlairSimulator/src/Simulator_impl.cpp

    r218 r286  
    3131
    3232Simulator_impl::Simulator_impl(Simulator *self, int optitrack_mstime,
    33                                float yaw_deg)
    34     : vrpn_Connection_IP(), Thread(self, "simulator", 1) {
     33                               float yaw_deg,int port)
     34    : vrpn_Connection_IP(port), Thread(self, "simulator", 1) {
    3535  this->self = self;
    3636  this->optitrack_mstime = optitrack_mstime;
  • trunk/lib/FlairSimulator/src/VisualizationCamera.cpp

    r70 r286  
    3131using namespace core;
    3232using namespace scene;
     33using namespace video;
    3334
    3435namespace flair {
     
    4041  LMouseKey = false;
    4142
    42    // camera
     43  // camera for visualization
    4344  camera = getGui()->getSceneManager()->addCameraSceneNode();
    4445  camera->setAspectRatio(getGui()->getAspectRatio()); // on force a cause du view port
     
    4849
    4950  getGui()->pimpl_->AddVisualizationCamera(this);
     51 
     52  // camera to draw axis, in a new dedicated scene manager
     53  axis_scenemanager=getGui()->getSceneManager()->createNewSceneManager();
     54  axis_camera = axis_scenemanager->addCameraSceneNode();
     55  axis_camera->setAspectRatio(1);  // same as texture ratio, TODO: get it from texture in renderAxisToTexture
     56  axis_camera->setUpVector(vector3df(0, 0, 1));
     57  axis_camera->setFOV(PI / 2.5f);
     58  axis_scenemanager->setActiveCamera(axis_camera);
     59  prendre en compte le yaw monde/optitrack (rotation de axis_scenemanager?)
     60  IAnimatedMesh* arrowMeshRed = axis_scenemanager->addArrowMesh( "x_axisArrow",video::SColor(255, 255, 0, 0),video::SColor(255, 255, 0, 0));
     61  nodeX = axis_scenemanager->addMeshSceneNode(arrowMeshRed);
     62  nodeX->setMaterialFlag(video::EMF_LIGHTING, false);
     63  nodeX->setRotation(vector3df(0,0,-90));
     64  nodeX->setScale(vector3df(1,3,1));
     65 
     66  IAnimatedMesh* arrowMeshGreen = axis_scenemanager->addArrowMesh( "y_axisArrow",video::SColor(255, 0, 255, 0),video::SColor(255, 0, 255, 0));
     67  nodeY = axis_scenemanager->addMeshSceneNode(arrowMeshGreen);
     68  nodeY->setMaterialFlag(video::EMF_LIGHTING, false);
     69  nodeY->setScale(vector3df(1,3,1));
     70 
     71  IAnimatedMesh* arrowMeshBlue = axis_scenemanager->addArrowMesh( "z_axisArrow",video::SColor(255, 0, 0, 255),video::SColor(255, 0, 0, 255));
     72  nodeZ = axis_scenemanager->addMeshSceneNode(arrowMeshBlue);
     73  nodeZ->setMaterialFlag(video::EMF_LIGHTING, false);
     74  nodeZ->setRotation(vector3df(-90,0,0));//irrlicht is left handed, draw a right handed axis
     75  nodeZ->setScale(vector3df(1,3,1));
    5076}
    5177
    5278VisualizationCamera::~VisualizationCamera() {}
     79
     80void VisualizationCamera::renderAxisToTexture(ITexture* texture) {
     81  //put axis at a "normalized" distance
     82  vector3df direction=camera->getTarget()-camera->getPosition();
     83  direction.normalize();
     84  nodeX->setPosition(camera->getPosition()+direction*6);
     85  nodeY->setPosition(camera->getPosition()+direction*6);
     86  nodeZ->setPosition(camera->getPosition()+direction*6);
     87
     88  axis_camera->setPosition(camera->getPosition());
     89  axis_camera->setRotation(camera->getRotation());
     90  axis_camera->setTarget(camera->getTarget());
     91 
     92  axis_scenemanager->getVideoDriver()->setRenderTarget(texture, true, true, SColor(0,0,0,0));
     93  axis_scenemanager->drawAll();
     94  axis_scenemanager->getVideoDriver()->setRenderTarget(0, true, true, 0);
     95}
    5396
    5497std::string VisualizationCamera::getName(void) {
  • trunk/lib/FlairSimulator/src/VisualizationCamera.h

    r70 r286  
    2727    class ICameraSceneNode;
    2828  }
     29  namespace video {
     30    class ITexture;
     31  }
    2932}
    3033
     
    4245  irr::scene::ICameraSceneNode *getCameraSceneNode(void);
    4346  std::string getName(void);
     47  void renderAxisToTexture(irr::video::ITexture* texture);
    4448
    4549private:
    4650  virtual bool isEventReceiverEnabled(void) const { return true; }
    47 
     51  irr::scene::ISceneNode *nodeX,*nodeY,*nodeZ;
     52  irr::scene::ISceneManager *axis_scenemanager;
     53 
    4854protected:
    4955  bool LMouseKey;
    5056  irr::scene::ICameraSceneNode *camera;
     57  irr::scene::ICameraSceneNode *axis_camera;
    5158  irr::core::position2df MousePos;
    5259  float currentZoom;
  • trunk/lib/FlairSimulator/src/X4.h

    r214 r286  
    4343#ifdef GL
    4444  virtual void Draw(void);
    45   virtual void ExtraDraw(void){};
     45  virtual void ExtraDraw(void){};
     46#endif
    4647
    47 protected:
    48   Blade *fl_blade, *fr_blade, *rl_blade, *rr_blade;
    49   core::Mutex *motor_speed_mutex;
    50 #endif
    5148private:
    5249  void CalcModel(void);
     
    5653  void WritedbtBuf(char *dbtbuf);
    5754  void ReaddbtBuf(char *dbtbuf);
     55  Blade *fl_blade, *fr_blade, *rl_blade, *rr_blade;
     56  core::Mutex *motor_speed_mutex;
    5857#endif
    5958
  • trunk/lib/FlairSimulator/src/X8.h

    r214 r286  
    4545
    4646protected:
    47 #ifdef GL
    48   Blade *tfl_blade, *tfr_blade, *trl_blade, *trr_blade;
    49   Blade *bfl_blade, *bfr_blade, *brl_blade, *brr_blade;
    50 #endif
     47
    5148private:
    5249  void CalcModel(void);
     
    5754  void ReaddbtBuf(char *dbtbuf);
    5855  core::Mutex *motor_speed_mutex;
     56  Blade *tfl_blade, *tfr_blade, *trl_blade, *trr_blade;
     57  Blade *bfl_blade, *bfr_blade, *brl_blade, *brr_blade;
    5958#endif
    6059
  • trunk/lib/FlairSimulator/src/unexported/GenericObject.h

    r158 r286  
    4747        void setPosition(const irr::core::vector3df& position);
    4848  void setRotation(const irr::core::vector3df& rotation);
     49  void setVisible(bool isVisible);//visible by default at construction
    4950 
    5051private:
  • trunk/lib/FlairSimulator/src/unexported/Model_impl.h

    r218 r286  
    7272  void OnRegisterSceneNode(void);
    7373  void render(void);
    74   void Draw(void) {
    75     printf("CA MARCHE PAS PUNAISE\r\n");
    76     ExtraDraw();
    77   };
    78   void ExtraDraw(void) { printf("nope\r\n"); };
    7974
    8075  const irr::core::aabbox3d<irr::f32> &getBoundingBox(void) const {
  • trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h

    r158 r286  
    3737public:
    3838  Simulator_impl(flair::simulator::Simulator *self, int optitrack_mstime = 10,
    39                  float yaw_deg = 30);
     39                 float yaw_deg = 30, int port=3883);
    4040  ~Simulator_impl();
    4141
Note: See TracChangeset for help on using the changeset viewer.