@@ -25,8 +25,11 @@ namespace BT
25
25
*
26
26
* An empty queue will return SUCCESS
27
27
*/
28
+
29
+
28
30
template <typename T>
29
- class ConsumeQueue : public DecoratorNode
31
+ class [[deprecated(" You are encouraged to use the LoopNode instead" )]]
32
+ ConsumeQueue : public DecoratorNode
30
33
{
31
34
public:
32
35
ConsumeQueue (const std::string& name, const NodeConfig& config) :
@@ -35,6 +38,9 @@ class ConsumeQueue : public DecoratorNode
35
38
36
39
NodeStatus tick () override
37
40
{
41
+ // by default, return SUCCESS, even if queue is empty
42
+ NodeStatus status_to_be_returned = NodeStatus::SUCCESS;
43
+
38
44
if (running_child_)
39
45
{
40
46
NodeStatus child_state = child_node_->executeTick ();
@@ -46,6 +52,7 @@ class ConsumeQueue : public DecoratorNode
46
52
else
47
53
{
48
54
haltChild ();
55
+ status_to_be_returned = child_state;
49
56
}
50
57
}
51
58
@@ -79,18 +86,18 @@ class ConsumeQueue : public DecoratorNode
79
86
{
80
87
return NodeStatus::FAILURE;
81
88
}
89
+ status_to_be_returned = child_state;
82
90
}
83
91
}
84
92
}
85
93
86
- return NodeStatus::SUCCESS ;
94
+ return status_to_be_returned ;
87
95
}
88
96
89
97
static PortsList providedPorts ()
90
98
{
91
- return {InputPort<std::shared_ptr<ProtectedQueue<T>>>(" queue" ), OutputPort<T>(" popped"
92
- " _ite"
93
- " m" )};
99
+ return {InputPort<std::shared_ptr<ProtectedQueue<T>>>(" queue" ),
100
+ OutputPort<T>(" popped_item" )};
94
101
}
95
102
96
103
private:
0 commit comments