Loading...
Searching...
No Matches
ompl::control::DiscreteControlSpace Class Reference

A space representing discrete controls; i.e. there are a small number of discrete controls the system can react to. Controls are represented as integers [lowerBound, upperBound], where lowerBound and upperBound are inclusive. More...

#include <ompl/control/spaces/DiscreteControlSpace.h>

Inheritance diagram for ompl::control::DiscreteControlSpace:

Classes

class  ControlType
 The definition of a discrete control. More...
 

Public Member Functions

 DiscreteControlSpace (const base::StateSpacePtr &stateSpace, int lowerBound, int upperBound)
 Construct a discrete space in wich controls can take values in the set [lowerBound, upperBound]. More...
 
unsigned int getDimension () const override
 Get the dimension of this control space. 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...
 
ControlSamplerPtr allocDefaultControlSampler () const override
 Allocate the default control sampler. More...
 
ControlallocControl () const override
 Allocate memory for a control. More...
 
void freeControl (Control *control) const override
 Free the memory of a control. More...
 
void nullControl (Control *control) const override
 This sets the control value to lowerBound_. More...
 
void printControl (const Control *control, std::ostream &out) 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...
 
unsigned int getControlCount () const
 Returns the number of controls possible. More...
 
int getLowerBound () const
 Returns the lowest possible control value. More...
 
int getUpperBound () const
 Returns the highest possible control value. More...
 
void setBounds (int lowerBound, int upperBound)
 Set the bounds for the states in this space (the states will be in the set [lowerBound, upperBound]. 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...
 
- 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

int lowerBound_
 The lowest integer state. More...
 
int upperBound_
 The highest integer state. 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 space representing discrete controls; i.e. there are a small number of discrete controls the system can react to. Controls are represented as integers [lowerBound, upperBound], where lowerBound and upperBound are inclusive.

Definition at line 62 of file DiscreteControlSpace.h.

Constructor & Destructor Documentation

◆ DiscreteControlSpace()

ompl::control::DiscreteControlSpace::DiscreteControlSpace ( const base::StateSpacePtr &  stateSpace,
int  lowerBound,
int  upperBound 
)
inline

Construct a discrete space in wich controls can take values in the set [lowerBound, upperBound].

Definition at line 75 of file DiscreteControlSpace.h.

Member Function Documentation

◆ allocControl()

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

Allocate memory for a control.

Implements ompl::control::ControlSpace.

Definition at line 66 of file DiscreteControlSpace.cpp.

◆ allocDefaultControlSampler()

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

Allocate the default control sampler.

Implements ompl::control::ControlSpace.

Definition at line 61 of file DiscreteControlSpace.cpp.

◆ copyControl()

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

Copy a control to another.

Implements ompl::control::ControlSpace.

Definition at line 51 of file DiscreteControlSpace.cpp.

◆ deserialize()

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

Deserializes a control from the serialization buffer.

Reimplemented from ompl::control::ControlSpace.

Definition at line 114 of file DiscreteControlSpace.cpp.

◆ equalControls()

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

Check if two controls are the same.

Implements ompl::control::ControlSpace.

Definition at line 56 of file DiscreteControlSpace.cpp.

◆ freeControl()

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

Free the memory of a control.

Implements ompl::control::ControlSpace.

Definition at line 71 of file DiscreteControlSpace.cpp.

◆ getControlCount()

unsigned int ompl::control::DiscreteControlSpace::getControlCount ( ) const
inline

Returns the number of controls possible.

Definition at line 104 of file DiscreteControlSpace.h.

◆ getDimension()

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

Get the dimension of this control space.

Implements ompl::control::ControlSpace.

Definition at line 46 of file DiscreteControlSpace.cpp.

◆ getLowerBound()

int ompl::control::DiscreteControlSpace::getLowerBound ( ) const
inline

Returns the lowest possible control value.

Definition at line 110 of file DiscreteControlSpace.h.

◆ getSerializationLength()

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

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

Reimplemented from ompl::control::ControlSpace.

Definition at line 104 of file DiscreteControlSpace.cpp.

◆ getUpperBound()

int ompl::control::DiscreteControlSpace::getUpperBound ( ) const
inline

Returns the highest possible control value.

Definition at line 116 of file DiscreteControlSpace.h.

◆ nullControl()

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

This sets the control value to lowerBound_.

Implements ompl::control::ControlSpace.

Definition at line 76 of file DiscreteControlSpace.cpp.

◆ printControl()

void ompl::control::DiscreteControlSpace::printControl ( const Control control,
std::ostream &  out 
) const
overridevirtual

Print a control to a stream.

Reimplemented from ompl::control::ControlSpace.

Definition at line 81 of file DiscreteControlSpace.cpp.

◆ printSettings()

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

Print the settings for this control space to a stream.

Reimplemented from ompl::control::ControlSpace.

Definition at line 91 of file DiscreteControlSpace.cpp.

◆ serialize()

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

Serializes the given control into the serialization buffer.

Reimplemented from ompl::control::ControlSpace.

Definition at line 109 of file DiscreteControlSpace.cpp.

◆ setBounds()

void ompl::control::DiscreteControlSpace::setBounds ( int  lowerBound,
int  upperBound 
)
inline

Set the bounds for the states in this space (the states will be in the set [lowerBound, upperBound].

Definition at line 123 of file DiscreteControlSpace.h.

◆ setup()

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

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

Reimplemented from ompl::control::ControlSpace.

Definition at line 97 of file DiscreteControlSpace.cpp.

Member Data Documentation

◆ lowerBound_

int ompl::control::DiscreteControlSpace::lowerBound_
protected

The lowest integer state.

Definition at line 142 of file DiscreteControlSpace.h.

◆ upperBound_

int ompl::control::DiscreteControlSpace::upperBound_
protected

The highest integer state.

Definition at line 145 of file DiscreteControlSpace.h.


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