Skip to content

Commit 0f9ebb2

Browse files
Add interaction node
1 parent a25e96d commit 0f9ebb2

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

Diff for: include/behaviortree_cpp/action_node.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ActionNodeBase : public LeafNode
3838
ActionNodeBase(const std::string& name, const NodeConfig& config);
3939
~ActionNodeBase() override = default;
4040

41-
virtual NodeType type() const override final
41+
virtual NodeType type() const override
4242
{
4343
return NodeType::ACTION;
4444
}

Diff for: include/behaviortree_cpp/basic_types.h

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ enum class NodeType
2121
{
2222
UNDEFINED = 0,
2323
ACTION,
24+
INTERACTION,
2425
CONDITION,
2526
ASSUMPTIONCHECKER,
2627
CONTROL,

Diff for: include/behaviortree_cpp/interaction_node.h

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef INTERACTIONNODE_H
2+
#define INTERACTIONNODE_H
3+
4+
#include "leaf_node.h"
5+
#include "behaviortree_cpp/action_node.h"
6+
7+
namespace BT
8+
{
9+
class InteractionNode : public SyncActionNode
10+
{
11+
public:
12+
InteractionNode(const std::string& name, const NodeConfig& config);
13+
~InteractionNode() override = default;
14+
15+
/// throws if the derived class return RUNNING.
16+
virtual NodeStatus executeTick() override;
17+
18+
virtual NodeType type() const override final
19+
{
20+
return NodeType::INTERACTION;
21+
}
22+
};
23+
} // namespace BT
24+
25+
#endif

Diff for: src/interaction_node.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include "behaviortree_cpp/interaction_node.h"
2+
3+
namespace BT
4+
{
5+
InteractionNode::InteractionNode(const std::string& name, const NodeConfig& config)
6+
: SyncActionNode(name, config)
7+
{}
8+
}

0 commit comments

Comments
 (0)