37 #ifndef OMPL_CONTROL_CONTROL_SPACE_
38 #define OMPL_CONTROL_CONTROL_SPACE_
40 #include "ompl/base/StateSpace.h"
41 #include "ompl/control/Control.h"
42 #include "ompl/control/ControlSampler.h"
43 #include "ompl/control/ControlSpaceTypes.h"
45 #include "ompl/util/ClassForward.h"
46 #include <boost/concept_check.hpp>
47 #include <boost/noncopyable.hpp>
59 OMPL_CLASS_FORWARD(ControlSpace);
80 BOOST_CONCEPT_ASSERT((boost::Convertible<T*, ControlSpace*>));
82 return static_cast<T*
>(
this);
87 const T*
as(
void)
const
90 BOOST_CONCEPT_ASSERT((boost::Convertible<T*, ControlSpace*>));
92 return static_cast<const T*
>(
this);
96 const std::string&
getName(
void)
const;
99 void setName(
const std::string &name);
160 virtual void setup(
void);
214 T*
as(
const unsigned int index)
const
217 BOOST_CONCEPT_ASSERT((boost::Convertible<T*, ControlSpace*>));
254 virtual void setup(
void);
int getType(void) const
Get the type of the control space. The type can be used to verify whether two space instances are of ...
virtual void serialize(void *serialization, const Control *ctrl) const
Serializes the given control into the serialization buffer.
void clearControlSamplerAllocator(void)
Clear the control sampler allocator (reset to default)
base::StateSpacePtr stateSpace_
The state space controls can be applied to.
virtual void freeControl(Control *control) const =0
Free the memory of a control.
virtual unsigned int getDimension(void) const
Get the dimension of this control space.
bool locked_
Flag indicating whether adding further components is allowed or not.
virtual void addSubspace(const ControlSpacePtr &component)
Adds a control space as a component of the compound control space.
Definition of an abstract control.
A boost shared pointer wrapper for ompl::base::StateSpace.
A boost shared pointer wrapper for ompl::control::ControlSampler.
virtual unsigned int getSerializationLength(void) const
Returns the serialization size for a single control in this space.
virtual void deserialize(Control *ctrl, const void *serialization) const
Deserializes a control from the serialization buffer.
virtual void serialize(void *serialization, const Control *ctrl) const
Serializes the given control into the serialization buffer.
virtual bool isCompound(void) const
Check if the control space is compound.
virtual void copyControl(Control *destination, const Control *source) const =0
Copy a control to another.
const ControlSpacePtr & getSubspace(const unsigned int index) const
Get a specific subspace from the compound control space.
virtual ControlSamplerPtr allocDefaultControlSampler(void) const =0
Allocate the default control sampler.
CompoundControl ControlType
Define the type of control allocated by this control space.
virtual void setup(void)
Perform final setup steps. This function is automatically called by the SpaceInformation.
void setName(const std::string &name)
Set the name of the control space.
virtual ControlSamplerPtr allocDefaultControlSampler(void) const
Allocate the default control sampler.
virtual Control * allocControl(void) const =0
Allocate memory for a control.
const T * as(void) const
Cast this instance to a desired type.
unsigned int getSubspaceCount(void) const
Get the number of control spaces that make up the compound control space.
CompoundControlSpace(const base::StateSpacePtr &stateSpace)
Constructor. The corresponding state space needs to be specified.
T * as(const unsigned int index) const
Cast a component of this instance to a desired type.
virtual void printControl(const Control *control, std::ostream &out=std::cout) const
Print a control to a stream.
virtual void printSettings(std::ostream &out) const
Print the settings for this control space to a stream.
virtual double * getValueAddressAtIndex(Control *control, const unsigned int index) const
Many controls contain a number of double values. This function provides a means to get the memory add...
std::vector< ControlSpacePtr > components_
The component control spaces that make up the compound control space.
A boost shared pointer wrapper for ompl::control::ControlSpace.
Definition of a compound control.
const std::string & getName(void) const
Get the name of the control space.
virtual void copyControl(Control *destination, const Control *source) const
Copy a control to another.
int type_
A type assigned for this control space.
virtual double * getValueAddressAtIndex(Control *control, const unsigned int index) const
Many controls contain a number of double values. This function provides a means to get the memory add...
virtual void setup(void)
Perform final setup steps. This function is automatically called by the SpaceInformation.
ControlSpace(const base::StateSpacePtr &stateSpace)
Construct a control space, given the state space.
A control space representing the space of applicable controls.
virtual bool equalControls(const Control *control1, const Control *control2) const
Check if two controls are the same.
virtual unsigned int getSerializationLength(void) const
Returns the serialization size for a single control in this space.
unsigned int componentCount_
The number of contained components.
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...
virtual void printControl(const Control *control, std::ostream &out) const
Print a control to a stream.
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.
void setControlSamplerAllocator(const ControlSamplerAllocator &csa)
Set the sampler allocator to use.
ControlSamplerAllocator csa_
An optional control sampler allocator.
virtual unsigned int getDimension(void) const =0
Get the dimension of this control space.
A control space to allow the composition of control spaces.
const base::StateSpacePtr & getStateSpace(void) const
Return the state space this control space depends on.
virtual bool isCompound(void) const
Check if the control space is compound.
virtual Control * allocControl(void) const
Allocate memory for a control.
void lock(void)
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.
virtual ControlSamplerPtr allocControlSampler(void) const
Allocate an instance of the control sampler for this space. This sampler will be allocated with the s...
virtual void deserialize(Control *ctrl, const void *serialization) const
Deserializes a control from the serialization buffer.
virtual void nullControl(Control *control) const
Make the control have no effect if it were to be applied to a state for any amount of time...
T * as(void)
Cast this instance to a desired type.
virtual void printSettings(std::ostream &out) const
Print the settings for this control space to a stream.
virtual void freeControl(Control *control) const
Free the memory of a control.
boost::function< ControlSamplerPtr(const ControlSpace *)> ControlSamplerAllocator
Definition of a function that can allocate a control sampler.
virtual bool equalControls(const Control *control1, const Control *control2) const =0
Check if two controls are the same.