1 |
|
|
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 |
|
|
* Copyright Projet JRL-Japan, 2007 |
3 |
|
|
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
4 |
|
|
* |
5 |
|
|
* File: StepComputer.h |
6 |
|
|
* Project: SOT |
7 |
|
|
* Author: Paul Evrard, Nicolas Mansard |
8 |
|
|
* |
9 |
|
|
* Version control |
10 |
|
|
* =============== |
11 |
|
|
* |
12 |
|
|
* $Id$ |
13 |
|
|
* |
14 |
|
|
* Description |
15 |
|
|
* ============ |
16 |
|
|
* |
17 |
|
|
* Computes reference signals for the stepper. |
18 |
|
|
* |
19 |
|
|
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
20 |
|
|
|
21 |
|
|
#ifndef __SOT_STEP_OBSERVER_H__ |
22 |
|
|
#define __SOT_STEP_OBSERVER_H__ |
23 |
|
|
|
24 |
|
|
/* --------------------------------------------------------------------- */ |
25 |
|
|
/* --- INCLUDE --------------------------------------------------------- */ |
26 |
|
|
/* --------------------------------------------------------------------- */ |
27 |
|
|
|
28 |
|
|
#include <dynamic-graph/entity.h> |
29 |
|
|
#include <dynamic-graph/signal-ptr.h> |
30 |
|
|
#include <dynamic-graph/signal-time-dependent.h> |
31 |
|
|
|
32 |
|
|
#include <sot/core/matrix-geometry.hh> |
33 |
|
|
|
34 |
|
|
/* --------------------------------------------------------------------- */ |
35 |
|
|
/* --- API ------------------------------------------------------------- */ |
36 |
|
|
/* --------------------------------------------------------------------- */ |
37 |
|
|
|
38 |
|
|
#if defined(WIN32) |
39 |
|
|
#if defined(step_observer_EXPORTS) |
40 |
|
|
#define StepObserver_EXPORT __declspec(dllexport) |
41 |
|
|
#else |
42 |
|
|
#define StepObserver_EXPORT __declspec(dllimport) |
43 |
|
|
#endif |
44 |
|
|
#else |
45 |
|
|
#define StepObserver_EXPORT |
46 |
|
|
#endif |
47 |
|
|
|
48 |
|
|
namespace dynamicgraph { |
49 |
|
|
namespace sot { |
50 |
|
|
|
51 |
|
|
/* --------------------------------------------------------------------- */ |
52 |
|
|
/* --- CLASS ----------------------------------------------------------- */ |
53 |
|
|
/* --------------------------------------------------------------------- */ |
54 |
|
|
|
55 |
|
|
/// Computes a reference frame from the position of both |
56 |
|
|
/// hands and feet of the robot. The coordinates of the reference |
57 |
|
|
/// frames are computed both in the left and right foot frames, |
58 |
|
|
/// and in the waist frame. |
59 |
|
|
class StepObserver_EXPORT StepObserver : public Entity { |
60 |
|
|
public: |
61 |
|
|
static const std::string CLASS_NAME; |
62 |
|
|
virtual const std::string &getClassName(void) const { return CLASS_NAME; } |
63 |
|
|
|
64 |
|
|
public: |
65 |
|
|
SignalPtr<MatrixHomogeneous, int> leftHandPositionSIN; |
66 |
|
|
SignalPtr<MatrixHomogeneous, int> rightHandPositionSIN; |
67 |
|
|
|
68 |
|
|
SignalPtr<MatrixHomogeneous, int> leftFootPositionSIN; |
69 |
|
|
SignalPtr<MatrixHomogeneous, int> rightFootPositionSIN; |
70 |
|
|
SignalPtr<MatrixHomogeneous, int> waistPositionSIN; |
71 |
|
|
|
72 |
|
|
/// Reference frame in left foot coordinates. |
73 |
|
|
SignalTimeDependent<MatrixHomogeneous, int> referencePositionLeftSOUT; |
74 |
|
|
|
75 |
|
|
/// Reference frame in right foot coordinates. |
76 |
|
|
SignalTimeDependent<MatrixHomogeneous, int> referencePositionRightSOUT; |
77 |
|
|
|
78 |
|
|
/// Reference frame in the waist coordinates. |
79 |
|
|
SignalTimeDependent<MatrixHomogeneous, int> referencePositionWaistSOUT; |
80 |
|
|
|
81 |
|
|
public: // methods |
82 |
|
|
StepObserver(const std::string &name); |
83 |
|
|
|
84 |
|
|
SignalArray<int> getSignals(void); |
85 |
|
|
operator SignalArray<int>(); |
86 |
|
|
|
87 |
|
|
public: // signal callbacks |
88 |
|
|
MatrixHomogeneous &computeReferencePositionLeft(MatrixHomogeneous &res, |
89 |
|
|
int timeCurr); |
90 |
|
|
MatrixHomogeneous &computeReferencePositionRight(MatrixHomogeneous &res, |
91 |
|
|
int timeCurr); |
92 |
|
|
MatrixHomogeneous &computeReferencePositionWaist(MatrixHomogeneous &res, |
93 |
|
|
int timeCurr); |
94 |
|
|
|
95 |
|
|
public: // Entity |
96 |
|
|
virtual void display(std::ostream &os) const; |
97 |
|
|
virtual void commandLine(const std::string &cmdLine, |
98 |
|
|
std::istringstream &cmdArgs, std::ostream &os); |
99 |
|
|
|
100 |
|
|
private: // helpers |
101 |
|
|
MatrixHomogeneous &computeRefPos(MatrixHomogeneous &res, int timeCurr, |
102 |
|
|
const MatrixHomogeneous &wMref); |
103 |
|
|
}; |
104 |
|
|
|
105 |
|
|
} // namespace sot |
106 |
|
|
} // namespace dynamicgraph |
107 |
|
|
|
108 |
|
|
#endif |