Loading...
Searching...
No Matches

Representation of a space in which planning can be performed. Topology specific sampling, interpolation and distance are defined. More...

#include <ompl/base/StateSpace.h>

Inheritance diagram for ompl::base::StateSpace:

Classes

struct  SubstateLocation
 Representation of the address of a substate in a state. This structure stores the indexing information needed to access a particular substate of a state. More...
 
struct  ValueLocation
 Representation of the address of a value in a state. This structure stores the indexing information needed to access elements of a state (no pointer values are stored) More...
 

Public Types

enum  SanityChecks {
  STATESPACE_DISTANCE_DIFFERENT_STATES = (1 << 1) , STATESPACE_DISTANCE_SYMMETRIC = (1 << 2) , STATESPACE_INTERPOLATION = (1 << 3) , STATESPACE_TRIANGLE_INEQUALITY = (1 << 4) ,
  STATESPACE_DISTANCE_BOUND = (1 << 5) , STATESPACE_RESPECT_BOUNDS = (1 << 6) , STATESPACE_ENFORCE_BOUNDS_NO_OP = (1 << 7) , STATESPACE_SERIALIZATION = (1 << 8)
}
 Flags to use in a bit mask for state space sanity checks. Some basic checks do not have flags associated (they are always executed; for example, whether copyState() works as expected) More...
 
using StateType = ompl::base::State
 Define the type of state allocated by this space. More...
 

Public Member Functions

 StateSpace (const StateSpace &)=delete
 
StateSpaceoperator= (const StateSpace &)=delete
 
 StateSpace ()
 Constructor. Assigns a unique name to the space. More...
 
template<class T >
T * as ()
 Cast this instance to a desired type. More...
 
template<class T >
const T * as () const
 Cast this instance to a desired type. More...
 
virtual void setup ()
 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 and call their setup() functions. It is safe to call this function multiple times. At a subsequent call, projections that have been previously user configured are not re-instantiated, but their setup() method is still called. More...
 
Generic functionality for state spaces
virtual bool isCompound () const
 Check if the state space is compound. More...
 
virtual bool isDiscrete () const
 Check if the set of states is discrete. More...
 
virtual bool isHybrid () const
 Check if this is a hybrid state space (i.e., both discrete and continuous components exist) More...
 
virtual bool isMetricSpace () const
 Return true if the distance function associated with the space is a metric. More...
 
virtual bool hasSymmetricDistance () const
 Check if the distance function on this state space is symmetric, i.e. distance(s1,s2) = distance(s2,s1). Default implementation returns true. More...
 
virtual bool hasSymmetricInterpolate () const
 Check if the interpolation function on this state space is symmetric, i.e. interpolate(from, to, t, state) = interpolate(to, from, 1-t, state). Default implementation returns true. More...
 
const std::string & getName () const
 Get the name of the state space. More...
 
void setName (const std::string &name)
 Set the name of the state space. More...
 
int getType () 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) More...
 
bool includes (const StateSpacePtr &other) const
 Return true if other is a space included (perhaps equal, perhaps a subspace) in this one. More...
 
bool includes (const StateSpace *other) const
 Return true if other is a space included (perhaps equal, perhaps a subspace) in this one. More...
 
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. More...
 
bool covers (const StateSpace *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. More...
 
ParamSetparams ()
 Get the parameters for this space. More...
 
const ParamSetparams () const
 Get the parameters for this space. More...
 
virtual double getLongestValidSegmentFraction () 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. More...
 
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. More...
 
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. More...
 
virtual 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). More...
 
virtual unsigned int getValidSegmentCountFactor () const
 Get the value used to multiply the return value of validSegmentCount(). More...
 
virtual double getLongestValidSegmentLength () const
 Get the longest valid segment at the time setup() was called. More...
 
virtual void computeSignature (std::vector< int > &signature) const
 Compute an array of ints that uniquely identifies the structure of the state space. The first element of the signature is the number of integers that follow. More...
 
Functionality specific to state spaces (to be implemented by derived state spaces)
virtual unsigned int getDimension () const =0
 Get the dimension of the space (not the dimension of the surrounding ambient space) More...
 
virtual double getMaximumExtent () const =0
 Get the maximum value a call to distance() can return (or an upper bound). For unbounded state spaces, this function can return infinity. More...
 
virtual double getMeasure () const =0
 Get a measure of the space (this can be thought of as a generalization of volume) More...
 
virtual void enforceBounds (State *state) const =0
 Bring the state within the bounds of the state space. For unbounded spaces this function can be a no-op. More...
 
