Changeset 121 in flair-src
- Timestamp:
- Dec 22, 2016, 5:32:58 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ReleaseNotes
r107 r121 1 1 * Actual Version: 2 3 - added fixed cameras in simulator, see $FLAIR_ROOT/flair-bin/models/indoor_fligh 4 t_arena.xml for an exemple 2 5 3 6 ----------------------------------------------------------- -
trunk/demos/CircleFollower/uav/src/CircleFollower.cpp
r38 r121 30 30 #include <Ahrs.h> 31 31 #include <AhrsData.h> 32 #include <Camera.h> 32 33 33 34 using namespace std; … … 69 70 70 71 customOrientation=new AhrsData(this,"orientation"); 72 getFrameworkManager()->AddDeviceToLog(uav->GetVerticalCamera()); 71 73 } 72 74 -
trunk/lib/FlairCore/src/IODevice.cpp
r38 r121 29 29 IODevice::IODevice(const Object* parent,string name): Object(parent,name,"IODevice") { 30 30 pimpl_=new IODevice_impl(this); 31 lastUpdate=GetTime();32 31 } 33 32 … … 49 48 50 49 if(data!=NULL) { 51 lastUpdate=data->DataTime();52 50 if(getFrameworkManager()->IsLogging()==true) pimpl_->WriteLog(data->DataTime()); 53 51 -
trunk/lib/FlairCore/src/IODevice.h
r58 r121 115 115 virtual DataType const &GetOutputDataType() const; 116 116 117 Time lastUpdate;118 117 protected: 119 118 /*! -
trunk/lib/FlairMeta/src/Uav.cpp
r15 r121 46 46 uav_vrpn = NULL; 47 47 verticalCamera = NULL; 48 horizontalCamera = NULL; 48 49 this->multiplex = multiplex; 49 50 } … … 76 77 void Uav::SetVerticalCamera(const Camera *inVerticalCamera) { 77 78 verticalCamera = (Camera *)inVerticalCamera; 79 } 80 81 void Uav::SetHorizontalCamera(const Camera *inHorizontalCamera) { 82 horizontalCamera = (Camera *)inHorizontalCamera; 78 83 } 79 84 /* … … 189 194 Camera *Uav::GetVerticalCamera(void) const { return verticalCamera; } 190 195 196 Camera *Uav::GetHorizontalCamera(void) const { return horizontalCamera; } 197 191 198 } // end namespace meta 192 199 } // end namespace flair -
trunk/lib/FlairMeta/src/Uav.h
r15 r121 78 78 meta::MetaVrpnObject *GetVrpnObject(void) const; 79 79 sensor::Camera *GetVerticalCamera(void) const; 80 sensor::Camera *GetHorizontalCamera(void) const; 80 81 81 82 protected: … … 86 87 void SetBatteryMonitor(const sensor::BatteryMonitor *battery); 87 88 void SetVerticalCamera(const sensor::Camera *verticalCamera); 89 void SetHorizontalCamera(const sensor::Camera *verticalCamera); 88 90 89 91 private: … … 97 99 MetaVrpnObject *uav_vrpn; 98 100 sensor::BatteryMonitor *battery; 99 sensor::Camera *verticalCamera ;101 sensor::Camera *verticalCamera,*horizontalCamera; 100 102 }; 101 103 } // end namespace meta -
trunk/lib/FlairSensorActuator/src/Camera.cpp
r15 r121 24 24 #include <DataPlot1D.h> 25 25 #include <Picture.h> 26 #include <Buffer.h> 26 27 #include <highgui.h> 27 28 #include <fstream> … … 38 39 : IODevice(parent, name) { 39 40 plot_tab = NULL; 41 jpgBuffer=NULL; 42 logFormat=LogFormat::NONE; 40 43 41 44 // do not allocate imagedata, allocation is done by the camera 42 45 output = new cvimage((IODevice *)this, width, height, format, "out", false); 43 46 44 47 // station sol 45 48 main_tab = new Tab(parent->GetTabWidget(), name); … … 50 53 } 51 54 55 //This contructor must only be called for a simulated device. 52 56 Camera::Camera(const IODevice *parent, std::string name) 53 57 : IODevice(parent, name) { … … 59 63 60 64 output = NULL; 65 jpgBuffer=NULL; 66 logFormat=LogFormat::NONE; 61 67 } 62 68 … … 64 70 if (main_tab != NULL) 65 71 delete main_tab; 72 } 73 74 void Camera::SetLogFormat(LogFormat logFormat) { 75 this->logFormat=logFormat; 76 switch(logFormat) { 77 case LogFormat::RAW: 78 AddDataToLog(output); 79 Warn("raw log of cvimage is not yet implemented\n"); 80 break; 81 case LogFormat::JPG: 82 if(jpgBuffer==NULL) { 83 jpgBuffer=new Buffer(this,"jpg_bufer"); 84 AddDataToLog(jpgBuffer); 85 }else{ 86 Warn("log format already defined\n"); 87 } 88 break; 89 } 66 90 } 67 91 … … 94 118 core::cvimage *Camera::Output(void) { return output; } 95 119 120 void Camera::ProcessUpdate(core::io_data* data) { 121 switch(logFormat) { 122 case LogFormat::JPG: 123 ajouter compression jpg 124 break; 125 } 126 IODevice::ProcessUpdate(data); 127 } 128 96 129 void Camera::SaveToFile(string filename) const { 97 130 Printf("saving %s, size %i\n", filename.c_str(), output->img->imageSize); -
trunk/lib/FlairSensorActuator/src/Camera.h
r15 r121 19 19 20 20 namespace flair { 21 namespace gui { 22 class GroupBox; 23 class Tab; 24 class TabWidget; 25 class Picture; 26 class GridLayout; 27 } 21 namespace gui { 22 class GroupBox; 23 class Tab; 24 class TabWidget; 25 class Picture; 26 class GridLayout; 27 } 28 namespace core { 29 class Buffer; 30 } 28 31 } 29 32 … … 122 125 123 126 core::DataType const &GetOutputDataType() const; 124 127 128 /*! 129 \enum LogFormat 130 \brief log formats 131 */ 132 enum class LogFormat { 133 NONE, /*!< by default, no logging */ 134 RAW, /*!< raw format */ 135 JPG, /*!< jpg format */ 136 }; 137 138 /*! 139 * \brief Set log format 140 * 141 * Set the log format. \n 142 * Logging of the camera will be disabled if this method is not called. \n 143 * Calling this method enables logging of camera. 144 * 145 * \param LogFormat log format 146 */ 147 void SetLogFormat(LogFormat logFormat); 148 void ProcessUpdate(core::io_data* data); 125 149 protected: 126 150 /*! … … 138 162 gui::GroupBox *setup_groupbox; 139 163 gui::GridLayout *setup_layout; 164 LogFormat logFormat; 165 core::Buffer *jpgBuffer; 140 166 }; 141 167 } // end namespace sensor
Note:
See TracChangeset
for help on using the changeset viewer.