[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 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 |
|
---|
[15] | 18 | namespace flair {
|
---|
| 19 | namespace gui {
|
---|
| 20 | class Layout;
|
---|
| 21 | class LayoutPosition;
|
---|
[7] | 22 | }
|
---|
[15] | 23 | }
|
---|
[7] | 24 |
|
---|
| 25 | class NestedSat_impl;
|
---|
| 26 |
|
---|
[15] | 27 | namespace flair {
|
---|
| 28 | namespace filter {
|
---|
| 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
|
---|
| 40 | *station, \n
|
---|
| 41 | * where k is a conversion factor (see ConvertSatFromDegToRad()).
|
---|
| 42 | */
|
---|
| 43 | class NestedSat : public ControlLaw {
|
---|
| 44 | friend class ::NestedSat_impl;
|
---|
[7] | 45 |
|
---|
[15] | 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.
|
---|
| 52 | *After calling this function,
|
---|
| 53 | * position will be deleted as it is no longer usefull. \n
|
---|
| 54 | *
|
---|
| 55 | * \param position position to display settings
|
---|
| 56 | * \param name name
|
---|
| 57 | */
|
---|
| 58 | NestedSat(const gui::LayoutPosition *position, std::string name);
|
---|
[7] | 59 |
|
---|
[15] | 60 | /*!
|
---|
| 61 | * \brief Destructor
|
---|
| 62 | *
|
---|
| 63 | */
|
---|
| 64 | ~NestedSat();
|
---|
[7] | 65 |
|
---|
[15] | 66 | /*!
|
---|
| 67 | * \brief Set input values
|
---|
| 68 | *
|
---|
| 69 | * \param p_ref proportional reference
|
---|
| 70 | * \param p proportional value
|
---|
| 71 | * \param d derivative value
|
---|
| 72 | */
|
---|
| 73 | void SetValues(float p_ref, float p, float d);
|
---|
[7] | 74 |
|
---|
[15] | 75 | /*!
|
---|
| 76 | * \brief Convert saturation parameters in radians
|
---|
| 77 | *
|
---|
| 78 | * If this function is called, saturation parameters
|
---|
| 79 | * on the ground station will be interpreted as degrees. \n
|
---|
| 80 | * Thus, an internal conversion from degrees to radians will
|
---|
| 81 | * be done (k=PI/180).
|
---|
| 82 | */
|
---|
| 83 | void ConvertSatFromDegToRad(void);
|
---|
[7] | 84 |
|
---|
[15] | 85 | private:
|
---|
| 86 | /*!
|
---|
| 87 | * \brief Update using provided datas
|
---|
| 88 | *
|
---|
| 89 | * Reimplemented from IODevice.
|
---|
| 90 | *
|
---|
| 91 | * \param data data from the parent to process
|
---|
| 92 | */
|
---|
| 93 | void UpdateFrom(const core::io_data *data);
|
---|
[7] | 94 |
|
---|
[15] | 95 | NestedSat_impl *pimpl_;
|
---|
| 96 | };
|
---|
[7] | 97 | } // end namespace filter
|
---|
| 98 | } // end namespace flair
|
---|
| 99 | #endif // NESTEDSAT_H
|
---|