[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 PidThrust.h
|
---|
| 7 | * \brief Class defining a Pid for Thrust
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2014/11/07
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef PIDTHRUST_H
|
---|
| 14 | #define PIDTHRUST_H
|
---|
| 15 |
|
---|
| 16 | #include <ControlLaw.h>
|
---|
| 17 |
|
---|
[15] | 18 | namespace flair {
|
---|
| 19 | namespace gui {
|
---|
| 20 | class LayoutPosition;
|
---|
[7] | 21 | }
|
---|
[15] | 22 | }
|
---|
[7] | 23 |
|
---|
| 24 | class PidThrust_impl;
|
---|
| 25 |
|
---|
[15] | 26 | namespace flair {
|
---|
| 27 | namespace filter {
|
---|
| 28 | /*! \class PidThrust
|
---|
| 29 | *
|
---|
| 30 | * \brief Class defining a Pid for Thrust.\n
|
---|
| 31 | * This Pid as an extra offset for compensating gravity.
|
---|
| 32 | */
|
---|
| 33 | class PidThrust : public ControlLaw {
|
---|
| 34 | friend class ::PidThrust_impl;
|
---|
[7] | 35 |
|
---|
[15] | 36 | public:
|
---|
| 37 | /*!
|
---|
| 38 | * \brief Constructor
|
---|
| 39 | *
|
---|
| 40 | * Construct a PidThrust at given position
|
---|
| 41 | * The PidThrust will automatically be child of position->getLayout() Layout.
|
---|
| 42 | *After calling this function,
|
---|
| 43 | * position will be deleted as it is no longer usefull. \n
|
---|
| 44 | *
|
---|
| 45 | * \param position position to display settings
|
---|
| 46 | * \param name name
|
---|
| 47 | */
|
---|
| 48 | PidThrust(const gui::LayoutPosition *position, std::string name);
|
---|
[7] | 49 |
|
---|
[15] | 50 | /*!
|
---|
| 51 | * \brief Destructor
|
---|
| 52 | *
|
---|
| 53 | */
|
---|
| 54 | ~PidThrust();
|
---|
[7] | 55 |
|
---|
[15] | 56 | /*!
|
---|
[216] | 57 | * \brief Reset the control law
|
---|
| 58 | * equivalent to:
|
---|
| 59 | * ResetI();
|
---|
| 60 | * SetDefaultOffset();
|
---|
| 61 | * SetValues(0,0);
|
---|
| 62 | *
|
---|
| 63 | */
|
---|
| 64 | void Reset(void);
|
---|
| 65 |
|
---|
| 66 | /*!
|
---|
[15] | 67 | * \brief Reset integral to 0
|
---|
| 68 | *
|
---|
| 69 | */
|
---|
| 70 | void ResetI(void);
|
---|
[7] | 71 |
|
---|
[15] | 72 | /*!
|
---|
[206] | 73 | * \brief Set offset to a specified value
|
---|
[15] | 74 | *
|
---|
[206] | 75 | * \param value desired value
|
---|
[15] | 76 | */
|
---|
[206] | 77 | void SetOffset(float value);
|
---|
| 78 |
|
---|
[15] | 79 | /*!
|
---|
| 80 | * \brief Set offset to specified value in ground station
|
---|
| 81 | *
|
---|
| 82 | */
|
---|
[206] | 83 | void SetDefaultOffset(void);
|
---|
[7] | 84 |
|
---|
[15] | 85 | /*!
|
---|
| 86 | * \brief Get offset
|
---|
| 87 | *
|
---|
| 88 | * \return current offset
|
---|
| 89 | */
|
---|
[216] | 90 | float GetOffset(void) const;
|
---|
| 91 |
|
---|
| 92 | /*!
|
---|
| 93 | * \brief Get intergral part
|
---|
| 94 | *
|
---|
| 95 | * \return current integral part
|
---|
| 96 | */
|
---|
| 97 | float GetIntegral(void) const;
|
---|
[7] | 98 |
|
---|
[15] | 99 | /*!
|
---|
| 100 | * \brief Step up the offset according to specified value in ground station
|
---|
| 101 | *
|
---|
| 102 | * \return false if offset is at its maximum (1) value, true otherwise
|
---|
| 103 | */
|
---|
| 104 | bool OffsetStepUp(void);
|
---|
[7] | 105 |
|
---|
[15] | 106 | /*!
|
---|
| 107 | * \brief Step down the offset according to specified value in ground station
|
---|
| 108 | *
|
---|
| 109 | * \return false if offset is at its minimum (specified in ground station)
|
---|
| 110 | *value, true otherwise
|
---|
| 111 | */
|
---|
| 112 | bool OffsetStepDown(void);
|
---|
[7] | 113 |
|
---|
[15] | 114 | /*!
|
---|
| 115 | * \brief Set input values
|
---|
| 116 | *
|
---|
| 117 | * \param p proportional value
|
---|
| 118 | * \param d derivative value
|
---|
| 119 | */
|
---|
| 120 | void SetValues(float p, float d);
|
---|
[7] | 121 |
|
---|
[15] | 122 | /*!
|
---|
| 123 | * \brief Use default plot
|
---|
| 124 | *
|
---|
| 125 | * Plot the output values at position. \n
|
---|
| 126 | * Plot consists of 4 curves: proportional part,
|
---|
| 127 | * derivative part, integral part and
|
---|
| 128 | * the sum of the three. \n
|
---|
| 129 | * After calling this function, position will be deleted as it is no longer
|
---|
| 130 | *usefull. \n
|
---|
| 131 | *
|
---|
| 132 | * \param position position to display plot
|
---|
| 133 | */
|
---|
| 134 | void UseDefaultPlot(const gui::LayoutPosition *position);
|
---|
[7] | 135 |
|
---|
[15] | 136 | private:
|
---|
| 137 | /*!
|
---|
| 138 | * \brief Update using provided datas
|
---|
| 139 | *
|
---|
| 140 | * Reimplemented from IODevice.
|
---|
| 141 | *
|
---|
| 142 | * \param data data from the parent to process
|
---|
| 143 | */
|
---|
| 144 | void UpdateFrom(const core::io_data *data);
|
---|
[7] | 145 |
|
---|
[15] | 146 | PidThrust_impl *pimpl_;
|
---|
| 147 | };
|
---|
[7] | 148 | } // end namespace filter
|
---|
| 149 | } // end namespace flair
|
---|
| 150 | #endif // PIDTHRUST_H
|
---|