ompl::control::CompoundControlSpace Class Reference

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

#include <ompl/control/ControlSpace.h>

Inheritance diagram for ompl::control::CompoundControlSpace:

Public Types

using ControlType = ompl::control::CompoundControl
 Define the type of control allocated by this control space. More...
 

Public Member Functions

 CompoundControlSpace (const base::StateSpacePtr &stateSpace)
 Constructor. The corresponding state space needs to be specified. More...
 
template<class T >
T * as (const unsigned int index) const
 Cast a component of this instance to a desired type. More...
 
virtual void addSubspace (const ControlSpacePtr &component)
 Adds a control space as a component of the compound control space. More...
 
unsigned int getSubspaceCount () const
 Get the number of control spaces that make up the compound control space. More...
 
const ControlSpacePtrgetSubspace (unsigned int index) const
 Get a specific subspace from the compound control space. More...
 
const ControlSpacePtrgetSubspace (const std::string &name) const
 Get a specific subspace from the compound control space. More...
 
unsigned int getDimension () const override
 Get the dimension of this control space. More...
 
ControlallocControl () const override
 Allocate memory for a control. More...
 
void freeControl (Control *control) const override
 Free the memory of a control. More...
 
void copyControl (Control *destination, const Control *source) const override
 Copy a control to another. More...
 
bool equalControls (const Control *control1, const Control *control2) const override
 Check if two controls are the same. More...
 
void nullControl (Control *control) const override
 Make the control have no effect if it were to be applied to a state for any amount of time. More...
 
ControlSamplerPtr allocDefaultControlSampler () const override
 Allocate the default control sampler. More...
 
double * getValueAddressAtIndex (Control *control, unsigned int index) const override
 Many controls contain a number of double values. This function provides a means to get the memory address of a double value from a control control 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 control), the return value is nullptr. More...
 
void printControl (const Control *control, std::ostream &out=std::cout) const override
 Print a control to a stream. More...
 
void printSettings (std::ostream &out) const override
 Print the settings for this control space to a stream. More...
 
void setup () override
 Perform final setup steps. This function is automatically called by the SpaceInformation. More...
 
unsigned int getSerializationLength () const override
 Returns the serialization size for a single control in this space. More...
 
void serialize (void *serialization, const Control *ctrl) const override
 Serializes the given control into the serialization buffer. More...
 
void deserialize (Control *ctrl, const void *serialization) const override
 Deserializes a control from the serialization buffer. More...
 
bool isCompound () const override
 Check if the control space is compound. More...
 
void lock ()
 Lock this control space. This means no further control spaces can be added as components. This function can be for instance called from the constructor of a state space that inherits from CompoundControlSpace to prevent the user to add further components. More...
 
- Public Member Functions inherited from ompl::control::ControlSpace
 ControlSpace (const ControlSpace &)=delete
 
ControlSpaceoperator= (const ControlSpace &)=delete
 
 ControlSpace (base::StateSpacePtr stateSpace)
 Construct a control space, given the state 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...
 
const std::string & getName () const
 Get the name of the control space. More...
 
void setName (const std::string &name)
 Set the name of the control space. More...
 
int getType () const
 Get the type of the control space. The type can be used to verify whether two space instances are of the same type. More...
 
const base::StateSpacePtr & getStateSpace () const
 Return the state space this control space depends on. More...
 
virtual unsigned int getDimension () const =0
 Get the dimension of this control space. More...
 
virtual ControlallocControl () const =0
 Allocate memory for a control. More...
 
virtual void freeControl (Control *control) const =0
 Free the memory of a control. More...
 
virtual void copyControl (Control *destination, const Control *source) const =0
 Copy a control to another. More...
 
virtual bool equalControls (const Control *control1, const Control *control2) const =0
 Check if two controls are the same. More...
 
virtual void nullControl (Control *control) const =0
 Make the control have no effect if it were to be applied to a state for any amount of time. More...
 
virtual ControlSamplerPtr allocDefaultControlSampler () const =0
 Allocate the default control sampler. More...
 
virtual ControlSamplerPtr allocControlSampler () const
 Allocate an instance of the control sampler for this space. This sampler will be allocated with the sampler allocator that was previously specified by setControlSamplerAllocator() or, if no sampler allocator was specified, allocDefaultControlSampler() is called. More...
 
