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

Last change on this file since 137 was 15, checked in by Bayard Gildas, 8 years ago

sources reformatted with flair-format-dir script

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