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 |
|
|
* |
18 |
|
|
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
19 |
|
|
|
20 |
|
|
#ifndef __SOT_StepComputer_FORCE_H__ |
21 |
|
|
#define __SOT_StepComputer_FORCE_H__ |
22 |
|
|
|
23 |
|
|
/* --------------------------------------------------------------------- */ |
24 |
|
|
/* --- INCLUDE --------------------------------------------------------- */ |
25 |
|
|
/* --------------------------------------------------------------------- */ |
26 |
|
|
|
27 |
|
|
/* SOT */ |
28 |
|
|
#include <dynamic-graph/entity.h> |
29 |
|
|
#include <dynamic-graph/signal-ptr.h> |
30 |
|
|
#include <dynamic-graph/signal-time-dependent.h> |
31 |
|
|
#include <sot/pattern-generator/step-checker.h> |
32 |
|
|
#include <sot/pattern-generator/step-computer.h> |
33 |
|
|
#include <sot/pattern-generator/step-observer.h> |
34 |
|
|
|
35 |
|
|
#include <sot/core/matrix-geometry.hh> |
36 |
|
|
/* STD */ |
37 |
|
|
#include <deque> |
38 |
|
|
#include <fstream> |
39 |
|
|
#include <string> |
40 |
|
|
|
41 |
|
|
/* --------------------------------------------------------------------- */ |
42 |
|
|
/* --- API ------------------------------------------------------------- */ |
43 |
|
|
/* --------------------------------------------------------------------- */ |
44 |
|
|
|
45 |
|
|
#if defined(WIN32) |
46 |
|
|
#if defined(step_computer_pos_EXPORTS) |
47 |
|
|
#define StepComputerFORCE_EXPORT __declspec(dllexport) |
48 |
|
|
#else |
49 |
|
|
#define StepComputerFORCE_EXPORT __declspec(dllimport) |
50 |
|
|
#endif |
51 |
|
|
#else |
52 |
|
|
#define StepComputerFORCE_EXPORT |
53 |
|
|
#endif |
54 |
|
|
|
55 |
|
|
namespace dynamicgraph { |
56 |
|
|
namespace sot { |
57 |
|
|
|
58 |
|
|
/* --------------------------------------------------------------------- */ |
59 |
|
|
/* --- CLASS ----------------------------------------------------------- */ |
60 |
|
|
/* --------------------------------------------------------------------- */ |
61 |
|
|
|
62 |
|
|
class StepQueue; |
63 |
|
|
|
64 |
|
|
/// Generates footsteps. |
65 |
|
|
class StepComputerFORCE_EXPORT StepComputerPos : public Entity, |
66 |
|
|
public StepComputer { |
67 |
|
|
public: |
68 |
|
|
static const std::string CLASS_NAME; |
69 |
|
|
virtual const std::string &getClassName(void) const { return CLASS_NAME; } |
70 |
|
|
|
71 |
|
|
public: // Construction |
72 |
|
|
StepComputerPos(const std::string &name); |
73 |
|
|
|
74 |
|
|
public: // Methods |
75 |
|
|
void changeFirstStep(StepQueue &queue, int timeCurr); |
76 |
|
|
void nextStep(StepQueue &queue, int timeCurr); |
77 |
|
|
|
78 |
|
|
public: // Signals |
79 |
|
|
SignalPtr<MatrixHomogeneous, int> referencePositionLeftSIN; |
80 |
|
|
SignalPtr<MatrixHomogeneous, int> referencePositionRightSIN; |
81 |
|
|
SignalPtr<unsigned, int> contactFootSIN; |
82 |
|
|
|
83 |
|
|
public: // Entity |
84 |
|
|
virtual void display(std::ostream &os) const; |
85 |
|
|
virtual void commandLine(const std::string &cmdLine, |
86 |
|
|
std::istringstream &cmdArgs, std::ostream &os); |
87 |
|
|
|
88 |
|
|
private: // Reference frame |
89 |
|
|
MatrixHomogeneous rfMref0; |
90 |
|
|
MatrixHomogeneous lfMref0; |
91 |
|
|
StepObserver *twoHandObserver; |
92 |
|
|
StepChecker checker; |
93 |
|
|
|
94 |
|
|
void thisIsZero(); |
95 |
|
|
|
96 |
|
|
private: // Debug |
97 |
|
|
std::ofstream logChanges; |
98 |
|
|
std::ofstream logPreview; |
99 |
|
|
}; |
100 |
|
|
|
101 |
|
|
} // namespace sot |
102 |
|
|
} // namespace dynamicgraph |
103 |
|
|
|
104 |
|
|
#endif // #ifndef __SOT_STEPCOMPUTER_H__ |