sot-talos-balance  2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
round-double-to-int.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018, Gepetto team, LAAS-CNRS
3  *
4  * This file is part of sot-talos-balance.
5  * sot-talos-balance is free software: you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public License
7  * as published by the Free Software Foundation, either version 3 of
8  * the License, or (at your option) any later version.
9  * sot-talos-balance is distributed in the hope that it will be
10  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details. You should
13  * have received a copy of the GNU Lesser General Public License along
14  * with sot-talos-balance. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
18 
19 #include <dynamic-graph/all-commands.h>
20 #include <dynamic-graph/factory.h>
21 
22 #include <sot/core/debug.hh>
23 
24 namespace dynamicgraph {
25 namespace sot {
26 namespace talos_balance {
27 namespace dg = ::dynamicgraph;
28 using namespace dg;
29 using namespace dg::command;
30 
31 #define INPUT_SIGNALS m_sinSIN
32 
33 #define OUTPUT_SIGNALS m_soutSOUT
34 
37 typedef RoundDoubleToInt EntityClassName;
38 
39 /* --- DG FACTORY ---------------------------------------------------- */
40 DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(RoundDoubleToInt, "RoundDoubleToInt");
41 
42 /* ------------------------------------------------------------------- */
43 /* --- CONSTRUCTION -------------------------------------------------- */
44 /* ------------------------------------------------------------------- */
46  : Entity(name),
47  CONSTRUCT_SIGNAL_IN(sin, double),
48  CONSTRUCT_SIGNAL_OUT(sout, int, INPUT_SIGNALS) {
49  Entity::signalRegistration(INPUT_SIGNALS << OUTPUT_SIGNALS);
50 
51  /* Commands. */
52  addCommand("init",
53  makeCommandVoid0(*this, &RoundDoubleToInt::init,
54  docCommandVoid0("Initialize the entity.")));
55 }
56 
57 /* ------------------------------------------------------------------- */
58 /* --- SIGNALS ------------------------------------------------------- */
59 /* ------------------------------------------------------------------- */
60 
61 DEFINE_SIGNAL_OUT_FUNCTION(sout, int) {
62  double in = m_sinSIN(iter);
63  s = int(round(in));
64  return s;
65 }
66 
67 /* ------------------------------------------------------------------- */
68 /* --- ENTITY -------------------------------------------------------- */
69 /* ------------------------------------------------------------------- */
70 
71 void RoundDoubleToInt::display(std::ostream& os) const {
72  os << "RoundDoubleToInt " << getName();
73  // try
74  // {
75  // getProfiler().report_all(3, os);
76  // }
77  // catch (ExceptionSignal e) {}
78 }
79 
80 } // namespace talos_balance
81 } // namespace sot
82 } // namespace dynamicgraph
sot_talos_balance.test.appli_admittance_end_effector.sot
sot
Definition: appli_admittance_end_effector.py:117
round-double-to-int.hh
dynamicgraph
Definition: treeview.dox:24
dynamicgraph::sot::talos_balance::RoundDoubleToInt::display
virtual void display(std::ostream &os) const
Definition: round-double-to-int.cpp:71
dynamicgraph::sot::talos_balance::RoundDoubleToInt::init
void init()
Definition: round-double-to-int.hh:62
dynamicgraph::sot::talos_balance::DEFINE_SIGNAL_OUT_FUNCTION
DEFINE_SIGNAL_OUT_FUNCTION(dq, dynamicgraph::Vector)
Definition: admittance-controller-end-effector.cpp:210
dynamicgraph::sot::talos_balance::DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(AdmittanceControllerEndEffector, "AdmittanceControllerEndEffector")
dynamicgraph::sot::talos_balance::EntityClassName
AdmittanceControllerEndEffector EntityClassName
Definition: admittance-controller-end-effector.cpp:46
dynamicgraph::sot::talos_balance::RoundDoubleToInt::RoundDoubleToInt
EIGEN_MAKE_ALIGNED_OPERATOR_NEW RoundDoubleToInt(const std::string &name)
Definition: round-double-to-int.cpp:45
INPUT_SIGNALS
#define INPUT_SIGNALS
Definition: round-double-to-int.cpp:31
sot_talos_balance.test.appli_dcm_zmp_control.name
name
Definition: appli_dcm_zmp_control.py:298
OUTPUT_SIGNALS
#define OUTPUT_SIGNALS
Definition: round-double-to-int.cpp:33