Robotics Library  0.6.2
WorkspaceSphereExplorer.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2009, Markus Rickert
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 // POSSIBILITY OF SUCH DAMAGE.
25 //
26 
27 #ifndef _RL_PLAN_WORKSPACESPHEREEXPLORER_H_
28 #define _RL_PLAN_WORKSPACESPHEREEXPLORER_H_
29 
30 #include <list>
31 #include <set>
32 #include <boost/graph/adjacency_list.hpp>
33 #include <boost/random/mersenne_twister.hpp>
34 #include <boost/random/uniform_on_sphere.hpp>
35 #include <boost/random/variate_generator.hpp>
36 #include <rl/math/Vector.h>
37 
38 #include "WorkspaceSphere.h"
39 #include "WorkspaceSphereList.h"
40 
41 namespace rl
42 {
43  namespace plan
44  {
45  class DistanceModel;
46  class Viewer;
47 
49  {
50  public:
51  enum Greedy
52  {
56  };
57 
59 
60  virtual ~WorkspaceSphereExplorer();
61 
62  bool explore();
63 
64  void getPath(WorkspaceSphereList& path) const;
65 
66  bool isCovered(const ::rl::math::Vector3& point) const;
67 
68  void reset();
69 
70  void seed(const ::boost::mt19937::result_type& value);
71 
73 
75 
77 
79 
81 
82  ::std::size_t samples;
83 
85 
87 
88  protected:
89  struct VertexBundle
90  {
92  };
93 
94  typedef ::boost::adjacency_list<
95  ::boost::listS,
96  ::boost::listS,
97  ::boost::bidirectionalS,
99  > Graph;
100 
101  typedef ::boost::graph_traits< Graph >::edge_descriptor Edge;
102 
103  typedef ::boost::graph_traits< Graph >::edge_iterator EdgeIterator;
104 
105  typedef ::std::pair< EdgeIterator, EdgeIterator > EdgeIteratorPair;
106 
107  typedef ::boost::graph_traits< Graph >::vertex_descriptor Vertex;
108 
109  typedef ::boost::graph_traits< Graph >::vertex_iterator VertexIterator;
110 
111  typedef ::std::pair< VertexIterator, VertexIterator > VertexIteratorPair;
112 
113  Edge addEdge(const Vertex& u, const Vertex& v);
114 
115  Vertex addVertex(const WorkspaceSphere& sphere);
116 
117  bool isCovered(const Vertex& parent, const ::rl::math::Vector3& point) const;
118 
120 
122 
124 
125  ::std::multiset< WorkspaceSphere > queue;
126 
127  ::boost::variate_generator< ::boost::mt19937, ::boost::uniform_on_sphere< ::rl::math::Real > > rand;
128 
129  private:
130 
131  };
132  }
133 }
134 
135 #endif // _RL_PLAN_WORKSPACESPHEREEXPLORER_H_
rl::plan::WorkspaceSphereExplorer::goal
::rl::math::Vector3 * goal
Definition: WorkspaceSphereExplorer.h:72
rl::plan::WorkspaceSphereExplorer::rand
::boost::variate_generator< ::boost::mt19937, ::boost::uniform_on_sphere< ::rl::math::Real > > rand
Definition: WorkspaceSphereExplorer.h:127
rl::plan::WorkspaceSphereExplorer::graph
Graph graph
Definition: WorkspaceSphereExplorer.h:123
rl::plan::WorkspaceSphereExplorer::Edge
::boost::graph_traits< Graph >::edge_descriptor Edge
Definition: WorkspaceSphereExplorer.h:101
rl::plan::WorkspaceSphereExplorer::~WorkspaceSphereExplorer
virtual ~WorkspaceSphereExplorer()
Definition: WorkspaceSphereExplorer.cpp:60
rl::plan::WorkspaceSphereExplorer::WorkspaceSphereExplorer
WorkspaceSphereExplorer()
Definition: WorkspaceSphereExplorer.cpp:40
WorkspaceSphereList.h
rl::math::Vector3
::Eigen::Matrix< Real, 3, 1 > Vector3
Definition: Vector.h:45
rl::plan::WorkspaceSphereExplorer::Greedy
Greedy
Definition: WorkspaceSphereExplorer.h:52
rl::plan::WorkspaceSphereExplorer::explore
bool explore()
Definition: WorkspaceSphereExplorer.cpp:95
rl::plan::WorkspaceSphereExplorer::GREEDY_SOURCE_DISTANCE
@ GREEDY_SOURCE_DISTANCE
Definition: WorkspaceSphereExplorer.h:54
rl::plan::WorkspaceSphereExplorer::VertexBundle::sphere
WorkspaceSphere sphere
Definition: WorkspaceSphereExplorer.h:91
rl::plan::WorkspaceSphereExplorer::GREEDY_SPACE
@ GREEDY_SPACE
Definition: WorkspaceSphereExplorer.h:55
rl::plan::WorkspaceSphereExplorer::isCovered
bool isCovered(const ::rl::math::Vector3 &point) const
Definition: WorkspaceSphereExplorer.cpp:247
rl::plan::WorkspaceSphereExplorer::VertexBundle
Definition: WorkspaceSphereExplorer.h:90
rl::plan::WorkspaceSphereExplorer::EdgeIteratorPair
::std::pair< EdgeIterator, EdgeIterator > EdgeIteratorPair
Definition: WorkspaceSphereExplorer.h:105
rl::plan::WorkspaceSphereExplorer::begin
Vertex begin
Definition: WorkspaceSphereExplorer.h:119
Vector.h
rl::plan::WorkspaceSphereExplorer::getPath
void getPath(WorkspaceSphereList &path) const
Definition: WorkspaceSphereExplorer.cpp:216
rl::plan::WorkspaceSphereList
::std::list< WorkspaceSphere > WorkspaceSphereList
Definition: WorkspaceSphereList.h:38
rl::plan::WorkspaceSphereExplorer::queue
::std::multiset< WorkspaceSphere > queue
Definition: WorkspaceSphereExplorer.h:125
rl::plan::WorkspaceSphereExplorer::start
::rl::math::Vector3 * start
Definition: WorkspaceSphereExplorer.h:84
rl::plan::WorkspaceSphere
Definition: WorkspaceSphere.h:39
rl::plan::WorkspaceSphereExplorer::EdgeIterator
::boost::graph_traits< Graph >::edge_iterator EdgeIterator
Definition: WorkspaceSphereExplorer.h:103
rl::plan::WorkspaceSphereExplorer::addVertex
Vertex addVertex(const WorkspaceSphere &sphere)
Definition: WorkspaceSphereExplorer.cpp:78
rl::plan::WorkspaceSphereExplorer::radius
::rl::math::Real radius
Definition: WorkspaceSphereExplorer.h:78
rl::plan::WorkspaceSphereExplorer::model
DistanceModel * model
Definition: WorkspaceSphereExplorer.h:76
rl::plan::DistanceModel
Definition: DistanceModel.h:41
rl::plan::WorkspaceSphereExplorer::GREEDY_DISTANCE
@ GREEDY_DISTANCE
Definition: WorkspaceSphereExplorer.h:53
WorkspaceSphere.h
rl::plan::WorkspaceSphereExplorer::reset
void reset()
Definition: WorkspaceSphereExplorer.cpp:278
rl::plan::WorkspaceSphereExplorer::VertexIteratorPair
::std::pair< VertexIterator, VertexIterator > VertexIteratorPair
Definition: WorkspaceSphereExplorer.h:111
rl::plan::WorkspaceSphereExplorer::range
::rl::math::Real range
Definition: WorkspaceSphereExplorer.h:80
rl::plan::WorkspaceSphereExplorer::samples
::std::size_t samples
Definition: WorkspaceSphereExplorer.h:82
rl::plan::WorkspaceSphereExplorer::end
Vertex end
Definition: WorkspaceSphereExplorer.h:121
rl::plan::WorkspaceSphereExplorer::seed
void seed(const ::boost::mt19937::result_type &value)
Definition: WorkspaceSphereExplorer.cpp:287
rl::plan::WorkspaceSphereExplorer::addEdge
Edge addEdge(const Vertex &u, const Vertex &v)
Definition: WorkspaceSphereExplorer.cpp:65
rl::math::Real
double Real
Definition: Real.h:34
rl::plan::WorkspaceSphereExplorer::greedy
Greedy greedy
Definition: WorkspaceSphereExplorer.h:74
rl::plan::WorkspaceSphereExplorer::Vertex
::boost::graph_traits< Graph >::vertex_descriptor Vertex
Definition: WorkspaceSphereExplorer.h:107
rl::plan::WorkspaceSphereExplorer
Definition: WorkspaceSphereExplorer.h:49
rl::plan::WorkspaceSphereExplorer::VertexIterator
::boost::graph_traits< Graph >::vertex_iterator VertexIterator
Definition: WorkspaceSphereExplorer.h:109
rl::plan::WorkspaceSphereExplorer::viewer
Viewer * viewer
Definition: WorkspaceSphereExplorer.h:86
rl::plan::Viewer
Definition: Viewer.h:40
rl::plan::WorkspaceSphereExplorer::Graph
::boost::adjacency_list< ::boost::listS, ::boost::listS, ::boost::bidirectionalS, VertexBundle > Graph
Definition: WorkspaceSphereExplorer.h:99
rl
Definition: Ati.cpp:35