manual_node.h
Go to the documentation of this file.
1 /* Copyright (C) 2020-2022 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 
13 #pragma once
14 
16 
17 namespace BT
18 {
23 {
24 public:
25  ManualSelectorNode(const std::string& name, const NodeConfig& config);
26 
27  virtual ~ManualSelectorNode() override = default;
28 
29  virtual void halt() override;
30 
32  {
33  return { InputPort<bool>(REPEAT_LAST_SELECTION, false,
34  "If true, execute again the same child that was selected "
35  "the "
36  "last "
37  "time") };
38  }
39 
40 private:
41  static constexpr const char* REPEAT_LAST_SELECTION = "repeat_last_selection";
42 
43  virtual BT::NodeStatus tick() override;
46 
48  {
49  NUM_SUCCESS = 253,
50  NUM_FAILURE = 254,
51  NUM_RUNNING = 255,
52  };
53 
54  NodeStatus selectStatus() const;
55 
56  uint8_t selectChild() const;
57 };
58 
59 } // namespace BT
BT::ManualSelectorNode::providedPorts
static PortsList providedPorts()
Definition: manual_node.h:31
BT
Definition: ex01_wrap_legacy.cpp:29
BT::TreeNode::config
const NodeConfig & config() const
Definition: tree_node.cpp:345
BT::ManualSelectorNode::NUM_FAILURE
@ NUM_FAILURE
Definition: manual_node.h:50
BT::ManualSelectorNode::NUM_RUNNING
@ NUM_RUNNING
Definition: manual_node.h:51
BT::ManualSelectorNode::halt
virtual void halt() override
Definition: manual_node.cpp:28
BT::ManualSelectorNode::REPEAT_LAST_SELECTION
static constexpr const char * REPEAT_LAST_SELECTION
Definition: manual_node.h:41
BT::ManualSelectorNode::ManualSelectorNode
ManualSelectorNode(const std::string &name, const NodeConfig &config)
Definition: manual_node.cpp:20
BT::ManualSelectorNode::running_child_idx_
int running_child_idx_
Definition: manual_node.h:44
BT::ManualSelectorNode::previously_executed_idx_
int previously_executed_idx_
Definition: manual_node.h:45
BT::ManualSelectorNode::selectChild
uint8_t selectChild() const
Definition: manual_node.cpp:130
BT::ManualSelectorNode::NUM_SUCCESS
@ NUM_SUCCESS
Definition: manual_node.h:49
BT::PortsList
std::unordered_map< std::string, PortInfo > PortsList
Definition: basic_types.h:585
BT::ManualSelectorNode::~ManualSelectorNode
virtual ~ManualSelectorNode() override=default
control_node.h
BT::TreeNode::name
const std::string & name() const
Name of the instance, not the type.
Definition: tree_node.cpp:296
BT::ManualSelectorNode::NumericalStatus
NumericalStatus
Definition: manual_node.h:47
BT::ManualSelectorNode
Use a Terminal User Interface (ncurses) to select a certain child manually.
Definition: manual_node.h:22
BT::ManualSelectorNode::tick
virtual BT::NodeStatus tick() override
Method to be implemented by the user.
Definition: manual_node.cpp:38
BT::ManualSelectorNode::selectStatus
NodeStatus selectStatus() const
Definition: manual_node.cpp:84
BT::NodeConfig
Definition: tree_node.h:73
BT::ControlNode
Definition: control_node.h:21
BT::NodeStatus
NodeStatus
Definition: basic_types.h:33


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Jun 28 2024 02:20:07