source: flair-dev/trunk/include/FlairFilter/ControlLaw.h@ 8

Last change on this file since 8 was 6, checked in by Sanahuja Guillaume, 8 years ago

filter

File size: 3.2 KB
Line 
1/*!
2 * \file ControlLaw.h
3 * \brief Base class for control law
4 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
5 * \date 2014/04/30
6 * \version 4.0
7 */
8
9#ifndef CONTROLLAW_H
10#define CONTROLLAW_H
11
12#include <IODevice.h>
13
14namespace flair {
15 namespace gui {
16 class LayoutPosition;
17 }
18 namespace core {
19 class cvmatrix;
20 }
21}
22
23namespace flair { namespace filter {
24 /*! \class ControlLaw
25 *
26 * \brief Base class for control law
27 * input must be created by reimplemented class.\n
28 * output is created by this class, it is of size (nb_out,1) and type float.\n
29 * see constructor for nb_out
30 */
31 class ControlLaw : public core::IODevice {
32 public:
33 /*!
34 * \brief Constructor
35 *
36 * Construct a ControlLaw
37 *
38 * \param parent parent
39 * \param name name
40 * \param nb_out number of output
41 */
42 ControlLaw(const core::Object* parent,std::string name,uint32_t nb_out=1);
43
44 /*!
45 * \brief Destructor
46 *
47 */
48 ~ControlLaw();
49
50 /*!
51 * \brief Output value
52 *
53 * \param index output index, between 0 and nb_out-1
54 *
55 * \return output value
56 */
57 float Output(uint32_t index=0) const;
58
59 /*!
60 * \brief Use default plot
61 *
62 * Plot the output value at given position. \n
63 * Only Output(1,1) is plotted. \n
64 * In case of a mutliple output ControlLaw, this function should be reimplemented. \n
65 * After calling this function, position will be deleted as it is no longer usefull. \n
66 *
67 * \param position position to display plot
68 */
69 virtual void UseDefaultPlot(const gui::LayoutPosition* position);
70
71 /*!
72 * \brief Update using provided datas
73 *
74 * Reimplemented class must fill input matrix before calling this.
75 *
76 * \param time time of the update
77 */
78 void Update(core::Time time);
79
80 /*!
81 * \brief Reset the internal state of the control law
82 *
83 * Doesn't do anything by default
84 *
85 */
86 virtual void Reset() {};
87
88 protected:
89 /*!
90 * \brief input matrix
91 *
92 * This matrix must be created by the reimplemented class.
93 *
94 */
95 core::cvmatrix *input;
96
97 /*!
98 * \brief output matrix
99 *
100 * This matrix is created by this class. Its size is (nb_out,1) and its type
101 * is io_data::Float.
102 *
103 */
104 core::cvmatrix *output;
105
106 private:
107 /*!
108 * \brief Update using provided datas
109 *
110 * Reimplemented from IODevice.
111 *
112 * \param data data from the parent to process
113 */
114 virtual void UpdateFrom(const core::io_data *data)=0;
115 };
116} // end namespace filter
117} // end namespace flair
118#endif // CONTROLLAW_H
Note: See TracBrowser for help on using the repository browser.