src
decorators
subtree_node.cpp
Go to the documentation of this file.
1
#include "
behaviortree_cpp/decorators/subtree_node.h
"
2
3
BT::SubTreeNode::SubTreeNode
(
const
std::string& name,
const
NodeConfig
& config)
4
:
DecoratorNode
(name, config)
5
{
6
setRegistrationID
(
"SubTree"
);
7
}
8
9
BT::PortsList
BT::SubTreeNode::providedPorts
()
10
{
11
auto
port =
12
PortInfo
(
PortDirection::INPUT
,
typeid
(
bool
), GetAnyFromStringFunctor<bool>());
13
port.setDefaultValue(
false
);
14
port.setDescription(
"If true, all the ports with the same name "
15
"will be remapped"
);
16
17
return
{ {
"_autoremap"
, port } };
18
}
19
20
BT::NodeStatus
BT::SubTreeNode::tick
()
21
{
22
NodeStatus
prev_status = status();
23
if
(prev_status ==
NodeStatus::IDLE
)
24
{
25
setStatus(
NodeStatus::RUNNING
);
26
}
27
const
NodeStatus
child_status = child_node_->executeTick();
28
if
(
isStatusCompleted
(child_status))
29
{
30
resetChild();
31
}
32
33
return
child_status;
34
}
BT::PortInfo
Definition:
basic_types.h:392
BT::SubTreeNode::tick
virtual BT::NodeStatus tick() override
Method to be implemented by the user.
Definition:
subtree_node.cpp:20
subtree_node.h
BT::DecoratorNode
Definition:
decorator_node.h:8
BT::PortsList
std::unordered_map< std::string, PortInfo > PortsList
Definition:
basic_types.h:585
BT::SubTreeNode::SubTreeNode
SubTreeNode(const std::string &name, const NodeConfig &config)
Definition:
subtree_node.cpp:3
BT::PortDirection::INPUT
@ INPUT
BT::TreeNode::setRegistrationID
void setRegistrationID(StringView ID)
Definition:
tree_node.cpp:439
BT::NodeStatus::RUNNING
@ RUNNING
BT::isStatusCompleted
bool isStatusCompleted(const NodeStatus &status)
Definition:
basic_types.h:47
BT::SubTreeNode::providedPorts
static PortsList providedPorts()
Definition:
subtree_node.cpp:9
BT::NodeStatus::IDLE
@ IDLE
BT::NodeConfig
Definition:
tree_node.h:73
BT::NodeStatus
NodeStatus
Definition:
basic_types.h:33
behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Dec 13 2024 03:19:17