Changeset 165 in flair-src for trunk


Ignore:
Timestamp:
Mar 7, 2017, 8:26:53 PM (8 years ago)
Author:
Sanahuja Guillaume
Message:

modifs

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp

    r163 r165  
    1515#include <Uav.h>
    1616#include <Camera.h>
     17#include <V4LCamera.h>
    1718#include <CvtColor.h>
    1819#include <OpticalFlow.h>
     
    123124  uav->GetAhrs()->AddPlot(customReferenceOrientation,DataPlot::Yellow);
    124125  AddDataToControlLawLog(customReferenceOrientation);
     126 
     127  flagCameraLost=false;
    125128}
    126129
     
    196199}
    197200
     201void DemoOpticalFlow::ExtraSecurityCheck(void) {
     202  if(GetUav()->GetType()=="hds_x8") {
     203    if(((V4LCamera*)GetUav()->GetVerticalCamera())->HasProblems() && !flagCameraLost) {
     204      flagCameraLost = true;
     205      Thread::Err("Camera lost\n");
     206      SafeStop();
     207      Land();
     208    }
     209  }
     210}
     211
    198212DemoOpticalFlow::~DemoOpticalFlow() {
    199213}
  • trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.h

    r163 r165  
    5050        void ExtraCheckJoystick(void);
    5151    void ExtraCheckPushButton(void);
     52    void ExtraSecurityCheck(void);
    5253        const flair::core::AhrsData *GetReferenceOrientation(void);
    5354
     
    6970        flair::filter::LowPassFilter* opticalFlowSpeed;
    7071        flair::filter::LowPassFilter* opticalFlowAcceleration;
     72        bool flagCameraLost;
    7173};
    7274
  • trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp

    r162 r165  
    7979      for(uint32_t j=0;j<nbCol;j++) {
    8080        f[i*nbCol+j]->setup(1. / T->Value(), cutoff->Value());
    81         settingsChanged(f[i*nbCol+j],input->Value(i, j));
     81        //settingsChanged(f[i*nbCol+j],input->Value(i, j));
    8282      }
    8383    }
     
    103103      for(uint32_t j=0;j<nbCol;j++) {
    104104        f[i*nbCol+j]->setup(1. / delta_t, cutoff->Value());
    105         settingsChanged(f[i*nbCol+j],input->ValueNoMutex(i, j));
     105        //settingsChanged(f[i*nbCol+j],input->ValueNoMutex(i, j));
    106106      }
    107107    }
  • trunk/lib/FlairMeta/src/HdsX8.h

    r157 r165  
    3030        std::string GetDefaultVrpnAddress(void) const{return "192.168.147.197:3883";}
    3131  bool isReadyToFly(void) const;
     32  virtual std::string GetType(void) const{return "hds_x8";}
    3233
    3334private:
  • trunk/lib/FlairMeta/src/SimuX4.h

    r160 r165  
    3131    ~SimuX4();
    3232    void StartSensors(void);
     33    virtual std::string GetType(void) const{return "x4_simu";}
    3334
    3435  private:
  • trunk/lib/FlairMeta/src/SimuX8.h

    r160 r165  
    3030    ~SimuX8();
    3131    void StartSensors(void);
     32    virtual std::string GetType(void) const{return "simu_x8";}
    3233 
    3334  private:
  • trunk/lib/FlairMeta/src/Uav.h

    r157 r165  
    6464        virtual std::string GetDefaultVrpnAddress(void) const{return "127.0.0.1:3883";}
    6565  virtual bool isReadyToFly(void) const { return true;}
     66  virtual std::string GetType(void) const=0;
    6667
    6768protected:
  • trunk/lib/FlairMeta/src/UavStateMachine.h

    r122 r165  
    227227
    228228  const sensor::TargetController *GetJoystick(void) const;
     229  MetaDualShock3 *joy;
    229230
    230231  gui::Tab *setupLawTab, *graphLawTab;
     
    297298  filter::Pid *uYaw;
    298299  filter::PidThrust *uZ;
    299 
    300   MetaDualShock3 *joy;
    301300  filter::TrajectoryGenerator1D *altitudeTrajectory;
    302301};
  • trunk/lib/FlairMeta/src/XAir.h

    r157 r165  
    3030        std::string GetDefaultVrpnAddress(void) const{return "192.168.147.197:3883";}
    3131  bool isReadyToFly(void) const;
     32  virtual std::string GetType(void) const{return "xair";}
    3233
    3334private:
  • trunk/lib/FlairSensorActuator/src/V4LCamera.cpp

    r137 r165  
    7575  awb = new CheckBox(GetGroupBox()->LastRowLastCol(), "awb:");
    7676  fps = new Label(GetGroupBox()->NewRow(), "fps");
     77 
     78  hasProblems=false;
    7779}
    7880
     
    9597
    9698  while (!ToBeStopped()) {
     99    //check for ps3eye deconnection in hds uav
     100    if(cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH)<0) {
     101      Thread::Warn("camera disconnected\n");
     102      hasProblems=true;
     103    }
     104   
    97105    // fps counter
    98106    fpsCounter++;
     
    100108      fpsNow = GetTime();
    101109      fps->SetText("fps: %.1f",
    102                    fpsCounter / ((float)(fpsNow - fpsPrev) / 1000000000.));
     110       fpsCounter / ((float)(fpsNow - fpsPrev) / 1000000000.));
    103111      fpsCounter = 0;
    104112      fpsPrev = fpsNow;
     
    147155    }
    148156    new_time = GetTime();
     157   
     158    //check for ps3eye deconnection in hds uav
     159    if(new_time-cam_time>100*1000*1000) {
     160      Thread::Warn("delta trop grand\n");
     161      hasProblems=true;
     162    }
    149163
    150164    output->GetMutex();
     
    161175}
    162176
     177bool V4LCamera::HasProblems(void) {
     178  return hasProblems;
     179}
     180
    163181void V4LCamera::SetAutoGain(bool value) {
    164182  cvSetCaptureProperty(capture, CV_CAP_PROP_AUTOGAIN, value);
  • trunk/lib/FlairSensorActuator/src/V4LCamera.h

    r137 r165  
    5959  */
    6060  ~V4LCamera();
     61 
     62    //hack for ps3eye in hds uav
     63  //TODO: put this in ps3eye class
     64  bool HasProblems(void);
    6165
    6266protected:
     
    116120  */
    117121  virtual void SetContrast(float value);
    118 
     122 
    119123private:
    120124  /*!
     
    138142
    139143  gui::Tab *sensor_tab;
    140   gui::DoubleSpinBox *bright, *exposure, *gain, *contrast, *hue, *sharpness,
    141       *sat;
     144  gui::DoubleSpinBox *bright, *exposure, *gain, *contrast, *hue, *sharpness,*sat;
    142145  gui::CheckBox *autogain, *awb, *autoexposure;
    143146  gui::Label *fps;
     147  bool hasProblems;
    144148};
    145149} // end namespace sensor
Note: See TracChangeset for help on using the changeset viewer.