zmpreffromcom.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 using namespace dynamicgraph::sot;
15 using namespace dynamicgraph;
17 
18 const double ZmprefFromCom::DT_DEFAULT = 5e-3;
19 const double ZmprefFromCom::FOOT_HEIGHT_DEFAULT = .105;
20 
22  : Entity(name),
23  dt(DT_DEFAULT),
24  footHeight(FOOT_HEIGHT_DEFAULT),
25  waistPositionSIN(
26  NULL, "sotZmprefFromCom(" + name + ")::input(MatrixHomo)::waist"),
27  comPositionSIN(NULL,
28  "sotZmprefFromCom(" + name + ")::input(Vector)::com"),
29  dcomSIN(NULL, "sotZmprefFromCom(" + name + ")::input(Vector)::dcom"),
30  zmprefSOUT(boost::bind(&ZmprefFromCom::computeZmpref, this, _1, _2),
31  waistPositionSIN << comPositionSIN << dcomSIN,
32  "sotZmprefFromCom(" + name + ")::output(RPY)::zmpref") {
33  sotDEBUGIN(5);
34 
39 
40  sotDEBUGOUT(5);
41 }
42 
44  sotDEBUGIN(5);
45 
46  sotDEBUGOUT(5);
47  return;
48 }
49 
50 /* --- SIGNALS -------------------------------------------------------------- */
51 /* --- SIGNALS -------------------------------------------------------------- */
52 /* --- SIGNALS -------------------------------------------------------------- */
54  const int& time) {
55  sotDEBUGIN(15);
56 
58  const dynamicgraph::Vector& dcom = dcomSIN(time);
59  const MatrixHomogeneous& oTw = waistPositionSIN(time);
60 
61  MatrixHomogeneous wTo = oTw.inverse();
62  dynamicgraph::Vector nextComRef = dcom;
63  nextComRef *= dt;
64  nextComRef += com;
65 
66  nextComRef(2) = -footHeight; // projection on the ground.
67  res = wTo.matrix() * nextComRef;
68 
69  sotDEBUGOUT(15);
70  return res;
71 }
Eigen::Transform< double, 3, Eigen::Affine > SOT_CORE_EXPORT MatrixHomogeneous
dg::SignalPtr< MatrixHomogeneous, int > waistPositionSIN
Definition: zmpreffromcom.h:71
Eigen::VectorXd Vector
void signalRegistration(const SignalArray< int > &signals)
#define sotDEBUGOUT(level)
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(Latch, "Latch")
dg::SignalTimeDependent< dynamicgraph::Vector, int > zmprefSOUT
Definition: zmpreffromcom.h:74
#define sotDEBUGIN(level)
dg::SignalPtr< dynamicgraph::Vector, int > dcomSIN
Definition: zmpreffromcom.h:73
com
dynamicgraph::Vector & computeZmpref(dynamicgraph::Vector &res, const int &time)
static const double DT_DEFAULT
Definition: zmpreffromcom.h:59
ZmprefFromCom(const std::string &name)
static const double FOOT_HEIGHT_DEFAULT
Definition: zmpreffromcom.h:61
dg::SignalPtr< dynamicgraph::Vector, int > comPositionSIN
Definition: zmpreffromcom.h:72


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