robot_model_loader.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 * Software License Agreement (BSD License)
00003 *
00004 *  Copyright (c) 2012, Willow Garage, Inc.
00005 *  All rights reserved.
00006 *
00007 *  Redistribution and use in source and binary forms, with or without
00008 *  modification, are permitted provided that the following conditions
00009 *  are met:
00010 *
00011 *   * Redistributions of source code must retain the above copyright
00012 *     notice, this list of conditions and the following disclaimer.
00013 *   * Redistributions in binary form must reproduce the above
00014 *     copyright notice, this list of conditions and the following
00015 *     disclaimer in the documentation and/or other materials provided
00016 *     with the distribution.
00017 *   * Neither the name of the Willow Garage nor the names of its
00018 *     contributors may be used to endorse or promote products derived
00019 *     from this software without specific prior written permission.
00020 *
00021 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031 *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032 *  POSSIBILITY OF SUCH DAMAGE.
00033 *********************************************************************/
00034 
00035 /* Author: Ioan Sucan */
00036 
00037 #ifndef MOVEIT_PLANNING_MODELS_LOADER_ROBOT_MODEL_LOADER_
00038 #define MOVEIT_PLANNING_MODELS_LOADER_ROBOT_MODEL_LOADER_
00039 
00040 #include <moveit/robot_model/robot_model.h>
00041 #include <moveit/rdf_loader/rdf_loader.h>
00042 #include <moveit/kinematics_plugin_loader/kinematics_plugin_loader.h>
00043 
00044 namespace robot_model_loader
00045 {
00046 
00048 class RobotModelLoader
00049 {
00050 public:
00051 
00053   struct Options
00054   {
00055     Options(const std::string &robot_description = "robot_description") :
00056       robot_description_(robot_description),
00057       urdf_doc_(NULL),
00058       srdf_doc_(NULL),
00059       load_kinematics_solvers_(true)
00060     {
00061     }
00062 
00063     Options(const std::string &urdf_string, const std::string &srdf_string) :
00064       urdf_string_(urdf_string),
00065       srdf_string_(srdf_string),
00066       urdf_doc_(NULL),
00067       srdf_doc_(NULL),
00068       load_kinematics_solvers_(true)
00069     {
00070     }
00071 
00072     Options(TiXmlDocument *urdf_doc, TiXmlDocument *srdf_doc) :
00073       urdf_doc_(urdf_doc),
00074       srdf_doc_(srdf_doc),
00075       load_kinematics_solvers_(true)
00076     {
00077     }
00078 
00081     std::string robot_description_;
00082 
00084     std::string urdf_string_, srdf_string_;
00085 
00087     TiXmlDocument *urdf_doc_, *srdf_doc_;
00088 
00090     bool load_kinematics_solvers_;
00091 
00092   };
00093 
00094 
00096   RobotModelLoader(const Options &opt = Options());
00097 
00098   RobotModelLoader(const std::string &robot_description, bool load_kinematics_solvers = true);
00099 
00100   ~RobotModelLoader();
00101 
00103   const robot_model::RobotModelPtr& getModel() const
00104   {
00105     return model_;
00106   }
00107 
00109   const std::string& getRobotDescription() const
00110   {
00111     return rdf_loader_->getRobotDescription();
00112   }
00113 
00115   const boost::shared_ptr<urdf::ModelInterface>& getURDF() const
00116   {
00117     return rdf_loader_->getURDF();
00118   }
00119 
00121   const boost::shared_ptr<srdf::Model>& getSRDF() const
00122   {
00123     return rdf_loader_->getSRDF();
00124   }
00125 
00127   const rdf_loader::RDFLoaderPtr& getRDFLoader() const
00128   {
00129     return rdf_loader_;
00130   }
00131 
00134   const kinematics_plugin_loader::KinematicsPluginLoaderPtr& getKinematicsPluginLoader() const
00135   {
00136     return kinematics_loader_;
00137   }
00138 
00140   std::map<std::string, kinematics::KinematicsBasePtr> generateKinematicsSolversMap() const;
00141 
00143   void loadKinematicsSolvers(const kinematics_plugin_loader::KinematicsPluginLoaderPtr &kloader = kinematics_plugin_loader::KinematicsPluginLoaderPtr());
00144 
00145 private:
00146 
00147   void configure(const Options &opt);
00148 
00149   robot_model::RobotModelPtr model_;
00150   rdf_loader::RDFLoaderPtr rdf_loader_;
00151   kinematics_plugin_loader::KinematicsPluginLoaderPtr kinematics_loader_;
00152 
00153 };
00154 
00155 typedef boost::shared_ptr<RobotModelLoader> RobotModelLoaderPtr;
00156 typedef boost::shared_ptr<const RobotModelLoader> RobotModelLoaderConstPtr;
00157 
00158 }
00159 #endif


planning
Author(s): Ioan Sucan , Sachin Chitta
autogenerated on Mon Oct 6 2014 02:31:40