mass-apparent.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 #include <dynamic-graph/factory.h>
12 
13 #include <sot/core/debug.hh>
14 
15 using namespace dynamicgraph::sot;
16 using namespace dynamicgraph;
18 
19 MassApparent::MassApparent(const std::string& name)
20  : Entity(name),
21  jacobianSIN(NULL,
22  "sotMassApparent(" + name + ")::input(vector)::jacobian"),
23  inertiaInverseSIN(
24  NULL, "sotMassApparent(" + name + ")::input(vector)::inertiaInverse"),
25  massInverseSOUT(
26  boost::bind(&MassApparent::computeMassInverse, this, _1, _2),
27  jacobianSIN << inertiaInverseSIN,
28  "sotMassApparent(" + name + ")::output(Vector)::massInverse"),
29  massSOUT(boost::bind(&MassApparent::computeMass, this, _1, _2),
30  massInverseSOUT,
31  "sotMassApparent(" + name + ")::output(Vector)::mass")
32 
33  ,
34  inertiaSIN(NULL, "sotMassApparent(" + name + ")::input(vector)::inertia"),
35  inertiaInverseSOUT(
36  boost::bind(&MassApparent::computeInertiaInverse, this, _1, _2),
37  inertiaSIN,
38  "sotMassApparent(" + name + ")::input(vector)::inertiaInverseOUT") {
39  sotDEBUGIN(5);
40 
48 
49  sotDEBUGOUT(5);
50 }
51 
52 MassApparent::~MassApparent(void) { return; }
53 
54 /* --- SIGNALS -------------------------------------------------------------- */
55 /* --- SIGNALS -------------------------------------------------------------- */
56 /* --- SIGNALS -------------------------------------------------------------- */
58  dynamicgraph::Matrix& res, const int& time) {
59  sotDEBUGIN(15);
60 
61  const dynamicgraph::Matrix& J = jacobianSIN(time);
63 
64  dynamicgraph::Matrix AJt(J.cols(), J.rows());
65  AJt = A * J.transpose();
66 
67  res.resize(J.rows(), J.rows());
68  res = J * AJt;
69 
70  sotDEBUGOUT(15);
71  return res;
72 }
73 
75  const int& time) {
76  sotDEBUGIN(15);
77 
78  const dynamicgraph::Matrix& omega = massInverseSOUT(time);
79  res = omega.inverse();
80 
81  sotDEBUGOUT(15);
82  return res;
83 }
84 
86  dynamicgraph::Matrix& res, const int& time) {
87  sotDEBUGIN(15);
88 
89  const dynamicgraph::Matrix& A = inertiaSIN(time);
90  res = A.inverse();
91 
92  sotDEBUGOUT(15);
93  return res;
94 }
J
MassApparent(const std::string &name)
dg::SignalTimeDependent< dynamicgraph::Matrix, int > massInverseSOUT
Definition: mass-apparent.h:63
void signalRegistration(const SignalArray< int > &signals)
dynamicgraph::Matrix & computeMassInverse(dynamicgraph::Matrix &res, const int &time)
#define sotDEBUGOUT(level)
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(Latch, "Latch")
#define sotDEBUGIN(level)
dg::SignalTimeDependent< dynamicgraph::Matrix, int > massSOUT
Definition: mass-apparent.h:64
virtual void plug(SignalBase< Time > *ref)
dynamicgraph::Matrix & computeInertiaInverse(dynamicgraph::Matrix &res, const int &time)
Eigen::MatrixXd Matrix
dg::SignalPtr< dynamicgraph::Matrix, int > jacobianSIN
Definition: mass-apparent.h:61
A
dg::SignalPtr< dynamicgraph::Matrix, int > inertiaSIN
Definition: mass-apparent.h:66
dg::SignalTimeDependent< dynamicgraph::Matrix, int > inertiaInverseSOUT
Definition: mass-apparent.h:67
dynamicgraph::Matrix & computeMass(dynamicgraph::Matrix &res, const int &time)
dg::SignalPtr< dynamicgraph::Matrix, int > inertiaInverseSIN
Definition: mass-apparent.h:62


sot-dynamic-pinocchio
Author(s): Olivier Stasse
autogenerated on Tue Jun 20 2023 02:26:06