Changeset 143 in flair-src for trunk


Ignore:
Timestamp:
Feb 21, 2017, 4:37:58 PM (8 years ago)
Author:
Bayard Gildas
Message:

Plop

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/demos/OpticalFlow/simulator/build_x86_64/bin/simulator_x4.sh

    r122 r143  
    22
    33. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
     4
     5export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libdrm_intel.so.1:/usr/lib/x86_64-linux-gnu/libdrm_nouveau.so.2:/usr/lib/x86_64-linux-gnu/libdrm_radeon.so.1
    46
    57if [ -f /proc/xenomai/version ];then
  • trunk/demos/OpticalFlow/uav/build_x86_64/bin/setup_x4.xml

    r122 r143  
    1111    </GroupBox>
    1212    <GroupBox name="consignes joy">
    13      <DoubleSpinBox value="-20" name="debattement roll"/>
    14      <DoubleSpinBox value="-20" name="debattement pitch"/>
     13     <DoubleSpinBox value="-10" name="debattement roll"/>
     14     <DoubleSpinBox value="-10" name="debattement pitch"/>
    1515     <DoubleSpinBox value="90" name="debattement wz"/>
    1616     <DoubleSpinBox value="-0.7" name="debattement dz"/>
     
    2121     <PushButton value="0" name="reset pitch trim"/>
    2222    </GroupBox>
    23    <GroupBox name="consignes fo"><DoubleSpinBox name="debattement x" value="-1"/><DoubleSpinBox name="debattement y" value="1"/></GroupBox></Tab>
     23   <GroupBox name="consignes fo"><DoubleSpinBox name="debattement x" value="-1.0"/><DoubleSpinBox name="debattement y" value="1.0"/></GroupBox></Tab>
    2424   <Tab name="Mesures">
    2525    <DataPlot1D name="roll">
     
    153153    </DataPlot1D>
    154154   </Tab>
    155   </TabWidget>
     155  <Tab name="Quaternion"><DataPlot1D name="q0" period="100" enabled="0"/><DataPlot1D name="q1" period="100" enabled="0"/><DataPlot1D name="q2" period="100" enabled="0"/><DataPlot1D name="q3" period="100" enabled="0"/></Tab><Tab name="IMU"><DataPlot1D name="acc_x" period="100" enabled="0"/><DataPlot1D name="acc_y" period="100" enabled="0"/><DataPlot1D name="acc_z" period="100" enabled="0"/><DataPlot1D name="gyr_x" period="100" enabled="0"/><DataPlot1D name="gyr_y" period="100" enabled="0"/><DataPlot1D name="gyr_z" period="100" enabled="0"/><DataPlot1D name="mag_x" period="100" enabled="0"/><DataPlot1D name="mag_y" period="100" enabled="0"/><DataPlot1D name="mag_z" period="100" enabled="0"/></Tab></TabWidget>
    156156 </Tab>
    157157 <Tab name="battery">
     
    175175      <DoubleSpinBox value="1" name="cutoff frequency"/>
    176176     </GroupBox>
    177     </GridLayout>
     177    <GroupBox name="derivative"><DoubleSpinBox name="period, 0 for auto:" value="0.02"/></GroupBox><GroupBox name="Speed lowPass"><DoubleSpinBox name="period, 0 for auto" value="0.02"/><DoubleSpinBox name="cutoff frequency" value="2.00"/></GroupBox><GroupBox name="Acceleration lowPass"><DoubleSpinBox name="period, 0 for auto" value="0.02"/><DoubleSpinBox name="cutoff frequency" value="2.00"/></GroupBox></GridLayout>
    178178   </Tab>
    179179   <Tab name="Picture">
    180     <Picture name="simu_cam_v">
     180    <Picture name="simu_cam_v" period="200" enabled="0">
    181181     <Setup period="50" enabled="1"/>
    182182    </Picture>
     
    191191   <PushButton value="1" name="take_off"/>
    192192   <PushButton value="0" name="land"/>
    193   </GridLayout>
     193  <PushButton name="start optical flow"/></GridLayout>
    194194  <GroupBox name="takeoff/landing">
    195195   <DoubleSpinBox value="1" name="desired takeoff altitude"/>
     
    239239    <GroupBox name="u_x">
    240240     <DoubleSpinBox value="0" name="period, 0 for auto"/>
    241      <DoubleSpinBox value="0.030" name="kp:"/>
    242      <DoubleSpinBox value="0.020" name="ki:"/>
    243      <DoubleSpinBox value="0.20" name="sat i:"/>
    244      <DoubleSpinBox value="0.1" name="kd:"/>
     241     <DoubleSpinBox value="0.20" name="kp:"/>
     242     <DoubleSpinBox value="0.00" name="ki:"/>
     243     <DoubleSpinBox value="1.0" name="sat i:"/>
     244     <DoubleSpinBox value="0.005" name="kd:"/>
    245245     <DoubleSpinBox value="1" name="sat:"/>
    246246    </GroupBox>
    247247    <GroupBox name="u_y">
    248248     <DoubleSpinBox value="0" name="period, 0 for auto"/>
    249      <DoubleSpinBox value="0.03" name="kp:"/>
    250      <DoubleSpinBox value="0.020" name="ki:"/>
    251      <DoubleSpinBox value="0.20" name="sat i:"/>
    252      <DoubleSpinBox value="0.2" name="kd:"/>
     249     <DoubleSpinBox value="0.20" name="kp:"/>
     250     <DoubleSpinBox value="0.00" name="ki:"/>
     251     <DoubleSpinBox value="1.0" name="sat i:"/>
     252     <DoubleSpinBox value="0.005" name="kd:"/>
    253253     <DoubleSpinBox value="1" name="sat:"/>
    254254    </GroupBox>
     
    283283   <Setup period="100" enabled="1"/>
    284284  </DataPlot1D>
    285  </Tab>
    286   </TabWidget>
    287 <TabWidget name="App_TabWidget"><Tab name="x4_0"><PushButton name="save config on target" value="1"/></Tab></TabWidget></root>
     285 <DataPlot1D name="x_velocity_derivative" period="100" enabled="1"/><DataPlot1D name="y_velocity_derivative" period="100" enabled="1"/><DataPlot1D name="x_acceleration" period="100" enabled="1"/><DataPlot1D name="y_acceleration" period="100" enabled="1"/><DataPlot1D name="x speed (px/s)" period="100" enabled="1"/><DataPlot1D name="y speed (px/s)" period="100" enabled="1"/></Tab>
     286  </TabWidget>
     287<TabWidget name="App_TabWidget"><Tab name="x4_0"><PushButton name="save config on target" value="1"/></Tab></TabWidget><PushButton name="save config on target (x4_0)" value="1"/></root>
  • trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp

    r142 r143  
    5858
    5959        //optical flow stack
     60        //opticalFlow= matrice de déplacements en pixels entre 2 images consécutives
    6061        opticalFlow=new OpticalFlow(greyCameraImage,uav->GetVerticalCamera()->GetLayout()->NewRow(),"flux optique");
    6162        opticalFlowSpeedRaw=new OpticalFlowSpeed(opticalFlow,"vitesse du flux optique");
     63        //opticalFlowSpeed=vitesse de déplacement en pixel par seconde (moyenne sur tous les points et division par le delta T)
    6264        cvmatrix* twoByOneSpeed=new cvmatrix((const Thread*)this,2,1,floatType);
    6365        opticalFlowSpeed=new LowPassFilter(opticalFlowSpeedRaw,uav->GetVerticalCamera()->GetLayout()->NewRow(),"Speed lowPass",twoByOneSpeed);
     
    7072
    7173        Tab* opticalFlowTab=new Tab(getFrameworkManager()->GetTabWidget(),"flux optique");
    72         DataPlot1D* xVelocityPlot=new DataPlot1D(opticalFlowTab->NewRow(),"x_velocity",-5,5);
    73         DataPlot1D* yVelocityPlot=new DataPlot1D(opticalFlowTab->LastRowLastCol(),"y_velocity",-5,5);
    74         DataPlot1D* xAccelerationPlot=new DataPlot1D(opticalFlowTab->NewRow(),"x_acceleration",-5,5);
    75         DataPlot1D* yAccelerationPlot=new DataPlot1D(opticalFlowTab->LastRowLastCol(),"y_acceleration",-5,5);
     74        DataPlot1D* xVelocityPlot=new DataPlot1D(opticalFlowTab->NewRow(),"x speed (px/s)",-250,250);
     75        DataPlot1D* yVelocityPlot=new DataPlot1D(opticalFlowTab->LastRowLastCol(),"y speed (px/s)",-250,250);
     76        DataPlot1D* xAccelerationPlot=new DataPlot1D(opticalFlowTab->NewRow(),"x_acceleration",-250,250);
     77        DataPlot1D* yAccelerationPlot=new DataPlot1D(opticalFlowTab->LastRowLastCol(),"y_acceleration",-250,250);
    7678
    7779        xVelocityPlot->AddCurve(opticalFlowSpeedRaw->Output()->Element(0,0));
     
    143145    Euler refAngles=GetDefaultReferenceOrientation()->GetQuaternion().ToEuler();//to keep default yaw reference
    144146
    145     // /!\ in this demo, the target value is a speed (in pixel/s). As a consequence the error is the difference between the current speed and the target speed
     147    // /!\ in this demo, the target value is a speed (in m/s). As a consequence the error is the difference between the current speed and the target speed
    146148    Vector2D error, errorVariation; // in Uav coordinate system
    147 
    148     //opticalFlow= matrice de déplacements en pixels entre 2 images consécutives
    149     //opticalFlowSpeed=vitesse de déplacement en pixel par seconde (moyenne sur tous les points et division par le delta T)
    150     error.x=opticalFlowSpeed->Output(0,0)-opticalFlowReference->Value(0,0);
    151     error.y=opticalFlowSpeed->Output(1,0)-opticalFlowReference->Value(1,0);
    152     errorVariation.x=opticalFlowAcceleration->Output(0,0);
    153     errorVariation.y=opticalFlowAcceleration->Output(1,0);
     149    float focal=271.76;
     150    float z,dz;
     151    AltitudeValues(z, dz);
     152    float scale=z/focal;
     153    error.x=opticalFlowSpeed->Output(0,0)*scale-opticalFlowReference->Value(0,0);
     154    error.y=opticalFlowSpeed->Output(1,0)*scale-opticalFlowReference->Value(1,0);
     155    errorVariation.x=opticalFlowAcceleration->Output(0,0)*scale;
     156    errorVariation.y=opticalFlowAcceleration->Output(1,0)*scale;
     157//Printf("Altitude=%f, Error=(%f,%f)\n",z,error.x,error.y);
    154158
    155159    u_x->SetValues(error.x, errorVariation.x);
  • trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp

    r122 r143  
    4949
    5050    input->GetMutex();
    51     for(int i=0;i<input->NbFeatures();i++)
    52     {
    53         if(input->FoundFeature()[i]!=0)
    54         {
     51    for(int i=0;i<input->NbFeatures();i++) {
     52        if(input->FoundFeature()[i]!=0) {
    5553            deplx+=input->PointsB()[i].x-input->PointsA()[i].x;
    5654            deply+=input->PointsB()[i].y-input->PointsA()[i].y;
     
    5957    }
    6058    input->ReleaseMutex();
     59    Time deltaT=data->DataTime()-output->DataTime();
     60    output->SetDataTime(data->DataTime());
    6161
    62     if(nb_depl!=0)
    63     {
    64         output->SetValue(0,0,deplx/nb_depl);
    65         output->SetValue(1,0,deply/nb_depl);
     62    if(nb_depl!=0) {
     63        output->SetValue(0,0,deplx/(nb_depl*deltaT)*1000*1000*1000);
     64        output->SetValue(1,0,deply/(nb_depl*deltaT)*1000*1000*1000);
    6665    }
    6766
    68     output->SetDataTime(data->DataTime());
    6967    ProcessUpdate(output);
    7068}
  • trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.h

    r122 r143  
    3131    * \brief Optical flow speed calculation
    3232    *
    33     * Speed is the mean of all optical flow values.
     33    * Speed is the mean of all optical flow values divided by the delta time between images.
    3434    */
    3535    class OpticalFlowSpeed : public core::IODevice
     
    6767            * \brief Output matrix
    6868            *
    69             * Matrix is of sze (2,1). \n
     69            * Matrix is of size (2,1). \n
    7070            * First line is speed along x axis. \n
    7171            * Second line is speed along y axis. \n
Note: See TracChangeset for help on using the changeset viewer.