| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/* |
| 2 |
|
|
* Copyright 2010, |
| 3 |
|
|
* François Bleibel, |
| 4 |
|
|
* Olivier Stasse, |
| 5 |
|
|
* |
| 6 |
|
|
* CNRS/AIST |
| 7 |
|
|
* |
| 8 |
|
|
*/ |
| 9 |
|
|
|
| 10 |
|
|
#ifndef __SOT_FEATURE_1D_HH__ |
| 11 |
|
|
#define __SOT_FEATURE_1D_HH__ |
| 12 |
|
|
|
| 13 |
|
|
/* --------------------------------------------------------------------- */ |
| 14 |
|
|
/* --- INCLUDE --------------------------------------------------------- */ |
| 15 |
|
|
/* --------------------------------------------------------------------- */ |
| 16 |
|
|
|
| 17 |
|
|
/* SOT */ |
| 18 |
|
|
#include <sot/core/exception-task.hh> |
| 19 |
|
|
#include <sot/core/feature-abstract.hh> |
| 20 |
|
|
|
| 21 |
|
|
/* --------------------------------------------------------------------- */ |
| 22 |
|
|
/* --- API ------------------------------------------------------------- */ |
| 23 |
|
|
/* --------------------------------------------------------------------- */ |
| 24 |
|
|
|
| 25 |
|
|
#if defined(WIN32) |
| 26 |
|
|
#if defined(feature_1d_EXPORTS) |
| 27 |
|
|
#define SOTFEATURE1D_EXPORT __declspec(dllexport) |
| 28 |
|
|
#else |
| 29 |
|
|
#define SOTFEATURE1D_EXPORT __declspec(dllimport) |
| 30 |
|
|
#endif |
| 31 |
|
|
#else |
| 32 |
|
|
#define SOTFEATURE1D_EXPORT |
| 33 |
|
|
#endif |
| 34 |
|
|
|
| 35 |
|
|
/* --------------------------------------------------------------------- */ |
| 36 |
|
|
/* --- CLASS ----------------------------------------------------------- */ |
| 37 |
|
|
/* --------------------------------------------------------------------- */ |
| 38 |
|
|
|
| 39 |
|
|
namespace dynamicgraph { |
| 40 |
|
|
namespace sot { |
| 41 |
|
|
/*! |
| 42 |
|
|
\class Feature1D |
| 43 |
|
|
\brief Simple test: the task is defined to be e_2 = .5 . e'.e, with |
| 44 |
|
|
e the mother task. The jacobian is then J_2 = e'.J, J being the jacobian |
| 45 |
|
|
of the mother task. |
| 46 |
|
|
|
| 47 |
|
|
*/ |
| 48 |
|
|
class SOTFEATURE1D_EXPORT Feature1D : public FeatureAbstract, |
| 49 |
|
|
FeatureReferenceHelper<Feature1D> { |
| 50 |
|
|
public: |
| 51 |
|
|
/*! Field storing the class name. */ |
| 52 |
|
|
static const std::string CLASS_NAME; |
| 53 |
|
|
/*! Returns the name of the class. */ |
| 54 |
|
✗ |
virtual const std::string &getClassName(void) const { return CLASS_NAME; } |
| 55 |
|
|
|
| 56 |
|
|
protected: |
| 57 |
|
|
/* --- SIGNALS ------------------------------------------------------------ */ |
| 58 |
|
|
public: |
| 59 |
|
|
/*! \name Signals |
| 60 |
|
|
@{ |
| 61 |
|
|
*/ |
| 62 |
|
|
/*! \name Input signals |
| 63 |
|
|
@{ |
| 64 |
|
|
*/ |
| 65 |
|
|
/*! \brief Input for the error. */ |
| 66 |
|
|
dynamicgraph::SignalPtr<dynamicgraph::Vector, int> errorSIN; |
| 67 |
|
|
|
| 68 |
|
|
/*! \brief Input for the Jacobian. */ |
| 69 |
|
|
dynamicgraph::SignalPtr<dynamicgraph::Matrix, int> jacobianSIN; |
| 70 |
|
|
|
| 71 |
|
|
/*! @} */ |
| 72 |
|
|
|
| 73 |
|
|
/*! \name Output signals |
| 74 |
|
|
@{ |
| 75 |
|
|
*/ |
| 76 |
|
|
/*! \brief Publish the jacobian of the feature according to the robot state. |
| 77 |
|
|
*/ |
| 78 |
|
|
using FeatureAbstract::jacobianSOUT; |
| 79 |
|
|
|
| 80 |
|
|
/*! \brief Publish the error between the desired and the current value of the |
| 81 |
|
|
* feature. */ |
| 82 |
|
|
using FeatureAbstract::errorSOUT; |
| 83 |
|
|
|
| 84 |
|
|
public: |
| 85 |
|
|
/*! \brief Default constructor */ |
| 86 |
|
|
Feature1D(const std::string &name); |
| 87 |
|
|
|
| 88 |
|
|
/*! \brief Default destructor */ |
| 89 |
|
✗ |
virtual ~Feature1D(void) {} |
| 90 |
|
|
|
| 91 |
|
|
/*! \brief Get the dimension of the feature. */ |
| 92 |
|
|
virtual unsigned int &getDimension(unsigned int &dim, int time); |
| 93 |
|
|
|
| 94 |
|
|
/*! \name Methods to trigger computation related to this feature. |
| 95 |
|
|
@{ |
| 96 |
|
|
*/ |
| 97 |
|
|
|
| 98 |
|
|
/*! \brief Compute the error between the desired value and the value itself. |
| 99 |
|
|
*/ |
| 100 |
|
|
virtual dynamicgraph::Vector &computeError(dynamicgraph::Vector &res, |
| 101 |
|
|
int time); |
| 102 |
|
|
|
| 103 |
|
|
/*! \brief Compute the Jacobian of the value according to the robot state.. */ |
| 104 |
|
|
virtual dynamicgraph::Matrix &computeJacobian(dynamicgraph::Matrix &res, |
| 105 |
|
|
int time); |
| 106 |
|
|
|
| 107 |
|
|
/*! @} */ |
| 108 |
|
|
|
| 109 |
|
|
/*! \brief Display the information related to this 1D implementation. */ |
| 110 |
|
|
virtual void display(std::ostream &os) const; |
| 111 |
|
|
|
| 112 |
|
|
/*! \name Dealing with the reference value to be reach with this feature. |
| 113 |
|
|
@{ |
| 114 |
|
|
*/ |
| 115 |
|
✗ |
DECLARE_REFERENCE_FUNCTIONS(Feature1D); |
| 116 |
|
|
/*! @} */ |
| 117 |
|
|
}; |
| 118 |
|
|
|
| 119 |
|
|
} /* namespace sot */ |
| 120 |
|
|
} /* namespace dynamicgraph */ |
| 121 |
|
|
|
| 122 |
|
|
#endif // #ifndef __SOT_FEATURE_1D_HH__ |
| 123 |
|
|
|
| 124 |
|
|
/* |
| 125 |
|
|
* Local variables: |
| 126 |
|
|
* c-basic-offset: 2 |
| 127 |
|
|
* End: |
| 128 |
|
|
*/ |
| 129 |
|
|
|