custom_entity.cpp
Go to the documentation of this file.
1 /* Copyright 2010-2019 LAAS, CNRS
2  * Thomas Moulard.
3  *
4  */
5 
6 #define ENABLE_RT_LOG
7 
8 #include "custom_entity.h"
9 
11 #include <dynamic-graph/entity.h>
13 #include <dynamic-graph/factory.h>
14 #include <dynamic-graph/pool.h>
18 
19 #include <boost/bind.hpp>
20 
21 namespace dynamicgraph {
22 
23 CustomEntity::CustomEntity(const std::string n)
24  : Entity(n),
25  m_sigdSIN(NULL, "CustomEntity(" + name + ")::input(double)::in_double"),
26  m_sigdTimeDepSOUT(boost::bind(&CustomEntity::update, this, _1, _2),
27  m_sigdSIN,
28  "CustomEntity(" + name + ")::input(double)::out_double")
29 
30 {
31  addSignal();
32 
33  using namespace dynamicgraph::command;
34 
35  this->addCommand("act",
36  makeCommandVoid0(*this, &CustomEntity::act,
37  docCommandVoid0("act on input signal")));
38 }
39 
41  signalRegistration(m_sigdSIN << m_sigdTimeDepSOUT);
42 }
43 
45  signalDeregistration("in_double");
46  signalDeregistration("out_double");
47 }
48 
49 double &CustomEntity::update(double &res, const int &inTime) {
50  const double &aDouble = m_sigdSIN(inTime);
51  res = aDouble;
52  logger().stream(MSG_TYPE_ERROR) << "start update " << res << '\n';
54  << "This is a message of level MSG_TYPE_DEBUG\n";
56  << "This is a message of level MSG_TYPE_INFO\n";
58  << "This is a message of level MSG_TYPE_WARNING\n";
60  << "This is a message of level MSG_TYPE_ERROR\n";
62  << "This is a message of level MSG_TYPE_DEBUG_STREAM\n";
64  << "This is a message of level MSG_TYPE_INFO_STREAM\n";
66  << "This is a message of level MSG_TYPE_WARNING_STREAM\n";
68  << "This is a message of level MSG_TYPE_ERROR_STREAM\n";
69  logger().stream(MSG_TYPE_ERROR) << "end update\n";
70  return res;
71 }
72 
73 void CustomEntity::act() { m_sigdSIN.accessCopy(); }
74 
75 DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(CustomEntity, "CustomEntity");
76 } // namespace dynamicgraph
CommandVoid0< E > * makeCommandVoid0(E &entity, boost::function< void(void)> function, const std::string &docString)
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(MyEntity, "MyEntity")
#define DYNAMIC_GRAPH_ENTITY_DEBUG(entity)
#define DYNAMIC_GRAPH_ENTITY_WARNING_STREAM(entity)
#define DYNAMIC_GRAPH_ENTITY_INFO_STREAM(entity)
#define DYNAMIC_GRAPH_ENTITY_INFO(entity)
#define DYNAMIC_GRAPH_ENTITY_WARNING(entity)
#define DYNAMIC_GRAPH_ENTITY_ERROR(entity)
#define DYNAMIC_GRAPH_ENTITY_DEBUG_STREAM(entity)
std::string docCommandVoid0(const std::string &doc)
#define DYNAMIC_GRAPH_ENTITY_ERROR_STREAM(entity)
double & update(double &res, const int &inTime)
CustomEntity(const std::string &n)
res


dynamic-graph-python
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Sun Jun 25 2023 02:55:50