sot-talos-balance  1.5.0
simple-pidd.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2018, Gepetto team, LAAS-CNRS
3  *
4  * This file is part of sot-talos-balance.
5  * sot-talos-balance is free software: you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public License
7  * as published by the Free Software Foundation, either version 3 of
8  * the License, or (at your option) any later version.
9  * sot-talos-balance is distributed in the hope that it will be
10  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details. You should
13  * have received a copy of the GNU Lesser General Public License along
14  * with sot-talos-balance. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __sot_talos_balance_simple_pidd_H__
18 #define __sot_talos_balance_simple_pidd_H__
19 
20 /* --------------------------------------------------------------------- */
21 /* --- API ------------------------------------------------------------- */
22 /* --------------------------------------------------------------------- */
23 
24 #if defined (WIN32)
25 # if defined (simple_pidd_EXPORTS)
26 # define SIMPLE_PIDD_EXPORT __declspec(dllexport)
27 # else
28 # define SIMPLE_PIDD_EXPORT __declspec(dllimport)
29 # endif
30 #else
31 # define SIMPLE_PIDD_EXPORT
32 #endif
33 
34 
35 /* --------------------------------------------------------------------- */
36 /* --- INCLUDE --------------------------------------------------------- */
37 /* --------------------------------------------------------------------- */
38 
39 #include <dynamic-graph/signal-helper.h>
40 #include <map>
41 #include "boost/assign.hpp"
42 
43 namespace dynamicgraph {
44  namespace sot {
45  namespace talos_balance {
46 
47  /* --------------------------------------------------------------------- */
48  /* --- CLASS ----------------------------------------------------------- */
49  /* --------------------------------------------------------------------- */
50 
52  : public ::dynamicgraph::Entity
53  {
54  DYNAMIC_GRAPH_ENTITY_DECL();
55 
56  public:
57  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
58 
59  /* --- CONSTRUCTOR ---- */
60  SimplePIDD( const std::string & name );
61 
62  void init(const double & dt, const int & N);
63 
64  void resetVelocity();
65  void resetIntegralError();
66 
67  /* --- SIGNALS --- */
68  DECLARE_SIGNAL_IN(Kp, dynamicgraph::Vector);
69  DECLARE_SIGNAL_IN(Ki, dynamicgraph::Vector);
70  DECLARE_SIGNAL_IN(Kd, dynamicgraph::Vector);
71 
72  DECLARE_SIGNAL_IN(decayFactor, double);
73 
74  DECLARE_SIGNAL_IN(x, dynamicgraph::Vector);
75  DECLARE_SIGNAL_IN(x_des, dynamicgraph::Vector);
76 
77  DECLARE_SIGNAL_IN(dx, dynamicgraph::Vector);
78  DECLARE_SIGNAL_IN(dx_des, dynamicgraph::Vector);
79 
80  DECLARE_SIGNAL_IN(ddx_des, dynamicgraph::Vector);
81 
82  DECLARE_SIGNAL_OUT(ddx_ref, dynamicgraph::Vector);
83  DECLARE_SIGNAL_OUT(dx_ref, dynamicgraph::Vector);
84 
85  /* --- COMMANDS --- */
86  /* --- ENTITY INHERITANCE --- */
87  virtual void display( std::ostream& os ) const;
88 
89  protected:
91  dynamicgraph::Vector m_dx_ref; // internal state
93  double m_dt;
94 
95  }; // class SimplePIDD
96 
97  } // namespace talos_balance
98  } // namespace sot
99 } // namespace dynamicgraph
100 
101 
102 
103 #endif // #ifndef __sot_talos_balance_simple_pidd_H__
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Definition: math/fwd.hh:40
#define SIMPLE_PIDD_EXPORT
Definition: simple-pidd.hh:31
dynamicgraph::Vector m_dx_ref
true if the entity has been successfully initialized
Definition: simple-pidd.hh:91