Go to the documentation of this file.
14 #include <dynamic-graph/factory.h>
22 namespace dg = ::dynamicgraph;
25 using namespace dg::command;
27 #define PROFILE_ADMITTANCECONTROLOPPOINT_WFORCE_COMPUTATION \
28 "AdmittanceControlOpPoint: w_force computation "
30 #define PROFILE_ADMITTANCECONTROLOPPOINT_WDQ_COMPUTATION \
31 "AdmittanceControlOpPoint: w_dq computation "
33 #define PROFILE_ADMITTANCECONTROLOPPOINT_DQ_COMPUTATION \
34 "AdmittanceControlOpPoint: dq computation "
36 #define INPUT_SIGNALS \
37 m_KpSIN << m_KdSIN << m_dqSaturationSIN << m_forceSIN << m_w_forceDesSIN \
38 << m_opPoseSIN << m_sensorPoseSIN
40 #define INNER_SIGNALS m_w_forceSINNER << m_w_dqSINNER
42 #define OUTPUT_SIGNALS m_dqSOUT
50 "AdmittanceControlOpPoint");
68 m_initSucceeded(false) {
81 if (!m_dqSaturationSIN.isPlugged())
82 return SEND_MSG(
"Init failed: signal dqSaturation is not plugged",
84 if (!m_KpSIN.isPlugged())
86 if (!m_KdSIN.isPlugged())
88 if (!m_forceSIN.isPlugged())
90 if (!m_w_forceDesSIN.isPlugged())
91 return SEND_MSG(
"Init failed: signal w_forceDes is not plugged",
93 if (!m_opPoseSIN.isPlugged())
94 return SEND_MSG(
"Init failed: signal opPose is not plugged",
96 if (!m_sensorPoseSIN.isPlugged())
97 return SEND_MSG(
"Init failed: signal sensorPose is not plugged",
115 if (!m_initSucceeded) {
117 "Cannot compute signal w_force before initialization!");
120 if (
s.size() != 6)
s.resize(6);
124 const Vector &force = m_forceSIN(iter);
126 assert(force.size() == m_n &&
"Unexpected size of signal force");
128 sensorPose.matrix());
137 if (!m_initSucceeded) {
139 "Cannot compute signal w_dq before initialization!");
142 if (
s.size() != 6)
s.resize(6);
146 const Vector &w_forceDes = m_w_forceDesSIN(iter);
147 const Vector &w_force = m_w_forceSINNER(iter);
148 const Vector &Kp = m_KpSIN(iter);
149 const Vector &Kd = m_KdSIN(iter);
150 const Vector &dqSaturation = m_dqSaturationSIN(iter);
151 assert(w_force.size() == m_n &&
"Unexpected size of signal force");
152 assert(w_forceDes.size() == m_n &&
"Unexpected size of signal w_forceDes");
153 assert(Kp.size() == m_n &&
"Unexpected size of signal Kp");
154 assert(Kd.size() == m_n &&
"Unexpected size of signal Kd");
155 assert(dqSaturation.size() == m_n &&
156 "Unexpected size of signal dqSaturation");
158 m_w_dq = m_w_dq + m_dt * (Kp.cwiseProduct(w_forceDes - w_force)) -
159 Kd.cwiseProduct(m_w_dq);
162 if (m_w_dq[
i] > dqSaturation[
i]) m_w_dq[
i] = dqSaturation[
i];
163 if (m_w_dq[
i] < -dqSaturation[
i]) m_w_dq[
i] = -dqSaturation[
i];
174 if (!m_initSucceeded) {
178 if (
s.size() != 6)
s.resize(6);
182 const Vector &w_dq = m_w_dqSINNER(iter);
184 assert(w_dq.size() == m_n &&
"Unexpected size of signal w_dq");
200 os <<
"AdmittanceControlOpPoint " <<
getName();
#define SEND_MSG(msg, type)
void stop(std::string perf_name)
void resetDq()
Reset the velocity.
Eigen::Transform< double, 3, Eigen::Affine > SOT_CORE_EXPORT MatrixHomogeneous
#define CONSTRUCT_SIGNAL_IN(name, type)
double m_dt
Time step of the control.
std::string docCommandVoid0(const std::string &doc)
virtual void display(std::ostream &os) const
AdmittanceControlOpPoint EntityClassName
DEFINE_SIGNAL_OUT_FUNCTION(dq, dynamicgraph::Vector)
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(AdmittanceControlOpPoint, "AdmittanceControlOpPoint")
DEFINE_SIGNAL_INNER_FUNCTION(w_force, dynamicgraph::Vector)
const std::string & getName() const
CommandVoid0< E > * makeCommandVoid0(E &entity, boost::function< void(E *)> function, const std::string &docString)
dynamicgraph::Vector m_w_dq
Internal state.
std::string docCommandVoid1(const std::string &doc, const std::string &type)
bool m_initSucceeded
True if the entity has been successfully initialized.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW AdmittanceControlOpPoint(const std::string &name)
#define SEND_WARNING_STREAM_MSG(msg)
#define CONSTRUCT_SIGNAL_INNER(name, type, dep)
Stopwatch & getProfiler()
Admittance controller for an operational point wrt to a force sensor. It can be a point of the model ...
#define CONSTRUCT_SIGNAL_OUT(name, type, dep)
void addCommand(const std::string &name, command::Command *command)
void init(const double &dt)
Initialize the entity.
#define PROFILE_ADMITTANCECONTROLOPPOINT_WFORCE_COMPUTATION
#define PROFILE_ADMITTANCECONTROLOPPOINT_WDQ_COMPUTATION
void signalRegistration(const SignalArray< sigtime_t > &signals)
void start(std::string perf_name)
void report_all(int precision=2, std::ostream &output=std::cout)
CommandVoid1< E, T > * makeCommandVoid1(E &entity, boost::function< void(const T &)> function, const std::string &docString)
size_type m_n
Dimension of the force signals and of the output.
#define PROFILE_ADMITTANCECONTROLOPPOINT_DQ_COMPUTATION
sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:31