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