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 NodeConfiguration& 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 the "
35  "last "
36  "time")};
37  }
38 
39 private:
40  static constexpr const char* REPEAT_LAST_SELECTION = "repeat_last_selection";
41 
42  virtual BT::NodeStatus tick() override;
45 
47  {
48  NUM_SUCCESS = 253,
49  NUM_FAILURE = 254,
50  NUM_RUNNING = 255,
51  };
52 
53  NodeStatus selectStatus() const;
54 
55  uint8_t selectChild() const;
56 };
57 
58 } // namespace BT
BT::ManualSelectorNode::providedPorts
static PortsList providedPorts()
Definition: manual_node.h:31
BT
Definition: ex01_wrap_legacy.cpp:29
BT::ManualSelectorNode::halt
virtual void halt() override
Definition: manual_node.cpp:29
BT::ManualSelectorNode::REPEAT_LAST_SELECTION
static constexpr const char * REPEAT_LAST_SELECTION
Definition: manual_node.h:40
BT::ManualSelectorNode::NUM_SUCCESS
@ NUM_SUCCESS
Definition: manual_node.h:48
BT::PortsList
std::unordered_map< std::string, PortInfo > PortsList
Definition: basic_types.h:342
BT::TreeNode::config
const NodeConfiguration & config() const
Definition: tree_node.cpp:127
BT::ManualSelectorNode::running_child_idx_
int running_child_idx_
Definition: manual_node.h:43
BT::NodeConfiguration
Definition: tree_node.h:44
BT::ManualSelectorNode::previously_executed_idx_
int previously_executed_idx_
Definition: manual_node.h:44
BT::ManualSelectorNode::selectChild
uint8_t selectChild() const
Definition: manual_node.cpp:131
BT::ManualSelectorNode::NUM_FAILURE
@ NUM_FAILURE
Definition: manual_node.h:49
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:101
BT::ManualSelectorNode::ManualSelectorNode
ManualSelectorNode(const std::string &name, const NodeConfiguration &config)
Definition: manual_node.cpp:20
BT::ManualSelectorNode
Use a Terminal User Interface (ncurses) to select a certain child manually.
Definition: manual_node.h:22
BT::ManualSelectorNode::NumericarStatus
NumericarStatus
Definition: manual_node.h:46
BT::ManualSelectorNode::tick
virtual BT::NodeStatus tick() override
Method to be implemented by the user.
Definition: manual_node.cpp:39
BT::ManualSelectorNode::selectStatus
NodeStatus selectStatus() const
Definition: manual_node.cpp:85
BT::ManualSelectorNode::NUM_RUNNING
@ NUM_RUNNING
Definition: manual_node.h:50
BT::ControlNode
Definition: control_node.h:21
BT::NodeStatus
NodeStatus
Definition: basic_types.h:35


behaviortree_cpp_v3
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Wed Jun 26 2024 02:51:19