19 #include <dynamic-graph/all-commands.h>
20 #include <dynamic-graph/factory.h>
22 #include <sot/core/debug.hh>
23 #include <sot/core/stop-watch.hh>
27 namespace talos_balance {
28 namespace dg = ::dynamicgraph;
30 using namespace dg::command;
33 #define PROFILE_EXAMPLE_SUM_COMPUTATION \
34 "Example: sum computation "
35 #define PROFILE_EXAMPLE_NBJOINTS_COMPUTATION \
36 "Example: nbJoints extraction "
38 #define INPUT_SIGNALS m_firstAddendSIN << m_secondAddendSIN
40 #define OUTPUT_SIGNALS m_sumSOUT << m_nbJointsSOUT
54 CONSTRUCT_SIGNAL_IN(firstAddend, double),
55 CONSTRUCT_SIGNAL_IN(secondAddend, double),
58 m_initSucceeded(false) {
63 docCommandVoid1(
"Initialize the entity.",
68 if (!m_firstAddendSIN.isPlugged())
69 return SEND_MSG(
"Init failed: signal firstAddend is not plugged",
71 if (!m_secondAddendSIN.isPlugged())
72 return SEND_MSG(
"Init failed: signal secondAddend is not plugged",
76 std::string robotName_nonconst(
robotName);
78 if (!isNameInRobotUtil(robotName_nonconst)) {
79 SEND_MSG(
"You should have a robotUtil pointer initialized before",
83 std::cerr <<
"m_robot_util:" <<
m_robot_util << std::endl;
85 for (
unsigned int i = 0; i < 4; i++) {
86 std::cout <<
"Verbosity Level :" << i << std::endl;
87 Example::setLoggerVerbosityLevel((dynamicgraph::LoggerVerbosity)i);
88 Example::sendMsg(
"TEST MSG ERROR", dynamicgraph::MSG_TYPE_ERROR);
89 Example::sendMsg(
"TEST MSG DEBUG", dynamicgraph::MSG_TYPE_DEBUG);
90 Example::sendMsg(
"TEST MSG INFO", dynamicgraph::MSG_TYPE_INFO);
91 Example::sendMsg(
"TEST MSG WARNING", dynamicgraph::MSG_TYPE_WARNING);
101 if (!m_initSucceeded) {
102 SEND_WARNING_STREAM_MSG(
"Cannot compute signal sum before initialization!");
108 double firstAddend = m_firstAddendSIN(iter);
109 double secondAddend = m_secondAddendSIN(iter);
111 s = firstAddend + secondAddend;
119 if (!m_initSucceeded) {
120 SEND_WARNING_STREAM_MSG(
121 "Cannot compute signal nbJoints before initialization!");
128 s = int(m_robot_util->m_nbJoints);
142 os <<
"Example " << getName();
144 getProfiler().report_all(3, os);
145 }
catch (ExceptionSignal e) {