1 | /*!
|
---|
2 | * \file TrajectoryGenerator2DCircle.h
|
---|
3 | * \brief Class generating a circle trajectory in 2D
|
---|
4 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
5 | * \date 2013/04/08
|
---|
6 | * \version 4.0
|
---|
7 | */
|
---|
8 |
|
---|
9 | #ifndef TRAJECTORYGENERATOR2DCIRCLE_H
|
---|
10 | #define TRAJECTORYGENERATOR2DCIRCLE_H
|
---|
11 |
|
---|
12 | #include <IODevice.h>
|
---|
13 |
|
---|
14 | namespace flair
|
---|
15 | {
|
---|
16 | namespace core
|
---|
17 | {
|
---|
18 | class cvmatrix;
|
---|
19 | class Vector2D;
|
---|
20 | }
|
---|
21 | namespace gui
|
---|
22 | {
|
---|
23 | class LayoutPosition;
|
---|
24 | }
|
---|
25 | }
|
---|
26 |
|
---|
27 | class TrajectoryGenerator2DCircle_impl;
|
---|
28 |
|
---|
29 | namespace flair
|
---|
30 | {
|
---|
31 | namespace filter
|
---|
32 | {
|
---|
33 | /*! \class TrajectoryGenerator2DCircle
|
---|
34 | *
|
---|
35 | * \brief Class generating a circle trajectory in 2D
|
---|
36 | *
|
---|
37 | * This class generates position and velocity references, given
|
---|
38 | * a maximum velocity and an absolute acceleration, for a circle. \n
|
---|
39 | * When trajectory is started (StartTraj), position and velocity will increase
|
---|
40 | * at the given acceleration untill maximum velocity is reached. \n
|
---|
41 | * When trajectory is asked to be finished (see FinishTraj()), position
|
---|
42 | * and velocity will decrease at the given acceleration untill null velocity is 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 | {
|
---|
48 | public:
|
---|
49 | /*!
|
---|
50 | * \brief Constructor
|
---|
51 | *
|
---|
52 | * Construct a TrajectoryGenerator2DCircle at position. \n
|
---|
53 | * The TrajectoryGenerator2DCircle will automatically be child of 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,std::string name);
|
---|
60 |
|
---|
61 | /*!
|
---|
62 | * \brief Destructor
|
---|
63 | *
|
---|
64 | */
|
---|
65 | ~TrajectoryGenerator2DCircle();
|
---|
66 |
|
---|
67 | /*!
|
---|
68 | * \brief Start trajectory
|
---|
69 | *
|
---|
70 | * \param start_pos start position
|
---|
71 | * \param nb_lap number of laps, -1 for infinite
|
---|
72 | */
|
---|
73 | void StartTraj(const core::Vector2D &start_pos,float nb_lap=-1);
|
---|
74 |
|
---|
75 | /*!
|
---|
76 | * \brief Stop trajectory
|
---|
77 | *
|
---|
78 | * Stop abruptly the trajectory.
|
---|
79 | */
|
---|
80 | void StopTraj(void);
|
---|
81 |
|
---|
82 | /*!
|
---|
83 | * \brief Finish trajectory
|
---|
84 | *
|
---|
85 | * Finish smoothly the trajectory.
|
---|
86 | */
|
---|
87 | void FinishTraj(void);
|
---|
88 |
|
---|
89 | /*!
|
---|
90 | * \brief Set center position
|
---|
91 | *
|
---|
92 | * \param value center position
|
---|
93 | */
|
---|
94 | void SetCenter(const core::Vector2D &value);
|
---|
95 |
|
---|
96 | /*!
|
---|
97 | * \brief Set center speed
|
---|
98 | *
|
---|
99 | * \param value center speed
|
---|
100 | */
|
---|
101 | void SetCenterSpeed(const core::Vector2D &value);
|
---|
102 |
|
---|
103 | /*!
|
---|
104 | * \brief Update using provided datas
|
---|
105 | *
|
---|
106 | * Uses values specified by StartTraj(),
|
---|
107 | * SetCenter() and SetCenterSpeed().
|
---|
108 | *
|
---|
109 | * \param time time of the update
|
---|
110 | */
|
---|
111 | void Update(core::Time time);
|
---|
112 |
|
---|
113 | /*!
|
---|
114 | * \brief Position
|
---|
115 | *
|
---|
116 | * \param point returned position
|
---|
117 | */
|
---|
118 | void GetPosition(core::Vector2D &point) const;
|
---|
119 |
|
---|
120 | /*!
|
---|
121 | * \brief Speed
|
---|
122 | *
|
---|
123 | * \param point returned speed
|
---|
124 | */
|
---|
125 | void GetSpeed(core::Vector2D &point) const;
|
---|
126 |
|
---|
127 | /*!
|
---|
128 | * \brief Output matrix
|
---|
129 | *
|
---|
130 | * \return matrix
|
---|
131 | */
|
---|
132 | core::cvmatrix *Matrix(void) const;
|
---|
133 |
|
---|
134 | /*!
|
---|
135 | * \brief Is trajectory running?
|
---|
136 | *
|
---|
137 | * \return true if trajectory is running
|
---|
138 | */
|
---|
139 | bool IsRunning(void) const;
|
---|
140 |
|
---|
141 | private:
|
---|
142 | /*!
|
---|
143 | * \brief Update using provided datas
|
---|
144 | *
|
---|
145 | * Reimplemented from IODevice. Nothing to do in this IODevice.
|
---|
146 | *
|
---|
147 | * \param data data from the parent to process
|
---|
148 | */
|
---|
149 | void UpdateFrom(const core::io_data *data){};
|
---|
150 |
|
---|
151 | TrajectoryGenerator2DCircle_impl* pimpl_;
|
---|
152 |
|
---|
153 | };
|
---|
154 | } // end namespace filter
|
---|
155 | } // end namespace flair
|
---|
156 | #endif // TRAJECTORYGENERATOR2DCIRCLE_H
|
---|