Changeset 50 in flair-dev for trunk/include/FlairCore
- Timestamp:
- May 31, 2017, 3:54:26 PM (8 years ago)
- Location:
- trunk/include/FlairCore
- Files:
-
- 1 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/FlairCore/AhrsData.h
r13 r50 121 121 * 122 122 */ 123 void SetAngularRates(const Vector3D &angularRates);123 void SetAngularRates(const Vector3Df &angularRates); 124 124 125 125 /*! … … 131 131 * 132 132 */ 133 Vector3D GetAngularRates(void) const;133 Vector3Df GetAngularRates(void) const; 134 134 135 135 /*! … … 143 143 */ 144 144 void GetQuaternionAndAngularRates(Quaternion &quaternion, 145 Vector3D &angularRates) const;145 Vector3Df &angularRates) const; 146 146 147 147 /*! … … 155 155 */ 156 156 void SetQuaternionAndAngularRates(const Quaternion &quaternion, 157 const Vector3D &angularRates);157 const Vector3Df &angularRates); 158 158 159 159 const Type &GetDataType() const { return dataType; } … … 182 182 * 183 183 */ 184 Vector3D angularRates;184 Vector3Df angularRates; 185 185 186 186 Type dataType; -
trunk/include/FlairCore/GpsData.h
r30 r50 19 19 20 20 class IODataElement; 21 class Vector3D;22 21 23 22 /*! \class GpsData … … 42 41 size += UInt8Type.GetSize(); // FixQuality_t 43 42 size += 5*floatType.GetSize();//e,n,u,ve,vn 43 size += 3*floatType.GetSize();//pdop,hdop,vdop 44 44 return size; 45 45 } … … 63 63 EastVelocity /*! east velocity*/, 64 64 NorthVelocity /*! north velocity*/, 65 Pdop /* dilution of precision*/, 66 Hdop /* horizontal dilution of precision*/, 67 Vdop /* vertical dilution of precision*/, 65 68 } PlotableData_t; 66 69 … … 215 218 */ 216 219 void SetFixQuality(FixQuality_t fixQuality); 220 221 /*! 222 * \brief Get dilution of precision 223 * 224 * This method is mutex protected. 225 * 226 * \param pDop dilution of precision 227 * \param hDop horizontal dilution of precision 228 * \param vDop vertical dilution of precision 229 * 230 */ 231 void GetDop(float &pDop, float &hDop,float &vDop) const; 232 233 /*! 234 * \brief Set dilution of precision 235 * 236 * This method is mutex protected. 237 * 238 * \param pDop dilution of precision 239 * \param hDop horizontal dilution of precision 240 * \param vDop vertical dilution of precision 241 * 242 */ 243 void SetDop(float pDop, float hDop,float vDop); 217 244 218 245 Type const &GetDataType() const { return dataType; } … … 235 262 uint8_t numberOfSatellites; 236 263 FixQuality_t fixQuality; 237 float east,north,up,eastVelocity,northVelocity ;264 float east,north,up,eastVelocity,northVelocity,pDop,hDop,vDop; 238 265 }; 239 266 -
trunk/include/FlairCore/I2cPort.h
r13 r50 95 95 }; 96 96 } // end namespace core 97 } // end namespace f ramework97 } // end namespace flair 98 98 99 99 #endif // I2CPORT_H -
trunk/include/FlairCore/IODataElement.h
r13 r50 56 56 57 57 } // end namespace core 58 } // end namespace f ramework58 } // end namespace flair 59 59 60 60 #endif // IODATAELEMENT_H -
trunk/include/FlairCore/IODevice.h
r44 r50 110 110 */ 111 111 void OutputToShMem(bool enabled); 112 113 /*! 114 * \brief is device ready 115 * 116 * Use it check if a device is ready or not. 117 * See also setIsReady. 118 * 119 * \return true if device is ready 120 */ 121 bool IsReady(void) const; 112 122 113 123 // TODO: these 2 method should be pure virtual … … 115 125 virtual DataType const &GetOutputDataType() const; 116 126 117 protected: 118 /*! 119 * \brief Process the childs of type IODevice, and log if needed 120 * 121 * This method must be called after computing datas; 122 * generally at the end of the reimplemented UpdateFrom or after acquiring datas in case of a sensor. \n 123 * It will call UpdateFrom methods of each child of type IODevice, 124 * and log all datas (this IODevice and its childs) 125 * if logging is enabled (see SetDataToLog(), AddDeviceToLog(), 126 * FrameworkManager::StartLog and FrameworkManager::AddDeviceToLog). \n 127 * If a thread is waiting on this IODevice (see Thread::WaitUpdate), it will be resumed. 128 * 129 * \param data data to process 130 */ 131 void ProcessUpdate(io_data* data); 127 protected: 128 /*! 129 * \brief Process the childs of type IODevice, and log if needed 130 * 131 * This method must be called after computing datas; 132 * generally at the end of the reimplemented UpdateFrom or after acquiring datas in case of a sensor. \n 133 * It will call UpdateFrom methods of each child of type IODevice, 134 * and log all datas (this IODevice and its childs) 135 * if logging is enabled (see SetDataToLog(), AddDeviceToLog(), 136 * FrameworkManager::StartLog and FrameworkManager::AddDeviceToLog). \n 137 * If a thread is waiting on this IODevice (see Thread::WaitUpdate), it will be resumed. 138 * 139 * \param data data to process 140 */ 141 void ProcessUpdate(io_data* data); 142 143 /*! 144 * \brief set is ready 145 * 146 * Sets if the device is ready or not. By default the IODevice is not ready.\n 147 * See also isReady. 148 * 149 * \param status status 150 */ 151 void SetIsReady(bool status); 132 152 133 153 private: -
trunk/include/FlairCore/ImuData.h
r13 r50 104 104 * 105 105 */ 106 Vector3D GetRawAcc(void) const;106 Vector3Df GetRawAcc(void) const; 107 107 108 108 /*! … … 114 114 * 115 115 */ 116 Vector3D GetRawMag(void) const;116 Vector3Df GetRawMag(void) const; 117 117 118 118 /*! … … 124 124 * 125 125 */ 126 Vector3D GetRawGyr(void) const;126 Vector3Df GetRawGyr(void) const; 127 127 128 128 /*! … … 136 136 * 137 137 */ 138 void GetRawAccMagAndGyr(Vector3D &rawAcc, Vector3D&rawMag,139 Vector3D &rawGyr) const;138 void GetRawAccMagAndGyr(Vector3Df &rawAcc, Vector3Df &rawMag, 139 Vector3Df &rawGyr) const; 140 140 141 141 /*! … … 147 147 * 148 148 */ 149 void SetRawAcc(const Vector3D &rawAcc);149 void SetRawAcc(const Vector3Df &rawAcc); 150 150 151 151 /*! … … 157 157 * 158 158 */ 159 void SetRawMag(const Vector3D &rawMag);159 void SetRawMag(const Vector3Df &rawMag); 160 160 161 161 /*! … … 167 167 * 168 168 */ 169 void SetRawGyr(const Vector3D &rawGyr);169 void SetRawGyr(const Vector3Df &rawGyr); 170 170 171 171 /*! … … 179 179 * 180 180 */ 181 void SetRawAccMagAndGyr(const Vector3D &rawAcc, const Vector3D&rawMag,182 const Vector3D &rawGyr);181 void SetRawAccMagAndGyr(const Vector3Df &rawAcc, const Vector3Df &rawMag, 182 const Vector3Df &rawGyr); 183 183 184 184 Type const &GetDataType() const { return dataType; } … … 199 199 * 200 200 */ 201 Vector3D rawAcc;201 Vector3Df rawAcc; 202 202 203 203 /*! … … 205 205 * 206 206 */ 207 Vector3D rawGyr;207 Vector3Df rawGyr; 208 208 209 209 /*! … … 211 211 * 212 212 */ 213 Vector3D rawMag;213 Vector3Df rawMag; 214 214 215 215 void Queue(char **dst, const void *src, size_t size) const; -
trunk/include/FlairCore/OneAxisRotation.h
r13 r50 15 15 16 16 #include <GroupBox.h> 17 #include <Vector3D.h> 17 18 18 19 class OneAxisRotation_impl; … … 24 25 25 26 namespace core { 26 class Vector3D;27 27 class Euler; 28 28 class Quaternion; … … 57 57 * \brief Compute rotation 58 58 * 59 * \param vector Vector3D to rotate59 * \param vector Vector3Df to rotate 60 60 */ 61 void ComputeRotation(core::Vector3D&vector) const;61 template <typename T> void ComputeRotation(core::Vector3D<T> &vector) const; 62 62 63 63 /*! … … 81 81 */ 82 82 void ComputeRotation(core::RotationMatrix &matrix) const; 83 84 /*! 85 * \brief Get angle 86 * 87 * \return angle in radians 88 */ 89 float GetAngle() const; 90 int GetAxis() const; 83 91 84 92 private: -
trunk/include/FlairCore/Quaternion.h
r13 r50 13 13 #define QUATERNION_H 14 14 15 #include <Vector3D.h> 16 15 17 namespace flair { 16 18 namespace core { 17 19 class Euler; 18 class Vector3D;19 20 class RotationMatrix; 20 21 … … 62 63 * \param logarithm output logarithm 63 64 */ 64 void GetLogarithm(Vector3D &logarithm);65 void GetLogarithm(Vector3Df &logarithm); 65 66 66 67 /*! … … 71 72 * \return output logarithm 72 73 */ 73 Vector3D GetLogarithm(void);74 Vector3Df GetLogarithm(void); 74 75 75 76 /*! … … 92 93 * \return derivative 93 94 */ 94 Quaternion GetDerivative(const Vector3D &angularSpeed) const;95 Quaternion GetDerivative(const Vector3Df &angularSpeed) const; 95 96 96 97 /*! … … 99 100 * \param w rotationonal speed 100 101 */ 101 void Derivate(const Vector3D &angularSpeed);102 void Derivate(const Vector3Df &angularSpeed); 102 103 103 104 /*! -
trunk/include/FlairCore/SerialPort.h
r13 r50 85 85 }; 86 86 } // end namespace core 87 } // end namespace f ramework87 } // end namespace flair 88 88 89 89 #endif // SERIALPORT_H -
trunk/include/FlairCore/SharedMem.h
r13 r50 32 32 class SharedMem : public Object { 33 33 public: 34 enum class Type { mutex, producerConsumer }; 34 35 /*! 35 36 * \brief Constructor … … 40 41 * \param name name 41 42 * \param size size of the shared memory 43 * \param blockOnRead if true reading will block if nothing written 42 44 */ 43 SharedMem(const Object *parent, std::string name, size_t size );45 SharedMem(const Object *parent, std::string name, size_t size, Type type=Type::mutex); 44 46 45 47 /*! … … 65 67 void Read(char *buf, size_t size) const; 66 68 69 70 /*! 71 * \brief This function should be called when reader starts (in case of a SharedMem of type producerConsumer) 72 */ 73 void ReaderReady(); 67 74 private: 68 75 SharedMem_impl *pimpl_; 76 Type type; 69 77 }; 70 78 -
trunk/include/FlairCore/Thread.h
r13 r50 176 176 */ 177 177 bool IsSuspended(void) const; 178 179 /*! 180 * \brief Is the thread running? 181 * 182 * \return true if thread is running (call to Start). A suspended thread is running. 183 * 184 */ 185 bool IsRunning(void) const; 178 186 179 187 /*! -
trunk/include/FlairCore/Vector2D.h
r13 r50 21 21 * \brief Class defining a 2D vector 22 22 */ 23 template <typename T> 23 24 class Vector2D { 24 25 public: … … 31 32 * \param y 32 33 */ 33 Vector2D( float x = 0, floaty = 0);34 Vector2D(T x = 0, T y = 0); 34 35 35 36 /*! … … 73 74 * \param max maximum Vector2D value 74 75 */ 75 void Saturate(Vector2D min, Vector2Dmax);76 void Saturate(Vector2D<T> min, Vector2D<T> max); 76 77 77 78 /*! … … 92 93 * \param value saturation Vector2D value 93 94 */ 94 void Saturate(const Vector2D &value);95 void Saturate(const Vector2D<T> &value); 95 96 96 97 /*! … … 106 107 * \brief x 107 108 */ 108 floatx;109 T x; 109 110 110 111 /*! 111 112 * \brief y 112 113 */ 113 floaty;114 T y; 114 115 115 Vector2D &operator=(const Vector2D &vector); 116 template<typename S> Vector2D<T> &operator=(const Vector2D<S> &vector) { 117 x = vector.x; 118 y = vector.y; 119 return (*this); 120 } 121 Vector2D<T> &operator+=(const Vector2D<T> &vector); 122 Vector2D<T> &operator-=(const Vector2D<T> &vector); 116 123 }; 124 125 typedef Vector2D<float> Vector2Df; 117 126 118 127 /*! Add … … 123 132 * \param vectorB vector 124 133 */ 125 Vector2D operator+(const Vector2D &vectorA, const Vector2D&vectorB);134 template<typename T> Vector2D<T> operator+(const Vector2D<T> &vectorA, const Vector2D<T> &vectorB); 126 135 127 136 /*! Substract … … 132 141 * \param vectorB vector 133 142 */ 134 Vector2D operator-(const Vector2D &vectorA, const Vector2D &vectorB); 143 template<typename T> Vector2D<T> operator-(const Vector2D<T> &vectorA, const Vector2D<T> &vectorB); 144 145 /*! Opposite 146 * 147 * \brief Opposite 148 * 149 * \param vectorA vector 150 * 151 * \return -vectorA 152 */ 153 template<typename T> Vector2D<T> operator-(const Vector2D<T> &vectorA); 135 154 136 155 /*! Divid … … 142 161 * \return vector/coefficient 143 162 */ 144 Vector2D operator/(const Vector2D&vector, float coeff);163 template<typename T> Vector2D<T> operator/(const Vector2D<T> &vector, float coeff); 145 164 146 165 /*! Multiply … … 152 171 * \return coefficient*vector 153 172 */ 154 Vector2D operator*(const Vector2D&vector, float coeff);173 template<typename T> Vector2D<T> operator*(const Vector2D<T> &vector, float coeff); 155 174 156 175 /*! Multiply … … 162 181 * \return coefficient*vector 163 182 */ 164 Vector2D operator*(float coeff, const Vector2D&vector);183 template<typename T> Vector2D<T> operator*(float coeff, const Vector2D<T> &vector); 165 184 166 185 } // end namespace core -
trunk/include/FlairCore/Vector3D.h
r13 r50 15 15 16 16 #include <stddef.h> 17 #include <Vector2D.h> 17 18 18 19 namespace flair { 19 20 namespace core { 20 class Vector2D;21 21 class RotationMatrix; 22 22 class Quaternion; … … 26 26 * \brief Class defining a 3D vector 27 27 */ 28 template <typename T> 28 29 class Vector3D { 29 30 public: … … 37 38 * \param z 38 39 */ 39 Vector3D( float x = 0, float y = 0, floatz = 0);40 Vector3D(T x = 0, T y = 0, T z = 0); 40 41 41 42 /*! … … 48 49 * \brief x 49 50 */ 50 floatx;51 T x; 51 52 52 53 /*! 53 54 * \brief y 54 55 */ 55 floaty;56 T y; 56 57 57 58 /*! 58 59 * \brief z 59 60 */ 60 floatz;61 T z; 61 62 62 63 /*! … … 126 127 * \param vector destination 127 128 */ 128 void To2Dxy(Vector2D &vector) const;129 void To2Dxy(Vector2D<T> &vector) const; 129 130 130 131 /*! … … 135 136 * \return destination 136 137 */ 137 Vector2D To2Dxy(void) const;138 Vector2D<T> To2Dxy(void) const; 138 139 139 140 /*! … … 157 158 * \param max maximum value 158 159 */ 159 void Saturate(const Vector3D &min, const Vector3D&max);160 void Saturate(const Vector3D<T> &min, const Vector3D<T> &max); 160 161 161 162 /*! … … 176 177 * \param value saturation Vector3D value 177 178 */ 178 void Saturate(const Vector3D &value);179 void Saturate(const Vector3D<T> &value); 179 180 180 181 /*! … … 188 189 void Saturate(float value); 189 190 190 float &operator[](size_t idx); 191 const float &operator[](size_t idx) const; 192 Vector3D &operator=(const Vector3D &vector); 193 Vector3D &operator+=(const Vector3D &vector); 194 Vector3D &operator-=(const Vector3D &vector); 191 T &operator[](size_t idx); 192 const T &operator[](size_t idx) const; 193 //Vector3D<T> &operator=(const Vector3D<T> &vector); 194 template<typename S> Vector3D<T> &operator=(const Vector3D<S> &vector) { 195 x = vector.x; 196 y = vector.y; 197 z = vector.z; 198 return (*this); 199 } 200 Vector3D<T> &operator+=(const Vector3D<T> &vector); 201 Vector3D<T> &operator-=(const Vector3D<T> &vector); 195 202 196 203 private: 197 204 }; 198 205 206 typedef Vector3D<float> Vector3Df; 207 199 208 /*! Add 200 209 * … … 206 215 * \return vectorA+vectorB 207 216 */ 208 Vector3D operator+(const Vector3D &vectorA, const Vector3D&vectorB);217 template<typename T> Vector3D<T> operator+(const Vector3D<T> &vectorA, const Vector3D<T> &vectorB); 209 218 210 219 /*! Substract … … 217 226 * \return vectorA-vectorB 218 227 */ 219 Vector3D operator-(const Vector3D &vectorA, const Vector3D&vectorB);228 template<typename T> Vector3D<T> operator-(const Vector3D<T> &vectorA, const Vector3D<T> &vectorB); 220 229 221 230 /*! Minus … … 227 236 * \return -vector 228 237 */ 229 Vector3D operator-(const Vector3D&vector);238 template<typename T> Vector3D<T> operator-(const Vector3D<T> &vector); 230 239 231 240 /*! Divid … … 238 247 * \return vector/coefficient 239 248 */ 240 Vector3D operator/(const Vector3D&vector, float coeff);249 template<typename T> Vector3D<T> operator/(const Vector3D<T> &vector, float coeff); 241 250 242 251 /*! Hadamard product … … 249 258 * \return Hadamard product 250 259 */ 251 Vector3D operator*(const Vector3D &vectorA, const Vector3D&vectorB);260 template<typename T> Vector3D<T> operator*(const Vector3D<T> &vectorA, const Vector3D<T> &vectorB); 252 261 253 262 /*! Multiply … … 260 269 * \return coefficient*vector 261 270 */ 262 Vector3D operator*(const Vector3D&vector, float coeff);271 template<typename T> Vector3D<T> operator*(const Vector3D<T> &vector, float coeff); 263 272 264 273 /*! Multiply … … 271 280 * \return coefficient*vector 272 281 */ 273 Vector3D operator*(float coeff, const Vector3D&vector);282 template<typename T> Vector3D<T> operator*(float coeff, const Vector3D<T> &vector); 274 283 275 284 /*! Cross product … … 282 291 * \return cross product 283 292 */ 284 Vector3D CrossProduct(const Vector3D &vectorA, const Vector3D&vectorB);293 template<typename T> Vector3D<T> CrossProduct(const Vector3D<T> &vectorA, const Vector3D<T> &vectorB); 285 294 286 295 /*! Dot product … … 293 302 * \return dot product 294 303 */ 295 float DotProduct(const Vector3D &vectorA, const Vector3D&vectorB);304 template<typename T> float DotProduct(const Vector3D<T> &vectorA, const Vector3D<T> &vectorB); 296 305 297 306 } // end namespace core -
trunk/include/FlairCore/Vector3DSpinBox.h
r13 r50 44 44 Vector3DSpinBox(const LayoutPosition *position, std::string name, double min, 45 45 double max, double step, int decimals = 2, 46 core::Vector3D default_value = core::Vector3D(0, 0, 0));46 core::Vector3Df default_value = core::Vector3Df(0, 0, 0)); 47 47 48 48 /*! … … 57 57 * \return value 58 58 */ 59 core::Vector3D Value(void) const;59 core::Vector3Df Value(void) const; 60 60 // operator core::Vector3D() const; 61 61 private: … … 68 68 void XmlEvent(void); 69 69 70 core::Vector3D box_value;70 core::Vector3Df box_value; 71 71 }; 72 72 -
trunk/include/FlairCore/Vector3Ddata.h
r13 r50 26 26 * User must manually use the io_data's Mutex to access to Vector3D values. 27 27 */ 28 class Vector3Ddata : public io_data, public Vector3D {28 class Vector3Ddata : public io_data, public Vector3Df { 29 29 public: 30 30 /*! -
trunk/include/FlairCore/cvmatrix.h
r13 r50 55 55 * Construct an io_data representing a CvMat. \n 56 56 * It uses a cvmatrix_descriptor to get size and elements' names. \n 57 * Names are used for graphs and logs. 57 * Names are used for graphs and logs. \n 58 * All values are initialized to 0. 58 59 * 59 60 * \param parent parent 60 * \param descriptor matrix description 61 * \param descriptor matrix description, it is safe to destroy it after calling this constructor 61 62 * \param type type of matrix elements 62 63 * \param name name … … 71 72 * 72 73 * Construct an io_data representing a CvMat. \n 73 * Elements are unamed. 74 * Elements are unamed. \n 75 * All values are initialized to 0. 74 76 * 75 77 * \param parent parent
Note:
See TracChangeset
for help on using the changeset viewer.