Robotics Library  0.7.0
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 <random>
32 #include <set>
33 #include <boost/graph/adjacency_list.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 
59  {
60  public:
61  enum Greedy
62  {
66  };
67 
69 
70  virtual ~WorkspaceSphereExplorer();
71 
72  bool explore();
73 
75 
76  bool isCovered(const ::rl::math::Vector3& point) const;
77 
78  void reset();
79 
80  void seed(const ::std::mt19937::result_type& value);
81 
83 
85 
87 
89 
91 
92  ::std::size_t samples;
93 
95 
97 
98  protected:
99  struct VertexBundle
100  {
102  };
103 
104  typedef ::boost::adjacency_list<
105  ::boost::listS,
106  ::boost::listS,
107  ::boost::bidirectionalS,
109  > Graph;
110 
111  typedef ::boost::graph_traits<Graph>::edge_descriptor Edge;
112 
113  typedef ::boost::graph_traits<Graph>::edge_iterator EdgeIterator;
114 
115  typedef ::std::pair<EdgeIterator, EdgeIterator> EdgeIteratorPair;
116 
117  typedef ::boost::graph_traits<Graph>::vertex_descriptor Vertex;
118 
119  typedef ::boost::graph_traits<Graph>::vertex_iterator VertexIterator;
120 
121  typedef ::std::pair<VertexIterator, VertexIterator> VertexIteratorPair;
122 
123  Edge addEdge(const Vertex& u, const Vertex& v);
124 
125  Vertex addVertex(const WorkspaceSphere& sphere);
126 
127  bool isCovered(const Vertex& parent, const ::rl::math::Vector3& point) const;
128 
130 
132 
134 
135  ::std::multiset<WorkspaceSphere> queue;
136 
137  ::boost::variate_generator< ::std::mt19937, ::boost::uniform_on_sphere< ::rl::math::Real>> rand;
138 
139  private:
140 
141  };
142  }
143 }
144 
145 #endif // RL_PLAN_WORKSPACESPHEREEXPLORER_H
rl::plan::WorkspaceSphereExplorer::goal
::rl::math::Vector3 * goal
Definition: WorkspaceSphereExplorer.h:82
rl::plan::WorkspaceSphereExplorer::graph
Graph graph
Definition: WorkspaceSphereExplorer.h:133
rl::plan::WorkspaceSphereExplorer::seed
void seed(const ::std::mt19937::result_type &value)
Definition: WorkspaceSphereExplorer.cpp:288
rl::plan::WorkspaceSphereExplorer::~WorkspaceSphereExplorer
virtual ~WorkspaceSphereExplorer()
Definition: WorkspaceSphereExplorer.cpp:59
rl::plan::WorkspaceSphereExplorer::WorkspaceSphereExplorer
WorkspaceSphereExplorer()
Definition: WorkspaceSphereExplorer.cpp:39
WorkspaceSphereList.h
rl::plan::WorkspaceSphereExplorer::rand
::boost::variate_generator< ::std::mt19937, ::boost::uniform_on_sphere< ::rl::math::Real > > rand
Definition: WorkspaceSphereExplorer.h:137
rl::plan::WorkspaceSphereExplorer::EdgeIterator
::boost::graph_traits< Graph >::edge_iterator EdgeIterator
Definition: WorkspaceSphereExplorer.h:113
rl::plan::WorkspaceSphereExplorer::queue
::std::multiset< WorkspaceSphere > queue
Definition: WorkspaceSphereExplorer.h:135
rl::plan::WorkspaceSphereExplorer::getPath
WorkspaceSphereList getPath() const
Definition: WorkspaceSphereExplorer.cpp:213
rl::math::Vector3
::Eigen::Matrix< Real, 3, 1 > Vector3
Definition: Vector.h:46
rl::plan::WorkspaceSphereExplorer::Greedy
Greedy
Definition: WorkspaceSphereExplorer.h:62
rl::plan::WorkspaceSphereExplorer::explore
bool explore()
Definition: WorkspaceSphereExplorer.cpp:94
rl::plan::WorkspaceSphere
Definition: WorkspaceSphere.h:40
rl::plan::WorkspaceSphereExplorer::GREEDY_SOURCE_DISTANCE
@ GREEDY_SOURCE_DISTANCE
Definition: WorkspaceSphereExplorer.h:64
rl::plan::WorkspaceSphereExplorer::VertexBundle::sphere
WorkspaceSphere sphere
Definition: WorkspaceSphereExplorer.h:101
rl::plan::WorkspaceSphereExplorer::Vertex
::boost::graph_traits< Graph >::vertex_descriptor Vertex
Definition: WorkspaceSphereExplorer.h:117
rl::plan::WorkspaceSphereExplorer::GREEDY_SPACE
@ GREEDY_SPACE
Definition: WorkspaceSphereExplorer.h:65
rl::plan::WorkspaceSphereExplorer::isCovered
bool isCovered(const ::rl::math::Vector3 &point) const
Definition: WorkspaceSphereExplorer.cpp:248
rl::plan::WorkspaceSphereExplorer::VertexBundle
Definition: WorkspaceSphereExplorer.h:100
rl::plan::WorkspaceSphereExplorer::begin
Vertex begin
Definition: WorkspaceSphereExplorer.h:129
Vector.h
rl::plan::WorkspaceSphereExplorer::start
::rl::math::Vector3 * start
Definition: WorkspaceSphereExplorer.h:94
rl::plan::WorkspaceSphereExplorer::addVertex
Vertex addVertex(const WorkspaceSphere &sphere)
Definition: WorkspaceSphereExplorer.cpp:77
rl::plan::WorkspaceSphereExplorer::VertexIterator
::boost::graph_traits< Graph >::vertex_iterator VertexIterator
Definition: WorkspaceSphereExplorer.h:119
rl::plan::WorkspaceSphereExplorer::VertexIteratorPair
::std::pair< VertexIterator, VertexIterator > VertexIteratorPair
Definition: WorkspaceSphereExplorer.h:121
rl::plan::WorkspaceSphereExplorer::radius
::rl::math::Real radius
Definition: WorkspaceSphereExplorer.h:88
rl::plan::WorkspaceSphereExplorer::model
DistanceModel * model
Definition: WorkspaceSphereExplorer.h:86
rl::plan::DistanceModel
Definition: DistanceModel.h:41
rl::plan::WorkspaceSphereExplorer::GREEDY_DISTANCE
@ GREEDY_DISTANCE
Definition: WorkspaceSphereExplorer.h:63
WorkspaceSphere.h
rl::plan::WorkspaceSphereExplorer::reset
void reset()
Definition: WorkspaceSphereExplorer.cpp:279
rl::plan::WorkspaceSphereExplorer::Edge
::boost::graph_traits< Graph >::edge_descriptor Edge
Definition: WorkspaceSphereExplorer.h:111
rl::plan::WorkspaceSphereExplorer::range
::rl::math::Real range
Definition: WorkspaceSphereExplorer.h:90
rl::plan::WorkspaceSphereExplorer::EdgeIteratorPair
::std::pair< EdgeIterator, EdgeIterator > EdgeIteratorPair
Definition: WorkspaceSphereExplorer.h:115
rl::plan::WorkspaceSphereExplorer::samples
::std::size_t samples
Definition: WorkspaceSphereExplorer.h:92
rl::plan::WorkspaceSphereExplorer::end
Vertex end
Definition: WorkspaceSphereExplorer.h:131
rl::plan::WorkspaceSphereExplorer::addEdge
Edge addEdge(const Vertex &u, const Vertex &v)
Definition: WorkspaceSphereExplorer.cpp:64
rl::math::Real
double Real
Definition: Real.h:42
rl::plan::WorkspaceSphereExplorer::greedy
Greedy greedy
Definition: WorkspaceSphereExplorer.h:84
rl::plan::WorkspaceSphereExplorer
Wavefront expansion.
Definition: WorkspaceSphereExplorer.h:59
rl::plan::WorkspaceSphereExplorer::viewer
Viewer * viewer
Definition: WorkspaceSphereExplorer.h:96
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:109
rl::plan::WorkspaceSphereList
::std::list< WorkspaceSphere > WorkspaceSphereList
Definition: WorkspaceSphereList.h:38
rl
Robotics Library.
Definition: AnalogInput.cpp:30