Changeset 160 in flair-src for trunk/lib/FlairMeta/src
- Timestamp:
- Mar 5, 2017, 12:21:41 PM (8 years ago)
- Location:
- trunk/lib/FlairMeta/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairMeta/src/SimuX4.cpp
r158 r160 53 53 GetBatteryMonitor()->SetBatteryValue(12); 54 54 55 string camvOpts=FindArgument(options,"camv=",false);56 55 uint16_t camvWidth=320,camvHeight=240; 57 if(camvOpts=="") {58 Info("using defaultvertical camera resolution: %ix%i\n",camvWidth, camvHeight);59 } 56 ReadCameraResolutionOption(options,"camv",camvWidth,camvHeight); 57 Info("using vertical camera resolution: %ix%i\n",camvWidth, camvHeight); 58 SetVerticalCamera(new SimuCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10)); 60 59 61 SetVerticalCamera(new SimuCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10)); 62 //SetHorizontalCamera(new SimuCamera("simu_cam_h", 320, 240, 3, simu_id,1, 10)); 60 uint16_t camhWidth=320,camhHeight=240; 61 ReadCameraResolutionOption(options,"camh",camhWidth,camhHeight); 62 Info("using horizontal camera resolution: %ix%i\n",camhWidth, camhHeight); 63 SetHorizontalCamera(new SimuCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10)); 63 64 } 64 65 … … 69 70 ((SimuUs *)GetUsRangeFinder())->Start(); 70 71 ((SimuCamera *)GetVerticalCamera())->Start(); 72 ((SimuCamera *)GetHorizontalCamera())->Start(); 71 73 } 72 74 75 void SimuX4::ReadCameraResolutionOption(string options,string cameraName,uint16_t &camWidth,uint16_t &camHeight) const { 76 string camOpts=FindArgument(options,cameraName +"=",false); 77 if(camOpts!="") { 78 size_t position=camOpts.find("x"); 79 if(position!=std::string::npos) { 80 camWidth=std::stoi(camOpts.substr(0,position)); 81 camHeight=std::stoi(camOpts.substr(position+1,std::string::npos)); 82 } else { 83 Warn("bad camera resolution parameter (%s) should be WIDTHxHEIGHT format\n",camOpts.c_str()); 84 } 85 } 86 } 73 87 74 88 } // end namespace meta -
trunk/lib/FlairMeta/src/SimuX4.h
r158 r160 18 18 namespace flair { 19 19 namespace meta { 20 20 21 /*! \class SimuX4 21 22 * … … 23 24 */ 24 25 class SimuX4 : public Uav { 25 public: 26 // simu_id: 0 if simulating only one UAV 27 //>0 otherwise 28 SimuX4(std::string name, uint32_t simu_id = 0,std::string options="", 29 filter::UavMultiplex *multiplex = NULL); 30 ~SimuX4(); 31 void StartSensors(void); 26 public: 27 // simu_id: 0 if simulating only one UAV 28 //>0 otherwise 29 SimuX4(std::string name, uint32_t simu_id = 0,std::string options="", 30 filter::UavMultiplex *multiplex = NULL); 31 ~SimuX4(); 32 void StartSensors(void); 33 34 private: 35 void ReadCameraResolutionOption(std::string options,std::string cameraName,uint16_t &camWidth,uint16_t &camHeight) const; 36 32 37 }; 33 38 } // end namespace meta -
trunk/lib/FlairMeta/src/SimuX8.cpp
r158 r160 26 26 #include <BatteryMonitor.h> 27 27 #include <Tab.h> 28 #include <FindArgument.h> 28 29 29 30 using std::string; … … 51 52 SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery")); 52 53 GetBatteryMonitor()->SetBatteryValue(12); 53 SetVerticalCamera(new SimuCamera("simu_cam_v", 320, 240, 3, simu_id,0, 10)); 54 //SetHorizontalCamera(new SimuCamera("simu_cam_h", 320, 240, 3, simu_id,1, 10)); 54 55 uint16_t camvWidth=320,camvHeight=240; 56 ReadCameraResolutionOption(options,"camv",camvWidth,camvHeight); 57 Info("using vertical camera resolution: %ix%i\n",camvWidth, camvHeight); 58 SetVerticalCamera(new SimuCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10)); 59 60 uint16_t camhWidth=320,camhHeight=240; 61 ReadCameraResolutionOption(options,"camh",camhWidth,camhHeight); 62 Info("using horizontal camera resolution: %ix%i\n",camhWidth, camhHeight); 63 SetHorizontalCamera(new SimuCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10)); 55 64 } 56 65 … … 61 70 ((SimuUs *)GetUsRangeFinder())->Start(); 62 71 ((SimuCamera *)GetVerticalCamera())->Start(); 72 ((SimuCamera *)GetHorizontalCamera())->Start(); 73 } 74 75 void SimuX8::ReadCameraResolutionOption(string options,string cameraName,uint16_t &camWidth,uint16_t &camHeight) const { 76 string camOpts=FindArgument(options,cameraName +"=",false); 77 if(camOpts!="") { 78 size_t position=camOpts.find("x"); 79 if(position!=std::string::npos) { 80 camWidth=std::stoi(camOpts.substr(0,position)); 81 camHeight=std::stoi(camOpts.substr(position+1,std::string::npos)); 82 } else { 83 Warn("bad camera resolution parameter (%s) should be WIDTHxHEIGHT format\n",camOpts.c_str()); 84 } 85 } 63 86 } 64 87 -
trunk/lib/FlairMeta/src/SimuX8.h
r158 r160 23 23 */ 24 24 class SimuX8 : public Uav { 25 public: 26 // simu_id: 0 if simulating only one UAV 27 //>0 otherwise 28 SimuX8(std::string name, uint32_t simu_id = 0,std::string options="", 29 filter::UavMultiplex *multiplex = NULL); 30 ~SimuX8(); 31 void StartSensors(void); 25 public: 26 // simu_id: 0 if simulating only one UAV 27 //>0 otherwise 28 SimuX8(std::string name, uint32_t simu_id = 0,std::string options="", 29 filter::UavMultiplex *multiplex = NULL); 30 ~SimuX8(); 31 void StartSensors(void); 32 33 private: 34 void ReadCameraResolutionOption(std::string options,std::string cameraName,uint16_t &camWidth,uint16_t &camHeight) const; 35 32 36 }; 33 37 } // end namespace meta
Note:
See TracChangeset
for help on using the changeset viewer.