Changeset 121 in flair-src


Ignore:
Timestamp:
Dec 22, 2016, 5:32:58 PM (8 years ago)
Author:
Sanahuja Guillaume
Message:

modifs camera

Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/ReleaseNotes

    r107 r121  
    11* Actual Version:
     2
     3- added fixed cameras in simulator, see $FLAIR_ROOT/flair-bin/models/indoor_fligh
     4t_arena.xml for an exemple
    25
    36-----------------------------------------------------------
  • trunk/demos/CircleFollower/uav/src/CircleFollower.cpp

    r38 r121  
    3030#include <Ahrs.h>
    3131#include <AhrsData.h>
     32#include <Camera.h>
    3233
    3334using namespace std;
     
    6970
    7071    customOrientation=new AhrsData(this,"orientation");
     72                getFrameworkManager()->AddDeviceToLog(uav->GetVerticalCamera());
    7173}
    7274
  • trunk/lib/FlairCore/src/IODevice.cpp

    r38 r121  
    2929IODevice::IODevice(const Object* parent,string name): Object(parent,name,"IODevice") {
    3030    pimpl_=new IODevice_impl(this);
    31     lastUpdate=GetTime();
    3231}
    3332
     
    4948
    5049    if(data!=NULL) {
    51         lastUpdate=data->DataTime();
    5250        if(getFrameworkManager()->IsLogging()==true) pimpl_->WriteLog(data->DataTime());
    5351
  • trunk/lib/FlairCore/src/IODevice.h

    r58 r121  
    115115  virtual DataType const &GetOutputDataType() const;
    116116
    117             Time lastUpdate;
    118117        protected:
    119118            /*!
  • trunk/lib/FlairMeta/src/Uav.cpp

    r15 r121  
    4646  uav_vrpn = NULL;
    4747  verticalCamera = NULL;
     48  horizontalCamera = NULL;
    4849  this->multiplex = multiplex;
    4950}
     
    7677void Uav::SetVerticalCamera(const Camera *inVerticalCamera) {
    7778  verticalCamera = (Camera *)inVerticalCamera;
     79}
     80
     81void Uav::SetHorizontalCamera(const Camera *inHorizontalCamera) {
     82  horizontalCamera = (Camera *)inHorizontalCamera;
    7883}
    7984/*
     
    189194Camera *Uav::GetVerticalCamera(void) const { return verticalCamera; }
    190195
     196Camera *Uav::GetHorizontalCamera(void) const { return horizontalCamera; }
     197
    191198} // end namespace meta
    192199} // end namespace flair
  • trunk/lib/FlairMeta/src/Uav.h

    r15 r121  
    7878  meta::MetaVrpnObject *GetVrpnObject(void) const;
    7979  sensor::Camera *GetVerticalCamera(void) const;
     80  sensor::Camera *GetHorizontalCamera(void) const;
    8081
    8182protected:
     
    8687  void SetBatteryMonitor(const sensor::BatteryMonitor *battery);
    8788  void SetVerticalCamera(const sensor::Camera *verticalCamera);
     89  void SetHorizontalCamera(const sensor::Camera *verticalCamera);
    8890
    8991private:
     
    9799  MetaVrpnObject *uav_vrpn;
    98100  sensor::BatteryMonitor *battery;
    99   sensor::Camera *verticalCamera;
     101  sensor::Camera *verticalCamera,*horizontalCamera;
    100102};
    101103} // end namespace meta
  • trunk/lib/FlairSensorActuator/src/Camera.cpp

    r15 r121  
    2424#include <DataPlot1D.h>
    2525#include <Picture.h>
     26#include <Buffer.h>
    2627#include <highgui.h>
    2728#include <fstream>
     
    3839    : IODevice(parent, name) {
    3940  plot_tab = NULL;
     41        jpgBuffer=NULL;
     42        logFormat=LogFormat::NONE;
    4043
    4144  // do not allocate imagedata, allocation is done by the camera
    4245  output = new cvimage((IODevice *)this, width, height, format, "out", false);
    43 
     46       
    4447  // station sol
    4548  main_tab = new Tab(parent->GetTabWidget(), name);
     
    5053}
    5154
     55//This contructor must only be called for a simulated device.
    5256Camera::Camera(const IODevice *parent, std::string name)
    5357    : IODevice(parent, name) {
     
    5963
    6064  output = NULL;
     65        jpgBuffer=NULL;
     66        logFormat=LogFormat::NONE;
    6167}
    6268
     
    6470  if (main_tab != NULL)
    6571    delete main_tab;
     72}
     73
     74void 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        }
    6690}
    6791
     
    94118core::cvimage *Camera::Output(void) { return output; }
    95119
     120void 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
    96129void Camera::SaveToFile(string filename) const {
    97130  Printf("saving %s, size %i\n", filename.c_str(), output->img->imageSize);
  • trunk/lib/FlairSensorActuator/src/Camera.h

    r15 r121  
    1919
    2020namespace 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        }
    2831}
    2932
     
    122125
    123126  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);
     148void ProcessUpdate(core::io_data* data);
    125149protected:
    126150  /*!
     
    138162  gui::GroupBox *setup_groupbox;
    139163  gui::GridLayout *setup_layout;
     164        LogFormat logFormat;
     165        core::Buffer *jpgBuffer;
    140166};
    141167} // end namespace sensor
Note: See TracChangeset for help on using the changeset viewer.