Commit 192ae716 authored by Olivier Stasse's avatar Olivier Stasse

Change from admittance-controller to simple-admittance-controller

parent bec8136f
...@@ -48,21 +48,21 @@ namespace dynamicgraph { ...@@ -48,21 +48,21 @@ namespace dynamicgraph {
/* --- CLASS ----------------------------------------------------------- */ /* --- CLASS ----------------------------------------------------------- */
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
class ADMITTANCECONTROLLER_EXPORT AdmittanceController class ADMITTANCECONTROLLER_EXPORT SimpleAdmittanceController
: public ::dynamicgraph::Entity : public ::dynamicgraph::Entity
{ {
DYNAMIC_GRAPH_ENTITY_DECL(); DYNAMIC_GRAPH_ENTITY_DECL();
public: public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW EIGEN_MAKE_ALIGNED_OPERATOR_NEW
/* --- CONSTRUCTOR ---- */ /* --- CONSTRUCTOR ---- */
AdmittanceController( const std::string & name ); SimpleAdmittanceController( const std::string & name );
void init(const double & dt, const unsigned & n); void init(const double & dt, const unsigned & n);
void setPosition(const dynamicgraph::Vector & position); void setPosition(const dynamicgraph::Vector & position);
/* --- SIGNALS --- */ /* --- SIGNALS --- */
DECLARE_SIGNAL_IN(Kp, dynamicgraph::Vector); DECLARE_SIGNAL_IN(Kp, dynamicgraph::Vector);
DECLARE_SIGNAL_IN(state, dynamicgraph::Vector); DECLARE_SIGNAL_IN(state, dynamicgraph::Vector);
......
...@@ -35,9 +35,9 @@ namespace dynamicgraph ...@@ -35,9 +35,9 @@ namespace dynamicgraph
//Size to be aligned "-------------------------------------------------------" //Size to be aligned "-------------------------------------------------------"
#define PROFILE_ADMITTANCECONTROLLER_QREF_COMPUTATION "AdmittanceController: qRef computation " #define PROFILE_SIMPLE_ADMITTANCECONTROLLER_QREF_COMPUTATION "SimpleAdmittanceController: qRef computation "
#define PROFILE_ADMITTANCECONTROLLER_DQREF_COMPUTATION "AdmittanceController: dqRef computation " #define PROFILE_SIMPLE_ADMITTANCECONTROLLER_DQREF_COMPUTATION "SimpleAdmittanceController: dqRef computation "
#define INPUT_SIGNALS m_KpSIN << m_stateSIN << m_tauSIN << m_tauDesSIN #define INPUT_SIGNALS m_KpSIN << m_stateSIN << m_tauSIN << m_tauDesSIN
...@@ -45,16 +45,16 @@ namespace dynamicgraph ...@@ -45,16 +45,16 @@ namespace dynamicgraph
/// Define EntityClassName here rather than in the header file /// Define EntityClassName here rather than in the header file
/// so that it can be used by the macros DEFINE_SIGNAL_**_FUNCTION. /// so that it can be used by the macros DEFINE_SIGNAL_**_FUNCTION.
typedef AdmittanceController EntityClassName; typedef SimpleAdmittanceController EntityClassName;
/* --- DG FACTORY ---------------------------------------------------- */ /* --- DG FACTORY ---------------------------------------------------- */
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(AdmittanceController, DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(SimpleAdmittanceController,
"AdmittanceController"); "SimpleAdmittanceController");
/* ------------------------------------------------------------------- */ /* ------------------------------------------------------------------- */
/* --- CONSTRUCTION -------------------------------------------------- */ /* --- CONSTRUCTION -------------------------------------------------- */
/* ------------------------------------------------------------------- */ /* ------------------------------------------------------------------- */
AdmittanceController::AdmittanceController(const std::string& name) SimpleAdmittanceController::SimpleAdmittanceController(const std::string& name)
: Entity(name) : Entity(name)
, CONSTRUCT_SIGNAL_IN(Kp, dynamicgraph::Vector) , CONSTRUCT_SIGNAL_IN(Kp, dynamicgraph::Vector)
, CONSTRUCT_SIGNAL_IN(state, dynamicgraph::Vector) , CONSTRUCT_SIGNAL_IN(state, dynamicgraph::Vector)
...@@ -67,13 +67,13 @@ namespace dynamicgraph ...@@ -67,13 +67,13 @@ namespace dynamicgraph
Entity::signalRegistration( INPUT_SIGNALS << OUTPUT_SIGNALS ); Entity::signalRegistration( INPUT_SIGNALS << OUTPUT_SIGNALS );
/* Commands. */ /* Commands. */
addCommand("init", makeCommandVoid2(*this, &AdmittanceController::init, docCommandVoid2("Initialize the entity.","time step","Number of elements"))); addCommand("init", makeCommandVoid2(*this, &SimpleAdmittanceController::init, docCommandVoid2("Initialize the entity.","time step","Number of elements")));
addCommand("setPosition", makeCommandVoid1(*this, &AdmittanceController::setPosition, docCommandVoid1("Set initial reference position.","Initial position"))); addCommand("setPosition", makeCommandVoid1(*this, &SimpleAdmittanceController::setPosition, docCommandVoid1("Set initial reference position.","Initial position")));
addCommand("useExternalState", makeDirectSetter(*this,&m_useState, docDirectSetter("use external state","bool"))); addCommand("useExternalState", makeDirectSetter(*this,&m_useState, docDirectSetter("use external state","bool")));
addCommand("isUsingExternalState", makeDirectGetter(*this,&m_useState, docDirectGetter("use external state","bool"))); addCommand("isUsingExternalState", makeDirectGetter(*this,&m_useState, docDirectGetter("use external state","bool")));
} }
void AdmittanceController::init(const double & dt, const unsigned & n) void SimpleAdmittanceController::init(const double & dt, const unsigned & n)
{ {
if(n<1) if(n<1)
return SEND_MSG("n must be at least 1", MSG_TYPE_ERROR); return SEND_MSG("n must be at least 1", MSG_TYPE_ERROR);
...@@ -90,7 +90,7 @@ namespace dynamicgraph ...@@ -90,7 +90,7 @@ namespace dynamicgraph
m_initSucceeded = true; m_initSucceeded = true;
} }
void AdmittanceController::setPosition(const dynamicgraph::Vector & position) void SimpleAdmittanceController::setPosition(const dynamicgraph::Vector & position)
{ {
m_q = position; m_q = position;
...@@ -108,7 +108,7 @@ namespace dynamicgraph ...@@ -108,7 +108,7 @@ namespace dynamicgraph
return s; return s;
} }
getProfiler().start(PROFILE_ADMITTANCECONTROLLER_DQREF_COMPUTATION); getProfiler().start(PROFILE_SIMPLE_ADMITTANCECONTROLLER_DQREF_COMPUTATION);
const Vector & tauDes = m_tauDesSIN(iter); const Vector & tauDes = m_tauDesSIN(iter);
const Vector & tau = m_tauSIN(iter); const Vector & tau = m_tauSIN(iter);
...@@ -122,7 +122,7 @@ namespace dynamicgraph ...@@ -122,7 +122,7 @@ namespace dynamicgraph
s = dqRef; s = dqRef;
getProfiler().stop(PROFILE_ADMITTANCECONTROLLER_DQREF_COMPUTATION); getProfiler().stop(PROFILE_SIMPLE_ADMITTANCECONTROLLER_DQREF_COMPUTATION);
return s; return s;
} }
...@@ -135,7 +135,7 @@ namespace dynamicgraph ...@@ -135,7 +135,7 @@ namespace dynamicgraph
return s; return s;
} }
getProfiler().start(PROFILE_ADMITTANCECONTROLLER_QREF_COMPUTATION); getProfiler().start(PROFILE_SIMPLE_ADMITTANCECONTROLLER_QREF_COMPUTATION);
const Vector & dqRef = m_dqRefSOUT(iter); const Vector & dqRef = m_dqRefSOUT(iter);
...@@ -157,7 +157,7 @@ namespace dynamicgraph ...@@ -157,7 +157,7 @@ namespace dynamicgraph
s = m_q; s = m_q;
getProfiler().stop(PROFILE_ADMITTANCECONTROLLER_QREF_COMPUTATION); getProfiler().stop(PROFILE_SIMPLE_ADMITTANCECONTROLLER_QREF_COMPUTATION);
return s; return s;
} }
...@@ -169,9 +169,9 @@ namespace dynamicgraph ...@@ -169,9 +169,9 @@ namespace dynamicgraph
/* --- ENTITY -------------------------------------------------------- */ /* --- ENTITY -------------------------------------------------------- */
/* ------------------------------------------------------------------- */ /* ------------------------------------------------------------------- */
void AdmittanceController::display(std::ostream& os) const void SimpleAdmittanceController::display(std::ostream& os) const
{ {
os << "AdmittanceController " << getName(); os << "SimpleAdmittanceController " << getName();
try try
{ {
getProfiler().report_all(3, os); getProfiler().report_all(3, os);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment