| 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 NestedSat.h
|
---|
| 7 | * \brief Class defining a PID with saturations
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2013/04/15
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef NESTEDSAT_H
|
---|
| 14 | #define NESTEDSAT_H
|
---|
| 15 |
|
---|
| 16 | #include <ControlLaw.h>
|
---|
| 17 |
|
---|
| 18 | namespace flair
|
---|
| 19 | {
|
---|
| 20 | namespace gui
|
---|
| 21 | {
|
---|
| 22 | class Layout;
|
---|
| 23 | class LayoutPosition;
|
---|
| 24 | }
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | class NestedSat_impl;
|
---|
| 28 |
|
---|
| 29 | namespace flair
|
---|
| 30 | {
|
---|
| 31 | namespace filter
|
---|
| 32 | {
|
---|
| 33 | /*! \class NestedSat
|
---|
| 34 | *
|
---|
| 35 | * \brief Class defining a PID with saturations
|
---|
| 36 | *
|
---|
| 37 | * The output of this control law is calculated
|
---|
| 38 | * as follows: \n
|
---|
| 39 | * p_ref=Sat(p_ref,k*sat_ref) \n
|
---|
| 40 | * d_ref=Sat[(p_ref-p)*kp,k*sat_dref] \n
|
---|
| 41 | * law=Sat[(d-d_ref)*kd,sat_u] \n
|
---|
| 42 | * where p, p_ref and d are input values (see SetValues()), \n
|
---|
| 43 | * where sat_ref, sat_dref and sat_u are settings availables on the ground station, \n
|
---|
| 44 | * where k is a conversion factor (see ConvertSatFromDegToRad()).
|
---|
| 45 | */
|
---|
| 46 | class NestedSat : public ControlLaw
|
---|
| 47 | {
|
---|
| 48 | friend class ::NestedSat_impl;
|
---|
| 49 |
|
---|
| 50 | public:
|
---|
| 51 | /*!
|
---|
| 52 | * \brief Constructor
|
---|
| 53 | *
|
---|
| 54 | * Construct a NestedSat at given place position. \n
|
---|
| 55 | * The NestedSat will automatically be child of position->getLayout() Layout. After calling this function,
|
---|
| 56 | * position will be deleted as it is no longer usefull. \n
|
---|
| 57 | *
|
---|
| 58 | * \param position position to display settings
|
---|
| 59 | * \param name name
|
---|
| 60 | */
|
---|
| 61 | NestedSat(const gui::LayoutPosition* position,std::string name);
|
---|
| 62 |
|
---|
| 63 | /*!
|
---|
| 64 | * \brief Destructor
|
---|
| 65 | *
|
---|
| 66 | */
|
---|
| 67 | ~NestedSat();
|
---|
| 68 |
|
---|
| 69 | /*!
|
---|
| 70 | * \brief Set input values
|
---|
| 71 | *
|
---|
| 72 | * \param p_ref proportional reference
|
---|
| 73 | * \param p proportional value
|
---|
| 74 | * \param d derivative value
|
---|
| 75 | */
|
---|
| 76 | void SetValues(float p_ref,float p,float d);
|
---|
| 77 |
|
---|
| 78 | /*!
|
---|
| 79 | * \brief Convert saturation parameters in radians
|
---|
| 80 | *
|
---|
| 81 | * If this function is called, saturation parameters
|
---|
| 82 | * on the ground station will be interpreted as degrees. \n
|
---|
| 83 | * Thus, an internal conversion from degrees to radians will
|
---|
| 84 | * be done (k=PI/180).
|
---|
| 85 | */
|
---|
| 86 | void ConvertSatFromDegToRad(void);
|
---|
| 87 |
|
---|
| 88 | private:
|
---|
| 89 | /*!
|
---|
| 90 | * \brief Update using provided datas
|
---|
| 91 | *
|
---|
| 92 | * Reimplemented from IODevice.
|
---|
| 93 | *
|
---|
| 94 | * \param data data from the parent to process
|
---|
| 95 | */
|
---|
| 96 | void UpdateFrom(const core::io_data *data);
|
---|
| 97 |
|
---|
| 98 | NestedSat_impl* pimpl_;
|
---|
| 99 | };
|
---|
| 100 | } // end namespace filter
|
---|
| 101 | } // end namespace flair
|
---|
| 102 | #endif // NESTEDSAT_H
|
---|