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 sigtime_t& 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 }
dynamicgraph::sot::ZmprefFromCom::computeZmpref
dynamicgraph::Vector & computeZmpref(dynamicgraph::Vector &res, const sigtime_t &time)
Definition: zmpreffromcom.cpp:53
dynamicgraph::sot::MatrixHomogeneous
Eigen::Transform< double, 3, Eigen::Affine > SOT_CORE_EXPORT MatrixHomogeneous
dynamicgraph
dynamicgraph::sot::ZmprefFromCom::~ZmprefFromCom
virtual ~ZmprefFromCom(void)
Definition: zmpreffromcom.cpp:43
dynamicgraph::Entity
boost
debug.hh
dynamic_pinocchio.kine_romeo.dt
int dt
Definition: kine_romeo.py:37
res
res
dynamicgraph::sot::ZmprefFromCom::DT_DEFAULT
const static double DT_DEFAULT
Definition: zmpreffromcom.h:59
sotDEBUGOUT
#define sotDEBUGOUT(level)
dynamicgraph::sot::ZmprefFromCom::footHeight
double footHeight
Definition: zmpreffromcom.h:60
dynamicgraph::sot::ZmprefFromCom::comPositionSIN
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > comPositionSIN
Definition: zmpreffromcom.h:72
zmpreffromcom.h
sotDEBUGIN
#define sotDEBUGIN(level)
dynamicgraph::sot::ZmprefFromCom::waistPositionSIN
dg::SignalPtr< MatrixHomogeneous, sigtime_t > waistPositionSIN
Definition: zmpreffromcom.h:71
dynamicgraph::Vector
Eigen::VectorXd Vector
dynamicgraph::sot::ZmprefFromCom::dcomSIN
dg::SignalPtr< dynamicgraph::Vector, sigtime_t > dcomSIN
Definition: zmpreffromcom.h:73
dynamicgraph::sot::ZmprefFromCom::dt
double dt
Definition: zmpreffromcom.h:58
dynamicgraph::sot::ZmprefFromCom::ZmprefFromCom
ZmprefFromCom(const std::string &name)
Definition: zmpreffromcom.cpp:21
dynamicgraph::sot::ZmprefFromCom
Definition: zmpreffromcom.h:52
dynamicgraph::sot::ZmprefFromCom::FOOT_HEIGHT_DEFAULT
const static double FOOT_HEIGHT_DEFAULT
Definition: zmpreffromcom.h:61
dynamicgraph::sot::ZmprefFromCom::zmprefSOUT
dg::SignalTimeDependent< dynamicgraph::Vector, sigtime_t > zmprefSOUT
Definition: zmpreffromcom.h:74
dynamicgraph::sot
dynamicgraph::Entity::signalRegistration
void signalRegistration(const SignalArray< int > &signals)
com
com
compile.name
name
Definition: compile.py:22
dynamicgraph::sot::DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(DoubleConstant, "DoubleConstant")


sot-dynamic-pinocchio
Author(s): Olivier Stasse
autogenerated on Fri Jul 28 2023 02:10:01