parallel_node.h
Go to the documentation of this file.
1 /* Copyright (C) 2015-2018 Michele Colledanchise - All Rights Reserved
2  * Copyright (C) 2018 Davide Faconti - All Rights Reserved
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
6 * 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:
7 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 * 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,
11 * 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.
12 */
13 
14 #ifndef PARALLEL_NODE_H
15 #define PARALLEL_NODE_H
16 
18 
19 namespace BT
20 {
21 class ParallelNode : public ControlNode
22 {
23  public:
24 
25  ParallelNode(const std::string& name, int threshold);
26 
27  ParallelNode(const std::string& name, const NodeParameters& params);
28 
30  {
31  static NodeParameters params = {{THRESHOLD_KEY, "1"}};
32  return params;
33  }
34 
35  ~ParallelNode() = default;
36 
37  virtual void halt() override;
38 
39  unsigned int thresholdM();
40  void setThresholdM(unsigned int threshold_M);
41 
42  private:
43  unsigned int threshold_;
44  unsigned int success_childred_num_;
45  unsigned int failure_childred_num_;
46 
48  static constexpr const char* THRESHOLD_KEY = "threshold";
49 
50  virtual BT::NodeStatus tick() override;
51 };
52 }
53 #endif // PARALLEL_NODE_H
unsigned int thresholdM()
const std::string & name() const
Definition: tree_node.cpp:92
unsigned int success_childred_num_
Definition: parallel_node.h:44
std::unordered_map< std::string, std::string > NodeParameters
Definition: tree_node.h:33
ParallelNode(const std::string &name, int threshold)
static constexpr const char * THRESHOLD_KEY
Definition: parallel_node.h:48
void setThresholdM(unsigned int threshold_M)
virtual void halt() override
The method used to interrupt the execution of a RUNNING node.
bool read_parameter_from_blackboard_
Definition: parallel_node.h:47
unsigned int threshold_
Definition: parallel_node.h:43
static const NodeParameters & requiredNodeParameters()
Definition: parallel_node.h:29
virtual BT::NodeStatus tick() override
Method to be implemented by the user.
NodeStatus
Definition: basic_types.h:28
unsigned int failure_childred_num_
Definition: parallel_node.h:45
~ParallelNode()=default


behaviortree_cpp
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Sat Feb 2 2019 04:01:53