Changeset 50 in flair-dev for trunk/include/FlairCore


Ignore:
Timestamp:
05/31/17 15:54:26 (7 years ago)
Author:
Sanahuja Guillaume
Message:

doc

Location:
trunk/include/FlairCore
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/FlairCore/AhrsData.h

    r13 r50  
    121121  *
    122122  */
    123   void SetAngularRates(const Vector3D &angularRates);
     123  void SetAngularRates(const Vector3Df &angularRates);
    124124
    125125  /*!
     
    131131  *
    132132  */
    133   Vector3D GetAngularRates(void) const;
     133  Vector3Df GetAngularRates(void) const;
    134134
    135135  /*!
     
    143143  */
    144144  void GetQuaternionAndAngularRates(Quaternion &quaternion,
    145                                     Vector3D &angularRates) const;
     145                                    Vector3Df &angularRates) const;
    146146
    147147  /*!
     
    155155  */
    156156  void SetQuaternionAndAngularRates(const Quaternion &quaternion,
    157                                     const Vector3D &angularRates);
     157                                    const Vector3Df &angularRates);
    158158
    159159  const Type &GetDataType() const { return dataType; }
     
    182182  *
    183183  */
    184   Vector3D angularRates;
     184  Vector3Df angularRates;
    185185
    186186  Type dataType;
  • trunk/include/FlairCore/GpsData.h

    r30 r50  
    1919
    2020  class IODataElement;
    21   class Vector3D;
    2221
    2322/*! \class GpsData
     
    4241      size += UInt8Type.GetSize(); // FixQuality_t
    4342      size += 5*floatType.GetSize();//e,n,u,ve,vn
     43      size += 3*floatType.GetSize();//pdop,hdop,vdop
    4444      return size;
    4545    }
     
    6363    EastVelocity /*! east velocity*/,
    6464    NorthVelocity /*! north velocity*/,
     65    Pdop /* dilution of precision*/,
     66    Hdop /* horizontal dilution of precision*/,
     67    Vdop /* vertical dilution of precision*/,
    6568  } PlotableData_t;
    6669
     
    215218  */
    216219  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);
    217244
    218245  Type const &GetDataType() const { return dataType; }
     
    235262  uint8_t numberOfSatellites;
    236263  FixQuality_t fixQuality;
    237   float east,north,up,eastVelocity,northVelocity;
     264  float east,north,up,eastVelocity,northVelocity,pDop,hDop,vDop;
    238265};
    239266
  • trunk/include/FlairCore/I2cPort.h

    r13 r50  
    9595};
    9696} // end namespace core
    97 } // end namespace framework
     97} // end namespace flair
    9898
    9999#endif // I2CPORT_H
  • trunk/include/FlairCore/IODataElement.h

    r13 r50  
    5656
    5757} // end namespace core
    58 } // end namespace framework
     58} // end namespace flair
    5959
    6060#endif // IODATAELEMENT_H
  • trunk/include/FlairCore/IODevice.h

    r44 r50  
    110110  */
    111111  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;
    112122
    113123  // TODO: these 2 method should be pure virtual
     
    115125  virtual DataType const &GetOutputDataType() const;
    116126
    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);
    132152
    133153private:
  • trunk/include/FlairCore/ImuData.h

    r13 r50  
    104104  *
    105105  */
    106   Vector3D GetRawAcc(void) const;
     106  Vector3Df GetRawAcc(void) const;
    107107
    108108  /*!
     
    114114  *
    115115  */
    116   Vector3D GetRawMag(void) const;
     116  Vector3Df GetRawMag(void) const;
    117117
    118118  /*!
     
    124124  *
    125125  */
    126   Vector3D GetRawGyr(void) const;
     126  Vector3Df GetRawGyr(void) const;
    127127
    128128  /*!
     
    136136  *
    137137  */
    138   void GetRawAccMagAndGyr(Vector3D &rawAcc, Vector3D &rawMag,
    139                           Vector3D &rawGyr) const;
     138  void GetRawAccMagAndGyr(Vector3Df &rawAcc, Vector3Df &rawMag,
     139                          Vector3Df &rawGyr) const;
    140140
    141141  /*!
     
    147147  *
    148148  */
    149   void SetRawAcc(const Vector3D &rawAcc);
     149  void SetRawAcc(const Vector3Df &rawAcc);
    150150
    151151  /*!
     
    157157  *
    158158  */
    159   void SetRawMag(const Vector3D &rawMag);
     159  void SetRawMag(const Vector3Df &rawMag);
    160160
    161161  /*!
     
    167167  *
    168168  */
    169   void SetRawGyr(const Vector3D &rawGyr);
     169  void SetRawGyr(const Vector3Df &rawGyr);
    170170
    171171  /*!
     
    179179  *
    180180  */
    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);
    183183
    184184  Type const &GetDataType() const { return dataType; }
     
    199199  *
    200200  */
    201   Vector3D rawAcc;
     201  Vector3Df rawAcc;
    202202
    203203  /*!
     
    205205  *
    206206  */
    207   Vector3D rawGyr;
     207  Vector3Df rawGyr;
    208208
    209209  /*!
     
    211211  *
    212212  */
    213   Vector3D rawMag;
     213  Vector3Df rawMag;
    214214
    215215  void Queue(char **dst, const void *src, size_t size) const;
  • trunk/include/FlairCore/OneAxisRotation.h

    r13 r50  
    1515
    1616#include <GroupBox.h>
     17#include <Vector3D.h>
    1718
    1819class OneAxisRotation_impl;
     
    2425
    2526namespace core {
    26 class Vector3D;
    2727class Euler;
    2828class Quaternion;
     
    5757  * \brief Compute rotation
    5858  *
    59   * \param vector Vector3D to rotate
     59  * \param vector Vector3Df to rotate
    6060  */
    61   void ComputeRotation(core::Vector3D &vector) const;
     61  template <typename T> void ComputeRotation(core::Vector3D<T> &vector) const;
    6262
    6363  /*!
     
    8181  */
    8282  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;
    8391
    8492private:
  • trunk/include/FlairCore/Quaternion.h

    r13 r50  
    1313#define QUATERNION_H
    1414
     15#include <Vector3D.h>
     16
    1517namespace flair {
    1618namespace core {
    1719class Euler;
    18 class Vector3D;
    1920class RotationMatrix;
    2021
     
    6263  * \param logarithm output logarithm
    6364  */
    64   void GetLogarithm(Vector3D &logarithm);
     65  void GetLogarithm(Vector3Df &logarithm);
    6566
    6667  /*!
     
    7172  * \return output logarithm
    7273  */
    73   Vector3D GetLogarithm(void);
     74  Vector3Df GetLogarithm(void);
    7475
    7576  /*!
     
    9293  * \return derivative
    9394  */
    94   Quaternion GetDerivative(const Vector3D &angularSpeed) const;
     95  Quaternion GetDerivative(const Vector3Df &angularSpeed) const;
    9596
    9697  /*!
     
    99100  * \param w rotationonal speed
    100101  */
    101   void Derivate(const Vector3D &angularSpeed);
     102  void Derivate(const Vector3Df &angularSpeed);
    102103
    103104  /*!
  • trunk/include/FlairCore/SerialPort.h

    r13 r50  
    8585};
    8686} // end namespace core
    87 } // end namespace framework
     87} // end namespace flair
    8888
    8989#endif // SERIALPORT_H
  • trunk/include/FlairCore/SharedMem.h

    r13 r50  
    3232class SharedMem : public Object {
    3333public:
     34  enum class Type { mutex, producerConsumer };
    3435  /*!
    3536  * \brief Constructor
     
    4041  * \param name name
    4142  * \param size size of the shared memory
     43  * \param blockOnRead if true reading will block if nothing written
    4244  */
    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);
    4446
    4547  /*!
     
    6567  void Read(char *buf, size_t size) const;
    6668
     69
     70  /*!
     71  * \brief This function should be called when reader starts (in case of a SharedMem of type producerConsumer)
     72  */
     73   void ReaderReady();
    6774private:
    6875  SharedMem_impl *pimpl_;
     76  Type type;
    6977};
    7078
  • trunk/include/FlairCore/Thread.h

    r13 r50  
    176176  */
    177177  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;
    178186
    179187  /*!
  • trunk/include/FlairCore/Vector2D.h

    r13 r50  
    2121* \brief Class defining a 2D vector
    2222*/
     23template <typename T>
    2324class Vector2D {
    2425public:
     
    3132  * \param y
    3233  */
    33   Vector2D(float x = 0, float y = 0);
     34  Vector2D(T x = 0, T y = 0);
    3435
    3536  /*!
     
    7374  * \param max maximum Vector2D value
    7475  */
    75   void Saturate(Vector2D min, Vector2D max);
     76  void Saturate(Vector2D<T> min, Vector2D<T> max);
    7677
    7778  /*!
     
    9293  * \param value saturation Vector2D value
    9394  */
    94   void Saturate(const Vector2D &value);
     95  void Saturate(const Vector2D<T> &value);
    9596
    9697  /*!
     
    106107  * \brief x
    107108  */
    108   float x;
     109  T x;
    109110
    110111  /*!
    111112  * \brief y
    112113  */
    113   float y;
     114  T y;
    114115
    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);
    116123};
     124
     125typedef Vector2D<float> Vector2Df;
    117126
    118127/*! Add
     
    123132* \param vectorB vector
    124133*/
    125 Vector2D operator+(const Vector2D &vectorA, const Vector2D &vectorB);
     134template<typename T> Vector2D<T> operator+(const Vector2D<T> &vectorA, const Vector2D<T> &vectorB);
    126135
    127136/*! Substract
     
    132141* \param vectorB vector
    133142*/
    134 Vector2D operator-(const Vector2D &vectorA, const Vector2D &vectorB);
     143template<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*/
     153template<typename T> Vector2D<T> operator-(const Vector2D<T> &vectorA);
    135154
    136155/*! Divid
     
    142161* \return vector/coefficient
    143162*/
    144 Vector2D operator/(const Vector2D &vector, float coeff);
     163template<typename T> Vector2D<T> operator/(const Vector2D<T> &vector, float coeff);
    145164
    146165/*! Multiply
     
    152171* \return coefficient*vector
    153172*/
    154 Vector2D operator*(const Vector2D &vector, float coeff);
     173template<typename T> Vector2D<T> operator*(const Vector2D<T> &vector, float coeff);
    155174
    156175/*! Multiply
     
    162181* \return coefficient*vector
    163182*/
    164 Vector2D operator*(float coeff, const Vector2D &vector);
     183template<typename T> Vector2D<T> operator*(float coeff, const Vector2D<T> &vector);
    165184
    166185} // end namespace core
  • trunk/include/FlairCore/Vector3D.h

    r13 r50  
    1515
    1616#include <stddef.h>
     17#include <Vector2D.h>
    1718
    1819namespace flair {
    1920namespace core {
    20 class Vector2D;
    2121class RotationMatrix;
    2222class Quaternion;
     
    2626* \brief Class defining a 3D vector
    2727*/
     28template <typename T>
    2829class Vector3D {
    2930public:
     
    3738  * \param z
    3839  */
    39   Vector3D(float x = 0, float y = 0, float z = 0);
     40  Vector3D(T x = 0, T y = 0, T z = 0);
    4041
    4142  /*!
     
    4849  * \brief x
    4950  */
    50   float x;
     51  T x;
    5152
    5253  /*!
    5354  * \brief y
    5455  */
    55   float y;
     56  T y;
    5657
    5758  /*!
    5859  * \brief z
    5960  */
    60   float z;
     61  T z;
    6162
    6263  /*!
     
    126127  * \param vector destination
    127128  */
    128   void To2Dxy(Vector2D &vector) const;
     129  void To2Dxy(Vector2D<T> &vector) const;
    129130
    130131  /*!
     
    135136  * \return destination
    136137  */
    137   Vector2D To2Dxy(void) const;
     138  Vector2D<T> To2Dxy(void) const;
    138139
    139140  /*!
     
    157158  * \param max maximum value
    158159  */
    159   void Saturate(const Vector3D &min, const Vector3D &max);
     160  void Saturate(const Vector3D<T> &min, const Vector3D<T> &max);
    160161
    161162  /*!
     
    176177  * \param value saturation Vector3D value
    177178  */
    178   void Saturate(const Vector3D &value);
     179  void Saturate(const Vector3D<T> &value);
    179180
    180181  /*!
     
    188189  void Saturate(float value);
    189190
    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);
    195202
    196203private:
    197204};
    198205
     206typedef Vector3D<float> Vector3Df;
     207
    199208/*! Add
    200209*
     
    206215* \return vectorA+vectorB
    207216*/
    208 Vector3D operator+(const Vector3D &vectorA, const Vector3D &vectorB);
     217template<typename T> Vector3D<T> operator+(const Vector3D<T> &vectorA, const Vector3D<T> &vectorB);
    209218
    210219/*! Substract
     
    217226* \return vectorA-vectorB
    218227*/
    219 Vector3D operator-(const Vector3D &vectorA, const Vector3D &vectorB);
     228template<typename T> Vector3D<T> operator-(const Vector3D<T> &vectorA, const Vector3D<T> &vectorB);
    220229
    221230/*! Minus
     
    227236* \return -vector
    228237*/
    229 Vector3D operator-(const Vector3D &vector);
     238template<typename T> Vector3D<T> operator-(const Vector3D<T> &vector);
    230239
    231240/*! Divid
     
    238247* \return vector/coefficient
    239248*/
    240 Vector3D operator/(const Vector3D &vector, float coeff);
     249template<typename T> Vector3D<T> operator/(const Vector3D<T> &vector, float coeff);
    241250
    242251/*! Hadamard product
     
    249258* \return Hadamard product
    250259*/
    251 Vector3D operator*(const Vector3D &vectorA, const Vector3D &vectorB);
     260template<typename T> Vector3D<T> operator*(const Vector3D<T> &vectorA, const Vector3D<T> &vectorB);
    252261
    253262/*! Multiply
     
    260269* \return coefficient*vector
    261270*/
    262 Vector3D operator*(const Vector3D &vector, float coeff);
     271template<typename T> Vector3D<T> operator*(const Vector3D<T> &vector, float coeff);
    263272
    264273/*! Multiply
     
    271280* \return coefficient*vector
    272281*/
    273 Vector3D operator*(float coeff, const Vector3D &vector);
     282template<typename T> Vector3D<T> operator*(float coeff, const Vector3D<T> &vector);
    274283
    275284/*! Cross product
     
    282291* \return cross product
    283292*/
    284 Vector3D CrossProduct(const Vector3D &vectorA, const Vector3D &vectorB);
     293template<typename T> Vector3D<T> CrossProduct(const Vector3D<T> &vectorA, const Vector3D<T> &vectorB);
    285294
    286295/*! Dot product
     
    293302* \return dot product
    294303*/
    295 float DotProduct(const Vector3D &vectorA, const Vector3D &vectorB);
     304template<typename T> float DotProduct(const Vector3D<T> &vectorA, const Vector3D<T> &vectorB);
    296305
    297306} // end namespace core
  • trunk/include/FlairCore/Vector3DSpinBox.h

    r13 r50  
    4444  Vector3DSpinBox(const LayoutPosition *position, std::string name, double min,
    4545                  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));
    4747
    4848  /*!
     
    5757  * \return value
    5858  */
    59   core::Vector3D Value(void) const;
     59  core::Vector3Df Value(void) const;
    6060  // operator core::Vector3D() const;
    6161private:
     
    6868  void XmlEvent(void);
    6969
    70   core::Vector3D box_value;
     70  core::Vector3Df box_value;
    7171};
    7272
  • trunk/include/FlairCore/Vector3Ddata.h

    r13 r50  
    2626* User must manually use the io_data's Mutex to access to Vector3D values.
    2727*/
    28 class Vector3Ddata : public io_data, public Vector3D {
     28class Vector3Ddata : public io_data, public Vector3Df {
    2929public:
    3030  /*!
  • trunk/include/FlairCore/cvmatrix.h

    r13 r50  
    5555  * Construct an io_data representing a CvMat. \n
    5656  * 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.
    5859  *
    5960  * \param parent parent
    60   * \param descriptor matrix description
     61  * \param descriptor matrix description, it is safe to destroy it after calling this constructor
    6162  * \param type type of matrix elements
    6263  * \param name name
     
    7172  *
    7273  * Construct an io_data representing a CvMat. \n
    73   * Elements are unamed.
     74  * Elements are unamed. \n
     75  * All values are initialized to 0.
    7476  *
    7577  * \param parent parent
Note: See TracChangeset for help on using the changeset viewer.