AnytimePathShortening.h
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2014, Rice University
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 the Rice University 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: Ryan Luna */
36 
37 #ifndef OMPL_GEOMETRIC_PLANNERS_ANYTIMEOPTIMIZATION_ANYTIMEPATHSHORTENING_
38 #define OMPL_GEOMETRIC_PLANNERS_ANYTIMEOPTIMIZATION_ANYTIMEPATHSHORTENING_
39 
40 #include "ompl/base/Planner.h"
41 #include <vector>
42 
43 namespace ompl
44 {
45  namespace geometric
46  {
66  {
67  public:
70 
72  virtual ~AnytimePathShortening(void);
73 
76  void addPlanner(base::PlannerPtr &planner);
77 
82  virtual void setProblemDefinition(const base::ProblemDefinitionPtr &pdef);
83 
91 
95  virtual void clear(void);
96 
100  virtual void getPlannerData(base::PlannerData &data) const;
101 
103  virtual void getPlannerData(ompl::base::PlannerData &data, unsigned int idx) const;
104 
108  virtual void setup(void);
109 
114  virtual void checkValidity(void);
115 
117  unsigned int getNumPlanners(void) const;
118 
120  base::PlannerPtr getPlanner(unsigned int i) const;
121 
123  bool isShortcutting(void) const;
124 
126  void setShortcut(bool shortcut);
127 
129  bool isHybridizing(void) const;
130 
132  void setHybridize(bool hybridize);
133 
135  unsigned int maxHybridizationPaths(void) const;
136 
138  void setMaxHybridizationPath(unsigned int maxPathCount);
139 
141  void setDefaultNumPlanners(unsigned int numPlanners);
142 
144  unsigned int getDefaultNumPlanners() const;
145 
147  std::string getBestCost() const;
148 
149  protected:
152  virtual void threadSolve(base::Planner *planner, const base::PlannerTerminationCondition &ptc);
153 
155  std::vector<base::PlannerPtr> planners_;
156 
158  bool shortcut_;
159 
162 
165  unsigned int maxHybridPaths_;
166 
169  unsigned int defaultNumPlanners_;
170  };
171  }
172 }
173 #endif
Object containing planner generated vertex and edge data. It is assumed that all vertices are unique...
Definition: PlannerData.h:164
std::string getBestCost() const
Return best cost found so far by algorithm.
bool isShortcutting(void) const
Return whether the anytime planner will perform shortcutting on paths.
A boost shared pointer wrapper for ompl::base::ProblemDefinition.
virtual void getPlannerData(base::PlannerData &data) const
Get information about the most recent run of the motion planner.
virtual base::PlannerStatus solve(const base::PlannerTerminationCondition &ptc)
Method that solves the motion planning problem. This method terminates under just two conditions...
bool isHybridizing(void) const
Return whether the anytime planner will extract a hybrid path from the set of solution paths...
void setMaxHybridizationPath(unsigned int maxPathCount)
Set the maximum number of paths that will be hybridized.
Encapsulate a termination condition for a motion planner. Planners will call operator() to decide whe...
AnytimePathShortening(const base::SpaceInformationPtr &si)
Constructor requires the space information to plan in.
void setHybridize(bool hybridize)
Enable/disable path hybridization on the set of solution paths.
void setDefaultNumPlanners(unsigned int numPlanners)
Set default number of planners to use if none are specified.
virtual void setProblemDefinition(const base::ProblemDefinitionPtr &pdef)
Set the problem definition for the planners. The problem needs to be set before calling solve()...
Main namespace. Contains everything in this library.
Definition: Cost.h:42
unsigned int maxHybridPaths_
The maximum number of paths that will be hybridized. This prohibits hybridization of a very large pat...
A boost shared pointer wrapper for ompl::base::Planner.
virtual void clear(void)
Clear all internal planning datastructures. Planner settings are not affected. Subsequent calls to so...
Base class for a planner.
Definition: Planner.h:232
bool hybridize_
Flag indicating whether to hybridize the set of solution paths.
virtual void threadSolve(base::Planner *planner, const base::PlannerTerminationCondition &ptc)
The function that the planning threads execute when solving a motion planning problem.
void setShortcut(bool shortcut)
Enable/disable shortcutting on paths.
virtual void setup(void)
Perform any necessary configuration steps. This method also invokes ompl::base::SpaceInformation::set...
A class to store the exit status of Planner::solve()
Definition: PlannerStatus.h:48
unsigned int maxHybridizationPaths(void) const
Return the maximum number of paths that will be hybridized.
A boost shared pointer wrapper for ompl::base::SpaceInformation.
virtual void checkValidity(void)
Check to see if the planners are in a working state (setup has been called, a goal was set...
unsigned int defaultNumPlanners_
The number of planners to use if none are specified. This defaults to the number of cores...
unsigned int getNumPlanners(void) const
Retrieve the number of planners added.
void addPlanner(base::PlannerPtr &planner)
Adds the given planner to the set of planners used to compute candidate paths.
virtual ~AnytimePathShortening(void)
Destructor.
std::vector< base::PlannerPtr > planners_
The list of planners used for solving the problem.
base::PlannerPtr getPlanner(unsigned int i) const
Retrieve a pointer to the ith planner instance.
unsigned int getDefaultNumPlanners() const
Get default number of planners used if none are specified.
bool shortcut_
Flag indicating whether to shortcut paths.