Robotics Library  0.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 // * Neither the name of the Technische Universitaet Muenchen nor the names of
14 // its contributors may be used to endorse or promote products derived from
15 // this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 // POSSIBILITY OF SUCH DAMAGE.
28 //
29 
30 #ifndef _RL_PLAN_WORKSPACESPHEREEXPLORER_H_
31 #define _RL_PLAN_WORKSPACESPHEREEXPLORER_H_
32 
33 #include <list>
34 #include <set>
35 #include <boost/graph/adjacency_list.hpp>
36 #include <boost/random/mersenne_twister.hpp>
37 #include <boost/random/uniform_on_sphere.hpp>
38 #include <boost/random/variate_generator.hpp>
39 #include <rl/math/Vector.h>
40 
41 #include "VectorList.h"
42 #include "VectorPtr.h"
43 #include "WorkspaceSphere.h"
44 #include "WorkspaceSphereList.h"
45 
46 namespace rl
47 {
48  namespace plan
49  {
50  class DistanceModel;
51  class Viewer;
52 
54  {
55  public:
56  enum Greedy
57  {
61  };
62 
64 
65  virtual ~WorkspaceSphereExplorer();
66 
67  bool explore();
68 
69  void getPath(WorkspaceSphereList& path) const;
70 
71  bool isCovered(const ::rl::math::Vector& point) const;
72 
73  void reset();
74 
75  void seed(const ::boost::mt19937::result_type& value);
76 
78 
80 
82 
84 
86 
87  ::std::size_t samples;
88 
90 
92 
93  protected:
94  struct VertexBundle
95  {
97  };
98 
99  typedef ::boost::adjacency_list<
100  ::boost::listS,
101  ::boost::listS,
102  ::boost::bidirectionalS,
104  > Graph;
105 
106  typedef ::boost::graph_traits< Graph >::edge_descriptor Edge;
107 
108  typedef ::boost::graph_traits< Graph >::edge_iterator EdgeIterator;
109 
110  typedef ::std::pair< EdgeIterator, EdgeIterator > EdgeIteratorPair;
111 
112  typedef ::boost::graph_traits< Graph >::vertex_descriptor Vertex;
113 
114  typedef ::boost::graph_traits< Graph >::vertex_iterator VertexIterator;
115 
116  typedef ::std::pair< VertexIterator, VertexIterator > VertexIteratorPair;
117 
118  Edge addEdge(const Vertex& u, const Vertex& v);
119 
120  Vertex addVertex(const WorkspaceSphere& sphere);
121 
122  bool isCovered(const Vertex& parent, const ::rl::math::Vector& point) const;
123 
125 
127 
129 
130  ::std::multiset< WorkspaceSphere > queue;
131 
132  ::boost::variate_generator< ::boost::mt19937, ::boost::uniform_on_sphere< ::rl::math::Real > > rand;
133 
134  private:
135 
136  };
137  }
138 }
139 
140 #endif // _RL_PLAN_WORKSPACESPHEREEXPLORER_H_