Fawkes API  Fawkes Development Version
kdl_parser.h
1 /***************************************************************************
2  * kdl_parser.h - KDL Parser
3  *
4  * Created: Fri Feb 14 17:35:15 2014
5  * Copyright 2014 Till Hofmann
6  *
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 /* This code is based on ROS kdl_parser with the following copyright and license:
23  * Software License Agreement (BSD License)
24  *
25  * Copyright (c) 2008, Willow Garage, Inc.
26  * All rights reserved.
27  *
28  * Redistribution and use in source and binary forms, with or without
29  * modification, are permitted provided that the following conditions
30  * are met:
31  *
32  * * Redistributions of source code must retain the above copyright
33  * notice, this list of conditions and the following disclaimer.
34  * * Redistributions in binary form must reproduce the above
35  * copyright notice, this list of conditions and the following
36  * disclaimer in the documentation and/or other materials provided
37  * with the distribution.
38  * * Neither the name of the Willow Garage nor the names of its
39  * contributors may be used to endorse or promote products derived
40  * from this software without specific prior written permission.
41  *
42  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
45  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
46  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
47  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
48  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
52  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
53  * POSSIBILITY OF SUCH DAMAGE.
54  */
55 
56 #ifndef KDL_PARSER_H
57 #define KDL_PARSER_H
58 
59 #include <kdl/tree.hpp>
60 #include <string>
61 #include <urdf_model/model.h>
62 #include <tinyxml.h>
63 
64 namespace fawkes {
65 
66 namespace kdl_parser {
67 
68 #if 0 /* just to make Emacs auto-indent happy */
69  }
70 }
71 #endif
72 
73 /** Constructs a KDL tree from a file, given the file name
74  * @param file The filename from where to read the xml
75  * @param tree The resulting KDL Tree
76  * @return true on success, false on failure
77  */
78 bool tree_from_file(const std::string& file, KDL::Tree& tree);
79 
80 /** Constructs a KDL tree from the parameter server, given the parameter name
81  * @param param the name of the parameter on the parameter server
82  * @param tree The resulting KDL Tree
83  * @return true on success, false on failure
84  */
85 bool tree_from_param(const std::string& param, KDL::Tree& tree);
86 
87 /** Constructs a KDL tree from a string containing xml
88  * @param xml A string containting the xml description of the robot
89  * @param tree The resulting KDL Tree
90  * returns true on success, false on failure
91  */
92 bool tree_from_string(const std::string& xml, KDL::Tree& tree);
93 
94 /** Constructs a KDL tree from a TiXmlDocument
95  * @param xml_doc The TiXmlDocument containting the xml description of the robot
96  * @param tree The resulting KDL Tree
97  * @return true on success, false on failure
98  */
99 bool tree_from_xml(TiXmlDocument *xml_doc, KDL::Tree& tree);
100 
101 /** Constructs a KDL tree from a URDF robot model
102  * @param robot_model The URDF robot model
103  * @param tree The resulting KDL Tree
104  * @return true on success, false on failure
105  */
106 bool tree_from_urdf_model(const urdf::ModelInterface& robot_model, KDL::Tree& tree);
107 }
108 
109 }
110 
111 #endif
Fawkes library namespace.