Skip to content

Commit c9f0c2c

Browse files
author
Davide Faconti
committed
Renaming: Negation->Inverter and Deadline->Timeout
1 parent e085949 commit c9f0c2c

22 files changed

+71
-93
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ set(BT_Source
5858
src/shared_library.cpp
5959
src/shared_library_UNIX.cpp
6060

61-
src/decorators/negation_node.cpp
61+
src/decorators/inverter_node.cpp
6262
src/decorators/repeat_node.cpp
6363
src/decorators/retry_node.cpp
64-
src/decorators/deadline_node.cpp
64+
src/decorators/timeout_node.cpp
6565

6666
src/controls/parallel_node.cpp
6767
src/controls/fallback_node.cpp

docs/BT_basics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ You can create your own Decorators.
9696

9797
![Simple Decorator: Enter Room](images/DecoratorEnterRoom.png)
9898

99-
The node __Negation__ is a Decorator that inverts
100-
the result returned by its child; Negation followed by the node called
99+
The node __Inverter__ is a Decorator that inverts
100+
the result returned by its child; Inverter followed by the node called
101101
__DoorOpen__ is therefore equivalent to
102102

103103
"Is the door closed?".

docs/DecoratorNode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A decorator is a node that can have only a single child.
55
It is up to the Decorator to decide if, when and how many times the child should be
66
ticked.
77

8-
## NegationNode
8+
## InverterNode
99

1010
Tick the child once and return SUCCESS if the child failed or FAILURE if
1111
the child succeeded.

docs/images/CrossDoorSubtree.png

15.2 KB
Loading

docs/images/DecoratorEnterRoom.png

1.98 KB
Loading

docs/images/TypeHierarchy.png

6.33 KB
Loading

docs/tutorial_D_subtrees.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ Multiple BehaviorTrees can be created and composed in the XML itself.
3030
<!--------------------------------------->
3131
<BehaviorTree ID="DoorClosed">
3232
<Sequence name="door_closed_sequence">
33-
<Negation>
33+
<Inverter>
3434
<IsDoorOpen/>
35-
</Negation>
35+
</Inverter>
3636
<RetryUntilSuccesful num_attempts="4">
3737
<OpenDoor/>
3838
</RetryUntilSuccesful>

docs/uml/CrossDoorSubtree.uxf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
<w>80</w>
133133
<h>30</h>
134134
</coordinates>
135-
<panel_attributes>Negation</panel_attributes>
135+
<panel_attributes>Inverter</panel_attributes>
136136
<additional_attributes/>
137137
</element>
138138
<element>

docs/uml/EnterRoom.uxf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<w>100</w>
5353
<h>30</h>
5454
</coordinates>
55-
<panel_attributes>Negation
55+
<panel_attributes>Inverter
5656
fg=blue</panel_attributes>
5757
<additional_attributes/>
5858
</element>

docs/uml/EnterRoom2.uxf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<w>100</w>
5353
<h>30</h>
5454
</coordinates>
55-
<panel_attributes>Negation
55+
<panel_attributes>Inverter
5656
fg=blue</panel_attributes>
5757
<additional_attributes/>
5858
</element>

docs/uml/Sequence2.uxf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
<w>100</w>
9898
<h>30</h>
9999
</coordinates>
100-
<panel_attributes>Negation
100+
<panel_attributes>Inverter
101101
fg=blue</panel_attributes>
102102
<additional_attributes/>
103103
</element>

docs/uml/TypeHierarchy.uxf

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<element>
1717
<id>UMLClass</id>
1818
<coordinates>
19-
<x>490</x>
19+
<x>590</x>
2020
<y>280</y>
2121
<w>100</w>
2222
<h>30</h>
@@ -27,8 +27,8 @@
2727
<element>
2828
<id>UMLClass</id>
2929
<coordinates>
30-
<x>380</x>
31-
<y>280</y>
30+
<x>590</x>
31+
<y>320</y>
3232
<w>100</w>
3333
<h>30</h>
3434
</coordinates>
@@ -38,8 +38,8 @@
3838
<element>
3939
<id>UMLClass</id>
4040
<coordinates>
41-
<x>600</x>
42-
<y>280</y>
41+
<x>590</x>
42+
<y>240</y>
4343
<w>120</w>
4444
<h>30</h>
4545
</coordinates>
@@ -49,41 +49,41 @@
4949
<element>
5050
<id>Relation</id>
5151
<coordinates>
52-
<x>420</x>
52+
<x>500</x>
5353
<y>200</y>
5454
<w>110</w>
55-
<h>100</h>
55+
<h>160</h>
5656
</coordinates>
5757
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
58-
<additional_attributes>90.0;10.0;10.0;80.0</additional_attributes>
58+
<additional_attributes>10.0;10.0;10.0;140.0;90.0;140.0</additional_attributes>
5959
</element>
6060
<element>
6161
<id>Relation</id>
6262
<coordinates>
6363
<x>530</x>
6464
<y>200</y>
65-
<w>30</w>
66-
<h>100</h>
65+
<w>80</w>
66+
<h>110</h>
6767
</coordinates>
6868
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
69-
<additional_attributes>10.0;10.0;10.0;80.0</additional_attributes>
69+
<additional_attributes>10.0;10.0;10.0;90.0;60.0;90.0</additional_attributes>
7070
</element>
7171
<element>
7272
<id>Relation</id>
7373
<coordinates>
7474
<x>560</x>
7575
<y>200</y>
76-
<w>110</w>
77-
<h>100</h>
76+
<w>50</w>
77+
<h>70</h>
7878
</coordinates>
7979
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
80-
<additional_attributes>10.0;10.0;90.0;80.0</additional_attributes>
80+
<additional_attributes>10.0;10.0;10.0;50.0;30.0;50.0</additional_attributes>
8181
</element>
8282
<element>
8383
<id>UMLClass</id>
8484
<coordinates>
85-
<x>340</x>
86-
<y>380</y>
85+
<x>700</x>
86+
<y>420</y>
8787
<w>100</w>
8888
<h>30</h>
8989
</coordinates>
@@ -93,7 +93,7 @@
9393
<element>
9494
<id>UMLClass</id>
9595
<coordinates>
96-
<x>450</x>
96+
<x>700</x>
9797
<y>380</y>
9898
<w>120</w>
9999
<h>30</h>
@@ -104,30 +104,30 @@
104104
<element>
105105
<id>Relation</id>
106106
<coordinates>
107-
<x>380</x>
108-
<y>300</y>
109-
<w>60</w>
110-
<h>100</h>
107+
<x>620</x>
108+
<y>340</y>
109+
<w>100</w>
110+
<h>120</h>
111111
</coordinates>
112112
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
113-
<additional_attributes>40.0;10.0;10.0;80.0</additional_attributes>
113+
<additional_attributes>10.0;10.0;10.0;100.0;80.0;100.0</additional_attributes>
114114
</element>
115115
<element>
116116
<id>Relation</id>
117117
<coordinates>
118-
<x>430</x>
119-
<y>300</y>
118+
<x>640</x>
119+
<y>340</y>
120120
<w>80</w>
121-
<h>100</h>
121+
<h>70</h>
122122
</coordinates>
123123
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
124-
<additional_attributes>10.0;10.0;60.0;80.0</additional_attributes>
124+
<additional_attributes>10.0;10.0;10.0;50.0;60.0;50.0</additional_attributes>
125125
</element>
126126
<element>
127127
<id>UMLNote</id>
128128
<coordinates>
129-
<x>590</x>
130-
<y>330</y>
129+
<x>460</x>
130+
<y>360</y>
131131
<w>140</w>
132132
<h>90</h>
133133
</coordinates>

examples/crossdoor_example.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ const std::string xml_text = R"(
1616
<!--------------------------------------->
1717
<BehaviorTree ID="DoorClosed">
1818
<Sequence name="door_closed_sequence">
19-
<Negation>
19+
<Inverter>
2020
<Condition ID="IsDoorOpen"/>
21-
</Negation>
21+
</Inverter>
2222
<RetryUntilSuccesful num_attempts="4">
2323
<OpenDoor/>
2424
</RetryUntilSuccesful>

gtest/gtest_decorator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ using BT::NodeStatus;
2020

2121
struct DeadlineTest : testing::Test
2222
{
23-
BT::DeadlineNode root;
23+
BT::TimeoutNode root;
2424
BT::AsyncActionTest action;
2525

2626
DeadlineTest()

gtest/gtest_factory.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const std::string xml_text = R"(
1919
</Sequence>
2020
2121
<Sequence name="door_closed_sequence">
22-
<Decorator ID="Negation">
22+
<Decorator ID="Inverter">
2323
<Action ID="IsDoorOpen" />
2424
</Decorator>
2525
<Action ID="OpenDoor" />
@@ -56,7 +56,7 @@ const std::string xml_text_subtree = R"(
5656
5757
<BehaviorTree ID="CrossDoorSubtree">
5858
<Sequence name="door_sequence">
59-
<Decorator ID="Negation">
59+
<Decorator ID="Inverter">
6060
<Action ID="IsDoorLocked" />
6161
</Decorator>
6262
<Action ID="OpenDoor" />
@@ -123,12 +123,12 @@ TEST(BehaviorTreeFactory, VerifyLargeTree)
123123
ASSERT_TRUE(sequence_closed != nullptr);
124124

125125
ASSERT_EQ(sequence_closed->children().size(), 4);
126-
ASSERT_EQ(sequence_closed->child(0)->name(), "Negation");
126+
ASSERT_EQ(sequence_closed->child(0)->name(), "Inverter");
127127
ASSERT_EQ(sequence_closed->child(1)->name(), "OpenDoor");
128128
ASSERT_EQ(sequence_closed->child(2)->name(), "PassThroughDoor");
129129
ASSERT_EQ(sequence_closed->child(3)->name(), "CloseDoor");
130130

131-
auto decorator = dynamic_cast<const BT::NegationNode*>(sequence_closed->child(0));
131+
auto decorator = dynamic_cast<const BT::InverterNode*>(sequence_closed->child(0));
132132
ASSERT_TRUE(decorator != nullptr);
133133

134134
ASSERT_EQ(decorator->child()->name(), "IsDoorOpen");
@@ -173,12 +173,12 @@ TEST(BehaviorTreeFactory, Subtree)
173173
ASSERT_TRUE(sequence != nullptr);
174174

175175
ASSERT_EQ(sequence->children().size(), 4);
176-
ASSERT_EQ(sequence->child(0)->name(), "Negation");
176+
ASSERT_EQ(sequence->child(0)->name(), "Inverter");
177177
ASSERT_EQ(sequence->child(1)->name(), "OpenDoor");
178178
ASSERT_EQ(sequence->child(2)->name(), "PassThroughDoor");
179179
ASSERT_EQ(sequence->child(3)->name(), "CloseDoor");
180180

181-
auto decorator = dynamic_cast<const BT::NegationNode*>(sequence->child(0));
181+
auto decorator = dynamic_cast<const BT::InverterNode*>(sequence->child(0));
182182
ASSERT_TRUE(decorator != nullptr);
183183

184184
ASSERT_EQ(decorator->child()->name(), "IsDoorLocked");

include/behavior_tree_core/behavior_tree.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "behavior_tree_core/action_node.h"
2525
#include "behavior_tree_core/condition_node.h"
2626

27-
#include "behavior_tree_core/decorators/negation_node.h"
27+
#include "behavior_tree_core/decorators/inverter_node.h"
2828
#include "behavior_tree_core/decorators/retry_node.h"
2929
#include "behavior_tree_core/decorators/repeat_node.h"
3030
#include "behavior_tree_core/decorators/subtree_node.h"
@@ -35,8 +35,8 @@
3535

3636
#include "behavior_tree_core/decorators/force_success_node.h"
3737
#include "behavior_tree_core/decorators/force_failure_node.h"
38-
#include "behavior_tree_core/decorators/blackboard_precondition_node.h"
39-
#include "behavior_tree_core/decorators/deadline_node.h"
38+
#include "behavior_tree_core/decorators/blackboard_precondition.h"
39+
#include "behavior_tree_core/decorators/timeout_node.h"
4040

4141
namespace BT
4242
{

include/behavior_tree_core/decorators/negation_node.h renamed to include/behavior_tree_core/decorators/inverter_node.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2015-2018 Michele Colledanchise - All Rights Reserved
1+
/* Copyright (C) 2018 Michele Colledanchise - All Rights Reserved
22
* Copyright (C) 2018 Davide Faconti - All Rights Reserved
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
@@ -11,19 +11,19 @@
1111
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1212
*/
1313

14-
#ifndef DECORATORNEGATIONNODE_H
15-
#define DECORATORNEGATIONNODE_H
14+
#ifndef DECORATOR_INVERTER_NODE_H
15+
#define DECORATOR_INVERTER_NODE_H
1616

1717
#include "behavior_tree_core/decorator_node.h"
1818

1919
namespace BT
2020
{
21-
class NegationNode : public DecoratorNode
21+
class InverterNode : public DecoratorNode
2222
{
2323
public:
24-
NegationNode(const std::string& name);
24+
InverterNode(const std::string& name);
2525

26-
virtual ~NegationNode() override = default;
26+
virtual ~InverterNode() override = default;
2727

2828
private:
2929
virtual BT::NodeStatus tick() override;

include/behavior_tree_core/decorators/deadline_node.h renamed to include/behavior_tree_core/decorators/timeout_node.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
#ifndef DEADLINE_NODE_H
2-
#define DEADLINE_NODE_H
1+
#ifndef DECORATOR_TIMEOUT_NODE_H
2+
#define DECORATOR_TIMEOUT_NODE_H
33

44
#include "behavior_tree_core/decorator_node.h"
55
#include <atomic>
66
#include "timer_queue.h"
77

88
namespace BT
99
{
10-
class DeadlineNode : public DecoratorNode
10+
class TimeoutNode : public DecoratorNode
1111
{
1212
public:
1313

14-
DeadlineNode(const std::string& name, unsigned milliseconds);
14+
TimeoutNode(const std::string& name, unsigned milliseconds);
1515

16-
DeadlineNode(const std::string& name,const NodeParameters& params);
16+
TimeoutNode(const std::string& name,const NodeParameters& params);
1717

1818
static const NodeParameters& requiredNodeParameters()
1919
{

0 commit comments

Comments
 (0)