Changeset 286 in flair-src for trunk/lib/FlairMeta/src
- Timestamp:
- Jan 8, 2019, 10:13:03 AM (6 years ago)
- Location:
- trunk/lib/FlairMeta/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairMeta/src/MetaVrpnObject.cpp
r214 r286 18 18 19 19 #include "MetaVrpnObject.h" 20 #include "VrpnClient.h"21 20 #include <EulerDerivative.h> 22 21 #include <LowPassFilter.h> … … 38 37 namespace meta { 39 38 40 MetaVrpnObject::MetaVrpnObject(string name )41 : VrpnObject( name, GetVrpnClient()->GetTabWidget()) {42 ConstructorCommon(name );39 MetaVrpnObject::MetaVrpnObject(string name,VrpnClient *client) 40 : VrpnObject( name, client->GetTabWidget(),client) { 41 ConstructorCommon(name,client); 43 42 } 44 43 45 MetaVrpnObject::MetaVrpnObject(std::string name, 46 uint8_t id) 47 : VrpnObject(name, id, GetVrpnClient()->GetTabWidget()) { 48 ConstructorCommon( name); 44 MetaVrpnObject::MetaVrpnObject(std::string name,uint8_t id,VrpnClient *client) 45 : VrpnObject(name, id, client->GetTabWidget(),client) { 46 ConstructorCommon( name,client); 49 47 } 50 48 51 void MetaVrpnObject::ConstructorCommon(string name ) {49 void MetaVrpnObject::ConstructorCommon(string name,VrpnClient *client) { 52 50 cvmatrix_descriptor *desc = new cvmatrix_descriptor(7, 1); 53 51 for (int i = 0; i < desc->Rows(); i++) { … … 57 55 delete desc; 58 56 59 pbas = new LowPassFilter(this, GetVrpnClient()->GetLayout()->NewRow(),57 pbas = new LowPassFilter(this, client->GetLayout()->NewRow(), 60 58 name + " Passe bas", prev_value); 61 59 delete prev_value; … … 68 66 delete desc; 69 67 70 euler = new EulerDerivative(pbas, GetVrpnClient()->GetLayout()->NewRow(),68 euler = new EulerDerivative(pbas, client->GetLayout()->NewRow(), 71 69 name + "_euler", prev_value); 72 70 delete prev_value; … … 79 77 vz_opti_plot->AddCurve(euler->GetMatrix()->Element(6)); 80 78 81 plot_tab = new Tab( GetVrpnClient()->GetTabWidget(), "Mesures (xy) " + name);79 plot_tab = new Tab(client->GetTabWidget(), "Mesures (xy) " + name); 82 80 xy_plot = new DataPlot2D(plot_tab->NewRow(), "xy", "y", -5, 5, "x", -5, 5); 83 81 xy_plot->AddCurve(Output()->Element(5, 0), Output()->Element(4, 0)); -
trunk/lib/FlairMeta/src/MetaVrpnObject.h
r167 r286 15 15 16 16 #include <VrpnObject.h> 17 #include <VrpnClient.h> 17 18 #include <io_data.h> 18 19 #include <Vector3D.h> … … 41 42 class MetaVrpnObject : public sensor::VrpnObject { 42 43 public: 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()); 45 46 ~MetaVrpnObject(); 46 47 gui::DataPlot1D *VxPlot(void) const; // 1,0 … … 51 52 52 53 private: 53 void ConstructorCommon(std::string name );54 void ConstructorCommon(std::string name,sensor::VrpnClient *client); 54 55 filter::LowPassFilter *pbas; 55 56 filter::EulerDerivative *euler; -
trunk/lib/FlairMeta/src/SimuX4.cpp
r268 r286 20 20 #include <FrameworkManager.h> 21 21 #include <X4X8Multiplex.h> 22 #include <Simu Imu.h>23 #include <Simu Ahrs.h>24 #include <Simu Bldc.h>25 #include <Simu Us.h>26 #include <Simu Camera.h>27 #include <Simu PressureSensor.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> 28 28 #include <BatteryMonitor.h> 29 #include <Simu Gps.h>29 #include <SimulatedGps.h> 30 30 #include <Tab.h> 31 31 #include <FindArgument.h> … … 48 48 SetMultiplex(new X4X8Multiplex("motors", X4X8Multiplex::X4)); 49 49 50 SetBldc(new Simu Bldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),50 SetBldc(new SimulatedBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(), 51 51 "motors", GetUavMultiplex()->MotorsCount(), simu_id,0)); 52 SetUsRangeFinder(new Simu Us("us", simu_id,0, 60));53 SetAhrs(new Simu Ahrs("ahrs", simu_id, 0,70));52 SetUsRangeFinder(new SimulatedUs("us", simu_id,0, 60)); 53 SetAhrs(new SimulatedAhrs("ahrs", simu_id, 0,70)); 54 54 Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery"); 55 55 SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery")); … … 59 59 ReadCameraResolutionOption(options,"camv",camvWidth,camvHeight); 60 60 Info("using vertical camera resolution: %ix%i\n",camvWidth, camvHeight); 61 SetVerticalCamera(new Simu Camera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));61 SetVerticalCamera(new SimulatedCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10)); 62 62 63 63 uint16_t camhWidth=320,camhHeight=240; 64 64 ReadCameraResolutionOption(options,"camh",camhWidth,camhHeight); 65 65 Info("using horizontal camera resolution: %ix%i\n",camhWidth, camhHeight); 66 SetHorizontalCamera(new Simu Camera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));66 SetHorizontalCamera(new SimulatedCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10)); 67 67 68 68 string useGps=FindArgument(options,"use_gps=",false); 69 69 if(useGps=="true") { 70 SetGps(new Simu Gps("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)); 71 71 } 72 72 73 73 string usePressureSensor=FindArgument(options,"use_pressure_sensor=",false); 74 74 if(usePressureSensor=="true") { 75 SetPressureSensor(new Simu PressureSensor("pressuresensor", 0,0, 10));75 SetPressureSensor(new SimulatedPressureSensor("pressuresensor", 0,0, 10)); 76 76 } 77 77 } … … 80 80 81 81 void SimuX4::StartSensors(void) { 82 ((Simu Imu *)(GetAhrs()->GetImu()))->Start();83 ((Simu Us *)GetUsRangeFinder())->Start();84 ((Simu Camera *)GetVerticalCamera())->Start();85 ((Simu Camera *)GetHorizontalCamera())->Start();86 if(GetGps()) ((Simu Gps *)GetGps())->Start();87 if(GetPressureSensor()) ((Simu PressureSensor *)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(); 88 88 } 89 89 -
trunk/lib/FlairMeta/src/SimuX8.cpp
r268 r286 20 20 #include <FrameworkManager.h> 21 21 #include <X4X8Multiplex.h> 22 #include <Simu Imu.h>23 #include <Simu Ahrs.h>24 #include <Simu Bldc.h>25 #include <Simu Us.h>26 #include <Simu Camera.h>27 #include <Simu PressureSensor.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> 28 28 #include <BatteryMonitor.h> 29 #include <Simu Gps.h>29 #include <SimulatedGps.h> 30 30 #include <Tab.h> 31 31 #include <FindArgument.h> … … 48 48 SetMultiplex(new X4X8Multiplex("motors", X4X8Multiplex::X8)); 49 49 50 SetBldc(new Simu Bldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),50 SetBldc(new SimulatedBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(), 51 51 "motors", GetUavMultiplex()->MotorsCount(), simu_id,0)); 52 SetUsRangeFinder(new Simu Us("us", simu_id,0, 60));53 SetAhrs(new Simu Ahrs("ahrs", simu_id, 0,70));52 SetUsRangeFinder(new SimulatedUs("us", simu_id,0, 60)); 53 SetAhrs(new SimulatedAhrs("ahrs", simu_id, 0,70)); 54 54 Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery"); 55 55 SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery")); … … 59 59 ReadCameraResolutionOption(options,"camv",camvWidth,camvHeight); 60 60 Info("using vertical camera resolution: %ix%i\n",camvWidth, camvHeight); 61 SetVerticalCamera(new Simu Camera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));61 SetVerticalCamera(new SimulatedCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10)); 62 62 63 63 uint16_t camhWidth=320,camhHeight=240; 64 64 ReadCameraResolutionOption(options,"camh",camhWidth,camhHeight); 65 65 Info("using horizontal camera resolution: %ix%i\n",camhWidth, camhHeight); 66 SetHorizontalCamera(new Simu Camera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));66 SetHorizontalCamera(new SimulatedCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10)); 67 67 68 68 string useGps=FindArgument(options,"use_gps=",false); 69 69 if(useGps=="true") { 70 SetGps(new Simu Gps("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)); 71 71 } 72 72 73 73 string usePressureSensor=FindArgument(options,"use_pressure_sensor=",false); 74 74 if(usePressureSensor=="true") { 75 SetPressureSensor(new Simu PressureSensor("pressuresensor", 0,0, 10));75 SetPressureSensor(new SimulatedPressureSensor("pressuresensor", 0,0, 10)); 76 76 } 77 77 } … … 80 80 81 81 void SimuX8::StartSensors(void) { 82 ((Simu Imu *)(GetAhrs()->GetImu()))->Start();83 ((Simu Us *)GetUsRangeFinder())->Start();84 ((Simu Camera *)GetVerticalCamera())->Start();85 ((Simu Camera *)GetHorizontalCamera())->Start();86 if(GetGps()) ((Simu Gps *)GetGps())->Start();87 if(GetPressureSensor()) ((Simu PressureSensor *)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(); 88 88 } 89 89
Note:
See TracChangeset
for help on using the changeset viewer.