ompl::base::CompoundStateSpace Class Reference

A space to allow the composition of state spaces. More...

#include <StateSpace.h>

Inheritance diagram for ompl::base::CompoundStateSpace:
Inheritance graph
[legend]

List of all members.

Public Types

typedef CompoundState StateType
 Define the type of state allocated by this state space.

Public Member Functions

template<class T >
T * as (const std::string &name) const
 Cast a component of this instance to a desired type.
template<class T >
T * as (const unsigned int index) const
 Cast a component of this instance to a desired type.
 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).
 CompoundStateSpace (void)
 Construct an empty compound state space.
virtual bool isCompound (void) const
 Check if the state space is compound.
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.
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.
virtual ~CompoundStateSpace (void)
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.
const StateSpacePtrgetSubSpace (const std::string &name) const
 Get a specific subspace from the compound state space.
const StateSpacePtrgetSubSpace (const unsigned int index) const
 Get a specific subspace from the compound state space.
unsigned int getSubSpaceCount (void) const
 Get the number of state spaces that make up the compound state space.
unsigned int getSubSpaceIndex (const std::string &name) const
 Get the index of a specific subspace from the compound state space.
const std::vector
< StateSpacePtr > & 
getSubSpaces (void) const
 Get the list of components.
double getSubSpaceWeight (const std::string &name) const
 Get the weight of a subspace from the compound state space (used in distance computation).
double getSubSpaceWeight (const unsigned int index) const
 Get the weight of a subspace from the compound state space (used in distance computation).
const std::vector< double > & getSubSpaceWeights (void) const
 Get the list of component weights.
bool hasSubSpace (const std::string &name) const
 Check if a specific subspace is contained in this state space.
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.
void setSubSpaceWeight (const std::string &name, double weight)
 Set the weight of a subspace in 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).
Functionality specific to the state space

virtual StateallocState (void) const
 Allocate a state that can store a point in the described space.
virtual StateSamplerPtr allocStateSampler (void) const
 Allocate an instance of a uniform state sampler for this space.
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 value will always be between 0 and getMaximumExtent().
virtual void enforceBounds (State *state) const
 Bring the state within the bounds of the state space.
virtual bool equalStates (const State *state1, const State *state2) const
 Checks whether two states are equal.
virtual void freeState (State *state) const
 Free the memory of the allocated state.
virtual unsigned int getDimension (void) const
 Get the dimension of the space.
virtual double getMaximumExtent (void) const
 Get the maximum value a call to distance() can return.
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
 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
 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. 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.

Protected Member Functions

void allocStateComponents (CompoundState *state) const
 Allocate the state components. Called by allocState(). Usually called by derived state spaces.

Protected Attributes

unsigned int componentCount_
 The number of components.
std::vector< StateSpacePtrcomponents_
 The state spaces that make up the compound state space.
bool locked_
 Flag indicating whether adding further components is allowed or not.
std::vector< double > weights_
 The weight assigned to each component of the state space when computing the compound distance.

Detailed Description

A space to allow the composition of state spaces.

Definition at line 300 of file StateSpace.h.


Member Typedef Documentation

Define the type of state allocated by this state space.

Reimplemented from ompl::base::StateSpace.

Definition at line 305 of file StateSpace.h.


Constructor & Destructor Documentation

ompl::base::CompoundStateSpace::CompoundStateSpace ( void   ) 

Construct an empty compound state space.

ompl::base::CompoundStateSpace::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).

virtual ompl::base::CompoundStateSpace::~CompoundStateSpace ( void   )  [inline, virtual]

Definition at line 313 of file StateSpace.h.


Member Function Documentation

virtual void ompl::base::CompoundStateSpace::addSubSpace ( const StateSpacePtr component,
double  weight 
) [virtual]

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.

virtual State* ompl::base::CompoundStateSpace::allocState ( void   )  const [virtual]

Allocate a state that can store a point in the described space.

Implements ompl::base::StateSpace.

Reimplemented in ompl::base::SE2StateSpace, ompl::base::SE3StateSpace, and ompl::control::ODEStateSpace.

void ompl::base::CompoundStateSpace::allocStateComponents ( CompoundState state  )  const [protected]

Allocate the state components. Called by allocState(). Usually called by derived state spaces.

virtual StateSamplerPtr ompl::base::CompoundStateSpace::allocStateSampler ( void   )  const [virtual]

Allocate an instance of a uniform state sampler for this space.

Implements ompl::base::StateSpace.

template<class T >
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 329 of file StateSpace.h.

template<class T >
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 319 of file StateSpace.h.

virtual void ompl::base::CompoundStateSpace::copyState ( State destination,
const State source 
) const [virtual]

Copy a state to another. The memory of source and destination should NOT overlap.

Implements ompl::base::StateSpace.

Reimplemented in ompl::control::ODEStateSpace.

virtual double ompl::base::CompoundStateSpace::distance ( const State state1,
const State state2 
) const [virtual]

Computes distance to between two states. This value will always be between 0 and getMaximumExtent().

Implements ompl::base::StateSpace.

