10 #ifndef __SOT_FEATURE_ABSTRACT_H__
11 #define __SOT_FEATURE_ABSTRACT_H__
18 #include <dynamic-graph/linear-algebra.h>
21 #include <dynamic-graph/all-signals.h>
22 #include <dynamic-graph/entity.h>
82 virtual const std::string &
getClassName(
void)
const {
return CLASS_NAME; }
113 getDimension(res, time);
122 return dimensionSOUT.accessCopy();
185 SignalTimeDependent<dynamicgraph::Vector, int>
errorSOUT;
202 virtual SignalTimeDependent<dynamicgraph::Vector, int> &
getErrorDot() {
228 template <
class FeatureSpecialized>
230 FeatureSpecialized *ptr;
244 template <
class FeatureSpecialized>
247 ptr =
dynamic_cast<FeatureSpecialized *
>(sdes);
251 #define DECLARE_REFERENCE_FUNCTIONS(FeatureSpecialized) \
252 typedef FeatureReferenceHelper<FeatureSpecialized> SP; \
253 virtual void setReference(FeatureAbstract *sdes) { \
254 if (sdes == NULL) { \
256 if (SP::isReferenceSet()) removeDependenciesFromReference(); \
257 SP::unsetReference(); \
260 SP::setReference(sdes); \
261 if (SP::isReferenceSet()) addDependenciesFromReference(); \
264 virtual const FeatureAbstract *getReferenceAbstract(void) const { \
265 return SP::getReference(); \
267 virtual FeatureAbstract *getReferenceAbstract(void) { \
268 return (FeatureAbstract *)SP::getReference(); \
270 bool isReferenceSet(void) const { return SP::isReferenceSet(); } \
271 virtual void addDependenciesFromReference(void); \
272 virtual void removeDependenciesFromReference(void)
275 #define DECLARE_NO_REFERENCE \
276 virtual void setReference(FeatureAbstract *) {} \
277 virtual const FeatureAbstract *getReferenceAbstract(void) const { \
280 virtual FeatureAbstract *getReferenceAbstract(void) { return NULL; } \
281 virtual void addDependenciesFromReference(void) {} \
282 virtual void removeDependenciesFromReference(void) {} \
#define SOT_CORE_EXPORT
Definition: api.hh:20
This class gives the abstract definition of a feature.
Definition: feature-abstract.hh:76
SignalTimeDependent< dynamicgraph::Matrix, int > jacobianSOUT
Jacobian of the error wrt the robot state: .
Definition: feature-abstract.hh:193
virtual ~FeatureAbstract(void)
Default destructor.
Definition: feature-abstract.hh:93
virtual std::ostream & writeGraph(std::ostream &os) const
This method write a graph description on the file named FileName.
unsigned int getDimension(void) const
Shortest method.
Definition: feature-abstract.hh:121
unsigned int getDimension(int time)
Short method.
Definition: feature-abstract.hh:111
virtual FeatureAbstract * getReferenceAbstract(void)=0
virtual dynamicgraph::Vector & computeErrorDot(dynamicgraph::Vector &res, int time)
SignalTimeDependent< dynamicgraph::Vector, int > errordotSOUT
Derivative of the error with respect to time: .
Definition: feature-abstract.hh:189
SignalTimeDependent< dynamicgraph::Vector, int > errorSOUT
This signal returns the error between the desired value and the current value : .
Definition: feature-abstract.hh:185
virtual void unsetReference(void)
Definition: feature-abstract.hh:214
SignalTimeDependent< unsigned int, int > dimensionSOUT
Returns the dimension of the feature as an output signal.
Definition: feature-abstract.hh:196
virtual dynamicgraph::Matrix & computeJacobian(dynamicgraph::Matrix &res, int time)=0
Compute the Jacobian of the error according the robot state.
virtual const std::string & getClassName(void) const
Returns the name class.
Definition: feature-abstract.hh:82
FeatureAbstract(const std::string &name)
Default constructor: the name of the class should be given.
virtual unsigned int & getDimension(unsigned int &res, int time)=0
Verbose method.
static const std::string CLASS_NAME
Store the name of the class.
Definition: feature-abstract.hh:79
void featureRegistration(void)
Register the feature in the stack of tasks.
virtual dynamicgraph::Vector & computeError(dynamicgraph::Vector &res, int time)=0
Compute the error between the desired feature and the current value of the feature measured or deduce...
SignalPtr< dynamicgraph::Vector, int > errordotSIN
Derivative of the reference value.
Definition: feature-abstract.hh:176
std::string getReferenceByName(void) const
virtual SignalTimeDependent< dynamicgraph::Vector, int > & getErrorDot()
Definition: feature-abstract.hh:202
void setReferenceByName(const std::string &name)
SignalPtr< Flags, int > selectionSIN
This vector specifies which dimension are used to perform the computation. For instance let us assume...
Definition: feature-abstract.hh:173
virtual void setReference(FeatureAbstract *sdes)=0
virtual void removeDependenciesFromReference(void)=0
virtual bool isReferenceSet(void) const
Definition: feature-abstract.hh:217
virtual void addDependenciesFromReference(void)=0
virtual const FeatureAbstract * getReferenceAbstract(void) const =0
Definition: feature-abstract.hh:229
FeatureReferenceHelper(void)
Definition: feature-abstract.hh:234
FeatureSpecialized * getReference(void)
Definition: feature-abstract.hh:240
bool isReferenceSet(void) const
Definition: feature-abstract.hh:239
const FeatureSpecialized * getReference(void) const
Definition: feature-abstract.hh:241
void setReference(FeatureAbstract *sdes)
Definition: feature-abstract.hh:245
void unsetReference(void)
Definition: feature-abstract.hh:238
Definition: abstract-sot-external-interface.hh:17