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 {
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 MOVEIT_CLASS_FORWARD(PlanningContext);
00076 
00079 class PlanningContext
00080 {
00081 public:
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 
00119   virtual bool solve(MotionPlanResponse& res) = 0;
00120 
00123   virtual bool solve(MotionPlanDetailedResponse& res) = 0;
00124 
00127   virtual bool terminate() = 0;
00128 
00130   virtual void clear() = 0;
00131 
00132 protected:
00134   std::string name_;
00135 
00137   std::string group_;
00138 
00140   planning_scene::PlanningSceneConstPtr planning_scene_;
00141 
00143   MotionPlanRequest request_;
00144 };
00145 
00146 MOVEIT_CLASS_FORWARD(PlannerManager);
00147 
00149 class PlannerManager
00150 {
00151 public:
00152   PlannerManager()
00153   {
00154   }
00155 
00156   virtual ~PlannerManager()
00157   {
00158   }
00159 
00165   virtual bool initialize(const robot_model::RobotModelConstPtr& model, const std::string& ns);
00166 
00168   virtual std::string getDescription() const;
00169 
00172   virtual void getPlanningAlgorithms(std::vector<std::string>& algs) const;
00173 
00181   virtual PlanningContextPtr getPlanningContext(const planning_scene::PlanningSceneConstPtr& planning_scene,
00182                                                 const MotionPlanRequest& req,
00183                                                 moveit_msgs::MoveItErrorCodes& error_code) const = 0;
00184 
00186   PlanningContextPtr getPlanningContext(const planning_scene::PlanningSceneConstPtr& planning_scene,
00187                                         const MotionPlanRequest& req) const;
00188 
00190   virtual bool canServiceRequest(const MotionPlanRequest& req) const = 0;
00191 
00193   virtual void setPlannerConfigurations(const PlannerConfigurationMap& pcs);
00194 
00196   const PlannerConfigurationMap& getPlannerConfigurations() const
00197   {
00198     return config_settings_;
00199   }
00200 
00202   void terminate() const;
00203 
00204 protected:
00210   PlannerConfigurationMap config_settings_;
00211 };
00212 
00213 }  // planning_interface
00214 
00215 #endif


moveit_core
Author(s): Ioan Sucan , Sachin Chitta , Acorn Pooley
autogenerated on Mon Jul 24 2017 02:20:44