Changeset 160 in flair-src for trunk/lib/FlairMeta/src/SimuX4.cpp
- Timestamp:
- Mar 5, 2017, 12:21:41 PM (8 years ago)
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.