- Timestamp:
- Jul 23, 2018, 5:03:47 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ReleaseNotes
r237 r256 6 6 - file_ui com is only created when sending logs from uav to gcs (reduce overall data exchange between the 2) 7 7 - resolved https://devel.hds.utc.fr/projects/flair/ticket/37 8 - added a saturation to EulerDerivative: saturate in case of numerical problems 8 9 9 10 ----------------------------------------------------------- -
trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp
r223 r256 60 60 61 61 cvmatrix_descriptor *desc = new cvmatrix_descriptor(output->Rows(), output->Cols()); 62 prev_value = new Matrix(self, desc, output->GetDataType().GetElementDataType(), name); 62 prev_input = new Matrix(self, desc, output->GetDataType().GetElementDataType(), name); 63 prev_output = new Matrix(self, desc, output->GetDataType().GetElementDataType(), name); 64 delete desc; 63 65 64 66 65 67 // init UI 66 68 GroupBox *reglages_groupbox = new GroupBox(position, name); 67 T = new DoubleSpinBox(reglages_groupbox->NewRow(), "period, 0 for auto:", 68 " s", 0, 1, 0.01);69 T = new DoubleSpinBox(reglages_groupbox->NewRow(), "period, 0 for auto:"," s", 0, 1, 0.01); 70 sat = new DoubleSpinBox(reglages_groupbox->NewRow(), "saturation, -1 to disable:",-1,100000,1,1,-1); 69 71 } 70 72 … … 87 89 for (int i = 0; i < input->Rows(); i++) { 88 90 for (int j = 0; j < input->Cols(); j++) { 89 prev_ value->SetValueNoMutex(i, j, input->ValueNoMutex(i, j));91 prev_input->SetValueNoMutex(i, j, input->ValueNoMutex(i, j)); 90 92 } 91 93 } … … 101 103 for (int i = 0; i < input->Rows(); i++) { 102 104 for (int j = 0; j < input->Cols(); j++) { 103 output->SetValueNoMutex( 104 i, j, (input->ValueNoMutex(i, j) - prev_value->ValueNoMutex(i, j)) / 105 delta_t); 106 prev_value->SetValueNoMutex(i, j, input->ValueNoMutex(i, j)); 105 float result=(input->ValueNoMutex(i, j) - prev_input->ValueNoMutex(i, j)) / delta_t; 106 if(sat->Value()!=-1) { 107 if(result>sat->Value() && result>0) result=sat->Value(); 108 if(result<-sat->Value() && result<0) result=-sat->Value(); 109 }/* filter by acc 110 float acc=result-prev_output->ValueNoMutex(i, j)/delta_t; 111 if(acc>20 || acc<-20) { 112 printf("%s %f\n",self->ObjectName().c_str(),acc); 113 } else {*/ 114 output->SetValueNoMutex(i, j, result); 115 //} 116 prev_output->SetValueNoMutex(i, j, result); 117 prev_input->SetValueNoMutex(i, j, input->ValueNoMutex(i, j)); 118 107 119 } 108 120 } -
trunk/lib/FlairFilter/src/unexported/EulerDerivative_impl.h
r223 r256 44 44 45 45 private: 46 flair::gui::DoubleSpinBox *T ;46 flair::gui::DoubleSpinBox *T,*sat; 47 47 bool first_update; 48 flair::core::Matrix *prev_ value;48 flair::core::Matrix *prev_input,*prev_output; 49 49 flair::filter::EulerDerivative *self; 50 50 };
Note:
See TracChangeset
for help on using the changeset viewer.