1 |
|
|
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 |
|
|
* Copyright Projet JRL-Japan, 2007 |
3 |
|
|
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
4 |
|
|
* |
5 |
|
|
* File: WhichFootUpper.h |
6 |
|
|
* Project: SOT |
7 |
|
|
* Author: Nicolas Mansard |
8 |
|
|
* |
9 |
|
|
* Version control |
10 |
|
|
* =============== |
11 |
|
|
* |
12 |
|
|
* $Id$ |
13 |
|
|
* |
14 |
|
|
* Description |
15 |
|
|
* ============ |
16 |
|
|
* |
17 |
|
|
* |
18 |
|
|
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
19 |
|
|
|
20 |
|
|
#ifndef __SOT_WhichFootUpper_H__ |
21 |
|
|
#define __SOT_WhichFootUpper_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 |
|
|
|
32 |
|
|
#include <sot/core/matrix-geometry.hh> |
33 |
|
|
|
34 |
|
|
/* STD */ |
35 |
|
|
#include <string> |
36 |
|
|
|
37 |
|
|
/* --------------------------------------------------------------------- */ |
38 |
|
|
/* --- API ------------------------------------------------------------- */ |
39 |
|
|
/* --------------------------------------------------------------------- */ |
40 |
|
|
|
41 |
|
|
#if defined(WIN32) |
42 |
|
|
#if defined(which_foot_upper_EXPORTS) |
43 |
|
|
#define WhichFootUpper_EXPORT __declspec(dllexport) |
44 |
|
|
#else |
45 |
|
|
#define WhichFootUpper_EXPORT __declspec(dllimport) |
46 |
|
|
#endif |
47 |
|
|
#else |
48 |
|
|
#define WhichFootUpper_EXPORT |
49 |
|
|
#endif |
50 |
|
|
|
51 |
|
|
namespace dynamicgraph { |
52 |
|
|
namespace sot { |
53 |
|
|
|
54 |
|
|
/* --------------------------------------------------------------------- */ |
55 |
|
|
/* --- CLASS ----------------------------------------------------------- */ |
56 |
|
|
/* --------------------------------------------------------------------- */ |
57 |
|
|
|
58 |
|
|
class WhichFootUpper_EXPORT WhichFootUpper : public Entity { |
59 |
|
|
public: |
60 |
|
|
DYNAMIC_GRAPH_ENTITY_DECL(); |
61 |
|
|
|
62 |
|
|
protected: |
63 |
|
|
static const unsigned int INDEX_LEFT_FOOT_DEFAULT; |
64 |
|
|
static const unsigned int INDEX_RIGHT_FOOT_DEFAULT; |
65 |
|
|
unsigned int indexLeftFoot, indexRightFoot; |
66 |
|
|
|
67 |
|
|
static const double TRIGGER_THRESHOLD_DEFAULT; |
68 |
|
|
double triggerThreshold; |
69 |
|
|
|
70 |
|
|
unsigned int lastFoot; |
71 |
|
|
|
72 |
|
|
public: /* --- CONSTRUCTION --- */ |
73 |
|
|
WhichFootUpper(const std::string &name); |
74 |
|
|
virtual ~WhichFootUpper(void); |
75 |
|
|
|
76 |
|
|
public: /* --- SIGNAL --- */ |
77 |
|
|
SignalPtr<MatrixRotation, int> waistRsensorSIN; |
78 |
|
|
SignalPtr<MatrixRotation, int> worldRsensorSIN; |
79 |
|
|
SignalPtr<MatrixHomogeneous, int> waistMlfootSIN; |
80 |
|
|
SignalPtr<MatrixHomogeneous, int> waistMrfootSIN; |
81 |
|
|
|
82 |
|
|
SignalTimeDependent<MatrixHomogeneous, int> worldMlfootSOUT; |
83 |
|
|
SignalTimeDependent<MatrixHomogeneous, int> worldMrfootSOUT; |
84 |
|
|
SignalTimeDependent<unsigned int, int> whichFootSOUT; |
85 |
|
|
|
86 |
|
|
SignalPtr<MatrixHomogeneous, int> waistMsensorSIN; |
87 |
|
|
SignalTimeDependent<MatrixRotation, int> waistRsensorSOUT; |
88 |
|
|
|
89 |
|
|
public: /* --- FUNCTIONS --- */ |
90 |
|
|
static MatrixHomogeneous &computeFootPosition( |
91 |
|
|
const MatrixHomogeneous &waistMfoot, const MatrixRotation &waistRsensor, |
92 |
|
|
const MatrixRotation &worldRsensor, MatrixHomogeneous &res); |
93 |
|
|
|
94 |
|
|
MatrixRotation &computeRotationMatrix(MatrixRotation &rotMat, int time); |
95 |
|
|
|
96 |
|
|
unsigned int &whichFoot(const MatrixHomogeneous &waistMlfoot, |
97 |
|
|
const MatrixHomogeneous &waistMrfoot, |
98 |
|
|
unsigned int &res); |
99 |
|
|
|
100 |
|
|
public: /* --- PARAMS --- */ |
101 |
|
|
virtual void commandLine(const std::string &cmdLine, |
102 |
|
|
std::istringstream &cmdArgs, std::ostream &os); |
103 |
|
|
}; |
104 |
|
|
|
105 |
|
|
} // namespace sot |
106 |
|
|
} // namespace dynamicgraph |
107 |
|
|
|
108 |
|
|
#endif // #ifndef __SOT_WhichFootUpper_H__ |