Changeset 286 in flair-src for trunk/lib/FlairMeta


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

draw vrpn axis in simulator

Location:
trunk/lib/FlairMeta/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.