virtual bool satisfiesBounds (const State *state) const =0
 Check if a state is inside the bounding box. For unbounded spaces this function can always return true. More...
 
virtual void copyState (State *destination, const State *source) const =0
 Copy a state to another. The memory of source and destination should NOT overlap. More...
 
StatecloneState (const State *source) const
 Clone a state. More...
 
virtual double distance (const State *state1, const State *state2) const =0
 Computes distance between two states. This function satisfies the properties of a metric if isMetricSpace() is true, and its return value will always be between 0 and getMaximumExtent() More...
 
virtual unsigned int getSerializationLength () const
 Get the number of chars in the serialization of a state in this space. More...
 
virtual void serialize (void *serialization, const State *state) const
 Write the binary representation of state to serialization. More...
 
virtual void deserialize (State *state, const void *serialization) const
 Read the binary representation of a state from serialization and write it to state. More...
 
virtual bool equalStates (const State *state1, const State *state2) const =0
 Checks whether two states are equal. More...
 
virtual void interpolate (const State *from, const State *to, 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. More...
 
virtual StateSamplerPtr allocDefaultStateSampler () const =0
 Allocate an instance of the default uniform state sampler for this space. More...
 
virtual StateSamplerPtr allocStateSampler () const
 Allocate an instance of the state sampler for this space. This sampler will be allocated with the sampler allocator that was previously specified by setStateSamplerAllocator() or, if no sampler allocator was specified, allocDefaultStateSampler() is called. More...
 
void setStateSamplerAllocator (const StateSamplerAllocator &ssa)
 Set the sampler allocator to use. More...
 
void clearStateSamplerAllocator ()
 Clear the state sampler allocator (reset to default) More...
 
virtual StateallocState () const =0
 Allocate a state that can store a point in the described space. More...
 
virtual void freeState (State *state) const =0
 Free the memory of the allocated state. More...
 
Functionality specific to accessing real values in a state
virtual double * getValueAddressAtIndex (State *state, 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 nullptr. More...
 
const double * getValueAddressAtIndex (const State *state, unsigned int index) const
 Const variant of the same function as above;. More...
 
const std::vector< ValueLocation > & getValueLocations () const
 Get the locations of values of type double contained in a state from this space. The order of the values is consistent with getValueAddressAtIndex(). The setup() function must have been previously called. More...
 
const std::map< std::string, ValueLocation > & getValueLocationsByName () const
 Get the named locations of values of type double contained in a state from this space. The setup() function must have been previously called. More...
 
double * getValueAddressAtLocation (State *state, const ValueLocation &loc) const
 Get a pointer to the double value in state that loc points to. More...
 
const double * getValueAddressAtLocation (const State *state, const ValueLocation &loc) const
 Const variant of the same function as above;. More...
 
double * getValueAddressAtName (State *state, const std::string &name) const
 Get a pointer to the double value in state that name points to. More...
 
const double * getValueAddressAtName (const State *state, const std::string &name) const
 Const variant of the same function as above;. More...
 
virtual void copyToReals (std::vector< double > &reals, const State *source) const
 Copy all the real values from a state source to the array reals using getValueAddressAtLocation() More...
 
virtual void copyFromReals (State *destination, const std::vector< double > &reals) const
 Copy the values from reals to the state destination using getValueAddressAtLocation() More...
 
Management of projections from this state space to Euclidean spaces
void registerProjection (const std::string &name, const ProjectionEvaluatorPtr &projection)
 Register a projection for this state space under a specified name. More...
 
void registerDefaultProjection (const ProjectionEvaluatorPtr &projection)
 Register the default projection for this state space. More...
 
virtual void registerProjections ()
 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(). More...
 
ProjectionEvaluatorPtr getProjection (const std::string &name) const
 Get the projection registered under a specific name. More...
 
ProjectionEvaluatorPtr getDefaultProjection () const
 Get the default projection. More...
 
bool hasProjection (const std::string &name) const
 Check if a projection with a specified name is available. More...
 
bool hasDefaultProjection () const
 Check if a default projection is available. More...
 
const std::map< std::string, ProjectionEvaluatorPtr > & getRegisteredProjections () const
 Get all the registered projections. More...
 
Operations with substates
StateSamplerPtr allocSubspaceStateSampler (const StateSpacePtr &subspace) const
 Allocate a sampler that actually samples only components that are part of subspace. More...
 
virtual StateSamplerPtr allocSubspaceStateSampler (const StateSpace *subspace) const
 Allocate a sampler that actually samples only components that are part of subspace. More...
 
StategetSubstateAtLocation (State *state, const SubstateLocation &loc) const
 Get the substate of state that is pointed to by loc. More...
 
const StategetSubstateAtLocation (const State *state, const SubstateLocation &loc) const
 Get the substate of state that is pointed to by loc. More...
 
const std::map< std::string, SubstateLocation > & getSubstateLocationsByName () const
 Get the list of known substate locations (keys of the map corrspond to names of subspaces) More...
 
void getCommonSubspaces (const StateSpacePtr &other, std::vector< std::string > &subspaces) const
 Get the set of subspaces that this space and other have in common. The computed list of subspaces does not contain spaces that cover each other, even though they may be common, as that is redundant information. More...
 
void getCommonSubspaces (const StateSpace *other, std::vector< std::string > &subspaces) const
 Get the set of subspaces that this space and other have in common. The computed list of subspaces does not contain spaces that cover each other, even though they may be common, as that is redundant information. More...
 
virtual void computeLocations ()
 Compute the location information for various components of the state space. Either this function or setup() must be called before any calls to getValueAddressAtName(), getValueAddressAtLocation() (and other functions where those are used). More...
 

Protected Attributes

int type_
 A type assigned for this state space. More...
 
StateSamplerAllocator ssa_
 An optional state sampler allocator. More...
 
double maxExtent_
 The extent of this space at the time setup() was called. More...
 
double longestValidSegmentFraction_
 The fraction of the longest valid segment. More...
 
double longestValidSegment_
 The longest valid segment at the time setup() was called. More...
 
unsigned int longestValidSegmentCountFactor_
 The factor to multiply the value returned by validSegmentCount(). Rarely used but useful for things like doubling the resolution. More...
 
std::map< std::string, ProjectionEvaluatorPtrprojections_
 List of available projections. More...
 
ParamSet params_
 The set of parameters for this space. More...
 
std::vector< ValueLocationvalueLocationsInOrder_
 The value locations for all varliables of type double contained in a state; The locations point to values in the same order as that returned by getValueAddressAtIndex() More...
 
std::map< std::string, ValueLocationvalueLocationsByName_
 All the known value locations, by name. The names of state spaces access the first element of a state. RealVectorStateSpace dimensions are used to access individual dimensions. More...
 
std::map< std::string, SubstateLocationsubstateLocationsByName_
 All the known substat locations, by name. More...
 

Static Protected Attributes

static const std::string DEFAULT_PROJECTION_NAME = ""
 The name used for the default projection. More...
 

Debugging tools

virtual void printState (const State *state, std::ostream &out=std::cout) const
 Print a state to a stream. More...
 
virtual void printSettings (std::ostream &out) const
 Print the settings for this state space to a stream. More...
 
virtual void printProjections (std::ostream &out) const
 Print the list of registered projections. This function is also called by printSettings() More...
 
virtual void sanityChecks (double zero, double eps, unsigned int flags) const
 Perform sanity checks for this state space. Throws an exception if failures are found. More...
 
virtual void sanityChecks () const
 Convenience function that allows derived state spaces to choose which checks should pass (see SanityChecks flags) and how strict the checks are. This just calls sanityChecks() with some default arguments. More...
 
void diagram (std::ostream &out) const
 Print a Graphviz digraph that represents the containment diagram for the state space. More...
 
void list (std::ostream &out) const
 Print the list of all contained state space instances. More...
 
static void Diagram (std::ostream &out)
 Print a Graphviz digraph that represents the containment diagram for all the instantiated state spaces. More...
 
static void List (std::ostream &out)
 Print the list of available state space instances. More...
 

Detailed Description

Representation of a space in which planning can be performed. Topology specific sampling, interpolation and distance are defined.

See Implementing State Spaces.

Definition at line 70 of file StateSpace.h.

Member Typedef Documentation

◆ StateType

Define the type of state allocated by this space.

Definition at line 78 of file StateSpace.h.

Member Enumeration Documentation

◆ SanityChecks

Flags to use in a bit mask for state space sanity checks. Some basic checks do not have flags associated (they are always executed; for example, whether copyState() works as expected)

Enumerator
STATESPACE_DISTANCE_DIFFERENT_STATES 

Check whether the distances between non-equal states is strictly positive (StateSpace::distance())

STATESPACE_DISTANCE_SYMMETRIC 

Check whether the distance function is symmetric (StateSpace::distance())

STATESPACE_INTERPOLATION 

Check whether calling StateSpace::interpolate() works as expected.

STATESPACE_TRIANGLE_INEQUALITY 

Check whether the triangle inequality holds when using StateSpace::interpolate() and StateSpace::distance()

STATESPACE_DISTANCE_BOUND 

Check whether the StateSpace::distance() is bounded by StateSpace::getExtent()

STATESPACE_RESPECT_BOUNDS 

Check whether sampled states are always within bounds.

STATESPACE_ENFORCE_BOUNDS_NO_OP 

Check that enforceBounds() does not modify the contents of states that are within bounds.

STATESPACE_SERIALIZATION 

Check whether the StateSpace::serialize() and StateSpace::deserialize() work as expected.

Definition at line 134 of file StateSpace.h.

Constructor & Destructor Documentation

◆ StateSpace()

ompl::base::StateSpace::StateSpace ( )

Constructor. Assigns a unique name to the space.

Definition at line 84 of file StateSpace.cpp.

◆ ~StateSpace()

ompl::base::StateSpace::~StateSpace ( )
virtual

Definition at line 110 of file StateSpace.cpp.

Member Function Documentation

◆ allocDefaultStateSampler()

◆ allocState()

◆ allocStateSampler()

ompl::base::StateSamplerPtr ompl::base::StateSpace::allocStateSampler ( ) const
virtual

Allocate an instance of the state sampler for this space. This sampler will be allocated with the sampler allocator that was previously specified by setStateSamplerAllocator() or, if no sampler allocator was specified, allocDefaultStateSampler() is called.

Reimplemented in ompl::base::AtlasStateSpace, ompl::base::ProjectedStateSpace, ompl::base::MorseStateSpace, ompl::control::OpenDEStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 800 of file StateSpace.cpp.

◆ allocSubspaceStateSampler() [1/2]

ompl::base::StateSamplerPtr ompl::base::StateSpace::allocSubspaceStateSampler ( const StateSpace subspace) const
virtual

Allocate a sampler that actually samples only components that are part of subspace.

Reimplemented in ompl::base::WrapperStateSpace, ompl::base::CompoundStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 813 of file StateSpace.cpp.

◆ allocSubspaceStateSampler() [2/2]

ompl::base::StateSamplerPtr ompl::base::StateSpace::allocSubspaceStateSampler ( const StateSpacePtr subspace) const

Allocate a sampler that actually samples only components that are part of subspace.

Definition at line 808 of file StateSpace.cpp.

◆ as() [1/2]

template<class T >
T * ompl::base::StateSpace::as ( )
inline

Cast this instance to a desired type.

Make sure the type we are casting to is indeed a state space

Definition at line 87 of file StateSpace.h.

◆ as() [2/2]

template<class T >
const T * ompl::base::StateSpace::as ( ) 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 97 of file StateSpace.h.

◆ clearStateSamplerAllocator()

void ompl::base::StateSpace::clearStateSamplerAllocator ( )

Clear the state sampler allocator (reset to default)

Definition at line 795 of file StateSpace.cpp.

◆ cloneState()

ompl::base::State * ompl::base::StateSpace::cloneState ( const State source) const

Clone a state.

Definition at line 226 of file StateSpace.cpp.

◆ computeLocations()

void ompl::base::StateSpace::computeLocations ( )
virtual

Compute the location information for various components of the state space. Either this function or setup() must be called before any calls to getValueAddressAtName(), getValueAddressAtLocation() (and other functions where those are used).

Reimplemented in ompl::base::WrapperStateSpace, ompl::base::CompoundStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 214 of file StateSpace.cpp.

◆ computeSignature()

void ompl::base::StateSpace::computeSignature ( std::vector< int > &  signature) const
virtual

Compute an array of ints that uniquely identifies the structure of the state space. The first element of the signature is the number of integers that follow.

Reimplemented in ompl::base::WrapperStateSpace.

Definition at line 219 of file StateSpace.cpp.

◆ copyFromReals()

void ompl::base::StateSpace::copyFromReals ( State destination,
const std::vector< double > &  reals 
) const
virtual

Copy the values from reals to the state destination using getValueAddressAtLocation()

Reimplemented in ompl::base::WrapperStateSpace.

Definition at line 337 of file StateSpace.cpp.

◆ copyState()

virtual void ompl::base::StateSpace::copyState ( State destination,
const State source 
) const
pure virtual

◆ copyToReals()

void ompl::base::StateSpace::copyToReals ( std::vector< double > &  reals,
const State source 
) const
virtual

Copy all the real values from a state source to the array reals using getValueAddressAtLocation()

Reimplemented in ompl::base::WrapperStateSpace.

Definition at line 329 of file StateSpace.cpp.

◆ covers() [1/2]

bool ompl::base::StateSpace::covers ( const StateSpace 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.

Definition at line 483 of file StateSpace.cpp.

◆ covers() [2/2]

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.

Definition at line 473 of file StateSpace.cpp.

◆ deserialize()

void ompl::base::StateSpace::deserialize ( State state,
const void *  serialization 
) const
virtual

◆ Diagram()

void ompl::base::StateSpace::Diagram ( std::ostream &  out)
static

Print a Graphviz digraph that represents the containment diagram for all the instantiated state spaces.

Definition at line 580 of file StateSpace.cpp.

◆ diagram()

void ompl::base::StateSpace::diagram ( std::ostream &  out) const

Print a Graphviz digraph that represents the containment diagram for the state space.

Definition at line 553 of file StateSpace.cpp.

◆ distance()

virtual double ompl::base::StateSpace::distance ( const State state1,
const State state2 
) const
pure virtual

◆ enforceBounds()

virtual void ompl::base::StateSpace::enforceBounds ( State state) const
pure virtual

◆ equalStates()

virtual bool ompl::base::StateSpace::equalStates ( const State state1,
const State state2 
) const
pure virtual

◆ freeState()

◆ getCommonSubspaces() [1/2]

void ompl::base::StateSpace::getCommonSubspaces ( const StateSpace other,
std::vector< std::string > &  subspaces 
) const

Get the set of subspaces that this space and other have in common. The computed list of subspaces does not contain spaces that cover each other, even though they may be common, as that is redundant information.

Definition at line 498 of file StateSpace.cpp.

◆ getCommonSubspaces() [2/2]

void ompl::base::StateSpace::getCommonSubspaces ( const StateSpacePtr other,
std::vector< std::string > &  subspaces 
) const

Get the set of subspaces that this space and other have in common. The computed list of subspaces does not contain spaces that cover each other, even though they may be common, as that is redundant information.

Definition at line 493 of file StateSpace.cpp.

◆ getDefaultProjection()

ompl::base::ProjectionEvaluatorPtr ompl::base::StateSpace::getDefaultProjection ( ) const

Get the default projection.

Definition at line 723 of file StateSpace.cpp.

◆ getDimension()

virtual unsigned int ompl::base::StateSpace::getDimension ( ) const
pure virtual

◆ getLongestValidSegmentFraction()

double ompl::base::StateSpace::getLongestValidSegmentFraction ( ) 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.

Reimplemented in ompl::base::WrapperStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 841 of file StateSpace.cpp.

◆ getLongestValidSegmentLength()

double ompl::base::StateSpace::getLongestValidSegmentLength ( ) const
virtual

Get the longest valid segment at the time setup() was called.

Reimplemented in ompl::base::WrapperStateSpace.

Definition at line 846 of file StateSpace.cpp.

◆ getMaximumExtent()

virtual double ompl::base::StateSpace::getMaximumExtent ( ) const
pure virtual

Get the maximum value a call to distance() can return (or an upper bound). For unbounded state spaces, this function can return infinity.

Note
Tight upper bounds are preferred because the value of the extent is used in the automatic computation of parameters for planning. If the bounds are less tight, the automatically computed parameters will be less useful.

Implemented in ompl::base::DiscreteStateSpace, ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, ompl::base::WrapperStateSpace, ompl::base::CompoundStateSpace, and ompl::base::CForestStateSpaceWrapper.

◆ getMeasure()

virtual double ompl::base::StateSpace::getMeasure ( ) const
pure virtual

◆ getName()

const std::string & ompl::base::StateSpace::getName ( ) const

Get the name of the state space.

Definition at line 196 of file StateSpace.cpp.

◆ getProjection()

ompl::base::ProjectionEvaluatorPtr ompl::base::StateSpace::getProjection ( const std::string &  name) const

Get the projection registered under a specific name.

Definition at line 734 of file StateSpace.cpp.

◆ getRegisteredProjections()

const std::map< std::string, ompl::base::ProjectionEvaluatorPtr > & ompl::base::StateSpace::getRegisteredProjections ( ) const

Get all the registered projections.

Definition at line 747 of file StateSpace.cpp.

◆ getSerializationLength()

unsigned int ompl::base::StateSpace::getSerializationLength ( ) const
virtual

◆ getSubstateAtLocation() [1/2]

const ompl::base::State * ompl::base::StateSpace::getSubstateAtLocation ( const State state,
const SubstateLocation loc 
) const

Get the substate of state that is pointed to by loc.

Definition at line 297 of file StateSpace.cpp.

◆ getSubstateAtLocation() [2/2]

ompl::base::State * ompl::base::StateSpace::getSubstateAtLocation ( State state,
const SubstateLocation loc 
) const

Get the substate of state that is pointed to by loc.

Definition at line 289 of file StateSpace.cpp.

◆ getSubstateLocationsByName()

const std::map< std::string, ompl::base::StateSpace::SubstateLocation > & ompl::base::StateSpace::getSubstateLocationsByName ( ) const

Get the list of known substate locations (keys of the map corrspond to names of subspaces)

Definition at line 284 of file StateSpace.cpp.

◆ getType()

int ompl::base::StateSpace::getType ( ) 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 205 of file StateSpace.h.

◆ getValidSegmentCountFactor()

unsigned int ompl::base::StateSpace::getValidSegmentCountFactor ( ) const
virtual

Get the value used to multiply the return value of validSegmentCount().

Reimplemented in ompl::base::WrapperStateSpace.

Definition at line 836 of file StateSpace.cpp.

◆ getValueAddressAtIndex() [1/2]

const double * ompl::base::StateSpace::getValueAddressAtIndex ( const State state,
unsigned int  index 
) const

Const variant of the same function as above;.

Definition at line 311 of file StateSpace.cpp.

◆ getValueAddressAtIndex() [2/2]

double * ompl::base::StateSpace::getValueAddressAtIndex ( State state,
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 nullptr.

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. Ideally, state values should not be accessed by index. If accessing of individual state elements is however needed, getValueAddressAtLocation() provides a faster implementation.

Reimplemented in ompl::base::CForestStateSpaceWrapper, ompl::base::RealVectorStateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, ompl::base::WrapperStateSpace, and ompl::base::CompoundStateSpace.

Definition at line 306 of file StateSpace.cpp.

◆ getValueAddressAtLocation() [1/2]

const double * ompl::base::StateSpace::getValueAddressAtLocation ( const State state,
const ValueLocation loc 
) const

Const variant of the same function as above;.

Definition at line 353 of file StateSpace.cpp.

◆ getValueAddressAtLocation() [2/2]

double * ompl::base::StateSpace::getValueAddressAtLocation ( State state,
const ValueLocation loc 
) const

Get a pointer to the double value in state that loc points to.

Definition at line 345 of file StateSpace.cpp.

◆ getValueAddressAtName() [1/2]

const double * ompl::base::StateSpace::getValueAddressAtName ( const State state,
const std::string &  name 
) const

Const variant of the same function as above;.

Definition at line 368 of file StateSpace.cpp.

◆ getValueAddressAtName() [2/2]

double * ompl::base::StateSpace::getValueAddressAtName ( State state,
const std::string &  name 
) const

Get a pointer to the double value in state that name points to.

Definition at line 361 of file StateSpace.cpp.

◆ getValueLocations()

const std::vector< ompl::base::StateSpace::ValueLocation > & ompl::base::StateSpace::getValueLocations ( ) const

Get the locations of values of type double contained in a state from this space. The order of the values is consistent with getValueAddressAtIndex(). The setup() function must have been previously called.

Definition at line 318 of file StateSpace.cpp.

◆ getValueLocationsByName()

const std::map< std::string, ompl::base::StateSpace::ValueLocation > & ompl::base::StateSpace::getValueLocationsByName ( ) const

Get the named locations of values of type double contained in a state from this space. The setup() function must have been previously called.

Definition at line 324 of file StateSpace.cpp.

◆ hasDefaultProjection()

bool ompl::base::StateSpace::hasDefaultProjection ( ) const

Check if a default projection is available.

Definition at line 713 of file StateSpace.cpp.

◆ hasProjection()

bool ompl::base::StateSpace::hasProjection ( const std::string &  name) const

Check if a projection with a specified name is available.

Definition at line 718 of file StateSpace.cpp.

◆ hasSymmetricDistance()

bool ompl::base::StateSpace::hasSymmetricDistance ( ) const
virtual

Check if the distance function on this state space is symmetric, i.e. distance(s1,s2) = distance(s2,s1). Default implementation returns true.

Reimplemented in ompl::base::DubinsStateSpace, ompl::base::WrapperStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 780 of file StateSpace.cpp.

◆ hasSymmetricInterpolate()

bool ompl::base::StateSpace::hasSymmetricInterpolate ( ) const
virtual

Check if the interpolation function on this state space is symmetric, i.e. interpolate(from, to, t, state) = interpolate(to, from, 1-t, state). Default implementation returns true.

Reimplemented in ompl::base::DubinsStateSpace, ompl::base::WrapperStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 785 of file StateSpace.cpp.

◆ includes() [1/2]

bool ompl::base::StateSpace::includes ( const StateSpace other) const

Return true if other is a space included (perhaps equal, perhaps a subspace) in this one.

Definition at line 488 of file StateSpace.cpp.

◆ includes() [2/2]

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.

Definition at line 478 of file StateSpace.cpp.

◆ interpolate()

virtual void ompl::base::StateSpace::interpolate ( const State from,
const State to,
double  t,
State state 
) const
pure virtual

◆ isCompound()

bool ompl::base::StateSpace::isCompound ( ) const
virtual

Check if the state space is compound.

Reimplemented in ompl::base::WrapperStateSpace, ompl::base::CompoundStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 765 of file StateSpace.cpp.

◆ isDiscrete()

bool ompl::base::StateSpace::isDiscrete ( ) const
virtual

Check if the set of states is discrete.

Note
In fact, because of limited numerical precision, the representation of all spaces is discrete; this function returns true if the corresponding mathematical object is a discrete one.

Reimplemented in ompl::base::DiscreteStateSpace, ompl::base::WrapperStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 770 of file StateSpace.cpp.

◆ isHybrid()

bool ompl::base::StateSpace::isHybrid ( ) const
virtual

Check if this is a hybrid state space (i.e., both discrete and continuous components exist)

Reimplemented in ompl::base::WrapperStateSpace, ompl::base::CompoundStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 775 of file StateSpace.cpp.

◆ isMetricSpace()

virtual bool ompl::base::StateSpace::isMetricSpace ( ) const
inlinevirtual

Return true if the distance function associated with the space is a metric.

Reimplemented in ompl::base::ConstrainedStateSpace, ompl::base::DubinsStateSpace, ompl::base::WrapperStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 183 of file StateSpace.h.

◆ List()

void ompl::base::StateSpace::List ( std::ostream &  out)
static

Print the list of available state space instances.

Definition at line 527 of file StateSpace.cpp.

◆ list()

void ompl::base::StateSpace::list ( std::ostream &  out) const

Print the list of all contained state space instances.

Definition at line 535 of file StateSpace.cpp.

◆ params() [1/2]

ParamSet & ompl::base::StateSpace::params ( )
inline

Get the parameters for this space.

Definition at line 225 of file StateSpace.h.

◆ params() [2/2]

const ParamSet & ompl::base::StateSpace::params ( ) const
inline

Get the parameters for this space.

Definition at line 231 of file StateSpace.h.

◆ printProjections()

void ompl::base::StateSpace::printProjections ( std::ostream &  out) const
virtual

Print the list of registered projections. This function is also called by printSettings()

Reimplemented in ompl::base::WrapperStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 399 of file StateSpace.cpp.

◆ printSettings()

void ompl::base::StateSpace::printSettings ( std::ostream &  out) const
virtual

◆ printState()

void ompl::base::StateSpace::printState ( const State state,
std::ostream &  out = std::cout 
) const
virtual

◆ registerDefaultProjection()

void ompl::base::StateSpace::registerDefaultProjection ( const ProjectionEvaluatorPtr projection)

Register the default projection for this state space.

Definition at line 752 of file StateSpace.cpp.

◆ registerProjection()

void ompl::base::StateSpace::registerProjection ( const std::string &  name,
const ProjectionEvaluatorPtr projection 
)

Register a projection for this state space under a specified name.

Definition at line 757 of file StateSpace.cpp.

◆ registerProjections()

void ompl::base::StateSpace::registerProjections ( )
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 KinematicChainSpace, ompl::base::DiscreteStateSpace, ompl::base::RealVectorStateSpace, ompl::base::SE2StateSpace, ompl::base::SE3StateSpace, ompl::base::SO2StateSpace, ompl::base::SO3StateSpace, ompl::base::TimeStateSpace, ompl::base::WrapperStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 233 of file StateSpace.cpp.

◆ sanityChecks() [1/2]

void ompl::base::StateSpace::sanityChecks ( ) const
virtual

Convenience function that allows derived state spaces to choose which checks should pass (see SanityChecks flags) and how strict the checks are. This just calls sanityChecks() with some default arguments.

Reimplemented in ompl::base::ConstrainedStateSpace, ompl::base::TangentBundleStateSpace, ompl::base::DubinsStateSpace, ompl::base::ReedsSheppStateSpace, ompl::base::WrapperStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 603 of file StateSpace.cpp.

◆ sanityChecks() [2/2]

void ompl::base::StateSpace::sanityChecks ( double  zero,
double  eps,
unsigned int  flags 
) const
virtual

Perform sanity checks for this state space. Throws an exception if failures are found.

Note
This checks if distances are always positive, whether the integration works as expected, etc.

Reimplemented in ompl::base::WrapperStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 609 of file StateSpace.cpp.

◆ satisfiesBounds()

virtual bool ompl::base::StateSpace::satisfiesBounds ( const State state) const
pure virtual

◆ serialize()

void ompl::base::StateSpace::serialize ( void *  serialization,
const State state 
) const
virtual

◆ setLongestValidSegmentFraction()

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.

Note
This function's effect is not considered until after setup() has been called. For immediate effects (i.e., during planning) use setValidSegmentCountFactor()

Reimplemented in ompl::base::WrapperStateSpace, ompl::base::CompoundStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 828 of file StateSpace.cpp.

◆ setName()

void ompl::base::StateSpace::setName ( const std::string &  name)

Set the name of the state space.

Definition at line 201 of file StateSpace.cpp.

◆ setStateSamplerAllocator()

void ompl::base::StateSpace::setStateSamplerAllocator ( const StateSamplerAllocator ssa)

Set the sampler allocator to use.

Definition at line 790 of file StateSpace.cpp.

◆ setup()

void ompl::base::StateSpace::setup ( )
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 and call their setup() functions. It is safe to call this function multiple times. At a subsequent call, projections that have been previously user configured are not re-instantiated, but their setup() method is still called.

Reimplemented in ompl::base::ConstrainedStateSpace, ompl::base::DiscreteStateSpace, ompl::base::RealVectorStateSpace, ompl::base::WrapperStateSpace, ompl::base::CompoundStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 237 of file StateSpace.cpp.

◆ setValidSegmentCountFactor()

void ompl::base::StateSpace::setValidSegmentCountFactor ( unsigned int  factor)
virtual

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

Reimplemented in ompl::base::WrapperStateSpace.

Definition at line 820 of file StateSpace.cpp.

◆ validSegmentCount()

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::ConstrainedStateSpace, ompl::base::WrapperStateSpace, ompl::base::CompoundStateSpace, and ompl::base::CForestStateSpaceWrapper.

Definition at line 851 of file StateSpace.cpp.

Member Data Documentation

◆ DEFAULT_PROJECTION_NAME

const std::string ompl::base::StateSpace::DEFAULT_PROJECTION_NAME = ""
staticprotected

The name used for the default projection.

Definition at line 528 of file StateSpace.h.

◆ longestValidSegment_

double ompl::base::StateSpace::longestValidSegment_
protected

The longest valid segment at the time setup() was called.

Definition at line 543 of file StateSpace.h.

◆ longestValidSegmentCountFactor_

unsigned int ompl::base::StateSpace::longestValidSegmentCountFactor_
protected

The factor to multiply the value returned by validSegmentCount(). Rarely used but useful for things like doubling the resolution.

Definition at line 547 of file StateSpace.h.

◆ longestValidSegmentFraction_

double ompl::base::StateSpace::longestValidSegmentFraction_
protected

The fraction of the longest valid segment.

Definition at line 540 of file StateSpace.h.

◆ maxExtent_

double ompl::base::StateSpace::maxExtent_
protected

The extent of this space at the time setup() was called.

Definition at line 537 of file StateSpace.h.

◆ params_

ParamSet ompl::base::StateSpace::params_
protected

The set of parameters for this space.

Definition at line 553 of file StateSpace.h.

◆ projections_

std::map<std::string, ProjectionEvaluatorPtr> ompl::base::StateSpace::projections_
protected

List of available projections.

Definition at line 550 of file StateSpace.h.

◆ ssa_

StateSamplerAllocator ompl::base::StateSpace::ssa_
protected

An optional state sampler allocator.

Definition at line 534 of file StateSpace.h.

◆ substateLocationsByName_

std::map<std::string, SubstateLocation> ompl::base::StateSpace::substateLocationsByName_
protected

All the known substat locations, by name.

Definition at line 565 of file StateSpace.h.

◆ type_

int ompl::base::StateSpace::type_
protected

A type assigned for this state space.

Definition at line 531 of file StateSpace.h.

◆ valueLocationsByName_

std::map<std::string, ValueLocation> ompl::base::StateSpace::valueLocationsByName_
protected

All the known value locations, by name. The names of state spaces access the first element of a state. RealVectorStateSpace dimensions are used to access individual dimensions.

Definition at line 562 of file StateSpace.h.

◆ valueLocationsInOrder_

std::vector<ValueLocation> ompl::base::StateSpace::valueLocationsInOrder_
protected

The value locations for all varliables of type double contained in a state; The locations point to values in the same order as that returned by getValueAddressAtIndex()

Definition at line 557 of file StateSpace.h.


The documentation for this class was generated from the following files: