12 #include <dynamic-graph/all-commands.h>
13 #include <dynamic-graph/factory.h>
15 #include <sot/core/debug.hh>
16 #include <sot/core/stop-watch.hh>
18 #include "pinocchio/algorithm/center-of-mass.hpp"
19 #include "pinocchio/algorithm/frames.hpp"
23 namespace talos_balance {
24 namespace dg = ::dynamicgraph;
26 using namespace dg::command;
28 using namespace pinocchio;
29 using boost::math::normal;
32 #define PROFILE_BASE_POSITION_ESTIMATION "base-est position estimation"
33 #define PROFILE_BASE_VELOCITY_ESTIMATION "base-est velocity estimation"
34 #define PROFILE_BASE_KINEMATICS_COMPUTATION "base-est kinematics computation"
36 #define INPUT_SIGNALS m_qSIN << m_vSIN
37 #define OUTPUT_SIGNALS m_cSOUT << m_dcSOUT
53 m_data(pinocchio::Model()) {
60 docCommandVoid2(
"Initialize the entity.",
"time step (double)",
61 "URDF file path (string)")));
67 std::string localName(robotRef);
68 if (isNameInRobotUtil(localName)) {
70 std::cerr <<
"m_robot_util:" <<
m_robot_util << std::endl;
72 SEND_MSG(
"You should have a robotUtil pointer initialized before",
77 pinocchio::urdf::buildModel(
m_robot_util->m_urdf_filename,
78 pinocchio::JointModelFreeFlyer(),
m_model);
79 }
catch (
const std::exception& e) {
80 std::cout << e.what();
81 SEND_MSG(
"Init failed: Could load URDF :" +
m_robot_util->m_urdf_filename,
94 if (!m_initSucceeded) {
95 SEND_WARNING_STREAM_MSG(
"Cannot compute signal com before initialization!");
98 if (s.size() != 3) s.resize(3);
99 const Vector& dc = m_dcSOUT(iter);
106 if (!m_initSucceeded) {
107 SEND_WARNING_STREAM_MSG(
108 "Cannot compute signal dcom before initialization!");
111 if (s.size() != 3) s.resize(3);
112 const Vector&
q = m_qSIN(iter);
113 const Vector& v = m_vSIN(iter);
114 pinocchio::centerOfMass(m_model, m_data,
q, v);
120 os <<
"DcmEstimator " << getName();
122 getProfiler().report_all(3, os);
123 }
catch (ExceptionSignal e) {