Representation of a space in which planning can be performed. Topology specific sampling, interpolation and distance are defined. More...
#include <StateSpace.h>
Public Types | |
typedef State | StateType |
Define the type of state allocated by this space. | |
Public Member Functions | |
template<class T > | |
const T * | as (void) const |
Cast this instance to a desired type. | |
template<class T > | |
T * | as (void) |
Cast this instance to a desired type. | |
virtual void | printProjections (std::ostream &out) const |
Print the list of registered projections. This function is also called by printSettings(). | |
virtual void | printSettings (std::ostream &out) const |
Print the settings for this state space to a stream. | |
virtual void | printState (const State *state, std::ostream &out) const |
Print a state to a stream. | |
virtual void | setup (void) |
Perform final setup steps. This function is automatically called by the SpaceInformation. If any default projections are to be registered, this call will set them. It is safe to call this function multiple times. | |
StateSpace (void) | |
Constructor. Assigns a unique name to the space. | |
virtual | ~StateSpace (void) |
Functionality specific to state spaces (to be implemented by derived state spaces) | |
virtual State * | allocState (void) const =0 |
Allocate a state that can store a point in the described space. | |
virtual StateSamplerPtr | allocStateSampler (void) const =0 |
Allocate an instance of a uniform state sampler for this space. | |
virtual void | copyState (State *destination, const State *source) const =0 |
Copy a state to another. The memory of source and destination should NOT overlap. | |
virtual double | distance (const State *state1, const State *state2) const =0 |
Computes distance to between two states. This value will always be between 0 and getMaximumExtent(). | |
virtual void | enforceBounds (State *state) const =0 |
Bring the state within the bounds of the state space. | |
virtual bool | equalStates (const State *state1, const State *state2) const =0 |
Checks whether two states are equal. | |
virtual void | freeState (State *state) const =0 |
Free the memory of the allocated state. | |
virtual unsigned int | getDimension (void) const =0 |
Get the dimension of the space. | |
virtual double | getLongestValidSegmentFraction (void) const |
When performing discrete validation of motions, the length of the longest segment that does not require state validation needs to be specified. This function returns this length, for this state space, as a fraction of the space's maximum extent. | |
virtual double | getMaximumExtent (void) const =0 |
Get the maximum value a call to distance() can return. | |
unsigned int | getValidSegmentCountFactor (void) const |
Get the value used to multiply the return value of validSegmentCount(). | |
virtual double * | getValueAddressAtIndex (State *state, const unsigned int index) const |
Many states contain a number of double values. This function provides a means to get the memory address of a double value from state state located at position index. The first double value is returned for index = 0. If index is too large (does not point to any double values in the state), the return value is NULL. | |
virtual void | interpolate (const State *from, const State *to, const double t, State *state) const =0 |
Computes the state that lies at time t in [0, 1] on the segment that connects from state to to state. The memory location of state is not required to be different from the memory of either from or to. | |
virtual bool | satisfiesBounds (const State *state) const =0 |
Check if a state is inside the bounding box. | |
virtual void | setLongestValidSegmentFraction (double segmentFraction) |
When performing discrete validation of motions, the length of the longest segment that does not require state validation needs to be specified. This function sets this length as a fraction of the space's maximum extent. | |
void | setValidSegmentCountFactor (unsigned int factor) |
Set factor to be the value to multiply the return value of validSegmentCount(). By default, this value is 1. The higher the value, the smaller the size of the segments considered valid. The effect of this function is immediate (setup() does not need to be called). | |
virtual unsigned int | validSegmentCount (const State *state1, const State *state2) const |
Count how many segments of the "longest valid length" fit on the motion from state1 to state2. | |
Generic functionality for state spaces | |
bool | covers (const StateSpacePtr &other) const |
Return true if other is a space that is either included (perhaps equal, perhaps a subspace) in this one, or all of its subspaces are included in this one. | |
const std::string & | getName (void) const |
Get the name of the state space. | |
int | getType (void) const |
Get the type of the state space. The type can be used to verify whether two space instances are of the same type (e.g., SO2). | |
bool | includes (const StateSpacePtr &other) const |
Return true if other is a space included (perhaps equal, perhaps a subspace) in this one. | |
virtual bool | isCompound (void) const |
Check if the state space is compound. | |
void | setName (const std::string &name) |
Set the name of the state space. | |
Management of projections from this state space to Euclidean spaces | |
ProjectionEvaluatorPtr | getDefaultProjection (void) const |
Get the default projection. | |
ProjectionEvaluatorPtr | getProjection (const std::string &name) const |
Get the projection registered under a specific name. | |
const std::map< std::string, ProjectionEvaluatorPtr > & | getRegisteredProjections (void) const |
Get all the registered projections. | |
bool | hasDefaultProjection (void) const |
Check if a default projection is available. | |
bool | hasProjection (const std::string &name) const |
Check if a projection with a specified name is available. | |
void | registerDefaultProjection (const ProjectionEvaluatorPtr &projection) |
Register the default projection for this state space. | |
void | registerProjection (const std::string &name, const ProjectionEvaluatorPtr &projection) |
Register a projection for this state space under a specified name. | |
virtual void | registerProjections (void) |
Register the projections for this state space. Usually, this is at least the default projection. These are implicit projections, set by the implementation of the state space. This is called by setup(). | |
Static Public Member Functions | |
static void | diagram (std::ostream &out) |
Print a Graphviz digraph that represents the containment diagram for all the instantiated state spaces. | |
Protected Attributes | |
double | longestValidSegment_ |
The longest valid segment at the time setup() was called. | |
unsigned int | longestValidSegmentCountFactor_ |
The factor to multiply the value returned by validSegmentCount(). | |
double | longestValidSegmentFraction_ |
The fraction of the longest valid segment. | |
double | maxExtent_ |
The extent of this space at the time setup() was called. | |
msg::Interface | msg_ |
Interface used for console output. | |
std::map< std::string, ProjectionEvaluatorPtr > | projections_ |
List of available projections. | |
int | type_ |
A type assigned for this state space. | |
Static Protected Attributes | |
static const std::string | DEFAULT_PROJECTION_NAME |
The name used for the default projection. | |
Private Attributes | |
std::string | name_ |
State space name. |
Representation of a space in which planning can be performed. Topology specific sampling, interpolation and distance are defined.
See implementingStateSpaces.
Definition at line 70 of file StateSpace.h.
Define the type of state allocated by this space.
Reimplemented in ompl::base::CompoundStateSpace.
Definition at line 75 of file StateSpace.h.
ompl::base::StateSpace::StateSpace | ( | void | ) |
Constructor. Assigns a unique name to the space.
virtual ompl::base::StateSpace::~StateSpace | ( | void | ) | [virtual] |
virtual State* ompl::base::StateSpace::allocState | ( | void | ) | const [pure virtual] |
Allocate a state that can store a point in the described space.
Implemented in ompl::base::RealVectorStateSpace, ompl::base::SE2StateSpace, ompl::base::SE3StateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, ompl::base::CompoundStateSpace, and ompl::control::ODEStateSpace.
virtual StateSamplerPtr ompl::base::StateSpace::allocStateSampler | ( | void | ) | const [pure virtual] |
Allocate an instance of a uniform state sampler for this space.
Implemented in ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, and ompl::base::CompoundStateSpace.
const T* ompl::base::StateSpace::as | ( | void | ) | const [inline] |
Cast this instance to a desired type.
Make sure the type we are casting to is indeed a state space
Definition at line 94 of file StateSpace.h.
T* ompl::base::StateSpace::as | ( | void | ) | [inline] |
Cast this instance to a desired type.
Make sure the type we are casting to is indeed a state space
Definition at line 84 of file StateSpace.h.
virtual void ompl::base::StateSpace::copyState | ( | State * | destination, | |
const State * | source | |||
) | const [pure virtual] |
Copy a state to another. The memory of source and destination should NOT overlap.
Implemented in ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, ompl::base::CompoundStateSpace, and ompl::control::ODEStateSpace.
bool ompl::base::StateSpace::covers | ( | const StateSpacePtr & | other | ) | const |
Return true if other is a space that is either included (perhaps equal, perhaps a subspace) in this one, or all of its subspaces are included in this one.
static void ompl::base::StateSpace::diagram | ( | std::ostream & | out | ) | [static] |
Print a Graphviz digraph that represents the containment diagram for all the instantiated state spaces.
virtual double ompl::base::StateSpace::distance | ( | const State * | state1, | |
const State * | state2 | |||
) | const [pure virtual] |
Computes distance to between two states. This value will always be between 0 and getMaximumExtent().
Implemented in ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, and ompl::base::CompoundStateSpace.
virtual void ompl::base::StateSpace::enforceBounds | ( | State * | state | ) | const [pure virtual] |
Bring the state within the bounds of the state space.
Implemented in ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, and ompl::base::CompoundStateSpace.
virtual bool ompl::base::StateSpace::equalStates | ( | const State * | state1, | |
const State * | state2 | |||
) | const [pure virtual] |
Checks whether two states are equal.
Implemented in ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, and ompl::base::CompoundStateSpace.
virtual void ompl::base::StateSpace::freeState | ( | State * | state | ) | const [pure virtual] |
Free the memory of the allocated state.
Implemented in ompl::base::RealVectorStateSpace, ompl::base::SE2StateSpace, ompl::base::SE3StateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, ompl::base::CompoundStateSpace, and ompl::control::ODEStateSpace.
ProjectionEvaluatorPtr ompl::base::StateSpace::getDefaultProjection | ( | void | ) | const |
Get the default projection.
virtual unsigned int ompl::base::StateSpace::getDimension | ( | void | ) | const [pure virtual] |
Get the dimension of the space.
Implemented in ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, and ompl::base::CompoundStateSpace.
virtual double ompl::base::StateSpace::getLongestValidSegmentFraction | ( | void | ) | const [virtual] |
When performing discrete validation of motions, the length of the longest segment that does not require state validation needs to be specified. This function returns this length, for this state space, as a fraction of the space's maximum extent.
virtual double ompl::base::StateSpace::getMaximumExtent | ( | void | ) | const [pure virtual] |
Get the maximum value a call to distance() can return.
Implemented in ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, and ompl::base::CompoundStateSpace.
const std::string& ompl::base::StateSpace::getName | ( | void | ) | const |
Get the name of the state space.
ProjectionEvaluatorPtr ompl::base::StateSpace::getProjection | ( | const std::string & | name | ) | const |
Get the projection registered under a specific name.
const std::map<std::string, ProjectionEvaluatorPtr>& ompl::base::StateSpace::getRegisteredProjections | ( | void | ) | const |
Get all the registered projections.
int ompl::base::StateSpace::getType | ( | void | ) | const [inline] |
Get the type of the state space. The type can be used to verify whether two space instances are of the same type (e.g., SO2).
Definition at line 117 of file StateSpace.h.
unsigned int ompl::base::StateSpace::getValidSegmentCountFactor | ( | void | ) | const |
Get the value used to multiply the return value of validSegmentCount().
virtual double* ompl::base::StateSpace::getValueAddressAtIndex | ( | State * | state, | |
const unsigned int | index | |||
) | const [virtual] |
Many states contain a number of double values. This function provides a means to get the memory address of a double value from state state located at position index. The first double value is returned for index = 0. If index is too large (does not point to any double values in the state), the return value is NULL.
Reimplemented in ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, and ompl::base::CompoundStateSpace.
bool ompl::base::StateSpace::hasDefaultProjection | ( | void | ) | const |
Check if a default projection is available.
bool ompl::base::StateSpace::hasProjection | ( | const std::string & | name | ) | const |
Check if a projection with a specified name is available.
bool ompl::base::StateSpace::includes | ( | const StateSpacePtr & | other | ) | const |
Return true if other is a space included (perhaps equal, perhaps a subspace) in this one.
virtual void ompl::base::StateSpace::interpolate | ( | const State * | from, | |
const State * | to, | |||
const double | t, | |||
State * | state | |||
) | const [pure virtual] |
Computes the state that lies at time t in [0, 1] on the segment that connects from state to to state. The memory location of state is not required to be different from the memory of either from or to.
Implemented in ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, and ompl::base::CompoundStateSpace.
virtual bool ompl::base::StateSpace::isCompound | ( | void | ) | const [virtual] |
Check if the state space is compound.
Reimplemented in ompl::base::CompoundStateSpace.
virtual void ompl::base::StateSpace::printProjections | ( | std::ostream & | out | ) | const [virtual] |
Print the list of registered projections. This function is also called by printSettings().
virtual void ompl::base::StateSpace::printSettings | ( | std::ostream & | out | ) | const [virtual] |
Print the settings for this state space to a stream.
Reimplemented in ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, and ompl::base::CompoundStateSpace.
virtual void ompl::base::StateSpace::printState | ( | const State * | state, | |
std::ostream & | out | |||
) | const [virtual] |
Print a state to a stream.
Reimplemented in ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, and ompl::base::CompoundStateSpace.
void ompl::base::StateSpace::registerDefaultProjection | ( | const ProjectionEvaluatorPtr & | projection | ) |
Register the default projection for this state space.
void ompl::base::StateSpace::registerProjection | ( | const std::string & | name, | |
const ProjectionEvaluatorPtr & | projection | |||
) |
Register a projection for this state space under a specified name.
virtual void ompl::base::StateSpace::registerProjections | ( | void | ) | [virtual] |
Register the projections for this state space. Usually, this is at least the default projection. These are implicit projections, set by the implementation of the state space. This is called by setup().
Reimplemented in ompl::base::RealVectorStateSpace, ompl::base::SE2StateSpace, ompl::base::SE3StateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, and ompl::base::TimeStateSpace.
virtual bool ompl::base::StateSpace::satisfiesBounds | ( | const State * | state | ) | const [pure virtual] |
Check if a state is inside the bounding box.
Implemented in ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, and ompl::base::CompoundStateSpace.
virtual void ompl::base::StateSpace::setLongestValidSegmentFraction | ( | double | segmentFraction | ) | [virtual] |
When performing discrete validation of motions, the length of the longest segment that does not require state validation needs to be specified. This function sets this length as a fraction of the space's maximum extent.
Reimplemented in ompl::base::CompoundStateSpace.
void ompl::base::StateSpace::setName | ( | const std::string & | name | ) |
Set the name of the state space.
virtual void ompl::base::StateSpace::setup | ( | void | ) | [virtual] |
Perform final setup steps. This function is automatically called by the SpaceInformation. If any default projections are to be registered, this call will set them. It is safe to call this function multiple times.
Reimplemented in ompl::base::RealVectorStateSpace, and ompl::base::CompoundStateSpace.
void ompl::base::StateSpace::setValidSegmentCountFactor | ( | unsigned int | factor | ) |
Set factor to be the value to multiply the return value of validSegmentCount(). By default, this value is 1. The higher the value, the smaller the size of the segments considered valid. The effect of this function is immediate (setup() does not need to be called).
virtual unsigned int ompl::base::StateSpace::validSegmentCount | ( | const State * | state1, | |
const State * | state2 | |||
) | const [virtual] |
Count how many segments of the "longest valid length" fit on the motion from state1 to state2.
Reimplemented in ompl::base::CompoundStateSpace.
const std::string ompl::base::StateSpace::DEFAULT_PROJECTION_NAME [static, protected] |
The name used for the default projection.
Definition at line 270 of file StateSpace.h.
double ompl::base::StateSpace::longestValidSegment_ [protected] |
The longest valid segment at the time setup() was called.
Definition at line 282 of file StateSpace.h.
unsigned int ompl::base::StateSpace::longestValidSegmentCountFactor_ [protected] |
The factor to multiply the value returned by validSegmentCount().
Definition at line 285 of file StateSpace.h.
double ompl::base::StateSpace::longestValidSegmentFraction_ [protected] |
The fraction of the longest valid segment.
Definition at line 279 of file StateSpace.h.
double ompl::base::StateSpace::maxExtent_ [protected] |
The extent of this space at the time setup() was called.
Definition at line 276 of file StateSpace.h.
msg::Interface ompl::base::StateSpace::msg_ [protected] |
Interface used for console output.
Definition at line 288 of file StateSpace.h.
std::string ompl::base::StateSpace::name_ [private] |
State space name.
Definition at line 296 of file StateSpace.h.
std::map<std::string, ProjectionEvaluatorPtr> ompl::base::StateSpace::projections_ [protected] |
List of available projections.
Definition at line 291 of file StateSpace.h.
int ompl::base::StateSpace::type_ [protected] |
A type assigned for this state space.
Definition at line 273 of file StateSpace.h.