Skip to content
Snippets Groups Projects
Commit 17517cc4 authored by François Bailly's avatar François Bailly
Browse files

added compatiblilty with signal-helper of dynamic-graph and added test of logger inside example.cpp

parent e0d3d8d0
No related branches found
No related tags found
No related merge requests found
......@@ -36,11 +36,15 @@
/* --- INCLUDE --------------------------------------------------------- */
/* --------------------------------------------------------------------- */
#include "utils/signal-helper.hh"
#include "utils/logger.hh"
// #include "utils/signal-helper.hh"
#include <dynamic-graph/signal-helper.h>
// #include "utils/logger.hh"
#include <dynamic-graph/logger.h>
#include <map>
#include "boost/assign.hpp"
#include <sot/talos_balance/robot-utils.hh>
#include <sot/core/robot-utils.hh>
namespace dynamicgraph {
namespace sot {
......@@ -74,10 +78,10 @@ namespace dynamicgraph {
/* --- ENTITY INHERITANCE --- */
virtual void display( std::ostream& os ) const;
void sendMsg(const std::string& msg, MsgType t=MSG_TYPE_INFO, const char* file="", int line=0)
{
getLogger().sendMsg("[Example-"+name+"] "+msg, t, file, line);
}
// void sendMsg(const std::string& msg, MsgType t=MSG_TYPE_INFO, const char* file="", int line=0)
// {
// getLogger().sendMsg("[Example-"+name+"] "+msg, t, file, line);
// }
protected:
bool m_initSucceeded; /// true if the entity has been successfully initialized
......
......@@ -38,9 +38,9 @@ namespace dynamicgraph
#define PROFILE_EXAMPLE_SUM_COMPUTATION "Example: sum computation "
#define PROFILE_EXAMPLE_NBJOINTS_COMPUTATION "Example: nbJoints extraction "
#define INPUT_SIGNALS m_firstAddendSIN << m_secondAddendSIN
#define INPUT_SIGNALS firstAddendSIN << secondAddendSIN
#define OUTPUT_SIGNALS m_sumSOUT << m_nbJointsSOUT
#define OUTPUT_SIGNALS sumSOUT << nbJointsSOUT
/// Define EntityClassName here rather than in the header file
/// so that it can be used by the macros DEFINE_SIGNAL_**_FUNCTION.
......@@ -69,9 +69,9 @@ namespace dynamicgraph
void Example::init(const std::string& robotName)
{
if(!m_firstAddendSIN.isPlugged())
if(!firstAddendSIN.isPlugged())
return SEND_MSG("Init failed: signal firstAddend is not plugged", MSG_TYPE_ERROR);
if(!m_secondAddendSIN.isPlugged())
if(!secondAddendSIN.isPlugged())
return SEND_MSG("Init failed: signal secondAddend is not plugged", MSG_TYPE_ERROR);
/*std::string & robotName_nonconst = const_cast<std::string &>(robotName);*/
......@@ -86,7 +86,15 @@ namespace dynamicgraph
m_robot_util = getRobotUtil(robotName_nonconst);
std::cerr << "m_robot_util:" << m_robot_util << std::endl;
}
for (unsigned int i = 0; i<4; i++)
{
std::cout << "Verbosity Level :" << i << std::endl;
Example::setLoggerVerbosityLevel((dynamicgraph::LoggerVerbosity) i);
Example::sendMsg("TEST MSG ERROR",dynamicgraph::MSG_TYPE_ERROR);
Example::sendMsg("TEST MSG DEBUG",dynamicgraph::MSG_TYPE_DEBUG);
Example::sendMsg("TEST MSG INFO",dynamicgraph::MSG_TYPE_INFO);
Example::sendMsg("TEST MSG WARNING",dynamicgraph::MSG_TYPE_WARNING);
}
m_initSucceeded = true;
}
......@@ -104,8 +112,8 @@ namespace dynamicgraph
getProfiler().start(PROFILE_EXAMPLE_SUM_COMPUTATION);
double firstAddend = m_firstAddendSIN(iter);
double secondAddend = m_secondAddendSIN(iter);
double firstAddend = firstAddendSIN(iter);
double secondAddend = secondAddendSIN(iter);
s = firstAddend + secondAddend;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment