The RetryNode is used to execute a child several times if it fails. More...
#include <retry_node.h>
Public Member Functions | |
virtual void | halt () override |
The method used to interrupt the execution of this node. | |
RetryNode (const std::string &name, int NTries) | |
RetryNode (const std::string &name, const NodeConfiguration &config) | |
virtual | ~RetryNode () override |
Static Public Member Functions | |
static PortsList | providedPorts () |
Private Member Functions | |
virtual BT::NodeStatus | tick () override |
Method to be implemented by the user. | |
Private Attributes | |
int | max_attempts_ |
bool | read_parameter_from_ports_ |
int | try_index_ |
Static Private Attributes | |
static constexpr const char * | NUM_ATTEMPTS = "num_attempts" |
The RetryNode is used to execute a child several times if it fails.
If the child returns SUCCESS, the loop is stopped and this node returns SUCCESS.
If the child returns FAILURE, this node will try again up to N times (N is read from port "num_attempts").
Example:
<RetryUntilSuccesful num_attempts="3"> <OpenDoor> </RetryUntilSuccesful>
Definition at line 36 of file retry_node.h.
BT::RetryNode::RetryNode | ( | const std::string & | name, |
int | NTries | ||
) |
Definition at line 20 of file retry_node.cpp.
BT::RetryNode::RetryNode | ( | const std::string & | name, |
const NodeConfiguration & | config | ||
) |
Definition at line 29 of file retry_node.cpp.
virtual BT::RetryNode::~RetryNode | ( | ) | [override, virtual] |
void BT::RetryNode::halt | ( | ) | [override, virtual] |
The method used to interrupt the execution of this node.
Reimplemented from BT::DecoratorNode.
Definition at line 37 of file retry_node.cpp.
static PortsList BT::RetryNode::providedPorts | ( | ) | [inline, static] |
Definition at line 46 of file retry_node.h.
NodeStatus BT::RetryNode::tick | ( | ) | [override, private, virtual] |
Method to be implemented by the user.
Implements BT::TreeNode.
Definition at line 43 of file retry_node.cpp.
int BT::RetryNode::max_attempts_ [private] |
Definition at line 56 of file retry_node.h.
constexpr const char * BT::RetryNode::NUM_ATTEMPTS = "num_attempts" [static, private] |
Definition at line 60 of file retry_node.h.
bool BT::RetryNode::read_parameter_from_ports_ [private] |
Definition at line 59 of file retry_node.h.
int BT::RetryNode::try_index_ [private] |
Definition at line 57 of file retry_node.h.