void setControlSamplerAllocator (const ControlSamplerAllocator &csa)
 Set the sampler allocator to use. More...
 
void clearControlSamplerAllocator ()
 Clear the control sampler allocator (reset to default) More...
 
virtual double * getValueAddressAtIndex (Control *control, unsigned int index) const
 Many controls contain a number of double values. This function provides a means to get the memory address of a double value from a control control 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 control), the return value is nullptr. More...
 
virtual void printControl (const Control *control, std::ostream &out) const
 Print a control to a stream. More...
 
virtual void printSettings (std::ostream &out) const
 Print the settings for this control space to a stream. More...
 
virtual void setup ()
 Perform final setup steps. This function is automatically called by the SpaceInformation. More...
 
virtual unsigned int getSerializationLength () const
 Returns the serialization size for a single control in this space. More...
 
virtual void serialize (void *serialization, const Control *ctrl) const
 Serializes the given control into the serialization buffer. More...
 
virtual void deserialize (Control *ctrl, const void *serialization) const
 Deserializes a control from the serialization buffer. More...
 
void computeSignature (std::vector< int > &signature) const
 Compute an array of ints that uniquely identifies the structure of the control space. The first element of the signature is the number of integers that follow. More...
 
virtual bool isCompound () const
 Check if the control space is compound. More...
 

Protected Attributes

std::vector< ControlSpacePtrcomponents_
 The component control spaces that make up the compound control space. More...
 
unsigned int componentCount_
 The number of contained components. More...
 
bool locked_
 Flag indicating whether adding further components is allowed or not. More...
 
- Protected Attributes inherited from ompl::control::ControlSpace
int type_
 A type assigned for this control space. More...
 
base::StateSpacePtr stateSpace_
 The state space controls can be applied to. More...
 
ControlSamplerAllocator csa_
 An optional control sampler allocator. More...
 

Detailed Description

A control space to allow the composition of control spaces.

Definition at line 198 of file ControlSpace.h.

Member Typedef Documentation

◆ ControlType

Define the type of control allocated by this control space.

Definition at line 202 of file ControlSpace.h.

Constructor & Destructor Documentation

◆ CompoundControlSpace()

ompl::control::CompoundControlSpace::CompoundControlSpace ( const base::StateSpacePtr &  stateSpace)
inline

Constructor. The corresponding state space needs to be specified.

Definition at line 205 of file ControlSpace.h.

Member Function Documentation

◆ addSubspace()

void ompl::control::CompoundControlSpace::addSubspace ( const ControlSpacePtr component)
virtual

Adds a control space as a component of the compound control space.

Definition at line 143 of file ControlSpace.cpp.

◆ allocControl()

ompl::control::Control * ompl::control::CompoundControlSpace::allocControl ( ) const
overridevirtual

Allocate memory for a control.

Implements ompl::control::ControlSpace.

Definition at line 180 of file ControlSpace.cpp.

◆ allocDefaultControlSampler()

ompl::control::ControlSamplerPtr ompl::control::CompoundControlSpace::allocDefaultControlSampler ( ) const
overridevirtual

Allocate the default control sampler.

Implements ompl::control::ControlSpace.

Definition at line 223 of file ControlSpace.cpp.

◆ as()

template<class T >
T * ompl::control::CompoundControlSpace::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 control space

Definition at line 214 of file ControlSpace.h.

◆ copyControl()

void ompl::control::CompoundControlSpace::copyControl ( Control destination,
const Control source 
) const
overridevirtual

Copy a control to another.

Implements ompl::control::ControlSpace.

Definition at line 198 of file ControlSpace.cpp.

◆ deserialize()

void ompl::control::CompoundControlSpace::deserialize ( Control ctrl,
const void *  serialization 
) const
overridevirtual

Deserializes a control from the serialization buffer.

Reimplemented from ompl::control::ControlSpace.

Definition at line 300 of file ControlSpace.cpp.

◆ equalControls()

bool ompl::control::CompoundControlSpace::equalControls ( const Control control1,
const Control control2 
) const
overridevirtual

Check if two controls are the same.

Implements ompl::control::ControlSpace.

Definition at line 206 of file ControlSpace.cpp.

◆ freeControl()

void ompl::control::CompoundControlSpace::freeControl ( Control control) const
overridevirtual

