Changeset 154 in flair-src for trunk/demos/OpticalFlow
- Timestamp:
- Mar 1, 2017, 5:57:26 PM (8 years ago)
- Location:
- trunk/demos/OpticalFlow/uav
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/demos/OpticalFlow/uav/build_x86_64/bin/setup_x4.xml
r143 r154 21 21 <PushButton value="0" name="reset pitch trim"/> 22 22 </GroupBox> 23 <GroupBox name="consignes fo"><DoubleSpinBox name="debattement x" value="-1 .0"/><DoubleSpinBox name="debattement y" value="1.0"/></GroupBox></Tab>23 <GroupBox name="consignes fo"><DoubleSpinBox name="debattement x" value="-1"/><DoubleSpinBox name="debattement y" value="1"/></GroupBox></Tab> 24 24 <Tab name="Mesures"> 25 25 <DataPlot1D name="roll"> … … 175 175 <DoubleSpinBox value="1" name="cutoff frequency"/> 176 176 </GroupBox> 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>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"/></GroupBox><GroupBox name="Acceleration lowPass"><DoubleSpinBox name="period, 0 for auto" value="0.02"/><DoubleSpinBox name="cutoff frequency" value="2"/></GroupBox></GridLayout> 178 178 </Tab> 179 179 <Tab name="Picture"> … … 239 239 <GroupBox name="u_x"> 240 240 <DoubleSpinBox value="0" name="period, 0 for auto"/> 241 <DoubleSpinBox value="0.2 0" name="kp:"/>242 <DoubleSpinBox value="0 .00" name="ki:"/>243 <DoubleSpinBox value="1 .0" name="sat i:"/>241 <DoubleSpinBox value="0.2" name="kp:"/> 242 <DoubleSpinBox value="0" name="ki:"/> 243 <DoubleSpinBox value="1" name="sat i:"/> 244 244 <DoubleSpinBox value="0.005" name="kd:"/> 245 245 <DoubleSpinBox value="1" name="sat:"/> … … 247 247 <GroupBox name="u_y"> 248 248 <DoubleSpinBox value="0" name="period, 0 for auto"/> 249 <DoubleSpinBox value="0.2 0" name="kp:"/>250 <DoubleSpinBox value="0 .00" name="ki:"/>251 <DoubleSpinBox value="1 .0" name="sat i:"/>249 <DoubleSpinBox value="0.2" name="kp:"/> 250 <DoubleSpinBox value="0" name="ki:"/> 251 <DoubleSpinBox value="1" name="sat i:"/> 252 252 <DoubleSpinBox value="0.005" name="kd:"/> 253 253 <DoubleSpinBox value="1" name="sat:"/> … … 284 284 </DataPlot1D> 285 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>286 <Tab name="real speed"><DataPlot1D name="x speed (m/s)" period="100" enabled="1"/><DataPlot1D name="y speed (m/s)" period="100" enabled="1"/></Tab></TabWidget> 287 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
r147 r154 93 93 maxXSpeed=new DoubleSpinBox(opticalFlowGroupBox->NewRow(),"debattement x"," m/s",-5,5,0.1,1); 94 94 maxYSpeed=new DoubleSpinBox(opticalFlowGroupBox->LastRowLastCol(),"debattement y"," m/s",-5,5,0.1,1); 95 96 opticalFlowReference=new cvmatrix((const Thread*)this,2,1,floatType); 97 xVelocityPlot->AddCurve(opticalFlowReference->Element(0,0),DataPlot::Green,"consigne"); 98 yVelocityPlot->AddCurve(opticalFlowReference->Element(1,0),DataPlot::Green,"consigne"); 95 96 Tab* opticalFlowRealTab=new Tab(getFrameworkManager()->GetTabWidget(),"real speed"); 97 opticalFlowRealSpeed=new cvmatrix((const Thread*)this,2,1,floatType); 98 opticalFlowReference=new cvmatrix((const Thread*)this,2,1,floatType); 99 opticalFlowRealAcceleration=new cvmatrix((const Thread*)this,2,1,floatType); 100 DataPlot1D* xRealVelocityPlot=new DataPlot1D(opticalFlowRealTab->NewRow(),"x speed (m/s)",-2,2); 101 DataPlot1D* yRealVelocityPlot=new DataPlot1D(opticalFlowRealTab->LastRowLastCol(),"y speed (m/s)",-2,2); 102 DataPlot1D* xRealAccelerationPlot=new DataPlot1D(opticalFlowRealTab->NewRow(),"x acceleration (m/s2)",-2,2); 103 DataPlot1D* yRealAccelerationPlot=new DataPlot1D(opticalFlowRealTab->LastRowLastCol(),"y acceleration (m/s2)",-2,2); 104 xRealVelocityPlot->AddCurve(opticalFlowRealSpeed->Element(0)); 105 xRealVelocityPlot->AddCurve(opticalFlowReference->Element(0),DataPlot::Blue,"consigne"); 106 yRealVelocityPlot->AddCurve(opticalFlowRealSpeed->Element(1)); 107 yRealVelocityPlot->AddCurve(opticalFlowReference->Element(1),DataPlot::Blue,"consigne"); 108 xRealAccelerationPlot->AddCurve(opticalFlowRealAcceleration->Element(0)); 109 yRealAccelerationPlot->AddCurve(opticalFlowRealAcceleration->Element(1)); 99 110 100 111 customReferenceOrientation= new AhrsData(this,"reference"); … … 108 119 opticalFlowReference->SetValue(0,0,GetJoystick()->GetAxisValue(1)*maxXSpeed->Value());//joy axis 0 maps to x displacement 109 120 opticalFlowReference->SetValue(1,0,GetJoystick()->GetAxisValue(0)*maxYSpeed->Value());//joy axis 1 maps to y displacement 121 float focal=271.76; 122 float z,dz; 123 AltitudeValues(z, dz); 124 float scale=z/focal; 125 opticalFlowRealSpeed->SetValue(0,0,opticalFlowSpeed->Output(0,0)*scale); 126 opticalFlowRealSpeed->SetValue(1,0,opticalFlowSpeed->Output(1,0)*scale); 127 opticalFlowRealAcceleration->SetValue(0,0,opticalFlowAcceleration->Output(0,0)*scale); 128 opticalFlowRealAcceleration->SetValue(1,0,opticalFlowAcceleration->Output(1,0)*scale); 110 129 break; 111 130 } … … 146 165 // /!\ 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 147 166 Vector2D error, errorVariation; // in Uav coordinate system 148 float focal=271.76; 149 float z,dz; 150 AltitudeValues(z, dz); 151 float scale=z/focal; 152 error.x=opticalFlowSpeed->Output(0,0)*scale-opticalFlowReference->Value(0,0); 153 error.y=opticalFlowSpeed->Output(1,0)*scale-opticalFlowReference->Value(1,0); 154 errorVariation.x=opticalFlowAcceleration->Output(0,0)*scale; 155 errorVariation.y=opticalFlowAcceleration->Output(1,0)*scale; 167 168 error.x=opticalFlowRealSpeed->Value(0,0)-opticalFlowReference->Value(0,0); 169 error.y=opticalFlowRealSpeed->Value(1,0)-opticalFlowReference->Value(1,0); 170 errorVariation.x=opticalFlowRealAcceleration->Value(0,0); 171 errorVariation.y=opticalFlowRealAcceleration->Value(1,0); 156 172 //Printf("Altitude=%f, Error=(%f,%f)\n",z,error.x,error.y); 157 173 -
trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.h
r142 r154 66 66 flair::gui::PushButton *startOpticalflow,*stopOpticalflow; 67 67 void StartOpticalFlow(void); 68 flair::core::cvmatrix *opticalFlowRealSpeed,*opticalFlowRealAcceleration; 68 69 }; 69 70
Note:
See TracChangeset
for help on using the changeset viewer.