rdf_loader.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Ioan Sucan, Mathias Lüdtke, Dave Coleman */
36 
37 #pragma once
38 
40 #include <urdf/model.h>
41 #include <srdfdom/model.h>
42 
43 namespace rdf_loader
44 {
45 MOVEIT_CLASS_FORWARD(RDFLoader); // Defines RDFLoaderPtr, ConstPtr, WeakPtr... etc
46 
48 class RDFLoader
49 {
50 public:
54  RDFLoader(const std::string& robot_description = "robot_description");
55 
57  RDFLoader(const std::string& urdf_string, const std::string& srdf_string);
58 
60  const std::string& getRobotDescription() const
61  {
62  return robot_description_;
63  }
64 
66  const urdf::ModelInterfaceSharedPtr& getURDF() const
67  {
68  return urdf_;
69  }
70 
72  const srdf::ModelSharedPtr& getSRDF() const
73  {
74  return srdf_;
75  }
76 
78  static bool isXacroFile(const std::string& path);
79 
81  static bool loadFileToString(std::string& buffer, const std::string& path);
82 
84  static bool loadXacroFileToString(std::string& buffer, const std::string& path,
85  const std::vector<std::string>& xacro_args);
86 
89  static bool loadXmlFileToString(std::string& buffer, const std::string& path,
90  const std::vector<std::string>& xacro_args);
91 
93  static bool loadPkgFileToString(std::string& buffer, const std::string& package_name,
94  const std::string& relative_path, const std::vector<std::string>& xacro_args);
95 
96 private:
97  std::string robot_description_;
99  urdf::ModelInterfaceSharedPtr urdf_;
100 };
101 } // namespace rdf_loader
rdf_loader::RDFLoader::loadFileToString
static bool loadFileToString(std::string &buffer, const std::string &path)
load file from given path into buffer
Definition: rdf_loader.cpp:131
rdf_loader::RDFLoader::loadPkgFileToString
static bool loadPkgFileToString(std::string &buffer, const std::string &package_name, const std::string &relative_path, const std::vector< std::string > &xacro_args)
helper that generates a file path based on package name and relative file path to package
Definition: rdf_loader.cpp:212
rdf_loader::RDFLoader::srdf_
srdf::ModelSharedPtr srdf_
Definition: rdf_loader.h:130
rdf_loader::RDFLoader::loadXacroFileToString
static bool loadXacroFileToString(std::string &buffer, const std::string &path, const std::vector< std::string > &xacro_args)
run xacro with the given args on the file, return result in buffer
Definition: rdf_loader.cpp:162
srdf::ModelSharedPtr
std::shared_ptr< Model > ModelSharedPtr
rdf_loader::RDFLoader::getSRDF
const srdf::ModelSharedPtr & getSRDF() const
Get the parsed SRDF model.
Definition: rdf_loader.h:104
rdf_loader::RDFLoader::urdf_
urdf::ModelInterfaceSharedPtr urdf_
Definition: rdf_loader.h:131
model.h
rdf_loader::MOVEIT_CLASS_FORWARD
MOVEIT_CLASS_FORWARD(RDFLoader)
rdf_loader::RDFLoader
Definition: rdf_loader.h:80
rdf_loader::RDFLoader::isXacroFile
static bool isXacroFile(const std::string &path)
determine if given path points to a xacro file
Definition: rdf_loader.cpp:123
rdf_loader
Definition: rdf_loader.h:43
rdf_loader::RDFLoader::getRobotDescription
const std::string & getRobotDescription() const
Get the resolved parameter name for the robot description.
Definition: rdf_loader.h:92
rdf_loader::RDFLoader::getURDF
const urdf::ModelInterfaceSharedPtr & getURDF() const
Get the parsed URDF model.
Definition: rdf_loader.h:98
class_forward.h
rdf_loader::RDFLoader::loadXmlFileToString
static bool loadXmlFileToString(std::string &buffer, const std::string &path, const std::vector< std::string > &xacro_args)
helper that branches between loadFileToString() and loadXacroFileToString() based on result of isXacr...
Definition: rdf_loader.cpp:201
rdf_loader::RDFLoader::RDFLoader
RDFLoader(const std::string &robot_description="robot_description")
Default constructor.
Definition: rdf_loader.cpp:58
rdf_loader::RDFLoader::robot_description_
std::string robot_description_
Definition: rdf_loader.h:129


planning
Author(s): Ioan Sucan , Sachin Chitta
autogenerated on Thu Nov 21 2024 03:24:18