Changeset 122 in flair-src for trunk/lib/FlairSensorActuator/src


Ignore:
Timestamp:
Jan 6, 2017, 1:56:26 PM (8 years ago)
Author:
Sanahuja Guillaume
Message:

modifs uav vrpn i686

Location:
trunk/lib/FlairSensorActuator/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/Camera.cpp

    r121 r122  
    2424#include <DataPlot1D.h>
    2525#include <Picture.h>
    26 #include <Buffer.h>
    2726#include <highgui.h>
    2827#include <fstream>
     
    3938    : IODevice(parent, name) {
    4039  plot_tab = NULL;
    41         jpgBuffer=NULL;
    4240        logFormat=LogFormat::NONE;
    4341
     
    6361
    6462  output = NULL;
    65         jpgBuffer=NULL;
    6663        logFormat=LogFormat::NONE;
    6764}
     
    8077                        break;
    8178                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                         }
     79                                Warn("logging cvimage to jpeg\n");
     80                                Warn("jpeg are not included in classical dbt file, as dbt does not handle variable length\n");
    8881                        break;
     82                default:
     83                        Warn("LogFormat unknown\n");
    8984        }
    9085}
     
    119114
    120115void Camera::ProcessUpdate(core::io_data* data) {
    121         switch(logFormat) {
    122                 case LogFormat::JPG:
    123                                 ajouter compression jpg
    124                         break;
     116        if(getFrameworkManager()->IsLogging() && getFrameworkManager()->IsDeviceLogged(this)) {
     117                switch(logFormat) {
     118                        case LogFormat::JPG:
     119                                        IplImage *img=((cvimage*)data)->img;
     120                                        //dspSaveToJpeg(img,"toto");
     121                                break;
     122                }
    125123        }
    126124        IODevice::ProcessUpdate(data);
  • trunk/lib/FlairSensorActuator/src/Camera.h

    r121 r122  
    2525                class Picture;
    2626                class GridLayout;
    27         }
    28         namespace core {
    29                 class Buffer;
    3027        }
    3128}
     
    163160  gui::GridLayout *setup_layout;
    164161        LogFormat logFormat;
    165         core::Buffer *jpgBuffer;
    166162};
    167163} // end namespace sensor
  • trunk/lib/FlairSensorActuator/src/VrpnClient.cpp

    r15 r122  
    2626using namespace flair::gui;
    2727
     28namespace {
     29  flair::sensor::VrpnClient *singleton = NULL;
     30}
     31
     32
    2833namespace flair {
    2934namespace sensor {
    3035
    31 VrpnClient::VrpnClient(const FrameworkManager *parent, string name,
     36VrpnClient *GetVrpnClient(void) { return singleton; }
     37       
     38VrpnClient::VrpnClient(string name,
    3239                       string address, uint16_t us_period, uint8_t priority)
    33     : Thread(parent, name, priority) {
     40    : Thread(getFrameworkManager(), name, priority) {
     41        if (singleton != NULL) {
     42    Err("VrpnClient must be instanced only one time\n");
     43    return;
     44  }
     45
     46  singleton = this;
    3447  pimpl_ = new VrpnClient_impl(this, name, address, us_period);
    3548}
    3649
    37 VrpnClient::VrpnClient(const FrameworkManager *parent, string name,
     50VrpnClient::VrpnClient(string name,
    3851                       SerialPort *serialport, uint16_t us_period,
    3952                       uint8_t priority)
    40     : Thread(parent, name, priority) {
     53    : Thread(getFrameworkManager(), name, priority) {
     54        if (singleton != NULL) {
     55    Err("VrpnClient must be instanced only one time\n");
     56    return;
     57  }
     58
     59  singleton = this;
    4160  pimpl_ = new VrpnClient_impl(this, name, serialport, us_period);
    4261}
  • trunk/lib/FlairSensorActuator/src/VrpnClient.h

    r15 r122  
    1818
    1919namespace flair {
    20 namespace core {
    21 class FrameworkManager;
    22 class SerialPort;
    23 }
    24 namespace gui {
    25 class TabWidget;
    26 class Layout;
    27 }
     20        namespace core {
     21                class SerialPort;
     22        }
     23        namespace gui {
     24                class TabWidget;
     25                class Layout;
     26        }
    2827}
    2928
     
    3534/*! \class VrpnClient
    3635*
    37 * \brief Class to connect to a Vrpn server
     36* \brief Class to connect to a Vrpn server. The Thread is created with
     37*  the FrameworkManager as parent. FrameworkManager must be created before.
     38* Only one instance of this class is allowed by program.
    3839*/
    3940class VrpnClient : public core::Thread {
     
    4647  * Construct a VrpnClient. Connection is done by IP.
    4748  *
    48   * \param parent parent
    4949  * \param name name
    5050  * \param address server address
     
    5252  * \param priority priority of the Thread
    5353  */
    54   VrpnClient(const core::FrameworkManager *parent, std::string name,
     54  VrpnClient(std::string name,
    5555             std::string address, uint16_t us_period, uint8_t priority);
    5656
     
    6060  * Construct a VrpnClient. Connection is done by XBee modem.
    6161  *
    62   * \param parent parent
    6362  * \param name name
    6463  * \param serialport SerialPort for XBee modem
     
    6665  * \param priority priority of the Thread
    6766  */
    68   VrpnClient(const core::FrameworkManager *parent, std::string name,
     67  VrpnClient(std::string name,
    6968             core::SerialPort *serialport, uint16_t us_period,
    7069             uint8_t priority);
     
    108107  class VrpnClient_impl *pimpl_;
    109108};
     109
     110/*!
     111* \brief get VrpnClient
     112*
     113* \return the VrpnClient
     114*/
     115VrpnClient *GetVrpnClient(void);
     116
    110117} // end namespace sensor
    111118} // end namespace flair
  • trunk/lib/FlairSensorActuator/src/VrpnObject.cpp

    r15 r122  
    3030namespace sensor {
    3131
    32 VrpnObject::VrpnObject(const VrpnClient *parent, string name,
     32VrpnObject::VrpnObject(string name,
    3333                       const TabWidget *tab)
    34     : IODevice(parent, name) {
    35   pimpl_ = new VrpnObject_impl(this, parent, name, -1, tab);
     34    : IODevice(GetVrpnClient(), name) {
     35  pimpl_ = new VrpnObject_impl(this, name, -1, tab);
    3636  AddDataToLog(pimpl_->output);
    3737}
    3838
    39 VrpnObject::VrpnObject(const VrpnClient *parent, string name, uint8_t id,
     39VrpnObject::VrpnObject(string name, uint8_t id,
    4040                       const TabWidget *tab)
    41     : IODevice(parent, name) {
     41    : IODevice(GetVrpnClient(), name) {
    4242  Warn("Creation of object %s with id %i\n", name.c_str(), id);
    43   pimpl_ = new VrpnObject_impl(this, parent, name, id, tab);
     43  pimpl_ = new VrpnObject_impl(this, name, id, tab);
    4444  AddDataToLog(pimpl_->output);
    4545}
  • trunk/lib/FlairSensorActuator/src/VrpnObject.h

    r15 r122  
    1919
    2020namespace flair {
    21 namespace core {
    22 class cvmatrix;
    23 class Vector3D;
    24 class Euler;
    25 class Quaternion;
    26 }
    27 namespace gui {
    28 class TabWidget;
    29 class Tab;
    30 class DataPlot1D;
    31 }
     21        namespace core {
     22                class cvmatrix;
     23                class Vector3D;
     24                class Euler;
     25                class Quaternion;
     26        }
     27        namespace gui {
     28                class TabWidget;
     29                class Tab;
     30                class DataPlot1D;
     31        }
    3232}
    3333
     
    4141/*! \class VrpnObject
    4242*
    43 * \brief Class for VRPN object
     43* \brief Class for VRPN object. The IODevice is created with
     44*  the VrpnClient as parent. VrpnClient must be created before.
    4445*/
    4546class VrpnObject : public core::IODevice {
     
    5354  * Construct a VrpnObject. Connection is done by IP.
    5455  *
    55   * \param parent parent
    5656  * \param name VRPN object name, should be the same as defined in the server
    5757  * \param tab Tab for the user interface
    5858  */
    59   VrpnObject(const VrpnClient *parent, std::string name,
     59  VrpnObject(std::string name,
    6060             const gui::TabWidget *tab);
    6161
     
    6565  * Construct a VrpnObject. Connection is done by IP.
    6666  *
    67   * \param parent parent
    6867  * \param name name
    6968  * \param id VRPN object id, should be the same as defined in the server
    7069  * \param tab Tab for the user interface
    7170  */
    72   VrpnObject(const VrpnClient *parent, std::string name, uint8_t id,
     71  VrpnObject(std::string name, uint8_t id,
    7372             const gui::TabWidget *tab);
    7473
  • trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp

    r15 r122  
    3939using namespace flair::sensor;
    4040
    41 VrpnObject_impl::VrpnObject_impl(VrpnObject *self, const VrpnClient *parent,
     41VrpnObject_impl::VrpnObject_impl(VrpnObject *self,
    4242                                 string name, int id, const TabWidget *tab) {
    43   this->parent = parent;
     43  parent = GetVrpnClient();
    4444  this->self = self;
    4545
     46        if(parent==NULL) {
     47                self->Err("VrpnClient must be instanced before creating VrpnObject\n");
     48                return;
     49        }
    4650  if (id == -1 && parent->UseXbee()) {
    4751    self->Err("erreur aucun identifiant specifie pour la connexion Xbee\n");
  • trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h

    r15 r122  
    2626
    2727namespace flair {
    28 namespace core {
    29 class cvmatrix;
    30 class Vector3D;
    31 class Euler;
    32 }
    33 namespace gui {
    34 class TabWidget;
    35 class Tab;
    36 class DataPlot1D;
    37 }
    38 namespace sensor {
    39 class VrpnClient;
    40 class VrpnObject;
    41 }
     28        namespace core {
     29                class cvmatrix;
     30                class Vector3D;
     31                class Euler;
     32        }
     33        namespace gui {
     34                class TabWidget;
     35                class Tab;
     36                class DataPlot1D;
     37        }
     38        namespace sensor {
     39                class VrpnClient;
     40                class VrpnObject;
     41        }
    4242}
    4343
     
    4747public:
    4848  VrpnObject_impl(flair::sensor::VrpnObject *self,
    49                   const flair::sensor::VrpnClient *parent, std::string name,
     49                  std::string name,
    5050                  int id, const flair::gui::TabWidget *tab);
    5151  ~VrpnObject_impl(void);
Note: See TracChangeset for help on using the changeset viewer.