Changeset 15 in flair-src for trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.h
- Timestamp:
- 04/08/16 15:40:57 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle.h
r10 r15 16 16 #include <IODevice.h> 17 17 18 namespace flair 19 { 20 namespace core 21 { 22 class cvmatrix; 23 class Vector2D; 24 } 25 namespace gui 26 { 27 class LayoutPosition; 28 } 18 namespace flair { 19 namespace core { 20 class cvmatrix; 21 class Vector2D; 22 } 23 namespace gui { 24 class LayoutPosition; 25 } 29 26 } 30 27 31 28 class TrajectoryGenerator2DCircle_impl; 32 29 33 namespace flair 34 {35 namespace filter 36 { 37 /*! \class TrajectoryGenerator2DCircle 38 39 * \brief Class generating a circle trajectory in 2D 40 * 41 * This class generates position and velocity references, given 42 * a maximum velocity and an absolute acceleration, for a circle. \n43 * When trajectory is started (StartTraj), position and velocity will increase 44 * at the given acceleration untill maximum velocity is reached. \n 45 * When trajectory is asked to be finished (see FinishTraj()), position46 * and velocity will decrease at the given acceleration untill null velocity is reached. \n 47 * Position and velocity of the center of the circle can be manually changed 48 * through SetCenter() and SetCenterSpeed(). 49 */ 50 class TrajectoryGenerator2DCircle : public core::IODevice 51 {52 public:53 /*!54 * \brief Constructor55 *56 * Construct a TrajectoryGenerator2DCircle at position. \n57 * The TrajectoryGenerator2DCircle will automatically be child of position->getLayout() Layout. After calling this function,58 * position will be deleted as it is no longer usefull. \n59 *60 * \param position position to display settings61 * \param name name62 */63 TrajectoryGenerator2DCircle(const gui::LayoutPosition* position,std::string name);30 namespace flair { 31 namespace filter { 32 /*! \class TrajectoryGenerator2DCircle 33 * 34 * \brief Class generating a circle trajectory in 2D 35 * 36 * This class generates position and velocity references, given 37 * a maximum velocity and an absolute acceleration, for a circle. \n 38 * When trajectory is started (StartTraj), position and velocity will increase 39 * at the given acceleration untill maximum velocity is reached. \n 40 * When trajectory is asked to be finished (see FinishTraj()), position 41 * and velocity will decrease at the given acceleration untill null velocity is 42 *reached. \n 43 * Position and velocity of the center of the circle can be manually changed 44 * through SetCenter() and SetCenterSpeed(). 45 */ 46 class TrajectoryGenerator2DCircle : public core::IODevice { 47 public: 48 /*! 49 * \brief Constructor 50 * 51 * Construct a TrajectoryGenerator2DCircle at position. \n 52 * The TrajectoryGenerator2DCircle will automatically be child of 53 *position->getLayout() Layout. After calling this function, 54 * position will be deleted as it is no longer usefull. \n 55 * 56 * \param position position to display settings 57 * \param name name 58 */ 59 TrajectoryGenerator2DCircle(const gui::LayoutPosition *position, 60 std::string name); 64 61 65 66 67 68 69 62 /*! 63 * \brief Destructor 64 * 65 */ 66 ~TrajectoryGenerator2DCircle(); 70 67 71 72 73 74 75 76 77 void StartTraj(const core::Vector2D &start_pos,float nb_lap=-1);68 /*! 69 * \brief Start trajectory 70 * 71 * \param start_pos start position 72 * \param nb_lap number of laps, -1 for infinite 73 */ 74 void StartTraj(const core::Vector2D &start_pos, float nb_lap = -1); 78 75 79 80 81 82 83 84 76 /*! 77 * \brief Stop trajectory 78 * 79 * Stop abruptly the trajectory. 80 */ 81 void StopTraj(void); 85 82 86 87 88 89 90 91 83 /*! 84 * \brief Finish trajectory 85 * 86 * Finish smoothly the trajectory. 87 */ 88 void FinishTraj(void); 92 89 93 94 95 96 97 98 90 /*! 91 * \brief Set center position 92 * 93 * \param value center position 94 */ 95 void SetCenter(const core::Vector2D &value); 99 96 100 101 102 103 104 105 97 /*! 98 * \brief Set center speed 99 * 100 * \param value center speed 101 */ 102 void SetCenterSpeed(const core::Vector2D &value); 106 103 107 108 109 110 111 112 113 114 115 104 /*! 105 * \brief Update using provided datas 106 * 107 * Uses values specified by StartTraj(), 108 * SetCenter() and SetCenterSpeed(). 109 * 110 * \param time time of the update 111 */ 112 void Update(core::Time time); 116 113 117 118 119 120 121 122 114 /*! 115 * \brief Position 116 * 117 * \param point returned position 118 */ 119 void GetPosition(core::Vector2D &point) const; 123 120 124 125 126 127 128 129 121 /*! 122 * \brief Speed 123 * 124 * \param point returned speed 125 */ 126 void GetSpeed(core::Vector2D &point) const; 130 127 131 132 133 134 135 136 128 /*! 129 * \brief Output matrix 130 * 131 * \return matrix 132 */ 133 core::cvmatrix *Matrix(void) const; 137 134 138 139 140 141 142 143 135 /*! 136 * \brief Is trajectory running? 137 * 138 * \return true if trajectory is running 139 */ 140 bool IsRunning(void) const; 144 141 145 146 147 148 149 150 151 152 153 142 private: 143 /*! 144 * \brief Update using provided datas 145 * 146 * Reimplemented from IODevice. Nothing to do in this IODevice. 147 * 148 * \param data data from the parent to process 149 */ 150 void UpdateFrom(const core::io_data *data){}; 154 151 155 TrajectoryGenerator2DCircle_impl* pimpl_; 156 157 }; 152 TrajectoryGenerator2DCircle_impl *pimpl_; 153 }; 158 154 } // end namespace filter 159 155 } // end namespace flair
Note:
See TracChangeset
for help on using the changeset viewer.