control-gr.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_Control_GR_HH__
11 #define __SOT_Control_GR_HH__
12 
13 /* --------------------------------------------------------------------- */
14 /* --- INCLUDE --------------------------------------------------------- */
15 /* --------------------------------------------------------------------- */
16 
17 /* Matrix */
18 #include <dynamic-graph/linear-algebra.h>
19 namespace dg = dynamicgraph;
20 
21 /* SOT */
22 #include <dynamic-graph/entity.h>
23 #include <dynamic-graph/signal-ptr.h>
24 #include <dynamic-graph/signal-time-dependent.h>
25 
26 /* --------------------------------------------------------------------- */
27 /* --- API ------------------------------------------------------------- */
28 /* --------------------------------------------------------------------- */
29 
30 #if defined(WIN32)
31 #if defined(control_gr_EXPORTS)
32 #define ControlGR_EXPORT __declspec(dllexport)
33 #else
34 #define ControlGR_EXPORT __declspec(dllimport)
35 #endif
36 #else
37 #define ControlGR_EXPORT
38 #endif
39 
40 namespace dynamicgraph {
41 namespace sot {
42 
43 namespace dg = dynamicgraph;
44 
45 /* --------------------------------------------------------------------- */
46 /* --- CLASS ----------------------------------------------------------- */
47 /* --------------------------------------------------------------------- */
48 
49 class ControlGR_EXPORT ControlGR : public Entity {
50 
51 public: /* --- CONSTRUCTOR ---- */
52  ControlGR(const std::string &name);
53 
54 public: /* --- INIT --- */
55  void init(const double &step);
56 
57 public: /* --- CONSTANTS --- */
58  /* Default values. */
59  static const double TIME_STEP_DEFAULT; // = 0.001
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 torque-control function:
68  * tau = - A*qddot = g */
69  double TimeStep;
70  double _dimension;
71 
72 public: /* --- SIGNALS --- */
73  SignalPtr<dg::Matrix, int> matrixASIN;
74  SignalPtr<dg::Vector, int> accelerationSIN;
75  SignalPtr<dg::Vector, int> gravitySIN;
76  SignalTimeDependent<dg::Vector, int> controlSOUT;
77 
78 protected:
79  double &setsize(int dimension);
80  dg::Vector &computeControl(dg::Vector &tau, int t);
81 };
82 
83 } // namespace sot
84 } // namespace dynamicgraph
85 
86 #endif // #ifndef __SOT_Control_GR_HH__
dynamicgraph::sot::ControlGR::_dimension
double _dimension
Definition: control-gr.hh:70
dynamicgraph::sot::ControlGR::getClassName
virtual const std::string & getClassName(void) const
Definition: control-gr.hh:64
dynamicgraph
Definition: abstract-sot-external-interface.hh:17
dynamicgraph::sot::ControlGR
Definition: control-gr.hh:49
dynamicgraph::sot::ControlGR::TimeStep
double TimeStep
Definition: control-gr.hh:69
dynamicgraph::sot::ControlGR::TIME_STEP_DEFAULT
static const double TIME_STEP_DEFAULT
Definition: control-gr.hh:59
dynamicgraph::sot::ControlGR::matrixASIN
SignalPtr< dg::Matrix, int > matrixASIN
Definition: control-gr.hh:73
dynamicgraph::sot::ControlGR::CLASS_NAME
static const std::string CLASS_NAME
Definition: control-gr.hh:62
dynamicgraph::sot::ControlGR::accelerationSIN
SignalPtr< dg::Vector, int > accelerationSIN
Definition: control-gr.hh:74
dynamicgraph::sot::ControlGR::controlSOUT
SignalTimeDependent< dg::Vector, int > controlSOUT
Definition: control-gr.hh:76
ControlGR_EXPORT
#define ControlGR_EXPORT
Definition: control-gr.hh:37
dynamicgraph::sot::ControlGR::gravitySIN
SignalPtr< dg::Vector, int > gravitySIN
Definition: control-gr.hh:75