Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
* Copyright 2010, |
3 |
|
|
* François Bleibel, |
4 |
|
|
* Olivier Stasse, |
5 |
|
|
* |
6 |
|
|
* CNRS/AIST |
7 |
|
|
* |
8 |
|
|
*/ |
9 |
|
|
|
10 |
|
|
#ifndef __SOT_SOTINTEGRATORFORCE_H__ |
11 |
|
|
#define __SOT_SOTINTEGRATORFORCE_H__ |
12 |
|
|
|
13 |
|
|
/* --------------------------------------------------------------------- */ |
14 |
|
|
/* --- INCLUDE --------------------------------------------------------- */ |
15 |
|
|
/* --------------------------------------------------------------------- */ |
16 |
|
|
|
17 |
|
|
/* Matrix */ |
18 |
|
|
#include <dynamic-graph/linear-algebra.h> |
19 |
|
|
|
20 |
|
|
/* SOT */ |
21 |
|
|
#include <dynamic-graph/entity.h> |
22 |
|
|
#include <dynamic-graph/signal-ptr.h> |
23 |
|
|
#include <dynamic-graph/signal-time-dependent.h> |
24 |
|
|
|
25 |
|
|
#include <sot/core/matrix-geometry.hh> |
26 |
|
|
|
27 |
|
|
/* STD */ |
28 |
|
|
#include <string> |
29 |
|
|
|
30 |
|
|
/* --------------------------------------------------------------------- */ |
31 |
|
|
/* --- API ------------------------------------------------------------- */ |
32 |
|
|
/* --------------------------------------------------------------------- */ |
33 |
|
|
|
34 |
|
|
#if defined(WIN32) |
35 |
|
|
#if defined(integrator_force_EXPORTS) |
36 |
|
|
#define SOTINTEGRATORFORCE_EXPORT __declspec(dllexport) |
37 |
|
|
#else |
38 |
|
|
#define SOTINTEGRATORFORCE_EXPORT __declspec(dllimport) |
39 |
|
|
#endif |
40 |
|
|
#else |
41 |
|
|
#define SOTINTEGRATORFORCE_EXPORT |
42 |
|
|
#endif |
43 |
|
|
|
44 |
|
|
namespace dynamicgraph { |
45 |
|
|
namespace sot { |
46 |
|
|
namespace dg = dynamicgraph; |
47 |
|
|
|
48 |
|
|
/* --------------------------------------------------------------------- */ |
49 |
|
|
/* --- CLASS ----------------------------------------------------------- */ |
50 |
|
|
/* --------------------------------------------------------------------- */ |
51 |
|
|
|
52 |
|
|
class SOTINTEGRATORFORCE_EXPORT IntegratorForce : public dg::Entity { |
53 |
|
|
public: |
54 |
|
|
static const std::string CLASS_NAME; |
55 |
|
✗ |
virtual const std::string& getClassName(void) const { return CLASS_NAME; } |
56 |
|
|
|
57 |
|
|
protected: |
58 |
|
|
double timeStep; |
59 |
|
|
static const double TIME_STEP_DEFAULT; // = 5e-3 |
60 |
|
|
|
61 |
|
|
public: /* --- CONSTRUCTION --- */ |
62 |
|
|
IntegratorForce(const std::string& name); |
63 |
|
|
virtual ~IntegratorForce(void); |
64 |
|
|
|
65 |
|
|
public: /* --- SIGNAL --- */ |
66 |
|
|
dg::SignalPtr<dynamicgraph::Vector, int> forceSIN; |
67 |
|
|
dg::SignalPtr<dynamicgraph::Matrix, int> massInverseSIN; |
68 |
|
|
dg::SignalPtr<dynamicgraph::Matrix, int> frictionSIN; |
69 |
|
|
|
70 |
|
|
/* Memory of the previous iteration. The sig is fed by the previous |
71 |
|
|
* computations. */ |
72 |
|
|
dg::SignalPtr<dynamicgraph::Vector, int> velocityPrecSIN; |
73 |
|
|
dg::SignalTimeDependent<dynamicgraph::Vector, int> velocityDerivativeSOUT; |
74 |
|
|
dg::SignalTimeDependent<dynamicgraph::Vector, int> velocitySOUT; |
75 |
|
|
|
76 |
|
|
dg::SignalPtr<dynamicgraph::Matrix, int> massSIN; |
77 |
|
|
dg::SignalTimeDependent<dynamicgraph::Matrix, int> massInverseSOUT; |
78 |
|
|
|
79 |
|
|
public: /* --- FUNCTIONS --- */ |
80 |
|
|
dynamicgraph::Vector& computeDerivative(dynamicgraph::Vector& res, |
81 |
|
|
const int& time); |
82 |
|
|
dynamicgraph::Vector& computeIntegral(dynamicgraph::Vector& res, |
83 |
|
|
const int& time); |
84 |
|
|
|
85 |
|
|
dynamicgraph::Matrix& computeMassInverse(dynamicgraph::Matrix& res, |
86 |
|
|
const int& time); |
87 |
|
|
}; |
88 |
|
|
|
89 |
|
|
} /* namespace sot */ |
90 |
|
|
} /* namespace dynamicgraph */ |
91 |
|
|
|
92 |
|
|
#endif // #ifndef __SOT_WAISTATTITUDEFROMSENSOR_H__ |
93 |
|
|
|