Free the memory of a control.

Implements ompl::control::ControlSpace.

Definition at line 189 of file ControlSpace.cpp.

◆ getDimension()

unsigned int ompl::control::CompoundControlSpace::getDimension ( ) const
overridevirtual

Get the dimension of this control space.

Implements ompl::control::ControlSpace.

Definition at line 172 of file ControlSpace.cpp.

◆ getSerializationLength()

unsigned int ompl::control::CompoundControlSpace::getSerializationLength ( ) const
overridevirtual

Returns the serialization size for a single control in this space.

Reimplemented from ompl::control::ControlSpace.

Definition at line 281 of file ControlSpace.cpp.

◆ getSubspace() [1/2]

const ompl::control::ControlSpacePtr & ompl::control::CompoundControlSpace::getSubspace ( const std::string &  name) const

Get a specific subspace from the compound control space.

Definition at line 164 of file ControlSpace.cpp.

◆ getSubspace() [2/2]

const ompl::control::ControlSpacePtr & ompl::control::CompoundControlSpace::getSubspace ( unsigned int  index) const

Get a specific subspace from the compound control space.

Definition at line 157 of file ControlSpace.cpp.

◆ getSubspaceCount()

unsigned int ompl::control::CompoundControlSpace::getSubspaceCount ( ) const

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

Definition at line 152 of file ControlSpace.cpp.

◆ getValueAddressAtIndex()

double * ompl::control::CompoundControlSpace::getValueAddressAtIndex ( Control control,
unsigned int  index 
) const
overridevirtual

Many controls contain a number of double values. This function provides a means to get the memory address of a double value from a control control 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 control), the return value is nullptr.

Reimplemented from ompl::control::ControlSpace.

Definition at line 236 of file ControlSpace.cpp.

◆ isCompound()

bool ompl::control::CompoundControlSpace::isCompound ( ) const
overridevirtual

Check if the control space is compound.

Reimplemented from ompl::control::ControlSpace.

Definition at line 311 of file ControlSpace.cpp.

◆ lock()

void ompl::control::CompoundControlSpace::lock ( )

Lock this control space. This means no further control spaces can be added as components. This function can be for instance called from the constructor of a state space that inherits from CompoundControlSpace to prevent the user to add further components.

Definition at line 231 of file ControlSpace.cpp.

◆ nullControl()

void ompl::control::CompoundControlSpace::nullControl ( Control control) const
overridevirtual

Make the control have no effect if it were to be applied to a state for any amount of time.

Implements ompl::control::ControlSpace.

Definition at line 216 of file ControlSpace.cpp.

◆ printControl()

void ompl::control::CompoundControlSpace::printControl ( const Control control,
std::ostream &  out = std::cout 
) const
overridevirtual

Print a control to a stream.

Reimplemented from ompl::control::ControlSpace.

Definition at line 257 of file ControlSpace.cpp.

◆ printSettings()

void ompl::control::CompoundControlSpace::printSettings ( std::ostream &  out) const
overridevirtual

Print the settings for this control space to a stream.

Reimplemented from ompl::control::ControlSpace.

Definition at line 266 of file ControlSpace.cpp.

◆ serialize()

void ompl::control::CompoundControlSpace::serialize ( void *  serialization,
const Control ctrl 
) const
overridevirtual

Serializes the given control into the serialization buffer.

Reimplemented from ompl::control::ControlSpace.

Definition at line 289 of file ControlSpace.cpp.

◆ setup()

void ompl::control::CompoundControlSpace::setup ( )
overridevirtual

Perform final setup steps. This function is automatically called by the SpaceInformation.

Reimplemented from ompl::control::ControlSpace.

Definition at line 274 of file ControlSpace.cpp.

Member Data Documentation

◆ componentCount_

unsigned int ompl::control::CompoundControlSpace::componentCount_
protected

The number of contained components.

Definition at line 279 of file ControlSpace.h.

◆ components_

std::vector<ControlSpacePtr> ompl::control::CompoundControlSpace::components_
protected

The component control spaces that make up the compound control space.

Definition at line 276 of file ControlSpace.h.

◆ locked_

bool ompl::control::CompoundControlSpace::locked_
protected

Flag indicating whether adding further components is allowed or not.

Definition at line 282 of file ControlSpace.h.


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