virtual void ompl::base::CompoundStateSpace::enforceBounds ( State state  )  const [virtual]

Bring the state within the bounds of the state space.

Implements ompl::base::StateSpace.

virtual bool ompl::base::CompoundStateSpace::equalStates ( const State state1,
const State state2 
) const [virtual]

Checks whether two states are equal.

Implements ompl::base::StateSpace.

virtual void ompl::base::CompoundStateSpace::freeState ( State state  )  const [virtual]

Free the memory of the allocated state.

Implements ompl::base::StateSpace.

Reimplemented in ompl::base::SE2StateSpace, ompl::base::SE3StateSpace, and ompl::control::ODEStateSpace.

virtual unsigned int ompl::base::CompoundStateSpace::getDimension ( void   )  const [virtual]

Get the dimension of the space.

Implements ompl::base::StateSpace.

virtual double ompl::base::CompoundStateSpace::getMaximumExtent ( void   )  const [virtual]

Get the maximum value a call to distance() can return.

Implements ompl::base::StateSpace.

const StateSpacePtr& ompl::base::CompoundStateSpace::getSubSpace ( const std::string &  name  )  const

Get a specific subspace from the compound state space.

const StateSpacePtr& ompl::base::CompoundStateSpace::getSubSpace ( const unsigned int  index  )  const

Get a specific subspace from the compound state space.

unsigned int ompl::base::CompoundStateSpace::getSubSpaceCount ( void   )  const

Get the number of state spaces that make up the compound state space.

unsigned int ompl::base::CompoundStateSpace::getSubSpaceIndex ( const std::string &  name  )  const

Get the index of a specific subspace from the compound state space.

const std::vector<StateSpacePtr>& ompl::base::CompoundStateSpace::getSubSpaces ( void   )  const

Get the list of components.

double ompl::base::CompoundStateSpace::getSubSpaceWeight ( const std::string &  name  )  const

Get the weight of a subspace from the compound state space (used in distance computation).

double ompl::base::CompoundStateSpace::getSubSpaceWeight ( const unsigned int  index  )  const

Get the weight of a subspace from the compound state space (used in distance computation).

const std::vector<double>& ompl::base::CompoundStateSpace::getSubSpaceWeights ( void   )  const

Get the list of component weights.

virtual 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.

Note:
This function does not map a state to an array of doubles. There may be components of a state that do not correspond to double values and they are 'invisible' to this function. Furthermore, this function is slow and is not intended for use in the implementation of planners.

Reimplemented from ompl::base::StateSpace.

bool ompl::base::CompoundStateSpace::hasSubSpace ( const std::string &  name  )  const

Check if a specific subspace is contained in this state space.

virtual void ompl::base::CompoundStateSpace::interpolate ( const State from,
const State to,
const double  t,
State state 
) const [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.

Implements ompl::base::StateSpace.

virtual bool ompl::base::CompoundStateSpace::isCompound ( void   )  const [virtual]

Check if the state space is compound.

Reimplemented from ompl::base::StateSpace.

bool ompl::base::CompoundStateSpace::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.

void ompl::base::CompoundStateSpace::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.

virtual void ompl::base::CompoundStateSpace::printSettings ( std::ostream &  out  )  const [virtual]

Print the settings for this state space to a stream.

Reimplemented from ompl::base::StateSpace.

virtual void ompl::base::CompoundStateSpace::printState ( const State state,
std::ostream &  out 
) const [virtual]

Print a state to a stream.

Reimplemented from ompl::base::StateSpace.

virtual bool ompl::base::CompoundStateSpace::satisfiesBounds ( const State state  )  const [virtual]

Check if a state is inside the bounding box.

Implements ompl::base::StateSpace.

virtual void ompl::base::CompoundStateSpace::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. The call is passed to all contained subspaces.

Reimplemented from ompl::base::StateSpace.

void ompl::base::CompoundStateSpace::setSubSpaceWeight ( const std::string &  name,
double  weight 
)

Set the weight of a subspace in the compound state space (used in distance computation).

void ompl::base::CompoundStateSpace::setSubSpaceWeight ( const unsigned int  index,
double  weight 
)

Set the weight of a subspace in the compound state space (used in distance computation).

virtual void ompl::base::CompoundStateSpace::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 from ompl::base::StateSpace.

virtual unsigned int ompl::base::CompoundStateSpace::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. This is the max() of the counts returned by contained subspaces.

Reimplemented from ompl::base::StateSpace.


Member Data Documentation

The number of components.

Definition at line 448 of file StateSpace.h.

The state spaces that make up the compound state space.

Definition at line 445 of file StateSpace.h.

Flag indicating whether adding further components is allowed or not.

Definition at line 454 of file StateSpace.h.

std::vector<double> ompl::base::CompoundStateSpace::weights_ [protected]

The weight assigned to each component of the state space when computing the compound distance.

Definition at line 451 of file StateSpace.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


ompl
Author(s): Ioan Sucan/isucan@rice.edu, Mark Moll/mmoll@rice.edu, Lydia Kavraki/kavraki@rice.edu
autogenerated on Fri Jan 11 09:33:58 2013