RealVectorStateProjections.h
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2010, Rice University
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 Rice University 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 /* Author: Ioan Sucan */
36 
37 #ifndef OMPL_BASE_SPACES_REAL_VECTOR_STATE_PROJECTIONS_
38 #define OMPL_BASE_SPACES_REAL_VECTOR_STATE_PROJECTIONS_
39 
40 #include "ompl/base/ProjectionEvaluator.h"
41 #include "ompl/base/spaces/RealVectorStateSpace.h"
42 
43 namespace ompl
44 {
45  namespace base
46  {
47 
54  {
55  public:
56 
59  RealVectorLinearProjectionEvaluator(const StateSpace *space, const std::vector<double> &cellSizes,
60  const ProjectionMatrix::Matrix &projection);
61 
64  RealVectorLinearProjectionEvaluator(const StateSpacePtr &space, const std::vector<double> &cellSizes,
65  const ProjectionMatrix::Matrix &projection);
66 
70  const ProjectionMatrix::Matrix &projection);
71 
75  const ProjectionMatrix::Matrix &projection);
76 
77  virtual unsigned int getDimension() const;
78 
79  virtual void project(const State *state, EuclideanProjection &projection) const;
80 
81  protected:
82 
85 
86  };
87 
90  {
91  public:
92 
95  RealVectorRandomLinearProjectionEvaluator(const StateSpace *space, const std::vector<double> &cellSizes) :
96  RealVectorLinearProjectionEvaluator(space, cellSizes, ProjectionMatrix::ComputeRandom(space->getDimension(), cellSizes.size()))
97  {
98  }
99 
102  RealVectorRandomLinearProjectionEvaluator(const StateSpacePtr &space, const std::vector<double> &cellSizes) :
103  RealVectorLinearProjectionEvaluator(space, cellSizes, ProjectionMatrix::ComputeRandom(space->getDimension(), cellSizes.size()))
104  {
105  }
106 
109  RealVectorRandomLinearProjectionEvaluator(const StateSpace *space, unsigned int dim) :
110  RealVectorLinearProjectionEvaluator(space, ProjectionMatrix::ComputeRandom(space->getDimension(), dim,
111  space->as<RealVectorStateSpace>()->getBounds().getDifference()))
112  {
113  }
114 
118  RealVectorLinearProjectionEvaluator(space, ProjectionMatrix::ComputeRandom(space->getDimension(), dim,
119  space->as<RealVectorStateSpace>()->getBounds().getDifference()))
120  {
121  }
122 
123  };
124 
127  {
128  public:
129 
132  RealVectorOrthogonalProjectionEvaluator(const StateSpace *space, const std::vector<double> &cellSizes,
133  const std::vector<unsigned int> &components);
134 
137  RealVectorOrthogonalProjectionEvaluator(const StateSpacePtr &space, const std::vector<double> &cellSizes,
138  const std::vector<unsigned int> &components);
139 
142  RealVectorOrthogonalProjectionEvaluator(const StateSpace *space, const std::vector<unsigned int> &components);
143 
146  RealVectorOrthogonalProjectionEvaluator(const StateSpacePtr &space, const std::vector<unsigned int> &components);
147 
148  virtual unsigned int getDimension() const;
149 
150  virtual void defaultCellSizes();
151 
152  virtual void project(const State *state, EuclideanProjection &projection) const;
153 
154  protected:
155 
157  void copyBounds();
158 
160  std::vector<unsigned int> components_;
161 
162  };
163 
166  {
167  public:
168 
171  RealVectorIdentityProjectionEvaluator(const StateSpace *space, const std::vector<double> &cellSizes);
172 
175  RealVectorIdentityProjectionEvaluator(const StateSpacePtr &space, const std::vector<double> &cellSizes);
176 
180 
184 
185  virtual unsigned int getDimension() const;
186 
187  virtual void defaultCellSizes();
188 
189  virtual void setup();
190 
191  virtual void project(const State *state, EuclideanProjection &projection) const;
192 
193  private:
194 
196  void copyBounds();
197 
199  std::size_t copySize_;
200 
201  };
202 
203  }
204 }
205 #endif
RealVectorRandomLinearProjectionEvaluator(const StateSpacePtr &space, unsigned int dim)
Initialize a linear projection evaluator for state space space. The used projection matrix is sampled...
virtual unsigned int getDimension() const
Return the dimension of the projection defined by this evaluator.
A boost shared pointer wrapper for ompl::base::StateSpace.
ProjectionMatrix projection_
The projection matrix.
Definition for a class computing orthogonal projections.
Definition for a class computing a random linear projections.
Main namespace. Contains everything in this library.
Definition: Cost.h:42
virtual void project(const State *state, EuclideanProjection &projection) const
Compute the projection as an array of double values.
virtual void defaultCellSizes()
Set the default cell dimensions for this projection. The default implementation of this function is e...
const RealVectorBounds & getBounds()
Get the bounds computed/set for this projection.
A state space representing Rn. The distance function is the L2 norm.
Representation of a space in which planning can be performed. Topology specific sampling, interpolation and distance are defined.
Definition: StateSpace.h:73
RealVectorRandomLinearProjectionEvaluator(const StateSpacePtr &space, const std::vector< double > &cellSizes)
Initialize a linear projection evaluator for state space space. The used projection matrix is sampled...
boost::numeric::ublas::vector< double > EuclideanProjection
The datatype for state projections. This class contains a real vector.
Definition of an abstract state.
Definition: State.h:50
std::vector< unsigned int > components_
The set of components selected by the projection.
RealVectorRandomLinearProjectionEvaluator(const StateSpace *space, const std::vector< double > &cellSizes)
Initialize a linear projection evaluator for state space space. The used projection matrix is sampled...
A projection matrix – it allows multiplication of real vectors by a specified matrix. The matrix can also be randomly generated.
RealVectorRandomLinearProjectionEvaluator(const StateSpace *space, unsigned int dim)
Initialize a linear projection evaluator for state space space. The used projection matrix is sampled...
RealVectorLinearProjectionEvaluator(const StateSpace *space, const std::vector< double > &cellSizes, const ProjectionMatrix::Matrix &projection)
Initialize a linear projection evaluator for state space space. The used projection matrix is project...
boost::numeric::ublas::matrix< double > Matrix
Datatype for projection matrices.
Definition for a class computing linear projections (multiplication of a k-by-n matrix to the the Rn ...
virtual void setup()
Perform configuration steps, if needed.
Abstract definition for a class computing projections to Rn. Implicit integer grids are imposed on th...