sot-core  4.11.6
Hierarchical task solver plug-in for dynamic-graph.
gain-adaptive.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 #ifndef __SOT_GAIN_ADAPTATIVE_HH__
11 #define __SOT_GAIN_ADAPTATIVE_HH__
12 
13 /* --------------------------------------------------------------------- */
14 /* --- INCLUDE --------------------------------------------------------- */
15 /* --------------------------------------------------------------------- */
16 
17 /* Matrix */
18 #include <dynamic-graph/linear-algebra.h>
19 
20 /* SOT */
21 #include <dynamic-graph/all-signals.h>
22 #include <dynamic-graph/entity.h>
23 
24 /* --------------------------------------------------------------------- */
25 /* --- API ------------------------------------------------------------- */
26 /* --------------------------------------------------------------------- */
27 
28 #if defined(WIN32)
29 #if defined(gain_adaptive_EXPORTS)
30 #define SOTGAINADAPTATIVE_EXPORT __declspec(dllexport)
31 #else
32 #define SOTGAINADAPTATIVE_EXPORT __declspec(dllimport)
33 #endif
34 #else
35 #define SOTGAINADAPTATIVE_EXPORT
36 #endif
37 
38 /* --------------------------------------------------------------------- */
39 /* --- CLASS ----------------------------------------------------------- */
40 /* --------------------------------------------------------------------- */
41 
42 namespace dynamicgraph {
43 namespace sot {
44 
53 class SOTGAINADAPTATIVE_EXPORT GainAdaptive : public dynamicgraph::Entity {
54 
55 public: /* --- CONSTANTS --- */
56  /* Default values. */
57  static const double ZERO_DEFAULT; // = 0.1
58  static const double INFTY_DEFAULT; // = 0.1
59  static const double TAN_DEFAULT; // = 1.
60 
61 public: /* --- ENTITY INHERITANCE --- */
62  static const std::string CLASS_NAME;
63  virtual void display(std::ostream &os) const;
64  virtual const std::string &getClassName(void) const { return CLASS_NAME; }
65 
66 protected:
67  /* Parameters of the adaptative-gain function:
68  * lambda (x) = a * exp (-b*x) + c. */
69  double coeff_a;
70  double coeff_b;
71  double coeff_c;
72 
73 public: /* --- CONSTRUCTORS ---- */
74  GainAdaptive(const std::string &name);
75  GainAdaptive(const std::string &name, const double &lambda);
76  GainAdaptive(const std::string &name, const double &valueAt0,
77  const double &valueAtInfty, const double &tanAt0);
78 
79 public: /* --- INIT --- */
80  inline void init(void) { init(ZERO_DEFAULT, INFTY_DEFAULT, TAN_DEFAULT); }
81  inline void init(const double &lambda) { init(lambda, lambda, 1.); }
82  void init(const double &valueAt0, const double &valueAtInfty,
83  const double &tanAt0);
114  void initFromPassingPoint(const double &valueAt0, const double &valueAtInfty,
115  const double &errorReference,
116  const double &percentage);
117  void forceConstant(void);
118 
119 public: /* --- SIGNALS --- */
120  dynamicgraph::SignalPtr<dynamicgraph::Vector, int> errorSIN;
121  dynamicgraph::SignalTimeDependent<double, int> gainSOUT;
122 
123 protected:
124  double &computeGain(double &res, int t);
125 
126 private:
127  void addCommands();
128 };
129 
130 } /* namespace sot */
131 } /* namespace dynamicgraph */
132 
133 #endif // #ifndef __SOT_GAIN_ADAPTATIVE_HH__
#define SOTGAINADAPTATIVE_EXPORT
Definition: gain-adaptive.hh:35
void init(const double &lambda)
Definition: gain-adaptive.hh:81
double coeff_c
Definition: gain-adaptive.hh:71
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > errorSIN
Definition: gain-adaptive.hh:120
static const double ZERO_DEFAULT
Definition: gain-adaptive.hh:57
dynamicgraph::SignalTimeDependent< double, int > gainSOUT
Definition: gain-adaptive.hh:121
static const double TAN_DEFAULT
Definition: gain-adaptive.hh:59
virtual const std::string & getClassName(void) const
Definition: gain-adaptive.hh:64
Definition: gain-adaptive.hh:53
void init(void)
Definition: gain-adaptive.hh:80
static const double INFTY_DEFAULT
Definition: gain-adaptive.hh:58
double coeff_b
Definition: gain-adaptive.hh:70
double coeff_a
Definition: gain-adaptive.hh:69
static const std::string CLASS_NAME
Definition: gain-adaptive.hh:62
Definition: abstract-sot-external-interface.hh:17