planning_request_adapter.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2012, 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 */
36 
37 #pragma once
38 
42 #include <boost/function.hpp>
43 
46 {
47 MOVEIT_CLASS_FORWARD(PlanningRequestAdapter); // Defines PlanningRequestAdapterPtr, ConstPtr, WeakPtr... etc
48 
50 {
51 public:
52  using PlannerFn =
53  boost::function<bool(const planning_scene::PlanningSceneConstPtr&, const planning_interface::MotionPlanRequest&,
55 
57  {
58  }
59 
60  virtual ~PlanningRequestAdapter()
61  {
62  }
63 
66  virtual void initialize(const ros::NodeHandle& node_handle) = 0;
67 
69  virtual std::string getDescription() const
70  {
71  return "";
72  }
73 
74  bool adaptAndPlan(const planning_interface::PlannerManagerPtr& planner,
75  const planning_scene::PlanningSceneConstPtr& planning_scene,
78 
79  bool adaptAndPlan(const planning_interface::PlannerManagerPtr& planner,
80  const planning_scene::PlanningSceneConstPtr& planning_scene,
82  std::vector<std::size_t>& added_path_index) const;
83 
89  virtual bool adaptAndPlan(const PlannerFn& planner, const planning_scene::PlanningSceneConstPtr& planning_scene,
92  std::vector<std::size_t>& added_path_index) const = 0;
93 };
94 
97 {
98 public:
100  {
101  }
102 
103  void addAdapter(const PlanningRequestAdapterConstPtr& adapter)
104  {
105  adapters_.push_back(adapter);
106  }
107 
108  bool adaptAndPlan(const planning_interface::PlannerManagerPtr& planner,
109  const planning_scene::PlanningSceneConstPtr& planning_scene,
112 
113  bool adaptAndPlan(const planning_interface::PlannerManagerPtr& planner,
114  const planning_scene::PlanningSceneConstPtr& planning_scene,
116  std::vector<std::size_t>& added_path_index) const;
117 
118 private:
119  std::vector<PlanningRequestAdapterConstPtr> adapters_;
120 };
121 } // namespace planning_request_adapter
planning_request_adapter::PlanningRequestAdapterChain::addAdapter
void addAdapter(const PlanningRequestAdapterConstPtr &adapter)
Definition: planning_request_adapter.h:135
planning_interface.h
planning_request_adapter::PlanningRequestAdapter::~PlanningRequestAdapter
virtual ~PlanningRequestAdapter()
Definition: planning_request_adapter.h:92
planning_request_adapter::PlanningRequestAdapter::getDescription
virtual std::string getDescription() const
Get a short string that identifies the planning request adapter.
Definition: planning_request_adapter.h:101
planning_request_adapter::PlanningRequestAdapterChain::adaptAndPlan
bool adaptAndPlan(const planning_interface::PlannerManagerPtr &planner, const planning_scene::PlanningSceneConstPtr &planning_scene, const planning_interface::MotionPlanRequest &req, planning_interface::MotionPlanResponse &res) const
Definition: planning_request_adapter.cpp:152
planning_interface::MotionPlanResponse
Definition: planning_response.h:78
planning_scene.h
class_forward.h
planning_request_adapter::PlanningRequestAdapterChain::PlanningRequestAdapterChain
PlanningRequestAdapterChain()
Definition: planning_request_adapter.h:131
planning_request_adapter::PlanningRequestAdapter
Definition: planning_request_adapter.h:81
planning_request_adapter::PlanningRequestAdapterChain
Apply a sequence of adapters to a motion plan.
Definition: planning_request_adapter.h:128
planning_request_adapter::PlanningRequestAdapter::adaptAndPlan
bool adaptAndPlan(const planning_interface::PlannerManagerPtr &planner, const planning_scene::PlanningSceneConstPtr &planning_scene, const planning_interface::MotionPlanRequest &req, planning_interface::MotionPlanResponse &res) const
Definition: planning_request_adapter.cpp:102
planning_request_adapter::MOVEIT_CLASS_FORWARD
MOVEIT_CLASS_FORWARD(PlanningRequestAdapter)
planning_interface::MotionPlanRequest
moveit_msgs::MotionPlanRequest MotionPlanRequest
Definition: planning_request.h:77
planning_request_adapter::PlanningRequestAdapter::initialize
virtual void initialize(const ros::NodeHandle &node_handle)=0
Initialize parameters using the passed NodeHandle if no initialization is needed, simply implement as...
planning_request_adapter::PlanningRequestAdapter::PlanningRequestAdapter
PlanningRequestAdapter()
Definition: planning_request_adapter.h:88
planning_request_adapter::PlanningRequestAdapterChain::adapters_
std::vector< PlanningRequestAdapterConstPtr > adapters_
Definition: planning_request_adapter.h:151
planning_request_adapter::PlanningRequestAdapter::PlannerFn
boost::function< bool(const planning_scene::PlanningSceneConstPtr &, const planning_interface::MotionPlanRequest &, planning_interface::MotionPlanResponse &)> PlannerFn
Definition: planning_request_adapter.h:86
planning_request_adapter
Generic interface to adapting motion planning requests.
Definition: planning_request_adapter.h:45
planning_scene
This namespace includes the central class for representing planning contexts.
Definition: planning_interface.h:45
ros::NodeHandle


moveit_core
Author(s): Ioan Sucan , Sachin Chitta , Acorn Pooley
autogenerated on Tue Nov 24 2020 03:26:40