source: flair-src/trunk/lib/FlairFilter/src/ControlLaw.h @ 10

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

lic

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