dot_bt.h
Go to the documentation of this file.
00001 /* Copyright (C) 2017 Iason Sarantopoulos - All Rights Reserved
00002  *
00003  * Permission is hereby granted, free of charge, to any person obtaining a
00004  * copy of this software and associated documentation files (the "Software"),
00005  * to deal in the Software without restriction, including without limitation
00006  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00007  * and/or sell copies of the Software, and to permit persons to whom the
00008  * Software is furnished to do so, subject to the following conditions: The
00009  * above copyright notice and this permission notice shall be included in all
00010  * copies or substantial portions of the Software.
00011  *
00012  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00013  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00014  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00015  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00016  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00017  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00018  * DEALINGS IN THE SOFTWARE.
00019  */
00020 
00021 #ifndef DOT_BT_H
00022 #define DOT_BT_H
00023 
00024 #include <string>
00025 #include <ros/ros.h>
00026 #include <tree_node.h>
00027 #include <boost/algorithm/string.hpp>
00028 #include <vector>
00029 
00030 namespace BT
00031 {
00063 class DotBt
00064 {
00065 public:
00079   explicit DotBt(TreeNode* root,
00080                  const std::string& topic = "/bt_dotcode",
00081                  double ros_rate = 50,
00082                  bool left_right = false,
00083                  bool multiple_parents = false);
00084 
00088   ~DotBt();
00089 
00095   std::string getDotFile();
00096 
00104   void publish();
00105 private:
00122   void produceDot(TreeNode* node, TreeNode* parent = NULL, const std::string& parent_alias = "");
00123 
00137   std::string defineNodeDot(TreeNode* node, const std::string& alias);
00138 
00148   std::string getAlias(const std::string &name);
00149 
00153   std::string dot_file_;
00154 
00158   ros::NodeHandle n_;
00159 
00163   ros::Publisher dotbt_publisher_;
00164   
00168   TreeNode* root_;
00169 
00173   std::string topic_;
00174 
00178   ros::Rate loop_rate_;
00179 
00184   std::vector<std::string> aliases_;
00185 
00189   bool left_right_;
00190 
00195   bool multiple_parents_;
00196 
00197   int multiple_alias_solver_;
00198 };
00199 }  // namespace BT
00200 
00201 #endif  // DOT_BT_H


behavior_tree_core
Author(s): Michele Colledanchise
autogenerated on Sun Sep 10 2017 02:31:49