sot-core  4.11.6
Hierarchical task solver plug-in for dynamic-graph.
gain-hyperbolic.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_HYPERBOLIC_HH__
11 #define __SOT_GAIN_HYPERBOLIC_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_hyperbolic_EXPORTS)
30 #define SOTGAINHYPERBOLIC_EXPORT __declspec(dllexport)
31 #else
32 #define SOTGAINHYPERBOLIC_EXPORT __declspec(dllimport)
33 #endif
34 #else
35 #define SOTGAINHYPERBOLIC_EXPORT
36 #endif
37 
38 /* --------------------------------------------------------------------- */
39 /* --- CLASS ----------------------------------------------------------- */
40 /* --------------------------------------------------------------------- */
41 
42 namespace dynamicgraph {
43 namespace sot {
44 
53 class SOTGAINHYPERBOLIC_EXPORT GainHyperbolic : 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 hyperbolic-gain function:
68  * lambda (x) = a * exp (-b*x) + c. */
69  double coeff_a;
70  double coeff_b;
71  double coeff_c;
72  double coeff_d;
73 
74 public: /* --- CONSTRUCTORS ---- */
75  GainHyperbolic(const std::string &name);
76  GainHyperbolic(const std::string &name, const double &lambda);
77  GainHyperbolic(const std::string &name, const double &valueAt0,
78  const double &valueAtInfty, const double &tanAt0,
79  const double &decal0);
80 
81 public: /* --- INIT --- */
82  inline void init(void) { init(ZERO_DEFAULT, INFTY_DEFAULT, TAN_DEFAULT, 0); }
83  inline void init(const double &lambda) { init(lambda, lambda, 1., 0); }
90  void init(const double &valueAt0, const double &valueAtInfty,
91  const double &tanAt0, const double &decal0);
92  void forceConstant(void);
93 
94 public: /* --- SIGNALS --- */
95  dynamicgraph::SignalPtr<dynamicgraph::Vector, int> errorSIN;
96  dynamicgraph::SignalTimeDependent<double, int> gainSOUT;
97 
98 protected:
99  double &computeGain(double &res, int t);
100 };
101 
102 } /* namespace sot */
103 } /* namespace dynamicgraph */
104 
105 #endif // #ifndef __SOT_GAIN_HYPERBOLIC_HH__
dynamicgraph::sot::GainHyperbolic::gainSOUT
dynamicgraph::SignalTimeDependent< double, int > gainSOUT
Definition: gain-hyperbolic.hh:96
dynamicgraph
Definition: abstract-sot-external-interface.hh:17
dynamicgraph::sot::GainHyperbolic::errorSIN
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > errorSIN
Definition: gain-hyperbolic.hh:95
dynamicgraph::sot::GainHyperbolic::CLASS_NAME
static const std::string CLASS_NAME
Definition: gain-hyperbolic.hh:62
dynamicgraph::sot::GainHyperbolic::init
void init(void)
Definition: gain-hyperbolic.hh:82
dynamicgraph::sot::GainHyperbolic::coeff_d
double coeff_d
Definition: gain-hyperbolic.hh:72
dynamicgraph::sot::GainHyperbolic::init
void init(const double &lambda)
Definition: gain-hyperbolic.hh:83
dynamicgraph::sot::GainHyperbolic::coeff_a
double coeff_a
Definition: gain-hyperbolic.hh:69
dynamicgraph::sot::GainHyperbolic::getClassName
virtual const std::string & getClassName(void) const
Definition: gain-hyperbolic.hh:64
dynamicgraph::sot::GainHyperbolic::TAN_DEFAULT
static const double TAN_DEFAULT
Definition: gain-hyperbolic.hh:59
dynamicgraph::sot::GainHyperbolic::coeff_c
double coeff_c
Definition: gain-hyperbolic.hh:71
SOTGAINHYPERBOLIC_EXPORT
#define SOTGAINHYPERBOLIC_EXPORT
Definition: gain-hyperbolic.hh:35
dynamicgraph::sot::GainHyperbolic::coeff_b
double coeff_b
Definition: gain-hyperbolic.hh:70
dynamicgraph::sot::GainHyperbolic::INFTY_DEFAULT
static const double INFTY_DEFAULT
Definition: gain-hyperbolic.hh:58
dynamicgraph::sot::GainHyperbolic::ZERO_DEFAULT
static const double ZERO_DEFAULT
Definition: gain-hyperbolic.hh:57
dynamicgraph::sot::GainHyperbolic
Hyperbolic gain. It follows the law.
Definition: gain-hyperbolic.hh:53