1 | /*!
|
---|
2 | * \file TrajectoryGenerator1D.h
|
---|
3 | * \brief Class generating a trajectory in 1D
|
---|
4 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
5 | * \date 2011/05/01
|
---|
6 | * \version 4.0
|
---|
7 | */
|
---|
8 |
|
---|
9 | #ifndef TRAJECTORYGENERATOR1D_H
|
---|
10 | #define TRAJECTORYGENERATOR1D_H
|
---|
11 |
|
---|
12 | #include <IODevice.h>
|
---|
13 |
|
---|
14 | namespace flair
|
---|
15 | {
|
---|
16 | namespace core
|
---|
17 | {
|
---|
18 | class cvmatrix;
|
---|
19 | }
|
---|
20 | namespace gui
|
---|
21 | {
|
---|
22 | class LayoutPosition;
|
---|
23 | }
|
---|
24 | }
|
---|
25 |
|
---|
26 | class TrajectoryGenerator1D_impl;
|
---|
27 |
|
---|
28 | namespace flair
|
---|
29 | {
|
---|
30 | namespace filter
|
---|
31 | {
|
---|
32 | /*! \class TrajectoryGenerator1D
|
---|
33 | *
|
---|
34 | * \brief Class generating a trajectory in 1D
|
---|
35 | *
|
---|
36 | * This class generates position and velocity references, given
|
---|
37 | * an absolute maximum velocity and an absolute acceleration. \n
|
---|
38 | * When trajectory is started (see StartTraj()), position and velocity will increase
|
---|
39 | * at the given acceleration. If the maximum velocity is reached,
|
---|
40 | * velocity will not increase anymore. Then, velocity will decrease according
|
---|
41 | * to the given acceleration until velocity is null and final position is reached. \n
|
---|
42 | * Manual inputs can be introduced using SetPositionOffset() and SetSpeedOffset().
|
---|
43 | *
|
---|
44 | */
|
---|
45 | class TrajectoryGenerator1D : public core::IODevice
|
---|
46 | {
|
---|
47 | public:
|
---|
48 | /*!
|
---|
49 | * \brief Constructor
|
---|
50 | *
|
---|
51 | * Construct a TrajectoryGenerator1D at given position. \n
|
---|
52 | * The TrajectoryGenerator1D will automatically be child of position->getLayout() Layout. After calling this function,
|
---|
53 | * position will be deleted as it is no longer usefull. \n
|
---|
54 | *
|
---|
55 | * \param position position to display settings
|
---|
56 | * \param name name
|
---|
57 | * \param unit unit of the position (for exemple m, deg, etc). Its only used for display on ground station.
|
---|
58 | */
|
---|
59 | TrajectoryGenerator1D(const gui::LayoutPosition* position,std::string name,std::string unit="");
|
---|
60 |
|
---|
61 | /*!
|
---|
62 | * \brief Destructor
|
---|
63 | *
|
---|
64 | */
|
---|
65 | ~TrajectoryGenerator1D();
|
---|
66 |
|
---|
67 | /*!
|
---|
68 | * \brief Start trajectory
|
---|
69 | *
|
---|
70 | * \param start_pos start position
|
---|
71 | * \param end_pos end position
|
---|
72 | */
|
---|
73 | void StartTraj(float start_pos,float end_pos);
|
---|
74 |
|
---|
75 | /*!
|
---|
76 | * \brief Stop trajectory
|
---|
77 | *
|
---|
78 | */
|
---|
79 | void StopTraj(void);
|
---|
80 |
|
---|
81 | /*!
|
---|
82 | * \brief Reset
|
---|
83 | *
|
---|
84 | * Reset all outputs to 0. This can be done only when IsRunning()==false.
|
---|
85 | *
|
---|
86 | */
|
---|
87 | void Reset(void);
|
---|
88 |
|
---|
89 | /*!
|
---|
90 | * \brief Is trajectory running?
|
---|
91 | *
|
---|
92 | * \return true if trajectory is running
|
---|
93 | */
|
---|
94 | bool IsRunning(void) const;
|
---|
95 |
|
---|
96 | /*!
|
---|
97 | * \brief Set position offset
|
---|
98 | *
|
---|
99 | * \param value position offset
|
---|
100 | */
|
---|
101 | void SetPositionOffset(float value);
|
---|
102 |
|
---|
103 | /*!
|
---|
104 | * \brief Set speed offset
|
---|
105 | *
|
---|
106 | * \param value speed offset
|
---|
107 | */
|
---|
108 | void SetSpeedOffset(float value);
|
---|
109 |
|
---|
110 | /*!
|
---|
111 | * \brief Update using provided datas
|
---|
112 | *
|
---|
113 | * Uses values specified by StartTraj(),
|
---|
114 | * SetPositionOffset() and SetSpeedOffset().
|
---|
115 | *
|
---|
116 | * \param time time of the update
|
---|
117 | */
|
---|
118 | void Update(core::Time time);
|
---|
119 |
|
---|
120 | /*!
|
---|
121 | * \brief Position
|
---|
122 | *
|
---|
123 | */
|
---|
124 | float Position(void) const;
|
---|
125 |
|
---|
126 | /*!
|
---|
127 | * \brief Speed
|
---|
128 | *
|
---|
129 | */
|
---|
130 | float Speed(void) const;
|
---|
131 |
|
---|
132 | /*!
|
---|
133 | * \brief Output matrix
|
---|
134 | *
|
---|
135 | * \return matrix
|
---|
136 | */
|
---|
137 | core::cvmatrix *Matrix(void) const;
|
---|
138 |
|
---|
139 | private:
|
---|
140 | /*!
|
---|
141 | * \brief Update using provided datas
|
---|
142 | *
|
---|
143 | * Reimplemented from IODevice. Nothing to do in this IODevice.
|
---|
144 | *
|
---|
145 | * \param data data from the parent to process
|
---|
146 | */
|
---|
147 | void UpdateFrom(const core::io_data *data){};
|
---|
148 |
|
---|
149 | TrajectoryGenerator1D_impl* pimpl_;
|
---|
150 | };
|
---|
151 | } // end namespace filter
|
---|
152 | } // end namespace flair
|
---|
153 | #endif // TRAJECTORYGENERATOR1D_H
|
---|