OMPL
Overview
Download
Documentation
Primer
Installation
Tutorials
Demos
Python Bindings
Available Planners
Available State Spaces
FAQ
External links:
OMPL ROS Interface
OMPL ROS Tutorial
Code
API Overview
Classes
Files
Browse Repository
TeamCity Build Server
Issues
Community
Developers
Contributions
Education
Gallery
About
License
Citations
Acknowledgments
Contact Us
Blog
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
src
ompl
geometric
planners
rrt
LazyRRT.h
1
2
/*********************************************************************
3
* Software License Agreement (BSD License)
4
*
5
* Copyright (c) 2008, Willow Garage, Inc.
6
* All rights reserved.
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions
10
* are met:
11
*
12
* * Redistributions of source code must retain the above copyright
13
* notice, this list of conditions and the following disclaimer.
14
* * Redistributions in binary form must reproduce the above
15
* copyright notice, this list of conditions and the following
16
* disclaimer in the documentation and/or other materials provided
17
* with the distribution.
18
* * Neither the name of the Willow Garage nor the names of its
19
* contributors may be used to endorse or promote products derived
20
* from this software without specific prior written permission.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
* POSSIBILITY OF SUCH DAMAGE.
34
*********************************************************************/
35
36
/* Author: Ioan Sucan */
37
38
#ifndef OMPL_GEOMETRIC_PLANNERS_RRT_LAZY_RRT_
39
#define OMPL_GEOMETRIC_PLANNERS_RRT_LAZY_RRT_
40
41
#include "ompl/geometric/planners/PlannerIncludes.h"
42
#include "ompl/datastructures/NearestNeighbors.h"
43
#include <vector>
44
45
namespace
ompl
46
{
47
48
namespace
geometric
49
{
50
78
class
LazyRRT
:
public
base::Planner
79
{
80
public
:
81
83
LazyRRT
(
const
base::SpaceInformationPtr
&si);
84
85
virtual
~
LazyRRT
(
void
);
86
87
virtual
void
getPlannerData
(
base::PlannerData
&data)
const
;
88
89
virtual
base::PlannerStatus
solve
(
const
base::PlannerTerminationCondition
&ptc);
90
91
virtual
void
clear
(
void
);
92
102
void
setGoalBias
(
double
goalBias)
103
{
104
goalBias_
= goalBias;
105
}
106
108
double
getGoalBias
(
void
)
const
109
{
110
return
goalBias_
;
111
}
112
118
void
setRange
(
double
distance)
119
{
120
maxDistance_
= distance;
121
}
122
124
double
getRange
(
void
)
const
125
{
126
return
maxDistance_
;
127
}
128
130
template
<
template
<
typename
T>
class
NN>
131
void
setNearestNeighbors
(
void
)
132
{
133
nn_
.reset(
new
NN<Motion*>());
134
}
135
136
virtual
void
setup
(
void
);
137
138
protected
:
139
141
class
Motion
142
{
143
public
:
144
145
Motion
(
void
) :
state
(NULL),
parent
(NULL),
valid
(
false
)
146
{
147
}
148
150
Motion
(
const
base::SpaceInformationPtr
&si) :
state
(si->allocState()),
parent
(NULL),
valid
(false)
151
{
152
}
153
154
~
Motion
(
void
)
155
{
156
}
157
159
base::State
*
state
;
160
162
Motion
*
parent
;
163
165
bool
valid
;
166
168
std::vector<Motion*>
children
;
169
};
170
172
void
freeMemory
(
void
);
173
175
void
removeMotion
(
Motion
*motion);
176
178
double
distanceFunction
(
const
Motion
* a,
const
Motion
* b)
const
179
{
180
return
si_
->distance(a->
state
, b->
state
);
181
}
182
184
base::StateSamplerPtr
sampler_
;
185
187
boost::shared_ptr< NearestNeighbors<Motion*> >
nn_
;
188
190
double
goalBias_
;
191
193
double
maxDistance_
;
194
196
RNG
rng_
;
197
199
Motion
*
lastGoalMotion_
;
200
201
};
202
203
}
204
}
205
206
#endif