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 sigtime_t &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::sot::Event::lastVal_
bool lastVal_
Definition: event.hh:120
dynamicgraph::sot::Event::conditionSIN
SignalPtr< bool, sigtime_t > conditionSIN
Definition: event.hh:118
dynamicgraph
dynamicgraph::sot::Event::check
bool & check(bool &ret, const int64_t &time)
Definition: event.cpp:11
dynamicgraph::sot::DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(FeaturePosture, "FeaturePosture")
dynamicgraph::sot::Event::timeSinceUp_
sigtime_t timeSinceUp_
Definition: event.hh:121
dynamicgraph::sigtime_t
int64_t sigtime_t
dynamicgraph::sot::Event::triggers
Triggers_t triggers
Definition: event.hh:117
dynamicgraph::sot::Event::repeatAfterNIterations_
sigtime_t repeatAfterNIterations_
Definition: event.hh:121
event.hh
dynamicgraph::sot::Event
Definition: event.hh:44


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:31