step-computer-force.h
Go to the documentation of this file.
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>
34 #include <sot/core/matrix-geometry.hh>
35 /* STD */
36 #include <deque>
37 #include <fstream>
38 #include <string>
39 
40 /* --------------------------------------------------------------------- */
41 /* --- API ------------------------------------------------------------- */
42 /* --------------------------------------------------------------------- */
43 
44 #if defined(WIN32)
45 #if defined(step_computer_force_EXPORTS)
46 #define StepComputerFORCE_EXPORT __declspec(dllexport)
47 #else
48 #define StepComputerFORCE_EXPORT __declspec(dllimport)
49 #endif
50 #else
51 #define StepComputerFORCE_EXPORT
52 #endif
53 
54 namespace dynamicgraph {
55 namespace sot {
56 
57 /* --------------------------------------------------------------------- */
58 /* --- CLASS ----------------------------------------------------------- */
59 /* --------------------------------------------------------------------- */
60 
61 class StepQueue;
62 
65  public StepComputer {
66  public:
67  static const std::string CLASS_NAME;
68  virtual const std::string &getClassName(void) const { return CLASS_NAME; }
69 
70  public: // Construction
71  StepComputerForce(const std::string &name);
72 
73  public: // Methods
74  void changeFirstStep(StepQueue &queue, int timeCurr);
75  void nextStep(StepQueue &queue, int timeCurr);
76 
77  public: // Signals
78  SignalPtr<MatrixHomogeneous, int> waistMlhandSIN;
79  SignalPtr<MatrixHomogeneous, int> waistMrhandSIN;
80  SignalPtr<MatrixHomogeneous, int> referencePositionWaistSIN;
81  SignalPtr<Vector, int> stiffnessSIN;
82  SignalPtr<Vector, int> velocitySIN;
83  SignalPtr<unsigned, int> contactFootSIN;
84 
85  SignalTimeDependent<Vector, int> displacementSOUT;
86  SignalTimeDependent<Vector, int> forceSOUT;
87  SignalTimeDependent<Vector, int> forceLhandSOUT;
88  SignalTimeDependent<Vector, int> forceRhandSOUT;
89 
90  Vector &computeDisplacement(Vector &res, int timeCurr);
91  Vector &computeForce(Vector &res, int timeCurr);
92  Vector &computeForceL(Vector &res, int timeCurr);
93  Vector &computeForceR(Vector &res, int timeCurr);
94  Vector &computeHandForce(Vector &res, const MatrixHomogeneous &waMh,
95  const MatrixHomogeneous &waMref, const Vector &F);
96 
97  public: // Entity
98  virtual void display(std::ostream &os) const;
99  virtual void commandLine(const std::string &cmdLine,
100  std::istringstream &cmdArgs, std::ostream &os);
101 
102  private: // Reference frame
103  MatrixHomogeneous waMref0;
104  StepObserver *twoHandObserver;
105  StepChecker checker;
106 
107  void thisIsZero();
108 
109  private: // Debug
110  std::ofstream logChanges;
111  std::ofstream logPreview;
112 };
113 
114 } // namespace sot
115 } // namespace dynamicgraph
116 
117 #endif // #ifndef __SOT_STEPCOMPUTER_H__
virtual const std::string & getClassName(void) const
Definition: step-computer-force.h:68
Generates footsteps.
Definition: step-computer-force.h:64
#define StepComputerFORCE_EXPORT
Definition: step-computer-force.h:51
SignalPtr< unsigned, int > contactFootSIN
Definition: step-computer-force.h:83
Definition: step-checker.h:41
SignalTimeDependent< Vector, int > forceLhandSOUT
Definition: step-computer-force.h:87
SignalTimeDependent< Vector, int > forceRhandSOUT
Definition: step-computer-force.h:88
Generates footsteps.
Definition: step-computer.h:52
static const std::string CLASS_NAME
Definition: step-computer-force.h:67
Definition: step-observer.h:58
SignalPtr< MatrixHomogeneous, int > waistMlhandSIN
Definition: step-computer-force.h:78
SignalTimeDependent< Vector, int > forceSOUT
Definition: step-computer-force.h:86
SignalPtr< Vector, int > velocitySIN
Definition: step-computer-force.h:82
A step queue in the preview window.
Definition: step-queue.h:77
SignalTimeDependent< Vector, int > displacementSOUT
Definition: step-computer-force.h:85
SignalPtr< MatrixHomogeneous, int > waistMrhandSIN
Definition: step-computer-force.h:79
SignalPtr< Vector, int > stiffnessSIN
Definition: step-computer-force.h:81
SignalPtr< MatrixHomogeneous, int > referencePositionWaistSIN
Definition: step-computer-force.h:80
Definition: exception-pg.h:47