event.cpp
Go to the documentation of this file.
1 // Copyright (c) 2017, Joseph Mirabel
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 
4 #include <dynamic-graph/factory.h>
5 
6 #include <sot/core/event.hh>
7 
8 namespace dynamicgraph {
9 namespace sot {
10 
11 bool &Event::check(bool &ret, const int &time) {
12  const bool &val = conditionSIN(time);
13  ret = (val != lastVal_);
14  bool up = (!lastVal_ && val);
15  if (up) {
16  timeSinceUp_ = 0;
17  } else if (val) {
18  ++timeSinceUp_;
19  }
20  // If repetition is activated, trigger again after given number of iterations
21  bool trigger = up || (repeatAfterNIterations_ > 0 &&
23  if (ret) {
24  lastVal_ = val;
25  }
26  if (trigger) {
27  for (Triggers_t::const_iterator _s = triggers.begin(); _s != triggers.end();
28  ++_s)
29  (*_s)->recompute(time);
30  timeSinceUp_ = 0;
31  }
32  return ret;
33 }
34 
36 } // namespace sot
37 } // namespace dynamicgraph
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(FeaturePosture, "FeaturePosture")
Triggers_t triggers
Definition: event.hh:117
SignalPtr< bool, int > conditionSIN
Definition: event.hh:118
bool & check(bool &ret, const int &time)
Definition: event.cpp:11


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Wed Jun 21 2023 02:51:26