A space to allow the composition of state spaces. More...
#include <StateSpace.h>
Public Types | |
typedef CompoundState | StateType |
Define the type of state allocated by this state space. | |
Public Member Functions | |
CompoundStateSpace (void) | |
Construct an empty compound state space. | |
CompoundStateSpace (const std::vector< StateSpacePtr > &components, const std::vector< double > &weights) | |
Construct a compound state space from a list of subspaces (components) and their corresponding weights (weights) | |
template<class T > | |
T * | as (const unsigned int index) const |
Cast a component of this instance to a desired type. | |
template<class T > | |
T * | as (const std::string &name) const |
Cast a component of this instance to a desired type. | |
virtual bool | isCompound (void) const |
Check if the state space is compound. | |
virtual bool | isHybrid (void) const |
Check if this is a hybrid state space (i.e., both discrete and continuous components exist) | |
virtual void | printState (const State *state, std::ostream &out) const |
Print a state to a stream. | |
virtual void | printSettings (std::ostream &out) const |
Print the settings for this state space 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. | |
void | lock (void) |
Lock this state space. This means no further spaces can be added as components. This function can be for instance called from the constructor of a state space that inherits from CompoundStateSpace to prevent the user to add further components. | |
Management of contained subspaces | |
virtual void | addSubSpace (const StateSpacePtr &component, double weight) |
Adds a new state space as part of the compound state space. For computing distances within the compound state space, the weight of the component also needs to be specified. | |
unsigned int | getSubSpaceCount (void) const |
Get the number of state spaces that make up the compound state space. | |
const StateSpacePtr & | getSubSpace (const unsigned int index) const |
Get a specific subspace from the compound state space. | |
const StateSpacePtr & | getSubSpace (const std::string &name) const |
Get a specific subspace from the compound state space. | |
unsigned int | getSubSpaceIndex (const std::string &name) const |
Get the index of a specific subspace from the compound state space. | |
bool | hasSubSpace (const std::string &name) const |
Check if a specific subspace is contained in this state space. | |
double | getSubSpaceWeight (const unsigned int index) const |
Get the weight of a subspace from the compound state space (used in distance computation) | |
double | getSubSpaceWeight (const std::string &name) const |
Get the weight of a subspace from the compound state space (used in distance computation) | |
void | setSubSpaceWeight (const unsigned int index, double weight) |
Set the weight of a subspace in the compound state space (used in distance computation) | |
void | setSubSpaceWeight (const std::string &name, double weight) |
Set the weight of a subspace in the compound state space (used in distance computation) | |
const std::vector < StateSpacePtr > & | getSubSpaces (void) const |
Get the list of components. | |
const std::vector< double > & | getSubSpaceWeights (void) const |
Get the list of component weights. | |
bool | isLocked (void) const |
Return true if the state space is locked. A value of true means that no further spaces can be added as components. | |
Functionality specific to the state space | |
virtual unsigned int | getDimension (void) const |
Get the dimension of the space (not the dimension of the surrounding ambient space) | |
virtual double | getMaximumExtent (void) const |
Get the maximum value a call to distance() can return (or an upper bound). For unbounded state spaces, this function can return infinity. | |
virtual void | enforceBounds (State *state) const |
Bring the state within the bounds of the state space. For unbounded spaces this function can be a no-op. | |
virtual bool | satisfiesBounds (const State *state) const |
Check if a state is inside the bounding box. For unbounded spaces this function can always return true. | |
virtual void | copyState (State *destination, const State *source) const |
Copy a state to another. The memory of source and destination should NOT overlap. | |
virtual double | distance (const State *state1, const State *state2) const |
Computes distance to between two states. This function satisfies the properties of a metric and its return value will always be between 0 and getMaximumExtent() | |
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. The call is passed to all contained subspaces. | |
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. This is the max() of the counts returned by contained subspaces. | |
virtual bool | equalStates (const State *state1, const State *state2) const |
Checks whether two states are equal. | |
virtual void | interpolate (const State *from, const State *to, const double t, State *state) const |
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 StateSamplerPtr | allocStateSampler (void) const |
Allocate an instance of a uniform state sampler for this space. | |
virtual State * | allocState (void) const |
Allocate a state that can store a point in the described space. | |
virtual void | freeState (State *state) const |
Free the memory of the allocated state. | |
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. | |
Protected Member Functions | |
void | allocStateComponents (CompoundState *state) const |
Allocate the state components. Called by allocState(). Usually called by derived state spaces. | |
Protected Attributes | |
std::vector< StateSpacePtr > | components_ |
The state spaces that make up the compound state space. | |
unsigned int | componentCount_ |
The number of components. | |
std::vector< double > | weights_ |
The weight assigned to each component of the state space when computing the compound distance. | |
bool | locked_ |
Flag indicating whether adding further components is allowed or not. |
A space to allow the composition of state spaces.
Definition at line 328 of file StateSpace.h.
T* ompl::base::CompoundStateSpace::as | ( | const unsigned int | index | ) | const [inline] |
Cast a component of this instance to a desired type.
Make sure the type we are casting to is indeed a state space
Definition at line 347 of file StateSpace.h.
T* ompl::base::CompoundStateSpace::as | ( | const std::string & | name | ) | const [inline] |
Cast a component of this instance to a desired type.
Make sure the type we are casting to is indeed a state space
Definition at line 357 of file StateSpace.h.
double ompl::base::CompoundStateSpace::getMaximumExtent | ( | void | ) | const [virtual] |
Get the maximum value a call to distance() can return (or an upper bound). For unbounded state spaces, this function can return infinity.
Implements ompl::base::StateSpace.
Definition at line 546 of file StateSpace.cpp.
double * ompl::base::CompoundStateSpace::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 from ompl::base::StateSpace.
Definition at line 672 of file StateSpace.cpp.