Changeset 143 in flair-src for trunk/demos/OpticalFlow/uav
- Timestamp:
- Feb 21, 2017, 4:37:58 PM (8 years ago)
- Location:
- trunk/demos/OpticalFlow/uav
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/demos/OpticalFlow/uav/build_x86_64/bin/setup_x4.xml
r122 r143 11 11 </GroupBox> 12 12 <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"/> 15 15 <DoubleSpinBox value="90" name="debattement wz"/> 16 16 <DoubleSpinBox value="-0.7" name="debattement dz"/> … … 21 21 <PushButton value="0" name="reset pitch trim"/> 22 22 </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> 24 24 <Tab name="Mesures"> 25 25 <DataPlot1D name="roll"> … … 153 153 </DataPlot1D> 154 154 </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> 156 156 </Tab> 157 157 <Tab name="battery"> … … 175 175 <DoubleSpinBox value="1" name="cutoff frequency"/> 176 176 </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> 178 178 </Tab> 179 179 <Tab name="Picture"> 180 <Picture name="simu_cam_v" >180 <Picture name="simu_cam_v" period="200" enabled="0"> 181 181 <Setup period="50" enabled="1"/> 182 182 </Picture> … … 191 191 <PushButton value="1" name="take_off"/> 192 192 <PushButton value="0" name="land"/> 193 < /GridLayout>193 <PushButton name="start optical flow"/></GridLayout> 194 194 <GroupBox name="takeoff/landing"> 195 195 <DoubleSpinBox value="1" name="desired takeoff altitude"/> … … 239 239 <GroupBox name="u_x"> 240 240 <DoubleSpinBox value="0" name="period, 0 for auto"/> 241 <DoubleSpinBox value="0. 030" name="kp:"/>242 <DoubleSpinBox value="0.0 20" 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:"/> 245 245 <DoubleSpinBox value="1" name="sat:"/> 246 246 </GroupBox> 247 247 <GroupBox name="u_y"> 248 248 <DoubleSpinBox value="0" name="period, 0 for auto"/> 249 <DoubleSpinBox value="0. 03" name="kp:"/>250 <DoubleSpinBox value="0.0 20" 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:"/> 253 253 <DoubleSpinBox value="1" name="sat:"/> 254 254 </GroupBox> … … 283 283 <Setup period="100" enabled="1"/> 284 284 </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 58 58 59 59 //optical flow stack 60 //opticalFlow= matrice de déplacements en pixels entre 2 images consécutives 60 61 opticalFlow=new OpticalFlow(greyCameraImage,uav->GetVerticalCamera()->GetLayout()->NewRow(),"flux optique"); 61 62 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) 62 64 cvmatrix* twoByOneSpeed=new cvmatrix((const Thread*)this,2,1,floatType); 63 65 opticalFlowSpeed=new LowPassFilter(opticalFlowSpeedRaw,uav->GetVerticalCamera()->GetLayout()->NewRow(),"Speed lowPass",twoByOneSpeed); … … 70 72 71 73 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); 76 78 77 79 xVelocityPlot->AddCurve(opticalFlowSpeedRaw->Output()->Element(0,0)); … … 143 145 Euler refAngles=GetDefaultReferenceOrientation()->GetQuaternion().ToEuler();//to keep default yaw reference 144 146 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 speed147 // /!\ 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 146 148 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); 154 158 155 159 u_x->SetValues(error.x, errorVariation.x);
Note:
See TracChangeset
for help on using the changeset viewer.