waist-attitude-from-sensor.h 3.65 KB
Newer Older
Thomas Moulard's avatar
Thomas Moulard committed
1
2
3
4
/*
 * Copyright 2010,
 * François Bleibel,
 * Olivier Stasse,
Francois Bleibel's avatar
Francois Bleibel committed
5
 *
Thomas Moulard's avatar
Thomas Moulard committed
6
 * CNRS/AIST
Francois Bleibel's avatar
Francois Bleibel committed
7
 *
8
9
 * This file is part of sot-dynamic-pinocchio.
 * sot-dynamic-pinocchio is free software: you can redistribute it and/or
Thomas Moulard's avatar
Thomas Moulard committed
10
11
12
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
13
 * sot-dynamic-pinocchio is distributed in the hope that it will be
Thomas Moulard's avatar
Thomas Moulard committed
14
15
16
17
 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.  You should
 * have received a copy of the GNU Lesser General Public License along
18
 * with sot-dynamic-pinocchio.  If not, see <http://www.gnu.org/licenses/>.
Thomas Moulard's avatar
Thomas Moulard committed
19
 */
Francois Bleibel's avatar
Francois Bleibel committed
20
21
22
23
24
25
26
27
28

#ifndef __SOT_WAISTATTITUDEFROMSENSOR_H__
#define __SOT_WAISTATTITUDEFROMSENSOR_H__

/* --------------------------------------------------------------------- */
/* --- INCLUDE --------------------------------------------------------- */
/* --------------------------------------------------------------------- */

/* Matrix */
29
30
#include <dynamic-graph/linear-algebra.h>

Francois Bleibel's avatar
Francois Bleibel committed
31
32
33
34
35

/* SOT */
#include <dynamic-graph/entity.h>
#include <dynamic-graph/signal-ptr.h>
#include <dynamic-graph/signal-time-dependent.h>
36
#include <sot/core/matrix-geometry.hh>
Francois Bleibel's avatar
Francois Bleibel committed
37
38
39
40
41
42
43
44

/* STD */
#include <string>

/* --------------------------------------------------------------------- */
/* --- API ------------------------------------------------------------- */
/* --------------------------------------------------------------------- */

Guilhem Saurel's avatar
Guilhem Saurel committed
45
#if defined (WIN32)
Francois Keith's avatar
Francois Keith committed
46
#  if defined (waist_attitude_from_sensor_EXPORTS)
Francois Bleibel's avatar
Francois Bleibel committed
47
#    define SOTWAISTATTITUDEFROMSENSOR_EXPORT __declspec(dllexport)
Guilhem Saurel's avatar
Guilhem Saurel committed
48
#  else
Francois Bleibel's avatar
Francois Bleibel committed
49
#    define SOTWAISTATTITUDEFROMSENSOR_EXPORT __declspec(dllimport)
Guilhem Saurel's avatar
Guilhem Saurel committed
50
#  endif
Francois Bleibel's avatar
Francois Bleibel committed
51
52
53
54
55
#else
#  define SOTWAISTATTITUDEFROMSENSOR_EXPORT
#endif


56
namespace dynamicgraph { namespace sot {
Francois Bleibel's avatar
Francois Bleibel committed
57
58
59
60
61
62
63
64
65
66
67
namespace dg = dynamicgraph;

/* --------------------------------------------------------------------- */
/* --- CLASS ----------------------------------------------------------- */
/* --------------------------------------------------------------------- */

class SOTWAISTATTITUDEFROMSENSOR_EXPORT WaistAttitudeFromSensor
:public dg::Entity
{
 public:
  static const std::string CLASS_NAME;
68
  virtual const std::string& getClassName( void ) const { return CLASS_NAME; }
Francois Bleibel's avatar
Francois Bleibel committed
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

 public: /* --- CONSTRUCTION --- */

  WaistAttitudeFromSensor( const std::string& name );
  virtual ~WaistAttitudeFromSensor( void );

 public: /* --- SIGNAL --- */

  VectorRollPitchYaw & computeAttitudeWaist( VectorRollPitchYaw & res,
					       const int& time );

  dg::SignalPtr<MatrixRotation,int> attitudeSensorSIN;
  dg::SignalPtr<MatrixHomogeneous,int> positionSensorSIN;
  dg::SignalTimeDependent<VectorRollPitchYaw,int> attitudeWaistSOUT;

};


class SOTWAISTATTITUDEFROMSENSOR_EXPORT WaistPoseFromSensorAndContact
:public WaistAttitudeFromSensor
{
 public:
  static const std::string CLASS_NAME;

 protected:
94
95
96
97
98
99
100
101
  void fromSensor(const bool& inFromSensor) {
    fromSensor_ = inFromSensor;
  }
  bool fromSensor() const {
    return fromSensor_;
  }
 private:
  bool fromSensor_;
Francois Bleibel's avatar
Francois Bleibel committed
102
103
104
105
106
107
108
109

 public: /* --- CONSTRUCTION --- */

  WaistPoseFromSensorAndContact( const std::string& name );
  virtual ~WaistPoseFromSensorAndContact( void );

 public: /* --- SIGNAL --- */

110
  dynamicgraph::Vector& computePositionWaist( dynamicgraph::Vector& res,
Francois Bleibel's avatar
Francois Bleibel committed
111
112
113
				    const int& time );

  dg::SignalPtr<MatrixHomogeneous,int> positionContactSIN;
114
  dg::SignalTimeDependent<dynamicgraph::Vector,int> positionWaistSOUT;
Francois Bleibel's avatar
Francois Bleibel committed
115
116
117
118

};


119
} /* namespace sot */} /* namespace dynamicgraph */
Francois Bleibel's avatar
Francois Bleibel committed
120
121
122
123


#endif // #ifndef __SOT_WAISTATTITUDEFROMSENSOR_H__