Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
* Copyright 2010, |
3 |
|
|
* Florent Lamiraux |
4 |
|
|
* Thomas Moulard, |
5 |
|
|
* |
6 |
|
|
* CNRS/AIST |
7 |
|
|
* |
8 |
|
|
*/ |
9 |
|
|
|
10 |
|
|
#ifndef SOT_CORE_FEATURE_POSTURE_HH |
11 |
|
|
#define SOT_CORE_FEATURE_POSTURE_HH |
12 |
|
|
|
13 |
|
|
#include <dynamic-graph/signal-ptr.h> |
14 |
|
|
#include <dynamic-graph/signal-time-dependent.h> |
15 |
|
|
#include <dynamic-graph/value.h> |
16 |
|
|
|
17 |
|
|
#include "sot/core/api.hh" |
18 |
|
|
#include "sot/core/feature-abstract.hh" |
19 |
|
|
/* --------------------------------------------------------------------- */ |
20 |
|
|
/* --- API ------------------------------------------------------------- */ |
21 |
|
|
/* --------------------------------------------------------------------- */ |
22 |
|
|
|
23 |
|
|
#if defined(WIN32) |
24 |
|
|
#if defined(feature_posture_EXPORTS) |
25 |
|
|
#define SOTFEATUREPOSTURE_EXPORT __declspec(dllexport) |
26 |
|
|
#else |
27 |
|
|
#define SOTFEATUREPOSTURE_EXPORT __declspec(dllimport) |
28 |
|
|
#endif |
29 |
|
|
#else |
30 |
|
|
#define SOTFEATUREPOSTURE_EXPORT |
31 |
|
|
#endif |
32 |
|
|
|
33 |
|
|
namespace dynamicgraph { |
34 |
|
|
namespace sot { |
35 |
|
|
using command::Command; |
36 |
|
|
using command::Value; |
37 |
|
|
|
38 |
|
|
/*! @class dynamicgraph::sot::FeaturePosture feature-posture.hh |
39 |
|
|
* Feature that observes the posture of the robot, ie whose Jacobian is the |
40 |
|
|
* identity, or slices of the identity. This feature can be exactly |
41 |
|
|
* obtained with a generic posture, given the identity matrix as the input |
42 |
|
|
* Jacobian, the identity matrix. It is even prefereable, as the reference |
43 |
|
|
* value is then given by a signal, which can be reevalutated at each |
44 |
|
|
* iteration, for example to track a reference trajectory in the |
45 |
|
|
* configuration space. See for example the toFlag python function in the |
46 |
|
|
* sot-dyninv module to nicely selec the posture DOF. |
47 |
|
|
*/ |
48 |
|
|
|
49 |
|
|
class SOTFEATUREPOSTURE_EXPORT FeaturePosture : public FeatureAbstract { |
50 |
|
|
class SelectDof; |
51 |
|
|
friend class SelectDof; |
52 |
|
|
|
53 |
|
✗ |
DYNAMIC_GRAPH_ENTITY_DECL(); |
54 |
|
|
|
55 |
|
|
public: |
56 |
|
|
typedef dynamicgraph::SignalPtr<dynamicgraph::Vector, int> signalIn_t; |
57 |
|
|
typedef dynamicgraph::SignalTimeDependent<dynamicgraph::Vector, int> |
58 |
|
|
signalOut_t; |
59 |
|
|
|
60 |
|
✗ |
DECLARE_NO_REFERENCE; |
61 |
|
|
|
62 |
|
|
explicit FeaturePosture(const std::string &name); |
63 |
|
|
virtual ~FeaturePosture(); |
64 |
|
|
virtual unsigned int &getDimension(unsigned int &res, int); |
65 |
|
|
void selectDof(unsigned dofId, bool control); |
66 |
|
|
|
67 |
|
|
protected: |
68 |
|
|
virtual dynamicgraph::Vector &computeError(dynamicgraph::Vector &res, int); |
69 |
|
|
virtual dynamicgraph::Matrix &computeJacobian(dynamicgraph::Matrix &res, int); |
70 |
|
|
virtual dynamicgraph::Vector &computeErrorDot(dynamicgraph::Vector &res, |
71 |
|
|
int time); |
72 |
|
|
|
73 |
|
|
signalIn_t state_; |
74 |
|
|
signalIn_t posture_; |
75 |
|
|
signalIn_t postureDot_; |
76 |
|
|
signalOut_t error_; |
77 |
|
|
|
78 |
|
|
private: |
79 |
|
|
std::vector<bool> activeDofs_; |
80 |
|
|
std::size_t nbActiveDofs_; |
81 |
|
|
}; // class FeaturePosture |
82 |
|
|
} // namespace sot |
83 |
|
|
} // namespace dynamicgraph |
84 |
|
|
|
85 |
|
|
#endif // SOT_CORE_FEATURE_POSTURE_HH |
86 |
|
|
|