parallel_node.h
Go to the documentation of this file.
1 /* Copyright (C) 2015-2018 Michele Colledanchise - All Rights Reserved
2  * Copyright (C) 2018-2019 Davide Faconti, Eurecat - 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 
17 #include <set>
19 
20 namespace BT
21 {
22 
23 class ParallelNode : public ControlNode
24 {
25  public:
26 
27  ParallelNode(const std::string& name, unsigned threshold);
28 
29  ParallelNode(const std::string& name, const NodeConfiguration& config);
30 
32  {
33  return { InputPort<unsigned>(THRESHOLD_KEY) };
34  }
35 
36  ~ParallelNode() = default;
37 
38  virtual void halt() override;
39 
40  unsigned int thresholdM();
41  void setThresholdM(unsigned int threshold_M);
42 
43  private:
44  unsigned int threshold_;
45 
46  std::set<int> skip_list_;
47 
49  static constexpr const char* THRESHOLD_KEY = "threshold";
50 
51  virtual BT::NodeStatus tick() override;
52 };
53 
54 }
55 #endif // PARALLEL_NODE_H
unsigned int thresholdM()
const std::string & name() const
Name of the instance, not the type.
Definition: tree_node.cpp:73
const NodeConfiguration & config() const
Definition: tree_node.cpp:99
std::set< int > skip_list_
Definition: parallel_node.h:46
static constexpr const char * THRESHOLD_KEY
Definition: parallel_node.h:49
bool read_parameter_from_ports_
Definition: parallel_node.h:48
void setThresholdM(unsigned int threshold_M)
virtual void halt() override
std::unordered_map< std::string, PortInfo > PortsList
Definition: basic_types.h:316
unsigned int threshold_
Definition: parallel_node.h:44
ParallelNode(const std::string &name, unsigned threshold)
virtual BT::NodeStatus tick() override
Method to be implemented by the user.
NodeStatus
Definition: basic_types.h:35
~ParallelNode()=default
static PortsList providedPorts()
Definition: parallel_node.h:31


behaviortree_cpp
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Sat Jun 8 2019 18:04:05