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 
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_force_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 
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  StepComputerForce(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> waistMlhandSIN;
80  SignalPtr<MatrixHomogeneous, int> waistMrhandSIN;
81  SignalPtr<MatrixHomogeneous, int> referencePositionWaistSIN;
82  SignalPtr<Vector, int> stiffnessSIN;
83  SignalPtr<Vector, int> velocitySIN;
84  SignalPtr<unsigned, int> contactFootSIN;
85 
86  SignalTimeDependent<Vector, int> displacementSOUT;
87  SignalTimeDependent<Vector, int> forceSOUT;
88  SignalTimeDependent<Vector, int> forceLhandSOUT;
89  SignalTimeDependent<Vector, int> forceRhandSOUT;
90 
91  Vector &computeDisplacement(Vector &res, int timeCurr);
92  Vector &computeForce(Vector &res, int timeCurr);
93  Vector &computeForceL(Vector &res, int timeCurr);
94  Vector &computeForceR(Vector &res, int timeCurr);
95  Vector &computeHandForce(Vector &res, const MatrixHomogeneous &waMh,
96  const MatrixHomogeneous &waMref, const Vector &F);
97 
98  public: // Entity
99  virtual void display(std::ostream &os) const;
100  virtual void commandLine(const std::string &cmdLine,
101  std::istringstream &cmdArgs, std::ostream &os);
102 
103  private: // Reference frame
104  MatrixHomogeneous waMref0;
105  StepObserver *twoHandObserver;
106  StepChecker checker;
107 
108  void thisIsZero();
109 
110  private: // Debug
111  std::ofstream logChanges;
112  std::ofstream logPreview;
113 };
114 
115 } // namespace sot
116 } // namespace dynamicgraph
117 
118 #endif // #ifndef __SOT_STEPCOMPUTER_H__
dynamicgraph::sot::StepComputerForce::stiffnessSIN
SignalPtr< Vector, int > stiffnessSIN
Definition: step-computer-force.h:82
dynamicgraph
Definition: exception-pg.h:47
dynamicgraph::sot::StepComputerForce::contactFootSIN
SignalPtr< unsigned, int > contactFootSIN
Definition: step-computer-force.h:84
StepComputerFORCE_EXPORT
#define StepComputerFORCE_EXPORT
Definition: step-computer-force.h:52
step-checker.h
dynamicgraph::sot::StepComputerForce::displacementSOUT
SignalTimeDependent< Vector, int > displacementSOUT
Definition: step-computer-force.h:86
step-observer.h
dynamicgraph::sot::StepComputerForce::waistMrhandSIN
SignalPtr< MatrixHomogeneous, int > waistMrhandSIN
Definition: step-computer-force.h:80
dynamicgraph::sot::StepComputerForce::CLASS_NAME
static const std::string CLASS_NAME
Definition: step-computer-force.h:68
dynamicgraph::sot::StepComputerForce::waistMlhandSIN
SignalPtr< MatrixHomogeneous, int > waistMlhandSIN
Definition: step-computer-force.h:79
dynamicgraph::sot::StepComputerForce::forceRhandSOUT
SignalTimeDependent< Vector, int > forceRhandSOUT
Definition: step-computer-force.h:89
dynamicgraph::sot::StepComputer
Generates footsteps.
Definition: step-computer.h:53
dynamicgraph::sot::StepChecker
Definition: step-checker.h:41
dynamicgraph::sot::StepComputerForce::forceLhandSOUT
SignalTimeDependent< Vector, int > forceLhandSOUT
Definition: step-computer-force.h:88
dynamicgraph::sot::StepComputerForce::velocitySIN
SignalPtr< Vector, int > velocitySIN
Definition: step-computer-force.h:83
dynamicgraph::sot::StepComputerForce::getClassName
virtual const std::string & getClassName(void) const
Definition: step-computer-force.h:69
step-computer.h
dynamicgraph::sot::StepComputerForce::referencePositionWaistSIN
SignalPtr< MatrixHomogeneous, int > referencePositionWaistSIN
Definition: step-computer-force.h:81
dynamicgraph::sot::StepQueue
A step queue in the preview window.
Definition: step-queue.h:77
dynamicgraph::sot::StepObserver
Definition: step-observer.h:59
dynamicgraph::sot::StepComputerForce::forceSOUT
SignalTimeDependent< Vector, int > forceSOUT
Definition: step-computer-force.h:87
dynamicgraph::sot::StepComputerForce
Generates footsteps.
Definition: step-computer-force.h:65