[10] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[10] | 4 | // %flair:license}
|
---|
[7] | 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 |
|
---|
| 18 | namespace flair {
|
---|
[15] | 19 | namespace gui {
|
---|
| 20 | class LayoutPosition;
|
---|
[7] | 21 | }
|
---|
[15] | 22 | namespace core {
|
---|
[214] | 23 | class Matrix;
|
---|
[15] | 24 | }
|
---|
| 25 | }
|
---|
[7] | 26 |
|
---|
[15] | 27 | namespace flair {
|
---|
| 28 | namespace 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 | */
|
---|
| 36 | class ControlLaw : public core::IODevice {
|
---|
| 37 | public:
|
---|
| 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);
|
---|
[7] | 48 |
|
---|
[15] | 49 | /*!
|
---|
| 50 | * \brief Destructor
|
---|
| 51 | *
|
---|
| 52 | */
|
---|
| 53 | ~ControlLaw();
|
---|
[7] | 54 |
|
---|
[15] | 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;
|
---|
[7] | 63 |
|
---|
[15] | 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);
|
---|
[7] | 77 |
|
---|
[15] | 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);
|
---|
[7] | 86 |
|
---|
[15] | 87 | /*!
|
---|
| 88 | * \brief Reset the internal state of the control law
|
---|
| 89 | *
|
---|
[216] | 90 | * Does nothing by default
|
---|
[15] | 91 | *
|
---|
| 92 | */
|
---|
| 93 | virtual void Reset(){};
|
---|
[7] | 94 |
|
---|
[15] | 95 | protected:
|
---|
| 96 | /*!
|
---|
| 97 | * \brief input matrix
|
---|
| 98 | *
|
---|
| 99 | * This matrix must be created by the reimplemented class.
|
---|
| 100 | *
|
---|
| 101 | */
|
---|
[214] | 102 | core::Matrix *input;
|
---|
[7] | 103 |
|
---|
[15] | 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 | */
|
---|
[214] | 111 | core::Matrix *output;
|
---|
[7] | 112 |
|
---|
[15] | 113 | private:
|
---|
| 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 | };
|
---|
[7] | 123 | } // end namespace filter
|
---|
| 124 | } // end namespace flair
|
---|
| 125 | #endif // CONTROLLAW_H
|
---|