GridDecomposition.cpp
45 ompl::control::GridDecomposition::GridDecomposition(int len, int dim, const base::RealVectorBounds &b)
46 : Decomposition(dim, b), length_(len), cellVolume_(b.getVolume()), numGridCells_(calcNumGridCells(len, dim))
55 //We efficiently compute neighbors for dim = 1, 2, or 3; for higher dimensions we use a general approach.
144 void ompl::control::GridDecomposition::sampleFromRegion(int rid, RNG &rng, std::vector<double> &coord) const
152 void ompl::control::GridDecomposition::computeGridNeighbors (int rid, std::vector <int> &neighbors) const
188 // Make sure to include the same coordinate, for neighbors "above", "below", "in front of", "behind", etcetera.
201 void ompl::control::GridDecomposition::regionToGridCoord(int rid, std::vector<int>& coord) const
247 void ompl::control::GridDecomposition::coordToGridCoord(const std::vector<double>& coord, std::vector<int>& gridCoord) const
261 const ompl::base::RealVectorBounds& ompl::control::GridDecomposition::getRegionBounds(int rid) const
void regionToGridCoord(int rid, std::vector< int > &coord) const
Converts a given region to a coordinate in the grid.
Definition: GridDecomposition.cpp:201
virtual void getNeighbors(int rid, std::vector< int > &neighbors) const
Stores a given region's neighbors into a given vector.
Definition: GridDecomposition.cpp:53
virtual void sampleFromRegion(int rid, RNG &rng, std::vector< double > &coord) const
Samples a projected coordinate from a given region.
Definition: GridDecomposition.cpp:144
void computeGridNeighbors(int rid, std::vector< int > &neighbors) const
Computes the neighbors of the given region in a n-dimensional grid.
Definition: GridDecomposition.cpp:152
A Decomposition is a partition of a bounded Euclidean space into a fixed number of regions which are ...
Definition: Decomposition.h:62
virtual int locateRegion(const base::State *s) const
Returns the index of the region containing a given State. Most often, this is obtained by first calli...
Definition: GridDecomposition.cpp:137
void computeGridNeighborsSub(const std::vector< int > &coord, std::vector< int > &neighbors, int dim, std::vector< int > &candidate) const
Definition: GridDecomposition.cpp:161
Random number generation. An instance of this class cannot be used by multiple threads at once (membe...
Definition: RandomNumbers.h:54
int coordToRegion(const std::vector< double > &coord) const
Converts a decomposition space coordinate to the ID of the region that contains iit.
Definition: GridDecomposition.cpp:227
double uniformReal(double lower_bound, double upper_bound)
Generate a random real within given bounds: [lower_bound, upper_bound)
Definition: RandomNumbers.h:68
void coordToGridCoord(const std::vector< double > &coord, std::vector< int > &gridCoord) const
Converts a decomposition space coordinate to a grid coordinate.
Definition: GridDecomposition.cpp:247
virtual void project(const base::State *s, std::vector< double > &coord) const =0
Project a given State to a set of coordinates in R^k, where k is the dimension of this Decomposition...
GridDecomposition(int len, int dim, const base::RealVectorBounds &b)
Constructor. Creates a GridDecomposition as a hypercube with a given dimension, side length...
Definition: GridDecomposition.cpp:45
The lower and upper bounds for an Rn space.
Definition: RealVectorBounds.h:48
virtual const base::RealVectorBounds & getRegionBounds(int rid) const
Helper method to return the bounds of a given region.
Definition: GridDecomposition.cpp:261
int gridCoordToRegion(const std::vector< int > &coord) const
Converts the given grid coordinate to its corresponding region ID.
Definition: GridDecomposition.cpp:212