• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

BehaviorTree / BehaviorTree.CPP / 21669518654

04 Feb 2026 11:22AM UTC coverage: 79.715% (-0.03%) from 79.742%
21669518654

push

github

facontidavide
Merge branch 'master' of github.com:BehaviorTree/BehaviorTree.CPP

50 of 50 new or added lines in 1 file covered. (100.0%)

80 existing lines in 2 files now uncovered.

4692 of 5886 relevant lines covered (79.71%)

22434.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.74
/src/decorators/delay_node.cpp
1
/*  Contributed by Indraneel on 26/04/2020
2
 */
3

4
#include "behaviortree_cpp/decorators/delay_node.h"
5

6
namespace BT
7
{
8
DelayNode::DelayNode(const std::string& name, unsigned milliseconds)
×
9
  : DecoratorNode(name, {})
UNCOV
10
  , timer_id_(0)
×
11
  , msec_(milliseconds)
×
12
  , read_parameter_from_ports_(false)
×
13
{
UNCOV
14
  setRegistrationID("Delay");
×
UNCOV
15
}
×
16

17
DelayNode::DelayNode(const std::string& name, const NodeConfig& config)
3✔
18
  : DecoratorNode(name, config), timer_id_(0), msec_(0), read_parameter_from_ports_(true)
3✔
19
{}
3✔
20

21
void DelayNode::halt()
7✔
22
{
23
  delay_started_ = false;
7✔
24
  timer_.cancelAll();
7✔
25
  DecoratorNode::halt();
7✔
26
}
7✔
27

28
NodeStatus DelayNode::tick()
64✔
29
{
30
  if(read_parameter_from_ports_)
64✔
31
  {
32
    if(!getInput("delay_msec", msec_))
192✔
33
    {
UNCOV
34
      throw RuntimeError("Missing parameter [delay_msec] in DelayNode");
×
35
    }
36
  }
37

38
  if(!delay_started_)
64✔
39
  {
40
    delay_complete_ = false;
3✔
41
    delay_aborted_ = false;
3✔
42
    delay_started_ = true;
3✔
43
    setStatus(NodeStatus::RUNNING);
3✔
44

45
    timer_id_ = timer_.add(std::chrono::milliseconds(msec_), [this](bool aborted) {
3✔
46
      const std::unique_lock<std::mutex> lk(delay_mutex_);
3✔
47
      delay_complete_ = (!aborted);
3✔
48
      if(!aborted)
3✔
49
      {
50
        emitWakeUpSignal();
3✔
51
      }
52
    });
3✔
53
  }
54

55
  const std::unique_lock<std::mutex> lk(delay_mutex_);
64✔
56

57
  if(delay_aborted_)
64✔
58
  {
UNCOV
59
    delay_aborted_ = false;
×
UNCOV
60
    delay_started_ = false;
×
UNCOV
61
    return NodeStatus::FAILURE;
×
62
  }
63
  if(delay_complete_)
64✔
64
  {
65
    const NodeStatus child_status = child()->executeTick();
3✔
66
    if(isStatusCompleted(child_status))
3✔
67
    {
68
      delay_started_ = false;
3✔
69
      delay_aborted_ = false;
3✔
70
      resetChild();
3✔
71
    }
72
    return child_status;
3✔
73
  }
74
  return NodeStatus::RUNNING;
61✔
75
}
64✔
76

77
}  // namespace BT
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc