File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
include/behaviortree_cpp_v3/decorators Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ namespace BT {
15
15
class DecoratorEvent : public DecoratorNode {
16
16
public:
17
17
DecoratorEvent (const std::string &name, const NodeConfiguration &config)
18
- : DecoratorNode(name, config) {}
18
+ : DecoratorNode(name, config) {
19
+ reset_priority ();
20
+ }
19
21
20
22
static PortsList providedPorts () {
21
23
return {InputPort<int >(DECORATOR_PRIORITY_NAME), InputPort<int >(DECORATOR_INDEX_NAME)};
@@ -38,6 +40,8 @@ namespace BT {
38
40
void halt () override ;
39
41
40
42
private:
43
+ void reset_priority ();
44
+
41
45
bool m_reenter = false ;
42
46
bool m_initialized = false ;
43
47
int m_priority = 0 ;
Original file line number Diff line number Diff line change @@ -32,20 +32,24 @@ namespace BT {
32
32
if (auto prop = dynamic_cast <PropReenter *>(child ())) {
33
33
m_reenter = true ;
34
34
}
35
- Optional<int > ret = getInput<int >(DECORATOR_PRIORITY_NAME);
36
- if (ret) {
37
- m_priority = ret.value ();
38
- } else {
39
- m_priority = 0 ;
40
- }
41
35
return NodeStatus::SUCCESS;
42
36
}
43
37
44
38
void DecoratorEvent::halt () {
39
+ reset_priority ();
45
40
DecoratorNode::halt ();
46
41
}
47
42
48
43
void DecoratorEvent::set_priority (int prio) {
49
44
m_priority = prio;
50
45
}
46
+
47
+ void DecoratorEvent::reset_priority () {
48
+ Optional<int > ret = getInput<int >(DECORATOR_PRIORITY_NAME);
49
+ if (ret) {
50
+ m_priority = ret.value ();
51
+ } else {
52
+ m_priority = 0 ;
53
+ }
54
+ }
51
55
}
You can’t perform that action at this time.
0 commit comments