- Timestamp:
- Feb 7, 2018, 5:49:27 PM (7 years ago)
- Location:
- trunk/lib
- Files:
-
- 103 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/FrameworkManager_impl.cpp
r213 r214 211 211 } 212 212 213 UDT::startup( );213 UDT::startup(1024*256,1024*256,1024*256); 214 214 this->rcv_buf_size = rcv_buf_size; 215 215 -
trunk/lib/FlairCore/src/Matrix.cpp
r213 r214 19 19 #include <typeinfo> 20 20 #include <string.h> 21 22 //#include <iostream>23 21 24 22 using std::string; … … 37 35 this->col = col; 38 36 if (row >= matrix->Rows() || col >= matrix->Cols()) { 39 matrix->Err("index (%i,%i) out of bound (%i,%i)\n", row, col,37 matrix->Err("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 40 38 matrix->Rows() - 1, matrix->Cols() - 1); 41 39 size = 0; … … 71 69 } break; 72 70 } 71 } else if (typeid(matrix->GetDataType().GetElementDataType()) == 72 typeid(UnsignedIntegerType)) { 73 switch (matrix->GetDataType().GetElementDataType().GetSize()) { 74 case 1: { 75 uint8_t uint8Value = matrix->Value(row, col); 76 memcpy(dst, &uint8Value, 1); 77 } break; 78 case 2: { 79 uint16_t uint16Value = matrix->Value(row, col); 80 memcpy(dst, &uint16Value, 2); 81 } break; 82 } 73 83 } 74 84 } … … 133 143 if (row >= (uint32_t)pimpl_->descriptor->Rows() || 134 144 col >= (uint32_t)pimpl_->descriptor->Cols()) { 135 Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,145 Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 136 146 pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1); 137 147 return 0; … … 139 149 140 150 GetMutex(); 141 value = pimpl_-> datas[row][col];151 value = pimpl_->ValueNoMutex(row, col); 142 152 ReleaseMutex(); 143 153 … … 148 158 if (row >= (uint32_t)pimpl_->descriptor->Rows() || 149 159 col >= (uint32_t)pimpl_->descriptor->Cols()) { 150 Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,160 Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 151 161 pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1); 152 162 return 0; 153 163 } 154 164 155 return pimpl_-> datas[row][col];165 return pimpl_->ValueNoMutex(row, col); 156 166 } 157 167 … … 159 169 if (row >= (uint32_t)pimpl_->descriptor->Rows() || 160 170 col >= (uint32_t)pimpl_->descriptor->Cols()) { 161 Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,171 Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 162 172 pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1); 163 173 } else { 164 174 GetMutex(); 165 pimpl_-> datas[row][col]=value;175 pimpl_->SetValueNoMutex(row, col,value); 166 176 ReleaseMutex(); 167 177 } … … 171 181 if (row >= (uint32_t)pimpl_->descriptor->Rows() || 172 182 col >= (uint32_t)pimpl_->descriptor->Cols()) { 173 Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,183 Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 174 184 pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1); 175 185 } else { 176 pimpl_-> datas[row][col]=value;186 pimpl_->SetValueNoMutex(row, col,value); 177 187 } 178 188 } … … 180 190 void Matrix::CopyDatas(char *dst) const { 181 191 GetMutex(); 182 // printf("%f %x %i\n",cvGetReal2D(pimpl_->mat,0,0),dst,Size());183 192 memcpy(dst, pimpl_->datas, dataType.GetSize()); 184 193 ReleaseMutex(); -
trunk/lib/FlairCore/src/Matrix.h
r213 r214 27 27 * \brief Class defining a matrix 28 28 * 29 * Only supports float for the moment30 * TODO: write a template31 29 * 32 30 */ … … 196 194 197 195 Type const &GetDataType() const { return dataType; }; 198 196 void CopyDatas(char *dst) const; 199 197 private: 200 198 /*! … … 206 204 * \param dst destination buffer 207 205 */ 208 void CopyDatas(char *dst) const;206 //void CopyDatas(char *dst) const; 209 207 210 208 class Matrix_impl *pimpl_; -
trunk/lib/FlairCore/src/Matrix_impl.cpp
r213 r214 54 54 dynamic_cast<ScalarType const &>(elementDataType); 55 55 if (typeid(scalarType) == typeid(FloatType)) { 56 datas = (float **)malloc(descriptor->Rows() * sizeof(float*)); 57 if(datas==NULL) { 58 self->Err("error allocating matrix\n"); 59 return; 60 } 61 for(uint32_t i=0 ; i < descriptor->Rows() ; i++){ 62 datas[i] = (float*)malloc(descriptor->Cols() * sizeof(float) ); 63 if(datas[i]==NULL) { 64 self->Err("error allocating matrix\n"); 65 for(uint32_t j = i-1 ; j >= 0 ; j--) free(datas[j]); 66 free(datas); 67 return; 68 } 69 } 70 /* 71 } else if (typeid(scalarType) == typeid(SignedIntegerType)) { 56 datas =malloc(descriptor->Rows() * descriptor->Cols() * sizeof(float)); 57 } else if (typeid(scalarType) == typeid(SignedIntegerType) || typeid(scalarType) == typeid(UnsignedIntegerType) ) { 72 58 switch (elementDataType.GetSize()) { 73 59 case 1: 74 mat = cvCreateMat(descriptor->Rows(), descriptor->Cols(), CV_8SC1);60 datas=malloc(descriptor->Rows() * descriptor->Cols() * sizeof(uint8_t)); 75 61 break; 76 62 case 2: 77 mat = cvCreateMat(descriptor->Rows(), descriptor->Cols(), CV_16SC1);63 datas=malloc(descriptor->Rows() * descriptor->Cols() * sizeof(uint16_t)); 78 64 break; 79 65 default: 80 66 self->Err("unsupported integer scalar type\n"); 81 } */67 } 82 68 } else { 83 69 self->Err("unsupported scalar type\n"); … … 94 80 95 81 Matrix_impl::~Matrix_impl() { 96 for (uint32_t i = 0; i < descriptor->Rows();i++) {97 free(datas[i]);98 }99 82 free(datas); 100 83 delete descriptor; 101 84 } 85 86 float Matrix_impl::ValueNoMutex(uint32_t row, uint32_t col) const { 87 ScalarType const &scalarType = 88 dynamic_cast<ScalarType const &>(elementDataType); 89 if (typeid(scalarType) == typeid(FloatType)) { 90 return ((float*)datas)[row*descriptor->Cols()+col]; 91 } else if (typeid(scalarType) == typeid(SignedIntegerType)) { 92 switch (elementDataType.GetSize()) { 93 case 1: 94 return ((int8_t*)datas)[row*descriptor->Cols()+col]; 95 break; 96 case 2: 97 return ((int16_t*)datas)[row*descriptor->Cols()+col]; 98 break; 99 default: 100 self->Err("unsupported signed integer scalar type\n"); 101 } 102 } else if (typeid(scalarType) == typeid(UnsignedIntegerType)) { 103 switch (elementDataType.GetSize()) { 104 case 1: 105 return ((uint8_t*)datas)[row*descriptor->Cols()+col]; 106 break; 107 case 2: 108 return ((uint16_t*)datas)[row*descriptor->Cols()+col]; 109 break; 110 default: 111 self->Err("unsupported unsigned integer scalar type\n"); 112 } 113 } else { 114 self->Err("unsupported scalar type\n"); 115 } 116 return 0; 117 } 118 119 void Matrix_impl::SetValueNoMutex(uint32_t row, uint32_t col, float value) { 120 ScalarType const &scalarType = 121 dynamic_cast<ScalarType const &>(elementDataType); 122 if (typeid(scalarType) == typeid(FloatType)) { 123 ((float*)datas)[row*descriptor->Cols()+col]=value; 124 } else if (typeid(scalarType) == typeid(SignedIntegerType)) { 125 switch (elementDataType.GetSize()) { 126 case 1: 127 ((int8_t*)datas)[row*descriptor->Cols()+col]=value; 128 break; 129 case 2: 130 ((int16_t*)datas)[row*descriptor->Cols()+col]=value; 131 break; 132 default: 133 self->Err("unsupported signed integer scalar type\n"); 134 } 135 } else if (typeid(scalarType) == typeid(UnsignedIntegerType)) { 136 switch (elementDataType.GetSize()) { 137 case 1: 138 ((uint8_t*)datas)[row*descriptor->Cols()+col]=value; 139 break; 140 case 2: 141 ((uint16_t*)datas)[row*descriptor->Cols()+col]=value; 142 break; 143 default: 144 self->Err("unsupported unsigned integer scalar type\n"); 145 } 146 } else { 147 self->Err("unsupported scalar type\n"); 148 } 149 } -
trunk/lib/FlairCore/src/RangeFinderPlot.cpp
r137 r214 18 18 19 19 #include "RangeFinderPlot.h" 20 #include "cvmatrix.h" 21 #include "Layout.h" 20 #include "Matrix.h" 22 21 #include "LayoutPosition.h" 23 22 #include <cxcore.h> … … 32 31 string x_name, float xmin, float xmax, 33 32 string y_name, float ymin, float ymax, 34 const cvmatrix *datas, float start_angle,33 const Matrix *datas, float start_angle, 35 34 float end_angle, uint32_t nb_samples) 36 35 : SendData(position, name, "RangeFinderPlot", 200) { 37 36 this->datas = datas; 38 37 Warn("RangeFinderPlot::CopyDatas needs to be written\n"); 39 38 SetSendSize(datas->GetDataType().GetSize()); 40 39 … … 59 58 60 59 void RangeFinderPlot::CopyDatas(char *buf) const { 61 datas->GetMutex(); 62 memcpy(buf, datas->getCvMat()->data.ptr, datas->GetDataType().GetSize()); 63 datas->ReleaseMutex(); 60 //datas->CopyDatas(buf); 64 61 } 65 62 -
trunk/lib/FlairCore/src/RangeFinderPlot.h
r15 r214 20 20 namespace flair { 21 21 namespace core { 22 class cvmatrix;22 class Matrix; 23 23 } 24 24 } … … 61 61 std::string x_name, float xmin, float xmax, 62 62 std::string y_name, float ymin, float ymax, 63 const core:: cvmatrix *datas, float start_angle,63 const core::Matrix *datas, float start_angle, 64 64 float end_angle, uint32_t nb_samples); 65 65 … … 87 87 void ExtraXmlEvent(void){}; 88 88 89 const core:: cvmatrix *datas;89 const core::Matrix *datas; 90 90 }; 91 91 -
trunk/lib/FlairCore/src/cvmatrix.cpp
r15 r214 37 37 this->col = col; 38 38 if (row >= matrix->Rows() || col >= matrix->Cols()) { 39 matrix->Err("index (%i,%i) out of bound (%i,%i)\n", row, col,39 matrix->Err("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 40 40 matrix->Rows() - 1, matrix->Cols() - 1); 41 41 size = 0; … … 133 133 if (row >= (uint32_t)pimpl_->mat->rows || 134 134 col >= (uint32_t)pimpl_->mat->cols) { 135 Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,135 Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 136 136 pimpl_->mat->rows - 1, pimpl_->mat->cols - 1); 137 137 return 0; … … 148 148 if (row >= (uint32_t)pimpl_->mat->rows || 149 149 col >= (uint32_t)pimpl_->mat->cols) { 150 Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,150 Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 151 151 pimpl_->mat->rows - 1, pimpl_->mat->cols - 1); 152 152 return 0; … … 159 159 if (row >= (uint32_t)pimpl_->mat->rows || 160 160 col >= (uint32_t)pimpl_->mat->cols) { 161 Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,161 Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 162 162 pimpl_->mat->rows - 1, pimpl_->mat->cols - 1); 163 163 } else { … … 171 171 if (row >= (uint32_t)pimpl_->mat->rows || 172 172 col >= (uint32_t)pimpl_->mat->cols) { 173 Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,173 Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 174 174 pimpl_->mat->rows - 1, pimpl_->mat->cols - 1); 175 175 } else { -
trunk/lib/FlairCore/src/cvmatrix_descriptor.cpp
r15 r214 46 46 string name) { 47 47 if (row >= rows || col >= cols) { 48 getFrameworkManager()->Err("index out of bound %s (%i,%i), range(%i,%i)\n",48 getFrameworkManager()->Err("index out of bound %s (%i,%i), max (%i,%i)\n", 49 49 name.c_str(), row, col, rows - 1, cols - 1); 50 50 return; … … 55 55 string cvmatrix_descriptor::ElementName(uint32_t row, uint32_t col) const { 56 56 if (row >= rows || col >= cols) { 57 getFrameworkManager()->Err("index out of bound (%i,%i), range(%i,%i)\n",57 getFrameworkManager()->Err("index out of bound (%i,%i), max (%i,%i)\n", 58 58 row, col, rows - 1, cols - 1); 59 59 return *element_names[0]; // safe value... -
trunk/lib/FlairCore/src/unexported/Matrix_impl.h
r213 r214 33 33 flair::core::ScalarType const &elementDataType; 34 34 flair::core::cvmatrix_descriptor *descriptor; 35 float **datas; 35 void *datas; 36 void SetValueNoMutex(uint32_t row, uint32_t col, float value); 37 float ValueNoMutex(uint32_t row, uint32_t col) const; 36 38 37 39 private: -
trunk/lib/FlairCore/src/unexported/config.h
r213 r214 27 27 28 28 // nrt pipe size 29 #define NRT_PIPE_SIZE 1024 * 100 29 #define NRT_PIPE_SIZE 1024 * 100*10 30 30 31 31 // rt log heap size -
trunk/lib/FlairFilter/src/ButterworthLowPass.cpp
r162 r214 18 18 #include "ButterworthLowPass.h" 19 19 #include "ButterworthLowPass_impl.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Layout.h> 22 22 #include <LayoutPosition.h> … … 48 48 ButterworthLowPass::~ButterworthLowPass() { delete pimpl_; } 49 49 50 cvmatrix *ButterworthLowPass::Matrix(void) const { return pimpl_->output; }50 Matrix *ButterworthLowPass::GetMatrix(void) const { return pimpl_->output; } 51 51 52 52 float ButterworthLowPass::Output(void) const { -
trunk/lib/FlairFilter/src/ButterworthLowPass.h
r162 r214 18 18 namespace flair { 19 19 namespace core { 20 class cvmatrix;20 class Matrix; 21 21 } 22 22 namespace gui { … … 91 91 * \return filtered output 92 92 */ 93 core:: cvmatrix *Matrix(void) const;93 core::Matrix *GetMatrix(void) const; 94 94 95 95 /*! -
trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp
r165 r214 18 18 #include "ButterworthLowPass_impl.h" 19 19 #include "ButterworthLowPass.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Layout.h> 22 22 #include <GroupBox.h> … … 29 29 using namespace flair::filter; 30 30 31 ButterworthLowPass_impl::ButterworthLowPass_impl( ButterworthLowPass *self,31 ButterworthLowPass_impl::ButterworthLowPass_impl(const ButterworthLowPass *self, 32 32 const LayoutPosition *position, 33 33 string name, uint32_t order,uint32_t nbRow,uint32_t nbCol) { … … 41 41 cvmatrix_descriptor *desc = new cvmatrix_descriptor(nbRow, nbCol); 42 42 //desc->SetElementName(0, 0, "output"); 43 output = new cvmatrix(self, desc, floatType, name);43 output = new Matrix(self, desc, floatType, name); 44 44 delete desc; 45 45 … … 60 60 this->nbRow=nbRow; 61 61 this->nbCol=nbCol; 62 this->self=self; 62 63 } 63 64 … … 72 73 73 74 void ButterworthLowPass_impl::UpdateFrom(const io_data *data) { 74 cvmatrix *input = (cvmatrix *)data;75 75 float delta_t; 76 const Matrix* input = dynamic_cast<const Matrix*>(data); 77 78 if (!input) { 79 self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str()); 80 return; 81 } 76 82 77 83 if (T->ValueChanged() && T->Value() != 0) { -
trunk/lib/FlairFilter/src/ControlLaw.cpp
r148 r214 17 17 18 18 #include "ControlLaw.h" 19 #include < cvmatrix.h>19 #include <Matrix.h> 20 20 #include <cvmatrix_descriptor.h> 21 21 #include <DataPlot1D.h> … … 32 32 : IODevice(parent, name) { 33 33 if (nb_out == 1) { 34 output = new cvmatrix(this, nb_out, 1, floatType, name);34 output = new Matrix(this, nb_out, 1, floatType, name); 35 35 } else { 36 36 cvmatrix_descriptor *desc = new cvmatrix_descriptor(nb_out, 1); … … 40 40 desc->SetElementName(i, 0, ss.str()); 41 41 } 42 output = new cvmatrix(this, desc, floatType, name);42 output = new Matrix(this, desc, floatType, name); 43 43 delete desc; 44 44 } -
trunk/lib/FlairFilter/src/ControlLaw.h
r15 r214 21 21 } 22 22 namespace core { 23 class cvmatrix;23 class Matrix; 24 24 } 25 25 } … … 100 100 * 101 101 */ 102 core:: cvmatrix *input;102 core::Matrix *input; 103 103 104 104 /*! … … 109 109 * 110 110 */ 111 core:: cvmatrix *output;111 core::Matrix *output; 112 112 113 113 private: -
trunk/lib/FlairFilter/src/EulerDerivative.cpp
r157 r214 18 18 #include "EulerDerivative.h" 19 19 #include "EulerDerivative_impl.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <LayoutPosition.h> 22 22 … … 30 30 EulerDerivative::EulerDerivative(const IODevice *parent, 31 31 const LayoutPosition *position, string name, 32 const cvmatrix *init_value)32 const Matrix *init_value) 33 33 : IODevice(parent, name) { 34 34 pimpl_ = new EulerDerivative_impl(this, position, name, init_value); … … 40 40 EulerDerivative::~EulerDerivative() { delete pimpl_; } 41 41 42 cvmatrix *EulerDerivative::Matrix(void) const { return pimpl_->output; }42 Matrix *EulerDerivative::GetMatrix(void) const { return pimpl_->output; } 43 43 44 44 float EulerDerivative::Output(int row, int col) const { -
trunk/lib/FlairFilter/src/EulerDerivative.h
r147 r214 18 18 namespace flair { 19 19 namespace core { 20 class cvmatrix;20 class Matrix; 21 21 } 22 22 namespace gui { … … 56 56 EulerDerivative(const core::IODevice *parent, 57 57 const gui::LayoutPosition *position, std::string name, 58 const core:: cvmatrix *init_value = NULL);58 const core::Matrix *init_value = NULL); 59 59 60 60 /*! … … 79 79 * \return filtered output 80 80 */ 81 core:: cvmatrix *Matrix(void) const;81 core::Matrix *GetMatrix(void) const; 82 82 83 83 private: -
trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp
r148 r214 18 18 #include "EulerDerivative.h" 19 19 #include "EulerDerivative_impl.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Layout.h> 22 22 #include <GroupBox.h> … … 31 31 const LayoutPosition *position, 32 32 string name, 33 const cvmatrix *init_value) {33 const Matrix *init_value) { 34 34 first_update = true; 35 this->self = self; 35 36 36 37 if (init_value != NULL) { … … 43 44 } 44 45 } 45 output = new cvmatrix(self, desc,init_value->GetDataType().GetElementDataType(), name);46 output = new Matrix(self, desc,init_value->GetDataType().GetElementDataType(), name); 46 47 delete desc; 47 48 for (int i = 0; i < init_value->Rows(); i++) { … … 54 55 cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1); 55 56 desc->SetElementName(0, 0, "output"); 56 output = new cvmatrix(self, desc, floatType, name);57 output = new Matrix(self, desc, floatType, name); 57 58 delete desc; 58 59 } … … 60 61 61 62 cvmatrix_descriptor *desc = new cvmatrix_descriptor(output->Rows(), output->Cols()); 62 prev_value = new cvmatrix(self, desc, output->GetDataType().GetElementDataType(), name);63 prev_value = new Matrix(self, desc, output->GetDataType().GetElementDataType(), name); 63 64 64 65 … … 73 74 void EulerDerivative_impl::UpdateFrom(const io_data *data) { 74 75 float delta_t; 75 cvmatrix *input = (cvmatrix *)data; 76 const Matrix* input = dynamic_cast<const Matrix*>(data); 77 78 if (!input) { 79 self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str()); 80 return; 81 } 76 82 77 83 // on prend une fois pour toute les mutex et on fait des accès directs -
trunk/lib/FlairFilter/src/JoyReference.cpp
r157 r214 20 20 #include <Layout.h> 21 21 #include <LayoutPosition.h> 22 #include < cvmatrix.h>22 #include <Matrix.h> 23 23 #include <AhrsData.h> 24 24 #include <Euler.h> -
trunk/lib/FlairFilter/src/JoyReference_impl.cpp
r167 r214 20 20 #include <AhrsData.h> 21 21 #include <Euler.h> 22 #include < cvmatrix.h>22 #include <Matrix.h> 23 23 #include <Layout.h> 24 24 #include <GroupBox.h> … … 40 40 41 41 ahrsData = new AhrsData(self); 42 input = new cvmatrix(self, 4, 1, floatType, name);42 input = new Matrix(self, 4, 1, floatType, name); 43 43 44 44 cvmatrix_descriptor *desc = new cvmatrix_descriptor(4, 1); … … 48 48 desc->SetElementName(2, 0, "trim_roll"); 49 49 desc->SetElementName(3, 0, "trim_pitch"); 50 output = new cvmatrix(self, desc, floatType, name);50 output = new Matrix(self, desc, floatType, name); 51 51 delete desc; 52 52 … … 147 147 148 148 void JoyReference_impl::UpdateFrom(const io_data *data) { 149 cvmatrix *input = (cvmatrix *)data; 149 const Matrix* input = dynamic_cast<const Matrix*>(data); 150 151 if (!input) { 152 self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str()); 153 return; 154 } 150 155 151 156 if (previous_time == 0) -
trunk/lib/FlairFilter/src/LowPassFilter.cpp
r157 r214 18 18 #include "LowPassFilter.h" 19 19 #include "LowPassFilter_impl.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <LayoutPosition.h> 22 22 … … 30 30 LowPassFilter::LowPassFilter(const IODevice *parent, 31 31 const LayoutPosition *position, string name, 32 const cvmatrix *init_value)32 const Matrix *init_value) 33 33 : IODevice(parent, name) { 34 34 pimpl_ = new LowPassFilter_impl(this, position, name, init_value); … … 40 40 LowPassFilter::~LowPassFilter() { delete pimpl_; } 41 41 42 cvmatrix *LowPassFilter::Matrix(void) const { return pimpl_->output; }42 Matrix *LowPassFilter::GetMatrix(void) const { return pimpl_->output; } 43 43 44 44 float LowPassFilter::Output(int row, int col) const { -
trunk/lib/FlairFilter/src/LowPassFilter.h
r147 r214 18 18 namespace flair { 19 19 namespace core { 20 class cvmatrix;20 class Matrix; 21 21 } 22 22 namespace gui { … … 56 56 LowPassFilter(const core::IODevice *parent, 57 57 const gui::LayoutPosition *position, std::string name, 58 const core:: cvmatrix *init_value = NULL);58 const core::Matrix *init_value = NULL); 59 59 60 60 /*! … … 79 79 * \return filtered output 80 80 */ 81 core:: cvmatrix *Matrix(void) const;81 core::Matrix *GetMatrix(void) const; 82 82 83 83 private: -
trunk/lib/FlairFilter/src/LowPassFilter_impl.cpp
r148 r214 18 18 #include "LowPassFilter_impl.h" 19 19 #include "LowPassFilter.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Layout.h> 22 22 #include <GroupBox.h> 23 23 #include <SpinBox.h> 24 24 #include <DoubleSpinBox.h> 25 25 #include <typeinfo> 26 26 #define PI ((float)3.14159265358979323846) 27 27 … … 34 34 const LayoutPosition *position, 35 35 string name, 36 const cvmatrix *init_value) {36 const Matrix *init_value) { 37 37 38 38 if (init_value != NULL) { … … 45 45 } 46 46 } 47 output = new cvmatrix(self, desc,init_value->GetDataType().GetElementDataType(), name);47 output = new Matrix(self, desc,init_value->GetDataType().GetElementDataType(), name); 48 48 for (int i = 0; i < init_value->Rows(); i++) { 49 49 for (int j = 0; j < init_value->Cols(); j++) { … … 56 56 cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1); 57 57 desc->SetElementName(0, 0, "output"); 58 output = new cvmatrix(self, desc, floatType, name);58 output = new Matrix(self, desc, floatType, name); 59 59 delete desc; 60 60 } … … 68 68 69 69 previous_time=GetTime(); 70 this->self = self; 70 71 } 71 72 … … 74 75 void LowPassFilter_impl::UpdateFrom(const io_data *data) { 75 76 float delta_t; 76 cvmatrix *input = (cvmatrix *)data; 77 const Matrix* input = dynamic_cast<const Matrix*>(data); 78 79 if (!input) { 80 self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str()); 81 return; 82 } 77 83 78 84 // on prend une fois pour toute les mutex et on fait des accès directs -
trunk/lib/FlairFilter/src/NestedSat.cpp
r157 r214 18 18 #include "NestedSat.h" 19 19 #include "NestedSat_impl.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Layout.h> 22 22 #include <LayoutPosition.h> -
trunk/lib/FlairFilter/src/NestedSat_impl.cpp
r15 r214 18 18 #include "NestedSat_impl.h" 19 19 #include "NestedSat.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Layout.h> 22 22 #include <GroupBox.h> … … 34 34 35 35 // init matrix 36 self->input = new cvmatrix(self, 3, 1, floatType, name);36 self->input = new Matrix(self, 3, 1, floatType, name); 37 37 38 38 GroupBox *reglages_groupbox = new GroupBox(position, name); … … 50 50 void NestedSat_impl::UpdateFrom(const io_data *data) { 51 51 float cons, dcons, law; 52 cvmatrix *input = (cvmatrix *)data; 52 const Matrix* input = dynamic_cast<const Matrix*>(data); 53 54 if (!input) { 55 self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str()); 56 return; 57 } 53 58 54 59 input->GetMutex(); -
trunk/lib/FlairFilter/src/Pid.cpp
r157 r214 18 18 #include "Pid.h" 19 19 #include "Pid_impl.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Layout.h> 22 22 #include <LayoutPosition.h> -
trunk/lib/FlairFilter/src/PidThrust.cpp
r206 r214 18 18 #include "PidThrust.h" 19 19 #include "PidThrust_impl.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Layout.h> 22 22 #include <LayoutPosition.h> -
trunk/lib/FlairFilter/src/PidThrust_impl.cpp
r148 r214 17 17 #include "PidThrust_impl.h" 18 18 #include "PidThrust.h" 19 #include < cvmatrix.h>19 #include <Matrix.h> 20 20 #include <Layout.h> 21 21 #include <GroupBox.h> … … 36 36 37 37 // init matrix 38 self->input = new cvmatrix(self, 2, 1, floatType, name);38 self->input = new Matrix(self, 2, 1, floatType, name); 39 39 40 40 cvmatrix_descriptor *desc = new cvmatrix_descriptor(5, 1); … … 44 44 desc->SetElementName(3, 0, "p+i+d"); 45 45 desc->SetElementName(4, 0, "p+i+d+offset"); 46 state = new cvmatrix(self, desc, floatType, name);46 state = new Matrix(self, desc, floatType, name); 47 47 delete desc; 48 48 … … 76 76 float p, d, total; 77 77 float delta_t; 78 cvmatrix *input = (cvmatrix *)data; 78 const Matrix* input = dynamic_cast<const Matrix*>(data); 79 80 if (!input) { 81 self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str()); 82 return; 83 } 79 84 80 85 if (T->Value() == 0) { -
trunk/lib/FlairFilter/src/Pid_impl.cpp
r148 r214 17 17 #include "Pid_impl.h" 18 18 #include "Pid.h" 19 #include < cvmatrix.h>19 #include <Matrix.h> 20 20 #include <Layout.h> 21 21 #include <GroupBox.h> … … 34 34 35 35 // init matrix 36 self->input = new cvmatrix(self, 2, 1, floatType, name);36 self->input = new Matrix(self, 2, 1, floatType, name); 37 37 38 38 cvmatrix_descriptor *desc = new cvmatrix_descriptor(4, 1); … … 41 41 desc->SetElementName(2, 0, "d"); 42 42 desc->SetElementName(3, 0, "p+i+d"); 43 state = new cvmatrix(self, desc, floatType, name);43 state = new Matrix(self, desc, floatType, name); 44 44 delete desc; 45 45 … … 71 71 float p, d, total; 72 72 float delta_t; 73 cvmatrix *input = (cvmatrix *)data; 73 const Matrix* input = dynamic_cast<const Matrix*>(data); 74 75 if (!input) { 76 self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str()); 77 return; 78 } 74 79 75 80 if (T->Value() == 0) { -
trunk/lib/FlairFilter/src/TrajectoryGenerator1D.cpp
r205 r214 18 18 #include "TrajectoryGenerator1D.h" 19 19 #include "TrajectoryGenerator1D_impl.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Layout.h> 22 22 #include <LayoutPosition.h> … … 39 39 TrajectoryGenerator1D::~TrajectoryGenerator1D() { delete pimpl_; } 40 40 41 cvmatrix *TrajectoryGenerator1D::Matrix(void) const { return pimpl_->output; }41 Matrix *TrajectoryGenerator1D::GetMatrix(void) const { return pimpl_->output; } 42 42 43 43 void TrajectoryGenerator1D::StartTraj(float startPosition, float endPosition,float startVelocity) { -
trunk/lib/FlairFilter/src/TrajectoryGenerator1D.h
r205 r214 18 18 namespace flair { 19 19 namespace core { 20 class cvmatrix;20 class Matrix; 21 21 } 22 22 namespace gui { … … 152 152 * \return matrix 153 153 */ 154 core:: cvmatrix *Matrix(void) const;154 core::Matrix *GetMatrix(void) const; 155 155 156 156 private: -
trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp
r205 r214 18 18 #include "TrajectoryGenerator1D.h" 19 19 #include "TrajectoryGenerator1D_impl.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Layout.h> 22 22 #include <GroupBox.h> … … 63 63 desc->SetElementName(0, 0, "pos"); 64 64 desc->SetElementName(1, 0, "vel"); 65 output = new cvmatrix(self, desc, floatType, name);65 output = new Matrix(self, desc, floatType, name); 66 66 delete desc; 67 67 -
trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.cpp
r167 r214 18 18 #include "TrajectoryGenerator2DCircle.h" 19 19 #include "TrajectoryGenerator2DCircle_impl.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Layout.h> 22 22 #include <LayoutPosition.h> … … 44 44 } 45 45 46 cvmatrix *TrajectoryGenerator2DCircle::Matrix(void) const {46 Matrix *TrajectoryGenerator2DCircle::GetMatrix(void) const { 47 47 return pimpl_->output; 48 48 } -
trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.h
r167 r214 19 19 namespace flair { 20 20 namespace core { 21 class cvmatrix;21 class Matrix; 22 22 } 23 23 namespace gui { … … 131 131 * \return matrix 132 132 */ 133 core:: cvmatrix *Matrix(void) const;133 core::Matrix *GetMatrix(void) const; 134 134 135 135 /*! -
trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp
r167 r214 18 18 #include "TrajectoryGenerator2DCircle_impl.h" 19 19 #include "TrajectoryGenerator2DCircle.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Layout.h> 22 22 #include <GroupBox.h> … … 56 56 desc->SetElementName(1, 0, "vel.x"); 57 57 desc->SetElementName(1, 1, "vel.y"); 58 output = new cvmatrix(self, desc, floatType, name);58 output = new Matrix(self, desc, floatType, name); 59 59 delete desc; 60 60 } -
trunk/lib/FlairFilter/src/UavMultiplex.cpp
r137 r214 18 18 #include "UavMultiplex.h" 19 19 #include "UavMultiplex_impl.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <FrameworkManager.h> 22 22 #include <Tab.h> -
trunk/lib/FlairFilter/src/UavMultiplex_impl.cpp
r137 r214 18 18 #include "UavMultiplex_impl.h" 19 19 #include "UavMultiplex.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <FrameworkManager.h> 22 22 #include <TabWidget.h> … … 34 34 35 35 UavMultiplex_impl::UavMultiplex_impl(UavMultiplex *self, std::string name) { 36 input = new cvmatrix(self, 7, 1, floatType);36 input = new Matrix(self, 7, 1, floatType); 37 37 multiplexcombobox = NULL; 38 38 this->self = self; -
trunk/lib/FlairFilter/src/X4X8Multiplex_impl.cpp
r148 r214 18 18 #include "X4X8Multiplex_impl.h" 19 19 #include "X4X8Multiplex.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Tab.h> 22 22 #include <GridLayout.h> … … 55 55 } 56 56 57 output = new cvmatrix(self, desc, floatType);57 output = new Matrix(self, desc, floatType); 58 58 delete desc; 59 59 self->AddDataToLog(output); … … 83 83 float value[MAX_MOTORS]; 84 84 85 cvmatrix *input = (cvmatrix *)data; 85 const Matrix* input = dynamic_cast<const Matrix*>(data); 86 87 if (!input) { 88 self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str()); 89 return; 90 } 86 91 87 92 // on prend une fois pour toute le mutex et on fait des accès directs -
trunk/lib/FlairFilter/src/unexported/ButterworthLowPass_impl.h
r162 r214 19 19 namespace flair { 20 20 namespace core { 21 class cvmatrix;21 class Matrix; 22 22 } 23 23 namespace gui { … … 120 120 class ButterworthLowPass_impl { 121 121 public: 122 ButterworthLowPass_impl( flair::filter::ButterworthLowPass *self,122 ButterworthLowPass_impl(const flair::filter::ButterworthLowPass *self, 123 123 const flair::gui::LayoutPosition *position, 124 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); 127 flair::core:: cvmatrix *output;127 flair::core::Matrix *output; 128 128 129 129 private: … … 135 135 uint32_t order; 136 136 uint32_t nbRow, nbCol; 137 const flair::filter::ButterworthLowPass *self; 137 138 }; 138 139 -
trunk/lib/FlairFilter/src/unexported/EulerDerivative_impl.h
r15 r214 18 18 namespace flair { 19 19 namespace core { 20 class cvmatrix;20 class Matrix; 21 21 } 22 22 namespace gui { … … 38 38 const flair::gui::LayoutPosition *position, 39 39 std::string name, 40 const flair::core:: cvmatrix *init_value = NULL);40 const flair::core::Matrix *init_value = NULL); 41 41 ~EulerDerivative_impl(); 42 42 void UpdateFrom(const flair::core::io_data *data); 43 flair::core:: cvmatrix *output;43 flair::core::Matrix *output; 44 44 45 45 private: … … 47 47 flair::core::Time previous_time; 48 48 bool first_update; 49 flair::core::cvmatrix *prev_value; 49 flair::core::Matrix *prev_value; 50 flair::filter::EulerDerivative *self; 50 51 }; 51 52 -
trunk/lib/FlairFilter/src/unexported/JoyReference_impl.h
r15 r214 25 25 namespace flair { 26 26 namespace core { 27 class cvmatrix;27 class Matrix; 28 28 class io_data; 29 29 class AhrsData; … … 65 65 void Update(flair::core::Time time); 66 66 void UpdateFrom(const flair::core::io_data *data); 67 flair::core:: cvmatrix *output;67 flair::core::Matrix *output; 68 68 flair::core::AhrsData *ahrsData; 69 69 70 70 private: 71 flair::core:: cvmatrix *input;71 flair::core::Matrix *input; 72 72 73 73 flair::gui::GroupBox *reglages_groupbox; -
trunk/lib/FlairFilter/src/unexported/LowPassFilter_impl.h
r147 r214 18 18 namespace flair { 19 19 namespace core { 20 class cvmatrix;20 class Matrix; 21 21 } 22 22 namespace gui { … … 36 36 const flair::gui::LayoutPosition *position, 37 37 std::string name, 38 const flair::core:: cvmatrix *init_value = NULL);38 const flair::core::Matrix *init_value = NULL); 39 39 ~LowPassFilter_impl(); 40 40 void UpdateFrom(const flair::core::io_data *data); 41 flair::core:: cvmatrix *output;41 flair::core::Matrix *output; 42 42 43 43 private: 44 44 flair::core::Time previous_time; 45 45 flair::gui::DoubleSpinBox *freq, *T; 46 const flair::filter::LowPassFilter *self; 46 47 }; 47 48 -
trunk/lib/FlairFilter/src/unexported/PidThrust_impl.h
r15 r214 18 18 namespace flair { 19 19 namespace core { 20 class cvmatrix;20 class Matrix; 21 21 class io_data; 22 22 } … … 50 50 51 51 // matrix 52 flair::core:: cvmatrix *state;52 flair::core::Matrix *state; 53 53 54 54 flair::gui::DoubleSpinBox *T, *kp, *ki, *kd, *sat, *sati; -
trunk/lib/FlairFilter/src/unexported/Pid_impl.h
r15 r214 18 18 namespace flair { 19 19 namespace core { 20 class cvmatrix;20 class Matrix; 21 21 class io_data; 22 22 } … … 49 49 50 50 // matrix 51 flair::core:: cvmatrix *state;51 flair::core::Matrix *state; 52 52 53 53 flair::gui::DoubleSpinBox *T, *kp, *ki, *kd, *sat, *sati; -
trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator1D_impl.h
r205 r214 16 16 namespace flair { 17 17 namespace core { 18 class cvmatrix;18 class Matrix; 19 19 } 20 20 namespace gui { … … 39 39 void Reset(void); 40 40 float GetPercentageOfCompletion(void) const; 41 flair::core:: cvmatrix *output;41 flair::core::Matrix *output; 42 42 float pos_off, vel_off; 43 43 bool is_finished, is_started; -
trunk/lib/FlairFilter/src/unexported/TrajectoryGenerator2DCircle_impl.h
r167 r214 19 19 namespace flair { 20 20 namespace core { 21 class cvmatrix;21 class Matrix; 22 22 class io_data; 23 23 } … … 46 46 void FinishTraj(void); 47 47 bool is_running; 48 flair::core:: cvmatrix *output;48 flair::core::Matrix *output; 49 49 flair::core::Vector2Df pos_off, vel_off; 50 50 -
trunk/lib/FlairFilter/src/unexported/UavMultiplex_impl.h
r137 r214 20 20 namespace core { 21 21 class FrameworkManager; 22 class cvmatrix;22 class Matrix; 23 23 class io_data; 24 24 } … … 56 56 ~UavMultiplex_impl(); 57 57 58 flair::core:: cvmatrix *input;58 flair::core::Matrix *input; 59 59 void SetMultiplexComboBox(std::string name, int index); 60 60 int MultiplexValue(int index) const; -
trunk/lib/FlairFilter/src/unexported/X4X8Multiplex_impl.h
r15 r214 18 18 namespace flair { 19 19 namespace core { 20 class cvmatrix;20 class Matrix; 21 21 class io_data; 22 22 } … … 44 44 45 45 private: 46 flair::core:: cvmatrix *output;46 flair::core::Matrix *output; 47 47 flair::gui::ComboBox *pas; 48 48 flair::gui::DataPlot1D *plots[4]; -
trunk/lib/FlairMeta/src/MetaDualShock3.cpp
r157 r214 22 22 #include <Tab.h> 23 23 #include <FrameworkManager.h> 24 #include < cvmatrix.h>24 #include <Matrix.h> 25 25 #include <Ahrs.h> 26 26 #include <AhrsData.h> -
trunk/lib/FlairMeta/src/MetaDualShock3_impl.cpp
r38 r214 20 20 #include <JoyReference.h> 21 21 #include <Tab.h> 22 #include < cvmatrix.h>22 #include <Matrix.h> 23 23 #include <FrameworkManager.h> 24 24 … … 43 43 // receives updates from the controler 44 44 void MetaDualShock3_impl::UpdateFrom(const io_data *data) { 45 cvmatrix *input = (cvmatrix *)data; 45 const Matrix* input = dynamic_cast<const Matrix*>(data); 46 47 if (!input) { 48 self->Warn("casting %s to Matrix failed\n",data->ObjectName().c_str()); 49 return; 50 } 46 51 47 52 // on prend une fois pour toute le mutex et on fait des accès directs -
trunk/lib/FlairMeta/src/MetaUsRangeFinder.cpp
r170 r214 27 27 #include <EulerDerivative.h> 28 28 #include <GroupBox.h> 29 #include < cvmatrix.h>29 #include <Matrix.h> 30 30 31 31 using std::string; … … 53 53 us->UseDefaultPlot(); 54 54 55 us->GetPlot()->AddCurve(pbas_z-> Matrix()->Element(0), DataPlot::Blue);55 us->GetPlot()->AddCurve(pbas_z->GetMatrix()->Element(0), DataPlot::Blue); 56 56 57 57 vz_plot = new DataPlot1D(us->GetPlotTab()->LastRowLastCol(), "vz", -2, 2); 58 vz_plot->AddCurve(vz_euler-> Matrix()->Element(0));59 vz_plot->AddCurve(pbas_vz-> Matrix()->Element(0), DataPlot::Blue);58 vz_plot->AddCurve(vz_euler->GetMatrix()->Element(0)); 59 vz_plot->AddCurve(pbas_vz->GetMatrix()->Element(0), DataPlot::Blue); 60 60 } 61 61 -
trunk/lib/FlairMeta/src/MetaVrpnObject.cpp
r170 r214 27 27 #include <Tab.h> 28 28 #include <TabWidget.h> 29 #include < cvmatrix.h>29 #include <Matrix.h> 30 30 31 31 using std::string; … … 54 54 desc->SetElementName(i, 0, Output()->Name(i, 0)); 55 55 } 56 cvmatrix *prev_value = new cvmatrix(this, desc, floatType, name);56 Matrix *prev_value = new Matrix(this, desc, floatType, name); 57 57 delete desc; 58 58 … … 65 65 desc->SetElementName(i, 0, "d" + Output()->Name(i, 0)); 66 66 } 67 prev_value = new cvmatrix(this, desc, floatType, name);67 prev_value = new Matrix(this, desc, floatType, name); 68 68 delete desc; 69 69 … … 73 73 74 74 vx_opti_plot = new DataPlot1D(GetPlotTab()->NewRow(), "vx", -3, 3); 75 vx_opti_plot->AddCurve(euler-> Matrix()->Element(4));75 vx_opti_plot->AddCurve(euler->GetMatrix()->Element(4)); 76 76 vy_opti_plot = new DataPlot1D(GetPlotTab()->LastRowLastCol(), "vy", -3, 3); 77 vy_opti_plot->AddCurve(euler-> Matrix()->Element(5));77 vy_opti_plot->AddCurve(euler->GetMatrix()->Element(5)); 78 78 vz_opti_plot = new DataPlot1D(GetPlotTab()->LastRowLastCol(), "vz", -2, 2); 79 vz_opti_plot->AddCurve(euler-> Matrix()->Element(6));79 vz_opti_plot->AddCurve(euler->GetMatrix()->Element(6)); 80 80 81 81 plot_tab = new Tab(GetVrpnClient()->GetTabWidget(), "Mesures (xy) " + name); -
trunk/lib/FlairMeta/src/Uav.cpp
r186 r214 28 28 #include <NmeaGps.h> 29 29 #include <Bldc.h> 30 #include < cvmatrix.h>30 #include <Matrix.h> 31 31 #include "MetaUsRangeFinder.h" 32 32 #include "MetaVrpnObject.h" -
trunk/lib/FlairMeta/src/UavStateMachine.cpp
r206 r214 39 39 #include <Vector3D.h> 40 40 #include <Vector2D.h> 41 #include < cvmatrix.h>41 #include <Matrix.h> 42 42 #include <stdio.h> 43 43 #include <TrajectoryGenerator1D.h> … … 109 109 new TrajectoryGenerator1D(uavTab->NewRow(), "alt cons", "m"); 110 110 uav->GetMetaUsRangeFinder()->GetZPlot()->AddCurve( 111 altitudeTrajectory-> Matrix()->Element(0), DataPlot::Green);111 altitudeTrajectory->GetMatrix()->Element(0), DataPlot::Green); 112 112 uav->GetMetaUsRangeFinder()->GetVzPlot()->AddCurve( 113 altitudeTrajectory-> Matrix()->Element(1), DataPlot::Green);113 altitudeTrajectory->GetMatrix()->Element(1), DataPlot::Green); 114 114 } 115 115 … … 459 459 void UavStateMachine::TakeOff(void) { 460 460 flagZTrajectoryFinished = false; 461 462 if((altitudeState==AltitudeState_t::Stopped) && safeToFly && uav->isReadyToFly() && uav->GetBatteryMonitor()->IsBatteryLow()==false && !flagConnectionLost) { 461 462 if(altitudeState!=AltitudeState_t::Stopped) { 463 Warn("cannot takeoff, altitudeState!=AltitudeState_t::Stopped\n"); 464 joy->ErrorNotify(); 465 } else if(!safeToFly) { 466 Warn("cannot takeoff, uav is not safe to fly\n"); 467 joy->ErrorNotify(); 468 } else if(!uav->isReadyToFly()) { 469 Warn("cannot takeoff, uav is not ready\n"); 470 joy->ErrorNotify(); 471 } else if(uav->GetBatteryMonitor()->IsBatteryLow()) { 472 Warn("cannot takeoff, battery is low\n"); 473 joy->ErrorNotify(); 474 } else if(flagConnectionLost) { 475 Warn("cannot takeoff, connection with flairgcs lost\n"); 476 joy->ErrorNotify(); 477 } else { 463 478 //The uav always takes off in fail safe mode 464 479 flagBatteryLow=false; … … 480 495 altitudeState = AltitudeState_t::TakingOff; 481 496 SignalEvent(Event_t::TakingOff); 482 } else {483 Warn("cannot takeoff\n");484 joy->ErrorNotify();485 497 } 486 498 } … … 511 523 altitudeState=AltitudeState_t::FinishLanding; 512 524 safeToFly=false; 513 Printf("Emergency landing!\n"); 525 Warn("Emergency landing!\n"); 526 Warn("You will not be able to take off again\n"); 514 527 } 515 528 -
trunk/lib/FlairSensorActuator/src/AfroBldc_impl.cpp
r15 r214 22 22 #include <SpinBox.h> 23 23 #include <Label.h> 24 #include < cvmatrix.h>24 #include <Matrix.h> 25 25 #include <string.h> 26 26 -
trunk/lib/FlairSensorActuator/src/BlCtrlV2_impl.cpp
r15 r214 23 23 #include <SpinBox.h> 24 24 #include <Label.h> 25 #include < cvmatrix.h>25 #include <Matrix.h> 26 26 #include <string.h> 27 27 … … 96 96 97 97 // on prend une fois pour toute le mutex et on fait des accès directs 98 cvmatrix *output = self->output;98 Matrix *output = self->output; 99 99 output->GetMutex(); 100 100 for (int i = 0; i < nb_mot; i++) -
trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.cpp
r170 r214 25 25 #include <ComboBox.h> 26 26 #include <PushButton.h> 27 #include < cvmatrix.h>27 #include <Matrix.h> 28 28 #include <Mutex.h> 29 29 #include <FrameworkManager.h> … … 119 119 pas->AddItem("inverse"); 120 120 121 input = new cvmatrix((IODevice *)this, 8, 1, floatType);121 input = new Matrix((IODevice *)this, 8, 1, floatType); 122 122 123 123 cvmatrix_descriptor *desc = new cvmatrix_descriptor(4, 2); … … 131 131 desc->SetElementName(2, 1, "cons avant droite"); 132 132 desc->SetElementName(3, 1, "cons arriere gauche"); 133 output = new cvmatrix((IODevice *)this, desc, floatType);133 output = new Matrix((IODevice *)this, desc, floatType); 134 134 delete desc; 135 135 -
trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.h
r137 r214 24 24 namespace flair { 25 25 namespace core { 26 class cvmatrix;26 class Matrix; 27 27 class I2cPort; 28 28 } … … 97 97 98 98 // matrix 99 core:: cvmatrix *input;100 core:: cvmatrix *output;99 core::Matrix *input; 100 core::Matrix *output; 101 101 102 102 int tested_motor; -
trunk/lib/FlairSensorActuator/src/Bldc.cpp
r157 r214 18 18 #include "Bldc.h" 19 19 #include "Bldc_impl.h" 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <DoubleSpinBox.h> 22 22 #include <sstream> … … 53 53 } 54 54 55 output = new cvmatrix(this, desc, floatType);55 output = new Matrix(this, desc, floatType); 56 56 delete desc; 57 57 AddDataToLog(output); … … 81 81 uint8_t Bldc::MotorsCount(void) const { return pimpl_->motors_count; } 82 82 83 cvmatrix *Bldc::Output(void) const { return output; }83 Matrix *Bldc::Output(void) const { return output; } 84 84 85 85 bool Bldc::AreEnabled(void) const { return pimpl_->are_enabled; } -
trunk/lib/FlairSensorActuator/src/Bldc.h
r170 r214 19 19 namespace flair { 20 20 namespace core { 21 class cvmatrix;21 class Matrix; 22 22 } 23 23 namespace gui { … … 96 96 * 97 97 */ 98 core:: cvmatrix *Output(void) const;98 core::Matrix *Output(void) const; 99 99 100 100 /*! … … 161 161 162 162 protected: 163 core:: cvmatrix *output;163 core::Matrix *output; 164 164 165 165 private: -
trunk/lib/FlairSensorActuator/src/Bldc_impl.cpp
r137 r214 20 20 #include <GroupBox.h> 21 21 #include <DoubleSpinBox.h> 22 #include < cvmatrix.h>22 #include <Matrix.h> 23 23 #include <Label.h> 24 24 #include <PushButton.h> … … 110 110 111 111 void Bldc_impl::UpdateFrom(const io_data *data) { 112 cvmatrix *input = (cvmatrix *)data;112 Matrix *input = (Matrix *)data; 113 113 bool is_motor_running = false; 114 114 -
trunk/lib/FlairSensorActuator/src/Camera.cpp
r169 r214 119 119 if(logFormat==LogFormat::JPG) { 120 120 data->GetMutex(); 121 IplImage *img=((cvimage*)data)->img; 121 //IplImage *img=((cvimage*)data)->img; 122 const cvimage* input = dynamic_cast<const cvimage*>(data); 123 if (!input) { 124 Warn("casting %s to cvimage failed\n",data->ObjectName().c_str()); 125 return; 126 } 127 IplImage *img=input->img; 128 122 129 string filename=getFrameworkManager()->GetLogPath()+"/"+ObjectName()+"_"+std::to_string(data->DataTime())+".jpg"; 123 130 switch(((cvimage*)data)->GetDataType().GetFormat()) { -
trunk/lib/FlairSensorActuator/src/EmulatedController.cpp
r202 r214 17 17 #include <cstring> 18 18 #include <string> 19 #include < cvmatrix.h>19 #include <Matrix.h> 20 20 #include <stdexcept> 21 21 … … 46 46 } 47 47 48 template<typename T> void EmulatedController::fillVectorNoMutex( cvmatrix &vector,T data[],unsigned int size) {48 template<typename T> void EmulatedController::fillVectorNoMutex(Matrix &vector,T data[],unsigned int size) { 49 49 for (unsigned int i=0; i<size; i++) { 50 50 vector.SetValueNoMutex(i,0,data[i]); … … 52 52 } 53 53 54 void EmulatedController::fillVectorNoMutex( cvmatrix &destination,cvmatrix &source,unsigned int size) {54 void EmulatedController::fillVectorNoMutex(Matrix &destination,Matrix &source,unsigned int size) { 55 55 for (unsigned int i=0; i<size; i++) { 56 56 destination.SetValueNoMutex(i,0,source.Value(i,0)); … … 69 69 70 70 void EmulatedController::AddStep(unsigned int durationMs,string description,uint16_t buttonPressed, float leftAxisX, float leftAxisY, float rightAxisX, float rightAxisY) { 71 cvmatrix *axisMatrix=new cvmatrix((IODevice *)this,4,1,floatType);71 Matrix *axisMatrix=new Matrix((IODevice *)this,4,1,floatType); 72 72 axisMatrix->SetValueNoMutex(0,0,leftAxisX); 73 73 axisMatrix->SetValueNoMutex(1,0,leftAxisY); … … 75 75 axisMatrix->SetValueNoMutex(3,0,rightAxisY); 76 76 77 cvmatrix *buttonMatrix=new cvmatrix((IODevice *)this,16,1,SignedIntegerType(8));77 Matrix *buttonMatrix=new Matrix((IODevice *)this,16,1,SignedIntegerType(8)); 78 78 if (buttonPressed&(uint16_t)ButtonType::start) buttonMatrix->SetValueNoMutex(0,0,1); 79 79 if (buttonPressed&(uint16_t)ButtonType::select) buttonMatrix->SetValueNoMutex(1,0,1); … … 98 98 } 99 99 100 void EmulatedController::ComputeControllerData(DataType dataType, cvmatrix &data) {100 void EmulatedController::ComputeControllerData(DataType dataType, Matrix &data) { 101 101 static Time startStepTime=GetTime(); 102 102 … … 130 130 } 131 131 132 void EmulatedController::AcquireAxisData(core:: cvmatrix &axis) {132 void EmulatedController::AcquireAxisData(core::Matrix &axis) { 133 133 ComputeControllerData(DataType::axis,axis); 134 134 } 135 135 136 void EmulatedController::AcquireButtonData(core:: cvmatrix &button) {136 void EmulatedController::AcquireButtonData(core::Matrix &button) { 137 137 ComputeControllerData(DataType::button,button); 138 138 } -
trunk/lib/FlairSensorActuator/src/EmulatedController.h
r137 r214 21 21 namespace flair { 22 22 namespace core { 23 class cvmatrix;23 class Matrix; 24 24 } 25 25 namespace gui { … … 52 52 bool ProcessMessage(core::Message *msg); 53 53 bool IsDataFrameReady(); 54 void AcquireAxisData(core:: cvmatrix &axis); //responsible for getting the axis data from the hardware55 void AcquireButtonData(core:: cvmatrix &button); //responsible for getting the button data from the hardware54 void AcquireAxisData(core::Matrix &axis); //responsible for getting the axis data from the hardware 55 void AcquireButtonData(core::Matrix &button); //responsible for getting the button data from the hardware 56 56 bool ControllerInitialization(); 57 57 58 58 private: 59 59 enum class DataType { axis,button }; 60 void ComputeControllerData(DataType dataType, core:: cvmatrix &data);61 template<typename T> void fillVectorNoMutex(core:: cvmatrix &vector,T data[],unsigned int size);62 void fillVectorNoMutex(core:: cvmatrix &destination,core::cvmatrix &source,unsigned int size);60 void ComputeControllerData(DataType dataType, core::Matrix &data); 61 template<typename T> void fillVectorNoMutex(core::Matrix &vector,T data[],unsigned int size); 62 void fillVectorNoMutex(core::Matrix &destination,core::Matrix &source,unsigned int size); 63 63 struct StepData { 64 64 unsigned int durationMs; //milliseconds 65 core:: cvmatrix *axisData;66 core:: cvmatrix *buttonData;65 core::Matrix *axisData; 66 core::Matrix *buttonData; 67 67 std::string description; 68 68 void Print(); -
trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.cpp
r170 r214 21 21 #include <FrameworkManager.h> 22 22 #include <RangeFinderPlot.h> 23 #include < cvmatrix.h>23 #include <Matrix.h> 24 24 #include <Tab.h> 25 25 #include <sstream> … … 40 40 main_tab = new Tab(getFrameworkManager()->GetTabWidget(), name); 41 41 cvmatrix_descriptor *desc = new cvmatrix_descriptor(1081, 1); 42 output = new cvmatrix((IODevice *)this, desc, SignedIntegerType(16));42 output = new Matrix((IODevice *)this, desc, SignedIntegerType(16)); 43 43 delete desc; 44 44 … … 246 246 #endif 247 247 } 248 cvmatrix *HokuyoUTM30Lx::getDatas() { return output; }248 Matrix *HokuyoUTM30Lx::getDatas() { return output; } 249 249 250 250 void HokuyoUTM30Lx::UseDefaultPlot(void) { -
trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.h
r170 r214 23 23 namespace flair { 24 24 namespace core { 25 class cvmatrix;25 class Matrix; 26 26 class SerialPort; 27 27 class Mutex; … … 56 56 void getMesure(int startStep, int endStep, int clusterCount, int interval, 57 57 int scanNumber = 0); 58 core:: cvmatrix *getDatas(void);58 core::Matrix *getDatas(void); 59 59 60 60 /*! … … 78 78 79 79 // matrix 80 core:: cvmatrix *output;80 core::Matrix *output; 81 81 82 82 std::queue<std::string> bufRet; -
trunk/lib/FlairSensorActuator/src/HostEthController.cpp
r178 r214 18 18 #include "HostEthController.h" 19 19 #include <Controller.h> 20 #include < cvmatrix.h>20 #include <Matrix.h> 21 21 #include <Tab.h> 22 22 #include <TabWidget.h> -
trunk/lib/FlairSensorActuator/src/HostEthController.h
r178 r214 26 26 namespace flair { 27 27 namespace core { 28 class cvmatrix;28 class Matrix; 29 29 class TcpSocket; 30 30 class UdpSocket; … … 81 81 GetAxisData() = 0; // responsible for getting the axis data from the hardware 82 82 unsigned int axisNumber; 83 core:: cvmatrix *axis;83 core::Matrix *axis; 84 84 gui::DataPlot1D **axisPlot; 85 85 uint32_t bitsPerAxis; … … 90 90 // from the hardware 91 91 unsigned int buttonNumber; 92 core:: cvmatrix *button;92 core::Matrix *button; 93 93 uint8_t buttonOffset; 94 94 bool meaningfulDataAvailable; -
trunk/lib/FlairSensorActuator/src/LaserRangeFinder.cpp
r148 r214 17 17 18 18 #include "LaserRangeFinder.h" 19 #include < cvmatrix.h>19 #include <Matrix.h> 20 20 #include <Tab.h> 21 21 #include <TabWidget.h> … … 38 38 : IODevice(getFrameworkManager(), name) { 39 39 cvmatrix_descriptor *desc = new cvmatrix_descriptor(360, 1); 40 output = new cvmatrix(this, desc, floatType);40 output = new Matrix(this, desc, floatType); 41 41 delete desc; 42 42 AddDataToLog(output); -
trunk/lib/FlairSensorActuator/src/LaserRangeFinder.h
r170 r214 19 19 namespace core { 20 20 class FrameworkManager; 21 class cvmatrix;21 class Matrix; 22 22 } 23 23 namespace gui { … … 102 102 * \return output matrix 103 103 */ 104 core:: cvmatrix *output;104 core::Matrix *output; 105 105 106 106 /*! -
trunk/lib/FlairSensorActuator/src/NmeaGps.cpp
r206 r214 176 176 177 177 int result; 178 Printf("%s\n",frame);179 Printf("%x %x\n",&parser,parser.buffer);180 178 result = nmea_parse(&parser, frame, frame_size, &info); 181 Printf("%x %x\n",&parser,parser.buffer);179 182 180 if (result != 1) { 183 181 Warn("unrecognized nmea sentence: %s\n",frame); 184 182 return; 185 183 } 186 Printf("3\n"); 187 Printf("%x %x\n",&parser,parser.buffer); 184 188 185 result = nmea_parse_GPGGA(frame, frame_size, &pack); 189 Printf("%x %x\n",&parser,parser.buffer); 186 190 187 if (result == 1) { 191 Printf("%x %x\n",&parser,parser.buffer);192 188 nmea_info2pos(&info, &pos); 193 Printf("%x %x\n",&parser,parser.buffer);194 189 // Printf("nb:%i fix:%i lat:%f long:%f alt:%f vel:%f angle:%f\n",pack.satinuse,pack.sig,info.lat,info.lon,info.elv,info.speed*1000./3600.,info.direction); 195 190 //Printf("lat:%f long:%f\n",pos.lat,pos.lon); -
trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp
r157 r214 20 20 #include <TabWidget.h> 21 21 #include <FrameworkManager.h> 22 #include < cvmatrix.h>22 #include <Matrix.h> 23 23 #include <sstream> 24 24 … … 44 44 desc->SetElementName(i, 0, channel_name.str()); 45 45 } 46 output = new cvmatrix(this, desc, floatType, name);46 output = new Matrix(this, desc, floatType, name); 47 47 delete desc; 48 48 -
trunk/lib/FlairSensorActuator/src/RadioReceiver.h
r137 r214 19 19 namespace flair { 20 20 namespace core { 21 class cvmatrix;21 class Matrix; 22 22 } 23 23 namespace gui { … … 87 87 void UpdateFrom(const core::io_data *data){}; 88 88 89 core:: cvmatrix *output;89 core::Matrix *output; 90 90 bool is_connected; 91 91 unsigned int nb_channels; -
trunk/lib/FlairSensorActuator/src/SimuBldc.cpp
r158 r214 21 21 #include <GroupBox.h> 22 22 #include <SharedMem.h> 23 #include < cvmatrix.h>23 #include <Matrix.h> 24 24 #include <sstream> 25 #include <string.h> 25 26 26 27 using std::string; … … 36 37 : Bldc(parent, layout, name, motors_count) { 37 38 shmem = 38 new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float) );39 new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)+sizeof(Time)); 39 40 40 41 GroupBox *groupbox = new GroupBox(layout->NewRow(), "simubldc"); 41 42 k = new DoubleSpinBox(groupbox->NewRow(), "k driver:", 0, 10000, 1); 42 43 44 buf=(char*)malloc(motors_count * sizeof(float)+sizeof(Time)); 45 if(buf==NULL) { 46 Err("error creating buffer\n"); 47 return; 48 } 43 49 SetIsReady(true); 44 50 } … … 48 54 : Bldc(parent, name, motors_count) { 49 55 shmem = 50 new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)); 56 new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)+sizeof(Time)); 57 58 buf=(char*)malloc(motors_count * sizeof(float)+sizeof(Time)); 59 if(buf==NULL) { 60 Err("error creating buffer\n"); 61 return; 62 } 63 64 // reset values 65 float *values=(float*)buf; 66 for (int i = 0; i < motors_count; i++) values[i] = 0; 67 Time time=GetTime(); 68 memcpy(buf+motors_count * sizeof(float),&time,sizeof(Time)); 51 69 52 // reset values 53 float values[motors_count]; 54 for (int i = 0; i < motors_count; i++) 55 values[i] = 0; 56 57 shmem->Write((char *)&values, motors_count * sizeof(float)); 70 shmem->Write(buf, motors_count * sizeof(float)+sizeof(Time)); 58 71 59 72 SetIsReady(true); 60 73 } 61 74 62 SimuBldc::~SimuBldc() {} 75 SimuBldc::~SimuBldc() { 76 if(buf!=NULL) free(buf); 77 } 63 78 64 79 string SimuBldc::ShMemName(uint32_t modelId,uint32_t deviceId) { … … 69 84 70 85 void SimuBldc::SetMotors(float *value) { 71 float values[MotorsCount()]; 86 float *values=(float*)buf; 87 for (int i = 0; i < MotorsCount(); i++) values[i] = k->Value() * value[i]; 88 Time time=GetTime(); 89 memcpy(buf+MotorsCount() * sizeof(float),&time,sizeof(Time)); 72 90 73 for (int i = 0; i < MotorsCount(); i++) 74 values[i] = k->Value() * value[i]; 75 76 shmem->Write((char *)&values, MotorsCount() * sizeof(float)); 91 shmem->Write(buf, MotorsCount() * sizeof(float)+sizeof(Time)); 77 92 78 93 // on prend une fois pour toute le mutex et on fait des accès directs 79 94 output->GetMutex(); 80 for (int i = 0; i < MotorsCount(); i++) 95 for (int i = 0; i < MotorsCount(); i++) { 81 96 output->SetValueNoMutex(i, 0, values[i]); 97 } 82 98 output->ReleaseMutex(); 83 99 } 84 100 85 void SimuBldc::GetSpeeds(float *value) const { 86 float values[MotorsCount()]; 87 shmem->Read((char *)&values, MotorsCount() * sizeof(float)); 101 void SimuBldc::GetSpeeds(float *value,Time* time) const { 102 float *values=(float*)buf; 103 shmem->Read(buf, MotorsCount() * sizeof(float)+sizeof(Time)); 104 memcpy(time,buf+MotorsCount() * sizeof(float),sizeof(Time)); 88 105 89 for (int i = 0; i < MotorsCount(); i++) 106 for (int i = 0; i < MotorsCount(); i++) { 90 107 value[i] = values[i]; 108 } 91 109 } 92 110 -
trunk/lib/FlairSensorActuator/src/SimuBldc.h
r158 r214 20 20 class SharedMem; 21 21 class IODevice; 22 class cvmatrix;22 class Matrix; 23 23 } 24 24 namespace gui { … … 78 78 * 79 79 * \param value array to store motors speeds 80 * \param time time when shared memory was written 80 81 */ 81 void GetSpeeds(float *value ) const;82 void GetSpeeds(float *value,core::Time* time) const; 82 83 83 84 /*! … … 113 114 core::SharedMem *shmem; 114 115 gui::DoubleSpinBox *k; 116 char *buf; 117 115 118 }; 116 119 } // end namespace actuator -
trunk/lib/FlairSensorActuator/src/SimuGps.cpp
r206 r214 25 25 #include <GroupBox.h> 26 26 #include <Euler.h> 27 #include < cvmatrix.h>27 #include <Matrix.h> 28 28 #include <sstream> 29 29 #include "geodesie.h" … … 80 80 void SimuGps::UpdateFrom(const io_data *data) { 81 81 if (data != NULL) { 82 cvmatrix *input = (cvmatrix *)data;82 Matrix *input = (Matrix *)data; 83 83 gps_states_t state; 84 84 … … 109 109 vtg.spk_k='K'; 110 110 vtg.spn_n='N'; 111 gga.elv_units='M'; 112 gga.diff_units='M'; 111 113 112 114 if (dataRate == NULL) { … … 152 154 gga.satinuse=numberOfSatellites->Value(); 153 155 154 nmea_gen_GPGGA(buf,sizeof(buf),&gga); 155 Printf("1\n"); 156 parseFrame(buf,sizeof(buf)); 157 156 int size=nmea_gen_GPGGA(buf,sizeof(buf),&gga); 157 parseFrame(buf,size); 158 158 159 vtg.dir=90-Euler::ToDegree(atan2f(state.vn,state.ve)); 159 160 vtg.spk=sqrtf(state.ve*state.ve+state.vn*state.vn)*3600./1000.; 160 nmea_gen_GPVTG(buf,sizeof(buf),&vtg); 161 Printf("2\n"); 162 parseFrame(buf,sizeof(buf)); 161 size=nmea_gen_GPVTG(buf,sizeof(buf),&vtg); 162 parseFrame(buf,size); 163 163 } 164 164 -
trunk/lib/FlairSensorActuator/src/SimuImu.cpp
r202 r214 21 21 #include <SpinBox.h> 22 22 #include <GroupBox.h> 23 #include < cvmatrix.h>23 #include <Matrix.h> 24 24 #include <SharedMem.h> 25 25 #include <AhrsData.h> … … 70 70 void SimuImu::UpdateFrom(const io_data *data) { 71 71 if (data != NULL) { 72 cvmatrix *input = (cvmatrix *)data;72 Matrix *input = (Matrix *)data; 73 73 imu_states_t state; 74 74 -
trunk/lib/FlairSensorActuator/src/SimuLaser.cpp
r158 r214 20 20 #include <SpinBox.h> 21 21 #include <GroupBox.h> 22 #include < cvmatrix.h>22 #include <Matrix.h> 23 23 #include <SharedMem.h> 24 24 #include <sstream> -
trunk/lib/FlairSensorActuator/src/SimuUs.cpp
r158 r214 20 20 #include <SpinBox.h> 21 21 #include <GroupBox.h> 22 #include < cvmatrix.h>22 #include <Matrix.h> 23 23 #include <SharedMem.h> 24 24 #include <sstream> -
trunk/lib/FlairSensorActuator/src/Srf08.cpp
r157 r214 21 21 #include <GroupBox.h> 22 22 #include <SpinBox.h> 23 #include < cvmatrix.h>23 #include <Matrix.h> 24 24 #include <string.h> 25 25 #include <errno.h> -
trunk/lib/FlairSensorActuator/src/TargetController.cpp
r202 r214 20 20 #include <Tab.h> 21 21 #include <FrameworkManager.h> 22 #include < cvmatrix.h>22 #include <Matrix.h> 23 23 24 24 #include <cstring> … … 122 122 } else { 123 123 124 axis = new cvmatrix((IODevice *)this, axisNumber, 1, floatType);124 axis = new Matrix((IODevice *)this, axisNumber, 1, floatType); 125 125 button = 126 new cvmatrix((IODevice *)this, buttonNumber, 1, SignedIntegerType(8));126 new Matrix((IODevice *)this, buttonNumber, 1, SignedIntegerType(8)); 127 127 128 128 while (!ToBeStopped()) { -
trunk/lib/FlairSensorActuator/src/TargetController.h
r137 r214 27 27 namespace core { 28 28 class FrameworkManager; 29 class cvmatrix;29 class Matrix; 30 30 class Socket; 31 31 class io_data; … … 82 82 // axis stuff 83 83 unsigned int axisNumber; 84 core:: cvmatrix *axis = NULL;85 virtual void AcquireAxisData(core:: cvmatrix &axis) = 0; // responsible for84 core::Matrix *axis = NULL; 85 virtual void AcquireAxisData(core::Matrix &axis) = 0; // responsible for 86 86 // getting the axis 87 87 // data from the … … 90 90 // button stuff 91 91 unsigned int buttonNumber; 92 core:: cvmatrix *button = NULL;93 virtual void AcquireButtonData(core:: cvmatrix &button) = 0; // responsible for92 core::Matrix *button = NULL; 93 virtual void AcquireButtonData(core::Matrix &button) = 0; // responsible for 94 94 // getting the 95 95 // button data -
trunk/lib/FlairSensorActuator/src/TargetEthController.cpp
r202 r214 24 24 #include <cstring> 25 25 #include <string> 26 #include < cvmatrix.h>26 #include <Matrix.h> 27 27 #include <stdexcept> 28 28 … … 150 150 } 151 151 152 void TargetEthController::AcquireAxisData(core:: cvmatrix &axis) {152 void TargetEthController::AcquireAxisData(core::Matrix &axis) { 153 153 axis.GetMutex(); 154 154 // char testFrameBuffer[3]={(char)0x09,(char)0x59,(char)0xB8}; … … 166 166 } 167 167 168 void TargetEthController::AcquireButtonData(core:: cvmatrix &button) {168 void TargetEthController::AcquireButtonData(core::Matrix &button) { 169 169 uint8_t buttonValue; 170 170 int currentButton = 0; -
trunk/lib/FlairSensorActuator/src/TargetEthController.h
r178 r214 27 27 namespace core { 28 28 class FrameworkManager; 29 class cvmatrix;29 class Matrix; 30 30 class TcpSocket; 31 31 class UdpSocket; … … 62 62 63 63 bool IsDataFrameReady(); 64 void AcquireAxisData(core:: cvmatrix &axis); // responsible for getting the64 void AcquireAxisData(core::Matrix &axis); // responsible for getting the 65 65 // axis data from the hardware 66 void AcquireButtonData(core:: cvmatrix &button); // responsible for getting the66 void AcquireButtonData(core::Matrix &button); // responsible for getting the 67 67 // button data from the 68 68 // hardware -
trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp
r148 r214 23 23 #include <Layout.h> 24 24 #include <DataPlot1D.h> 25 #include < cvmatrix.h>25 #include <Matrix.h> 26 26 27 27 using std::string; … … 38 38 cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1); 39 39 desc->SetElementName(0, 0, name); 40 output = new cvmatrix(this, desc, floatType);40 output = new Matrix(this, desc, floatType); 41 41 delete desc; 42 42 AddDataToLog(output); -
trunk/lib/FlairSensorActuator/src/UsRangeFinder.h
r137 r214 17 17 18 18 namespace flair { 19 namespace core {20 class cvmatrix;21 }22 namespace gui {23 class Tab;24 class TabWidget;25 class GroupBox;26 class Layout;27 class DataPlot1D;28 }19 namespace core { 20 class Matrix; 21 } 22 namespace gui { 23 class Tab; 24 class TabWidget; 25 class GroupBox; 26 class Layout; 27 class DataPlot1D; 28 } 29 29 } 30 30 … … 119 119 * \return output matrix 120 120 */ 121 core:: cvmatrix *output;121 core::Matrix *output; 122 122 123 123 /*! -
trunk/lib/FlairSensorActuator/src/VrpnObject.cpp
r167 r214 20 20 #include "VrpnClient.h" 21 21 #include <string.h> 22 23 #include <cvmatrix.h> 22 #include <Matrix.h> 24 23 25 24 using std::string; … … 53 52 } 54 53 55 cvmatrix *VrpnObject::Output(void) const { return pimpl_->output; }54 Matrix *VrpnObject::Output(void) const { return pimpl_->output; } 56 55 57 cvmatrix *VrpnObject::State(void) const { return pimpl_->state; }56 Matrix *VrpnObject::State(void) const { return pimpl_->state; } 58 57 59 58 Tab *VrpnObject::GetPlotTab(void) const { return pimpl_->plot_tab; } -
trunk/lib/FlairSensorActuator/src/VrpnObject.h
r167 r214 21 21 namespace flair { 22 22 namespace core { 23 class cvmatrix;23 class Matrix; 24 24 class Quaternion; 25 25 } … … 126 126 * \return Output matrix 127 127 */ 128 core:: cvmatrix *Output(void) const;128 core::Matrix *Output(void) const; 129 129 130 130 /*! … … 139 139 * \return State matrix 140 140 */ 141 core:: cvmatrix *State(void) const;141 core::Matrix *State(void) const; 142 142 143 143 /*! -
trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp
r167 r214 25 25 #include <unistd.h> 26 26 #include <vrpn_Connection.h> 27 #include < cvmatrix.h>27 #include <Matrix.h> 28 28 #include <Tab.h> 29 29 #include <TabWidget.h> … … 65 65 desc->SetElementName(5, 0, "y"); 66 66 desc->SetElementName(6, 0, "z"); 67 output = new cvmatrix(self, desc, floatType);67 output = new Matrix(self, desc, floatType); 68 68 delete desc; 69 69 … … 72 72 desc->SetElementName(1, 0, "pitch"); 73 73 desc->SetElementName(2, 0, "yaw"); 74 state = new cvmatrix(self, desc, floatType);74 state = new Matrix(self, desc, floatType); 75 75 delete desc; 76 76 -
trunk/lib/FlairSensorActuator/src/XBldc_impl.cpp
r15 r214 19 19 #include "XBldc.h" 20 20 #include <I2cPort.h> 21 #include < cvmatrix.h>21 #include <Matrix.h> 22 22 #include <string.h> 23 23 -
trunk/lib/FlairSensorActuator/src/unexported/VrpnObject_impl.h
r167 r214 28 28 namespace flair { 29 29 namespace core { 30 class cvmatrix;30 class Matrix; 31 31 } 32 32 namespace gui { … … 58 58 flair::gui::DataPlot1D *y_plot; 59 59 flair::gui::DataPlot1D *z_plot; 60 flair::core:: cvmatrix *output, *state;60 flair::core::Matrix *output, *state; 61 61 62 62 static void VRPN_CALLBACK handle_pos(void *userdata, const vrpn_TRACKERCB t); -
trunk/lib/FlairSimulator/src/Model_impl.cpp
r202 r214 25 25 #include "SpinBox.h" 26 26 #include "CheckBox.h" 27 #include " cvmatrix.h"27 #include "Matrix.h" 28 28 #include "Euler.h" 29 29 #include <math.h> … … 134 134 desc->SetElementName(17, 0, "my"); 135 135 desc->SetElementName(18, 0, "mz"); 136 output = new cvmatrix(this, desc, floatType, "state");136 output = new Matrix(this, desc, floatType, "state"); 137 137 delete desc; 138 138 -
trunk/lib/FlairSimulator/src/SimuLaserGL.cpp
r158 r214 20 20 #include "Model.h" 21 21 #include "Gui.h" 22 #include < cvmatrix.h>22 #include <Matrix.h> 23 23 #include <SharedMem.h> 24 24 #include <TabWidget.h> -
trunk/lib/FlairSimulator/src/SimuUsGL.cpp
r167 r214 17 17 #include "SimuUsGL.h" 18 18 #include "Model.h" 19 #include < cvmatrix.h>19 #include <Matrix.h> 20 20 #include <SharedMem.h> 21 21 #include <TabWidget.h> … … 54 54 #endif 55 55 // todo: utiliser le placement de l'us dans le drone et sa portée 56 cvmatrix *input = (cvmatrix *)data;56 Matrix *input = (Matrix *)data; 57 57 value = input->Value(9, 0); 58 58 shmem->Write((char *)&value, sizeof(float)); -
trunk/lib/FlairSimulator/src/X4.cpp
r167 r214 20 20 #include <Tab.h> 21 21 #include <DoubleSpinBox.h> 22 #include <SpinBox.h> 22 23 #include <GroupBox.h> 23 24 #include <math.h> … … 73 74 j_yaw = new DoubleSpinBox(setup_tab->LastRowLastCol(), "j_yaw:", 0, 1, 0.001, 74 75 5); // moment d'inertie d'un axe (N.m.s²/rad) 76 77 motorTimeout = new SpinBox(setup_tab->NewRow(), "motor timeout:","ms", 0, 1000, 100,100); 75 78 76 79 motors = new SimuBldc(this, name, 4, modelId,0); … … 199 202 float fl_speed, fr_speed, rl_speed, rr_speed; 200 203 float u_roll, u_pitch, u_yaw, u_thrust; 204 Time motorTime; 201 205 #ifdef GL 202 206 motor_speed_mutex->GetMutex(); 203 207 #endif // GL 204 motors->GetSpeeds(motor_speed); 208 motors->GetSpeeds(motor_speed,&motorTime); 209 if((GetTime()-motorTime)/1000000>motorTimeout->Value()) { 210 for(int i=0;i<4;i++) { 211 if(motor_speed[i]!=0) { 212 //Printf("timout\n"); 213 for(int i=0;i<4;i++) motor_speed[i]=0; 214 break; 215 } 216 } 217 } 205 218 #ifdef GL 206 219 motor_speed_mutex->ReleaseMutex(); 207 220 #endif // GL 221 208 222 fl_speed = motor_speed[0]; 209 223 fr_speed = motor_speed[1]; … … 212 226 213 227 /* 214 215 216 217 218 228 ** =================================================================== 229 ** u roll: roll torque 230 ** 231 ** =================================================================== 232 */ 219 233 u_roll = arm_length->Value() * k_mot->Value() * 220 234 (fl_speed * fl_speed + rl_speed * rl_speed - fr_speed * fr_speed - -
trunk/lib/FlairSimulator/src/X4.h
r158 r214 26 26 namespace gui { 27 27 class DoubleSpinBox; 28 class SpinBox; 28 29 } 29 30 namespace actuator { … … 63 64 gui::DoubleSpinBox *f_air_vert, *f_air_lat; 64 65 gui::DoubleSpinBox *j_roll, *j_pitch, *j_yaw; 66 gui::SpinBox *motorTimeout; 65 67 }; 66 68 } // end namespace simulator -
trunk/lib/FlairSimulator/src/X8.cpp
r167 r214 20 20 #include <Tab.h> 21 21 #include <DoubleSpinBox.h> 22 #include <SpinBox.h> 22 23 #include <GroupBox.h> 23 24 #include <math.h> … … 81 82 setup_tab->LastRowLastCol(), "S:", 1, 2, 82 83 0.1); // coefficient de forme des helices 1<S=1+Ss/Sprop<2 (sans unite) 84 85 motorTimeout = new SpinBox(setup_tab->NewRow(), "motor timeout:","ms", 0, 1000, 100,100); 83 86 84 87 motors = new SimuBldc(this, name, 8, modelId,0); … … 231 234 float u_roll, u_pitch, u_yaw, u_thrust; 232 235 float omega; 236 Time motorTime; 233 237 #ifdef GL 234 238 motor_speed_mutex->GetMutex(); 235 239 #endif // GL 236 motors->GetSpeeds(motor_speed); 240 motors->GetSpeeds(motor_speed,&motorTime); 241 if((GetTime()-motorTime)/1000000>motorTimeout->Value()) { 242 for(int i=0;i<8;i++) { 243 if(motor_speed[i]!=0) { 244 //Printf("timout\n"); 245 for(int i=0;i<8;i++) motor_speed[i]=0; 246 break; 247 } 248 } 249 } 237 250 #ifdef GL 238 251 motor_speed_mutex->ReleaseMutex(); -
trunk/lib/FlairSimulator/src/X8.h
r158 r214 26 26 namespace gui { 27 27 class DoubleSpinBox; 28 class SpinBox; 28 29 } 29 30 namespace actuator { … … 65 66 gui::DoubleSpinBox *j_roll, *j_pitch, *j_yaw; 66 67 gui::DoubleSpinBox *j_r, *sigma, *S; 68 gui::SpinBox *motorTimeout; 67 69 }; 68 70 } // end namespace simulator -
trunk/lib/FlairSimulator/src/unexported/Model_impl.h
r167 r214 25 25 namespace flair { 26 26 namespace core { 27 class cvmatrix;27 class Matrix; 28 28 class Mutex; 29 29 class ConditionVariable; … … 101 101 flair::gui::CheckBox *enable_opti; 102 102 flair::simulator::Model *self; 103 flair::core:: cvmatrix *output;103 flair::core::Matrix *output; 104 104 flair::core::Mutex *states_mutex; 105 105 -
trunk/lib/FlairVisionFilter/src/HoughLines.cpp
r157 r214 14 14 #include "HoughLines.h" 15 15 #include <cvimage.h> 16 #include < cvmatrix.h>16 #include <Matrix.h> 17 17 #include <Layout.h> 18 18 #include <GroupBox.h> … … 49 49 desc->SetElementName(2,0,"orientation deg"); 50 50 desc->SetElementName(3,0,"line_detected"); 51 output=new cvmatrix(this,desc,floatType,name);51 output=new Matrix(this,desc,floatType,name); 52 52 delete desc; 53 53 … … 90 90 } 91 91 92 cvmatrix *HoughLines::Output(void) const {92 Matrix *HoughLines::Output(void) const { 93 93 return output; 94 94 } -
trunk/lib/FlairVisionFilter/src/HoughLines.h
r122 r214 17 17 namespace core { 18 18 class cvimage; 19 class cvmatrix;19 class Matrix; 20 20 } 21 21 namespace gui { … … 56 56 float GetOrientation(void) const; 57 57 float GetDistance(void) const; 58 core:: cvmatrix *Output(void) const;58 core::Matrix *Output(void) const; 59 59 60 60 private: … … 69 69 float distance,orientation; 70 70 CvMat* linesStorage; 71 core:: cvmatrix *output;71 core::Matrix *output; 72 72 }; 73 73 } // end namespace filter -
trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp
r157 r214 14 14 #include "OpticalFlowSpeed.h" 15 15 #include "OpticalFlowData.h" 16 #include < cvmatrix.h>16 #include <Matrix.h> 17 17 #include <Object.h> 18 18 … … 30 30 desc->SetElementName(0,0,"vx"); 31 31 desc->SetElementName(1,0,"vy"); 32 output=new cvmatrix(this,desc,floatType,name);32 output=new Matrix(this,desc,floatType,name); 33 33 delete desc; 34 34 … … 81 81 } 82 82 83 core:: cvmatrix *OpticalFlowSpeed::Output() const83 core::Matrix *OpticalFlowSpeed::Output() const 84 84 { 85 85 return output; -
trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.h
r143 r214 17 17 namespace core 18 18 { 19 class cvmatrix;19 class Matrix; 20 20 } 21 21 } … … 71 71 * Second line is speed along y axis. \n 72 72 */ 73 core:: cvmatrix *Output() const;73 core::Matrix *Output() const; 74 74 75 75 private: … … 83 83 void UpdateFrom(const core::io_data *data); 84 84 85 core:: cvmatrix *output;85 core::Matrix *output; 86 86 }; 87 87 } // end namespace filter
Note:
See TracChangeset
for help on using the changeset viewer.