- Timestamp:
- Mar 6, 2017, 8:30:06 PM (8 years ago)
- Location:
- trunk/lib
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairFilter/src/ButterworthLowPass.cpp
r157 r162 31 31 ButterworthLowPass::ButterworthLowPass(const IODevice *parent, 32 32 const LayoutPosition *position, 33 string name, int order)33 string name, uint32_t order,uint32_t nbRow,uint32_t nbCol) 34 34 : IODevice(parent, name) { 35 pimpl_ = new ButterworthLowPass_impl(this, position, name, order );35 pimpl_ = new ButterworthLowPass_impl(this, position, name, order,nbRow,nbCol); 36 36 AddDataToLog(pimpl_->output); 37 37 … … 40 40 41 41 ButterworthLowPass::ButterworthLowPass(const gui::LayoutPosition *position, 42 string name, int order)42 string name, uint32_t order,uint32_t nbRow,uint32_t nbCol) 43 43 : IODevice(position->getLayout(), name) { 44 pimpl_ = new ButterworthLowPass_impl(this, position, name, order );44 pimpl_ = new ButterworthLowPass_impl(this, position, name, order,nbRow,nbCol); 45 45 AddDataToLog(pimpl_->output); 46 46 } -
trunk/lib/FlairFilter/src/ButterworthLowPass.h
r15 r162 48 48 * \param name name 49 49 * \param order order of the filter 50 * \param nbRow number of rows of input/output 51 * \param nbCol number of cols of input/output 50 52 */ 51 53 ButterworthLowPass(const IODevice *parent, 52 54 const gui::LayoutPosition *position, std::string name, 53 int order);55 uint32_t order,uint32_t nbRow=1,uint32_t nbCol=1); 54 56 55 57 /*! … … 65 67 * \param name name 66 68 * \param order order of the filter 69 * \param nbRow number of rows of input/output 70 * \param nbCol number of cols of input/output 67 71 */ 68 72 ButterworthLowPass(const gui::LayoutPosition *position, std::string name, 69 int order);73 uint32_t order,uint32_t nbRow,uint32_t nbCol); 70 74 71 75 /*! -
trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp
r148 r162 31 31 ButterworthLowPass_impl::ButterworthLowPass_impl(ButterworthLowPass *self, 32 32 const LayoutPosition *position, 33 string name, int order) {33 string name, uint32_t order,uint32_t nbRow,uint32_t nbCol) { 34 34 // init UI 35 35 GroupBox *reglages_groupbox = new GroupBox(position, name); … … 39 39 " Hz", 0, 10000, 0.1, 2, 1); 40 40 41 cvmatrix_descriptor *desc = new cvmatrix_descriptor( 1, 1);42 desc->SetElementName(0, 0, "output");41 cvmatrix_descriptor *desc = new cvmatrix_descriptor(nbRow, nbCol); 42 //desc->SetElementName(0, 0, "output"); 43 43 output = new cvmatrix(self, desc, floatType, name); 44 44 delete desc; 45 45 46 f = new PoleFilter(order); 47 48 if (T->Value() != 0) { 49 f->setup(1. / T->Value(), cutoff->Value()); 46 f=(PoleFilter**)malloc(sizeof(PoleFilter*)*nbRow*nbCol); 47 48 for(uint32_t i=0;i<nbRow;i++) { 49 for(uint32_t j=0;j<nbCol;j++) { 50 f[i*nbCol+j] = new PoleFilter(order); 51 if (T->Value() != 0) { 52 f[i*nbCol+j]->setup(1. / T->Value(), cutoff->Value()); 53 } 54 f[i*nbCol+j]->reset(); 55 } 50 56 } 51 52 f->reset();53 57 54 58 first_update = true; 55 59 this->order=order; 60 this->nbRow=nbRow; 61 this->nbCol=nbCol; 56 62 } 57 63 58 ButterworthLowPass_impl::~ButterworthLowPass_impl() { delete f; } 64 ButterworthLowPass_impl::~ButterworthLowPass_impl() { 65 for(uint32_t i=0;i<nbRow;i++) { 66 for(uint32_t j=0;j<nbCol;j++) { 67 delete f[i*nbCol+j]; 68 } 69 } 70 free(f); 71 } 59 72 60 73 void ButterworthLowPass_impl::UpdateFrom(const io_data *data) { 61 float result;62 74 cvmatrix *input = (cvmatrix *)data; 63 75 float delta_t; 64 76 65 if (T->ValueChanged()) { 66 if (T->Value() != 0) { 67 f->setup(1. / T->Value(), cutoff->Value()); 68 settingsChanged(input->Value(0, 0)); 77 if (T->ValueChanged() && T->Value() != 0) { 78 for(uint32_t i=0;i<nbRow;i++) { 79 for(uint32_t j=0;j<nbCol;j++) { 80 f[i*nbCol+j]->setup(1. / T->Value(), cutoff->Value()); 81 settingsChanged(f[i*nbCol+j],input->Value(i, j)); 82 } 69 83 } 70 84 } … … 72 86 if (T->Value() == 0) { 73 87 delta_t = (float)(data->DataTime() - previous_time) / 1000000000.; 74 f->setup(1. / delta_t, cutoff->Value()); 88 for(uint32_t i=0;i<nbRow;i++) { 89 for(uint32_t j=0;j<nbCol;j++) { 90 f[i*nbCol+j]->setup(1. / delta_t, cutoff->Value()); 91 } 92 } 75 93 } else { 76 94 delta_t=T->Value(); … … 82 100 83 101 if (cutoff->ValueChanged()) { 84 f->setup(1. / delta_t, cutoff->Value()); 85 settingsChanged(input->ValueNoMutex(0, 0)); 102 for(uint32_t i=0;i<nbRow;i++) { 103 for(uint32_t j=0;j<nbCol;j++) { 104 f[i*nbCol+j]->setup(1. / delta_t, cutoff->Value()); 105 settingsChanged(f[i*nbCol+j],input->ValueNoMutex(i, j)); 106 } 107 } 86 108 } 87 109 … … 89 111 first_update = false; 90 112 } else { 91 result = f->filter(input->ValueNoMutex(0, 0)); 92 output->SetValueNoMutex(0, 0, result); 113 for(uint32_t i=0;i<nbRow;i++) { 114 for(uint32_t j=0;j<nbCol;j++) { 115 float result = f[i*nbCol+j]->filter(input->ValueNoMutex(i, j)); 116 output->SetValueNoMutex(i, j, result); 117 } 118 } 93 119 } 94 120 … … 101 127 102 128 //ne gere pas les oscillations (s'arrete des qu'une valeure est bonne a 5%) 103 void ButterworthLowPass_impl::settingsChanged( float inputValue) {129 void ButterworthLowPass_impl::settingsChanged(PoleFilter*f,float inputValue) { 104 130 float result=f->filter(inputValue); 105 131 -
trunk/lib/FlairFilter/src/unexported/ButterworthLowPass_impl.h
r147 r162 122 122 ButterworthLowPass_impl(flair::filter::ButterworthLowPass *self, 123 123 const flair::gui::LayoutPosition *position, 124 std::string name, int order);124 std::string name, uint32_t order,uint32_t nbRow,uint32_t nbCol); 125 125 ~ButterworthLowPass_impl(); 126 126 void UpdateFrom(const flair::core::io_data *data); … … 128 128 129 129 private: 130 void settingsChanged( float inputValue);130 void settingsChanged(PoleFilter*f,float inputValue); 131 131 flair::gui::DoubleSpinBox *cutoff, *T; 132 PoleFilter * f;132 PoleFilter **f; 133 133 bool first_update; 134 134 flair::core::Time previous_time; 135 int order; 135 uint32_t order; 136 uint32_t nbRow, nbCol; 136 137 }; 137 138 -
trunk/lib/FlairSimulator/src/Gui_impl.cpp
r145 r162 131 131 Gui_impl::~Gui_impl() { 132 132 // printf("del Gui_impl\n"); 133 device->drop();133 //device->drop(); 134 134 135 135 delete receiver; … … 209 209 210 210 while (device->run()) { 211 if (dbtFile_r != NULL) // rejeu 212 { 211 if (dbtFile_r != NULL) {// rejeu 213 212 takeScreenshot(); // on enregistre l'image precedente 214 213 road_time_t time; … … 258 257 } 259 258 device->setWindowCaption(L"toto");*/ 260 261 if (dbtFile_r == NULL) // mode normal 262 { 259 if (dbtFile_r == NULL) {// mode normal 263 260 for (size_t i = 0; i < models.size(); i++) { 264 261 models.at(i)->pimpl_->CheckCollision(); -
trunk/lib/FlairSimulator/src/SimuCameraGL.cpp
r158 r162 111 111 free(buffer); 112 112 } 113 camera->removeAnimator(this); 114 camera->drop(); 113 115 } 114 116 -
trunk/lib/FlairSimulator/src/Simulator_impl.cpp
r15 r162 21 21 #include "Gui.h" 22 22 #include "Gui_impl.h" 23 #include <ISceneManager.h> 23 24 #endif 24 25 #include "Model.h" … … 46 47 models.at(i)->pimpl_->SafeStop(); 47 48 models.at(i)->pimpl_->Join(); 49 #ifdef GL 50 getGui()->getSceneManager()->getRootSceneNode()->removeChild(models.at(i)->pimpl_); 51 #endif 48 52 delete models.at(i); 49 53 }
Note:
See TracChangeset
for help on using the changeset viewer.