All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
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(void) 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(void) const;
149 
150  virtual void defaultCellSizes(void);
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(void) const;
186 
187  virtual void defaultCellSizes(void);
188 
189  virtual void setup(void);
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...
RealVectorIdentityProjectionEvaluator(const StateSpace *space, const std::vector< double > &cellSizes)
Initialize the identity projection evaluator for state space space. The indices of the kept component...
A boost shared pointer wrapper for ompl::base::StateSpace.
virtual void project(const State *state, EuclideanProjection &projection) const
Compute the projection as an array of double values.
void copyBounds()
Fill bounds_ with bounds from the state space.
virtual unsigned int getDimension(void) const
Return the dimension of the projection defined by this evaluator.
ProjectionMatrix projection_
The projection matrix.
virtual unsigned int getDimension(void) const
Return the dimension of the projection defined by this evaluator.
virtual void project(const State *state, EuclideanProjection &projection) const
Compute the projection as an array of double values.
Definition for a class computing orthogonal projections.
Definition for a class computing a random linear projections.
virtual void defaultCellSizes(void)
Set the default cell dimensions for this projection. The default implementation of this function is e...
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...
virtual unsigned int getDimension(void) const
Return the dimension of the projection defined by this evaluator.
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...
virtual void project(const State *state, EuclideanProjection &projection) const
Compute the projection as an array of double values.
RealVectorOrthogonalProjectionEvaluator(const StateSpace *space, const std::vector< double > &cellSizes, const std::vector< unsigned int > &components)
Initialize an orthogonal projection evaluator for state space space. The indices of the kept componen...
virtual void setup(void)
Perform configuration steps, if needed.
const RealVectorBounds & getBounds(void)
Get the bounds computed/set for this projection.
boost::numeric::ublas::matrix< double > Matrix
Datatype for projection matrices.
virtual void defaultCellSizes(void)
Set the default cell dimensions for this projection. The default implementation of this function is e...
Definition for a class computing linear projections (multiplication of a k-by-n matrix to the the Rn ...
Abstract definition for a class computing projections to Rn. Implicit integer grids are imposed on th...