VFRRT.h
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2015, Caleb Voss and Wilson Beebe
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 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 /* Authors: Caleb Voss, Wilson Beebe */
36 
37 #ifndef OMPL_GEOMETRIC_PLANNERS_RRT_VFRRT_
38 #define OMPL_GEOMETRIC_PLANNERS_RRT_VFRRT_
39 
40 #include <limits>
41 
42 #include <eigen3/Eigen/Core>
43 
44 #include <ompl/geometric/planners/rrt/RRT.h>
45 
46 namespace ompl
47 {
48  namespace geometric
49  {
64  class VFRRT : public RRT
65  {
66  public:
67  typedef std::function<Eigen::VectorXd(const base::State *state)> VectorField;
68 
70  VFRRT(const base::SpaceInformationPtr &si, const VectorField &vf, double exploration,
71  double initial_lambda, unsigned int update_freq);
72 
74  virtual ~VFRRT();
75 
77  virtual void clear();
78 
80  double determineMeanNorm();
81 
83  Eigen::VectorXd getNewDirection(const base::State *qnear, const base::State *qrand);
84 
86  double biasedSampling (const Eigen::VectorXd &vrand, const Eigen::VectorXd &vfield,
87  double lambdaScale);
88 
95  void updateGain ();
96 
102  Eigen::VectorXd computeAlphaBeta (double omega, const Eigen::VectorXd &vrand,
103  const Eigen::VectorXd &vfield);
104 
109  Motion *extendTree (Motion *m, base::State* rstate, const Eigen::VectorXd &v);
115 
118 
119  virtual void setup();
120 
121  private:
122 
124  const VectorField vf_;
125 
127  unsigned int efficientCount_;
128 
130  unsigned int inefficientCount_;
131 
133  double explorationInefficiency_;
134 
136  double explorationSetting_;
137 
139  double lambda_;
140 
142  unsigned int nth_step_;
143 
145  unsigned int step_;
146 
148  double meanNorm_;
149 
151  unsigned int vfdim_;
152  };
153  }
154 }
155 #endif
Eigen::VectorXd computeAlphaBeta(double omega, const Eigen::VectorXd &vrand, const Eigen::VectorXd &vfield)
Definition: VFRRT.cpp:138
virtual ~VFRRT()
Definition: VFRRT.cpp:59
double biasedSampling(const Eigen::VectorXd &vrand, const Eigen::VectorXd &vfield, double lambdaScale)
Definition: VFRRT.cpp:114
Encapsulate a termination condition for a motion planner. Planners will call operator() to decide whe...
virtual base::PlannerStatus solve(const base::PlannerTerminationCondition &ptc)
Definition: VFRRT.cpp:192
double determineMeanNorm()
Definition: VFRRT.cpp:78
Motion * extendTree(Motion *m, base::State *rstate, const Eigen::VectorXd &v)
Definition: VFRRT.cpp:152
void updateExplorationEfficiency(Motion *m)
Definition: VFRRT.cpp:182
Main namespace. Contains everything in this library.
Definition: Cost.h:42
A class to store the exit status of Planner::solve()
Definition: PlannerStatus.h:48
Rapidly-exploring Random Trees.
Definition: RRT.h:65
A shared pointer wrapper for ompl::base::SpaceInformation.
Definition of an abstract state.
Definition: State.h:50
Eigen::VectorXd getNewDirection(const base::State *qnear, const base::State *qrand)
Definition: VFRRT.cpp:91
VFRRT(const base::SpaceInformationPtr &si, const VectorField &vf, double exploration, double initial_lambda, unsigned int update_freq)
Definition: VFRRT.cpp:49
Representation of a motion.
Definition: RRT.h:132
virtual void setup()
Perform extra configuration steps, if needed. This call will also issue a call to ompl::base::SpaceIn...
Definition: VFRRT.cpp:72
virtual void clear()
Definition: VFRRT.cpp:63