planning_interface.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 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_INTERFACE_PLANNING_INTERFACE_
00038 #define MOVEIT_PLANNING_INTERFACE_PLANNING_INTERFACE_
00039 
00040 #include <moveit/macros/class_forward.h>
00041 #include <moveit/planning_interface/planning_request.h>
00042 #include <moveit/planning_interface/planning_response.h>
00043 #include <string>
00044 #include <map>
00045 
00046 namespace planning_scene
00047 {
00048 MOVEIT_CLASS_FORWARD(PlanningScene);
00049 }
00050 
00052 namespace planning_interface
00053 {
00054 
00059 struct PlannerConfigurationSettings
00060 {
00062   std::string                        group;
00063 
00064   /* \brief Name of the configuration. If there is only one configuration, this should be the same as the group name.
00065      If there are multiple configurations, the form "group_name[config_name]" is expected for the name. */
00066   std::string                        name;
00067 
00069   std::map<std::string, std::string> config;
00070 };
00071 
00073 typedef std::map<std::string, PlannerConfigurationSettings> PlannerConfigurationMap;
00074 
00075 
00078 class PlanningContext
00079 {
00080 public:
00081 
00083   PlanningContext(const std::string &name, const std::string &group);
00084 
00085   virtual ~PlanningContext();
00086 
00088   const std::string& getGroupName() const
00089   {
00090     return group_;
00091   }
00092 
00094   const std::string& getName() const
00095   {
00096     return name_;
00097   }
00098 
00100   const planning_scene::PlanningSceneConstPtr& getPlanningScene() const
00101   {
00102     return planning_scene_;
00103   }
00104 
00106   const MotionPlanRequest& getMotionPlanRequest() const
00107   {
00108     return request_;
00109   }
00110 
00112   void setPlanningScene(const planning_scene::PlanningSceneConstPtr &planning_scene);
00113 
00115   void setMotionPlanRequest(const MotionPlanRequest &request);
00116 
00118   virtual bool solve(MotionPlanResponse &res) = 0;
00119 
00121   virtual bool solve(MotionPlanDetailedResponse &res) = 0;
00122 
00124   virtual bool terminate() = 0;
00125 
00127   virtual void clear() = 0;
00128 
00129 protected:
00130 
00132   std::string name_;
00133 
00135   std::string group_;
00136 
00138   planning_scene::PlanningSceneConstPtr planning_scene_;
00139 
00141   MotionPlanRequest request_;
00142 };
00143 
00144 MOVEIT_CLASS_FORWARD(PlanningContext);
00145 
00147 class PlannerManager
00148 {
00149 public:
00150 
00151   PlannerManager()
00152   {
00153   }
00154 
00155   virtual ~PlannerManager()
00156   {
00157   }
00158 
00162   virtual bool initialize(const robot_model::RobotModelConstPtr& model, const std::string &ns);
00163 
00165   virtual std::string getDescription() const;
00166 
00168   virtual void getPlanningAlgorithms(std::vector<std::string> &algs) const;
00169 
00175   virtual PlanningContextPtr getPlanningContext(const planning_scene::PlanningSceneConstPtr& planning_scene,
00176                                                 const MotionPlanRequest &req,
00177                                                 moveit_msgs::MoveItErrorCodes &error_code) const = 0;
00178 
00180   PlanningContextPtr getPlanningContext(const planning_scene::PlanningSceneConstPtr& planning_scene,
00181                                         const MotionPlanRequest &req) const;
00182 
00184   virtual bool canServiceRequest(const MotionPlanRequest &req)  const = 0;
00185 
00187   virtual void setPlannerConfigurations(const PlannerConfigurationMap &pcs);
00188 
00190   const PlannerConfigurationMap& getPlannerConfigurations() const
00191   {
00192     return config_settings_;
00193   }
00194 
00196   void terminate() const;
00197 
00198 protected:
00199 
00205   PlannerConfigurationMap config_settings_;
00206 };
00207 
00208 MOVEIT_CLASS_FORWARD(PlannerManager);
00209 
00210 } // planning_interface
00211 
00212 #endif


moveit_core
Author(s): Ioan Sucan , Sachin Chitta , Acorn Pooley
autogenerated on Thu Aug 27 2015 13:58:52