Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f574155

Browse files
author
Davide Faconti
committed
files and node renamed
1 parent 884a267 commit f574155

File tree

12 files changed

+72
-39
lines changed

12 files changed

+72
-39
lines changed

CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,10 @@ set(BT_Source
6464
src/decorators/timeout_node.cpp
6565

6666
src/controls/parallel_node.cpp
67-
src/controls/fallback_node.cpp
6867
src/controls/sequence_node.cpp
69-
src/controls/fallback_node_with_memory.cpp
70-
src/controls/sequence_node_with_memory.cpp
71-
68+
src/controls/sequence_star_node.cpp
69+
src/controls/fallback_node.cpp
70+
src/controls/fallback_star_node.cpp
7271

7372
src/loggers/bt_cout_logger.cpp
7473
src/loggers/bt_file_logger.cpp

gtest/gtest_fallback.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct ComplexFallbackTest : testing::Test
6767

6868
struct SimpleFallbackWithMemoryTest : testing::Test
6969
{
70-
BT::FallbackNodeWithMemory root;
70+
BT::FallbackStarNode root;
7171
BT::AsyncActionTest action;
7272
BT::ConditionTestNode condition;
7373

@@ -84,16 +84,16 @@ struct SimpleFallbackWithMemoryTest : testing::Test
8484

8585
struct ComplexFallbackWithMemoryTest : testing::Test
8686
{
87-
BT::FallbackNodeWithMemory root;
87+
BT::FallbackStarNode root;
8888

8989
BT::AsyncActionTest action_1;
9090
BT::AsyncActionTest action_2;
9191

9292
BT::ConditionTestNode condition_1;
9393
BT::ConditionTestNode condition_2;
9494

95-
BT::FallbackNodeWithMemory fal_conditions;
96-
BT::FallbackNodeWithMemory fal_actions;
95+
BT::FallbackStarNode fal_conditions;
96+
BT::FallbackStarNode fal_actions;
9797

9898
ComplexFallbackWithMemoryTest()
9999
: root("root_fallback")

gtest/gtest_sequence.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct ComplexSequence2ActionsTest : testing::Test
126126

127127
struct SimpleSequenceWithMemoryTest : testing::Test
128128
{
129-
BT::SequenceNodeWithMemory root;
129+
BT::SequenceStarNode root;
130130
BT::AsyncActionTest action;
131131
BT::ConditionTestNode condition;
132132

@@ -143,16 +143,16 @@ struct SimpleSequenceWithMemoryTest : testing::Test
143143

144144
struct ComplexSequenceWithMemoryTest : testing::Test
145145
{
146-
BT::SequenceNodeWithMemory root;
146+
BT::SequenceStarNode root;
147147

148148
BT::AsyncActionTest action_1;
149149
BT::AsyncActionTest action_2;
150150

151151
BT::ConditionTestNode condition_1;
152152
BT::ConditionTestNode condition_2;
153153

154-
BT::SequenceNodeWithMemory seq_conditions;
155-
BT::SequenceNodeWithMemory seq_actions;
154+
BT::SequenceStarNode seq_conditions;
155+
BT::SequenceStarNode seq_actions;
156156

157157
ComplexSequenceWithMemoryTest()
158158
: root("root_sequence")

include/behavior_tree_core/behavior_tree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "behavior_tree_core/controls/fallback_node.h"
1919
#include "behavior_tree_core/controls/sequence_node.h"
2020

21-
#include "behavior_tree_core/controls/sequence_node_with_memory.h"
22-
#include "behavior_tree_core/controls/fallback_node_with_memory.h"
21+
#include "behavior_tree_core/controls/sequence_star_node.h"
22+
#include "behavior_tree_core/controls/fallback_star_node.h"
2323

2424
#include "behavior_tree_core/action_node.h"
2525
#include "behavior_tree_core/condition_node.h"

include/behavior_tree_core/controls/fallback_node_with_memory.h renamed to include/behavior_tree_core/controls/fallback_star_node.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
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 FALLBACK_NODE_WITH_MEMORY_H
15-
#define FALLBACK_NODE_WITH_MEMORY_H
14+
#ifndef selector_node_WITH_MEMORY_H
15+
#define selector_node_WITH_MEMORY_H
1616

1717
#include "behavior_tree_core/control_node.h"
1818

1919
namespace BT
2020
{
2121

2222
/**
23-
* @brief The FallbackNodeWithMemory is used to try different strategies,
23+
* @brief The FallbackStarNode is used to try different strategies,
2424
* until one succeed.
2525
* If any child returns RUNNING, previous children will NOT be ticked again.
2626
*
@@ -32,10 +32,10 @@ namespace BT
3232
* - If a child returns SUCCESS, stop the loop and returns SUCCESS.
3333
*/
3434

35-
class FallbackNodeWithMemory : public ControlNode
35+
class FallbackStarNode : public ControlNode
3636
{
3737
public:
38-
FallbackNodeWithMemory(const std::string& name);
38+
FallbackStarNode(const std::string& name);
3939

4040
virtual void halt() override;
4141

@@ -46,4 +46,4 @@ class FallbackNodeWithMemory : public ControlNode
4646
};
4747
}
4848

49-
#endif // FALLBACK_NODE_WITH_MEMORY_H
49+
#endif // selector_node_WITH_MEMORY_H

include/behavior_tree_core/controls/sequence_node_with_memory.h renamed to include/behavior_tree_core/controls/sequence_star_node.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace BT
2020
{
2121

2222
/**
23-
* @brief The SequenceNodeWithMemory is used to execute a sequence of children.
23+
* @brief The SequenceStarNode is used to execute a sequence of children.
2424
* If any child returns RUNNING, previous children are not ticked again.
2525
*
2626
* - If all the children return SUCCESS, this node returns SUCCESS.
@@ -33,15 +33,15 @@ namespace BT
3333
*
3434
*/
3535

36-
class SequenceNodeWithMemory : public ControlNode
36+
class SequenceStarNode : public ControlNode
3737
{
3838
public:
39-
SequenceNodeWithMemory(const std::string& name, bool reset_on_failure = true);
39+
SequenceStarNode(const std::string& name, bool reset_on_failure = true);
4040

4141
// Reset policy passed by parameter [reset_policy]
42-
SequenceNodeWithMemory(const std::string& name, const NodeParameters& params);
42+
SequenceStarNode(const std::string& name, const NodeParameters& params);
4343

44-
virtual ~SequenceNodeWithMemory() override = default;
44+
virtual ~SequenceStarNode() override = default;
4545

4646
virtual void halt() override;
4747

src/behavior_tree.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/* Copyright (C) 2018 Davide Faconti - All Rights Reserved
2+
*
3+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
4+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
5+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
*
8+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
10+
* 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.
11+
*/
12+
113
#include "behavior_tree_core/behavior_tree.h"
214
#include <cstring>
315

src/bt_factory.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/* Copyright (C) 2018 Michele Colledanchise - All Rights Reserved
2-
* Copyright (C) 2018 Davide Faconti - All Rights Reserved
1+
/* Copyright (C) 2018 Davide Faconti - All Rights Reserved
32
*
43
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
54
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
@@ -19,9 +18,9 @@ namespace BT
1918
BehaviorTreeFactory::BehaviorTreeFactory()
2019
{
2120
registerNodeType<FallbackNode>("Fallback");
22-
registerNodeType<FallbackNodeWithMemory>("FallbackStar");
21+
registerNodeType<FallbackStarNode>("FallbackStar");
2322
registerNodeType<SequenceNode>("Sequence");
24-
registerNodeType<SequenceNodeWithMemory>("SequenceStar");
23+
registerNodeType<SequenceStarNode>("SequenceStar");
2524

2625
registerNodeType<InverterNode>("Inverter");
2726
registerNodeType<RetryNode>("RetryUntilSuccesful");

src/controls/fallback_node_with_memory.cpp renamed to src/controls/fallback_star_node.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
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-
#include "behavior_tree_core/controls/fallback_node_with_memory.h"
14+
#include "behavior_tree_core/controls/fallback_star_node.h"
1515

1616
namespace BT
1717
{
1818

19-
FallbackNodeWithMemory::FallbackNodeWithMemory(const std::string& name)
19+
FallbackStarNode::FallbackStarNode(const std::string& name)
2020
: ControlNode::ControlNode(name, {})
2121
, current_child_idx_(0)
2222
{
2323
}
2424

25-
NodeStatus FallbackNodeWithMemory::tick()
25+
NodeStatus FallbackStarNode::tick()
2626
{
2727
// Vector size initialization. N_of_children_ could change at runtime if you edit the tree
2828
const unsigned N_of_children = children_nodes_.size();
@@ -72,7 +72,7 @@ NodeStatus FallbackNodeWithMemory::tick()
7272
return NodeStatus::FAILURE;
7373
}
7474

75-
void FallbackNodeWithMemory::halt()
75+
void FallbackStarNode::halt()
7676
{
7777
current_child_idx_ = 0;
7878
ControlNode::halt();

src/controls/sequence_node_with_memory.cpp renamed to src/controls/sequence_star_node.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@
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-
#include "behavior_tree_core/controls/sequence_node_with_memory.h"
14+
#include "behavior_tree_core/controls/sequence_star_node.h"
1515

1616
namespace BT
1717
{
1818

19-
SequenceNodeWithMemory::SequenceNodeWithMemory(const std::string& name, bool reset_on_failure)
20-
: ControlNode::ControlNode(name, SequenceNodeWithMemory::requiredNodeParameters() )
19+
SequenceStarNode::SequenceStarNode(const std::string& name, bool reset_on_failure)
20+
: ControlNode::ControlNode(name, SequenceStarNode::requiredNodeParameters() )
2121
, current_child_idx_(0)
2222
, reset_on_failure_(reset_on_failure)
2323
{
2424
}
2525

26-
SequenceNodeWithMemory::SequenceNodeWithMemory(const std::string& name, const NodeParameters& params)
26+
SequenceStarNode::SequenceStarNode(const std::string& name, const NodeParameters& params)
2727
: ControlNode::ControlNode(name, params)
2828
, current_child_idx_(0)
2929
, reset_on_failure_(true)
3030
{
3131
getParam<bool>("reset_on_failure", reset_on_failure_);
3232
}
3333

34-
NodeStatus SequenceNodeWithMemory::tick()
34+
NodeStatus SequenceStarNode::tick()
3535
{
3636
// Vector size initialization. N_of_children_ could change at runtime if you edit the tree
3737
const unsigned N_of_children = children_nodes_.size();
@@ -88,7 +88,7 @@ NodeStatus SequenceNodeWithMemory::tick()
8888
return NodeStatus::SUCCESS;
8989
}
9090

91-
void SequenceNodeWithMemory::halt()
91+
void SequenceStarNode::halt()
9292
{
9393
current_child_idx_ = 0;
9494
ControlNode::halt();

0 commit comments

Comments
 (0)