19 #include <sot/core/debug.hh> 20 #include <dynamic-graph/factory.h> 21 #include <dynamic-graph/command-bind.h> 23 #include <dynamic-graph/all-commands.h> 24 #include "sot/core/stop-watch.hh" 30 namespace talos_balance
32 namespace dg = ::dynamicgraph;
37 #define PROFILE_SIMPLE_CONTROLLER_6D_DX_REF_COMPUTATION "SimpleController6d: v_ref computation " 39 #define INPUT_SIGNALS m_KpSIN << m_xSIN << m_x_desSIN 41 #define OUTPUT_SIGNALS m_v_refSOUT 49 "SimpleController6d");
60 , m_initSucceeded(false)
73 template <
typename Derived>
91 SEND_WARNING_STREAM_MSG(
"Cannot compute signal v_ref before initialization!");
97 const Vector & Kp = m_KpSIN(iter);
99 const MatrixHomogeneous & x = m_xSIN(iter);
100 const MatrixHomogeneous & x_des = m_x_desSIN(iter);
104 const Eigen::Vector3d e_O = 0.5*(x.linear().col(0).cross(x_des.linear().col(0))
105 + x.linear().col(1).cross(x_des.linear().col(1))
106 + x.linear().col(2).cross(x_des.linear().col(2))
109 const Eigen::Matrix3d L = -0.5*(
skew(x_des.linear().col(0))*
skew(x.linear().col(0))
110 +
skew(x_des.linear().col(1))*
skew(x.linear().col(1))
111 +
skew(x_des.linear().col(2))*
skew(x.linear().col(2))
114 Eigen::Matrix<double,6,1> dv_ref;
117 dv_ref.head<3>() = x.linear().transpose() * Kp.head<3>().cwiseProduct(x_des.translation()-x.translation());
119 dv_ref.tail<3>() = x.linear().transpose() * L.inverse() * Kp.tail<3>().cwiseProduct(e_O);
136 os <<
"SimpleController6d " << getName();
139 getProfiler().report_all(3, os);
141 catch (ExceptionSignal e) {}
virtual void display(std::ostream &os) const
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
AdmittanceControllerEndEffector EntityClassName
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(AdmittanceControllerEndEffector, "AdmittanceControllerEndEffector")
EIGEN_MAKE_ALIGNED_OPERATOR_NEW SimpleController6d(const std::string &name)
Eigen::Matrix3d skew(const Eigen::MatrixBase< Derived > &v)
#define PROFILE_SIMPLE_CONTROLLER_6D_DX_REF_COMPUTATION
DEFINE_SIGNAL_OUT_FUNCTION(dq, dynamicgraph::Vector)