openrave.org

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
OpenRAVE::ConfigurationSpecification Class Reference

A configuration specification references values in the environment that then define a configuration-space which can be searched for. More...

#include <openrave.h>

Collaboration diagram for OpenRAVE::ConfigurationSpecification:
Collaboration graph
[legend]

Classes

class  Group
 A group referencing the values of one body in the environment. More...
 
class  Reader
 

Public Types

typedef boost::function< void(const
std::vector< dReal > &)> 
SetConfigurationStateFn
 
typedef boost::function< void(std::vector
< dReal > &)> 
GetConfigurationStateFn
 

Public Member Functions

 ConfigurationSpecification ()
 
 ConfigurationSpecification (const Group &g)
 
 ConfigurationSpecification (const ConfigurationSpecification &c)
 
virtual ~ConfigurationSpecification ()
 
virtual int GetDOF () const
 return the dimension of the configuraiton space (degrees of freedom)
 
virtual bool IsValid () const
 check if the groups form a continguous space
 
virtual void Validate () const
 check if the groups form a continguous space
 
virtual bool operator== (const ConfigurationSpecification &r) const
 
virtual bool operator!= (const ConfigurationSpecification &r) const
 
virtual const GroupGetGroupFromName (const std::string &name) const
 return the group whose name begins with a particular string.
 
virtual GroupGetGroupFromName (const std::string &name)
 return the group whose name begins with a particular string.
 
virtual std::vector< Group >
::const_iterator 
FindCompatibleGroup (const Group &g, bool exactmatch=false) const
 finds the most compatible group to the given group
 
virtual std::vector< Group >
::const_iterator 
FindCompatibleGroup (const std::string &name, bool exactmatch=false) const
 finds the most compatible group to the given group
 
virtual std::vector< Group >
::const_iterator 
FindTimeDerivativeGroup (const Group &g, bool exactmatch=false) const
 Return the most compatible group that represents the time-derivative data of the group.
 
virtual std::vector< Group >
::const_iterator 
FindTimeDerivativeGroup (const std::string &name, bool exactmatch=false) const
 Return the most compatible group that represents the time-derivative data of the group.
 
virtual void AddDerivativeGroups (int deriv, bool adddeltatime=false)
 adds velocity, acceleration, etc groups for every position group.
 
void AddVelocityGroups (bool adddeltatime) RAVE_DEPRECATED
 
virtual ConfigurationSpecification ConvertToVelocitySpecification () const
 converts all the groups to the corresponding velocity groups and returns the specification
 
virtual ConfigurationSpecification GetTimeDerivativeSpecification (int timederivative) const
 returns a new specification of just particular time-derivative groups.
 
virtual void ResetGroupOffsets ()
 set the offsets of each group in order to get a contiguous configuration space
 
virtual int AddDeltaTimeGroup ()
 adds the deltatime tag to the end if one doesn't exist and returns the index into the configuration space
 
virtual int AddGroup (const std::string &name, int dof, const std::string &interpolation="")
 Adds a new group to the specification and returns its new offset.
 
virtual
ConfigurationSpecification
operator+= (const ConfigurationSpecification &r)
 Merges all the information from the input group into this group.
 
virtual ConfigurationSpecification operator+ (const ConfigurationSpecification &r) const
 Return a new specification that holds the merged information from the current and input specification and the input parameter..
 
virtual bool ExtractTransform (Transform &t, std::vector< dReal >::const_iterator itdata, KinBodyConstPtr pbody, int timederivative=0) const
 extracts an affine transform given the start of a configuration space point
 
virtual bool ExtractIkParameterization (IkParameterization &ikparam, std::vector< dReal >::const_iterator itdata, int timederivative=0) const
 extracts an ikparameterization given the start of a configuration space point
 
virtual bool ExtractAffineValues (std::vector< dReal >::iterator itvalues, std::vector< dReal >::const_iterator itdata, KinBodyConstPtr pbody, int affinedofs, int timederivative=0) const
 extracts the affine values
 
virtual bool ExtractJointValues (std::vector< dReal >::iterator itvalues, std::vector< dReal >::const_iterator itdata, KinBodyConstPtr pbody, const std::vector< int > &indices, int timederivative=0) const
 extracts a body's joint values given the start of a configuration space point
 
virtual bool ExtractDeltaTime (dReal &deltatime, std::vector< dReal >::const_iterator itdata) const
 extracts the delta time from the configuration if one exists
 
virtual bool InsertJointValues (std::vector< dReal >::iterator itdata, std::vector< dReal >::const_iterator itvalues, KinBodyConstPtr pbody, const std::vector< int > &indices, int timederivative=0) const
 inserts a set of joint values into a configuration space point
 
virtual bool InsertDeltaTime (std::vector< dReal >::iterator itdata, dReal deltatime) const
 sets the deltatime field of the data if one exists
 
virtual int AddGroup (const Group &g)
 Adds a new group to the specification and returns its new offset.
 
virtual boost::shared_ptr
< SetConfigurationStateFn
GetSetFn (EnvironmentBasePtr penv) const
 return a function to set the states of the configuration in the environment
 
virtual boost::shared_ptr
< GetConfigurationStateFn
GetGetFn (EnvironmentBasePtr penv) const
 return a function to get the states of the configuration in the environment
 

Static Public Member Functions

static void ConvertGroupData (std::vector< dReal >::iterator ittargetdata, size_t targetstride, const Group &gtarget, std::vector< dReal >::const_iterator itsourcedata, size_t sourcestride, const Group &gsource, size_t numpoints, EnvironmentBaseConstPtr penv, bool filluninitialized=true)
 given two compatible groups, convers data represented in the source group to data represented in the target group
 
static void ConvertData (std::vector< dReal >::iterator ittargetdata, const ConfigurationSpecification &targetspec, std::vector< dReal >::const_iterator itsourcedata, const ConfigurationSpecification &sourcespec, size_t numpoints, EnvironmentBaseConstPtr penv, bool filluninitialized=true)
 Converts from one specification to another.
 
static std::string GetInterpolationDerivative (const std::string &interpolation, int deriv=1)
 gets the name of the interpolation that represents the derivative of the passed in interpolation.
 

Public Attributes

std::vector< Group_vgroups
 

Detailed Description

A configuration specification references values in the environment that then define a configuration-space which can be searched for.

It is composed of several groups targetting values for individual bodies. It is serialized into XML. The XML syntax is as follows:

<configuration>
<group name="string" offset="#OFF1" dof="#D1" interpolation="string"/>
<group name="string" offset="#OFF2" dof="#D2" interpolation="string"/>
</configuration>
Examples:
ormulticontrol.cpp, orplanning_multirobot.cpp, and orpr2turnlever.cpp.

Definition at line 940 of file openrave.h.

Member Typedef Documentation

typedef boost::function<void (std::vector<dReal>&)> OpenRAVE::ConfigurationSpecification::GetConfigurationStateFn

Definition at line 1207 of file openrave.h.

typedef boost::function<void (const std::vector<dReal>&)> OpenRAVE::ConfigurationSpecification::SetConfigurationStateFn

Definition at line 1206 of file openrave.h.

Constructor & Destructor Documentation

OpenRAVE::ConfigurationSpecification::ConfigurationSpecification ( )
OpenRAVE::ConfigurationSpecification::ConfigurationSpecification ( const Group g)
OpenRAVE::ConfigurationSpecification::ConfigurationSpecification ( const ConfigurationSpecification c)
virtual OpenRAVE::ConfigurationSpecification::~ConfigurationSpecification ( )
inlinevirtual

Definition at line 1009 of file openrave.h.

Member Function Documentation

virtual int OpenRAVE::ConfigurationSpecification::AddDeltaTimeGroup ( )
virtual

adds the deltatime tag to the end if one doesn't exist and returns the index into the configuration space

Examples:
ormulticontrol.cpp.
virtual void OpenRAVE::ConfigurationSpecification::AddDerivativeGroups ( int  deriv,
bool  adddeltatime = false 
)
virtual

adds velocity, acceleration, etc groups for every position group.

If the derivative groups already exist, they are checked for and/or modified. Note that the configuration space might be re-ordered as a result of this function call. If a new group is added, its interpolation will be the derivative of the position group as returned by GetInterpolationDerivative.

Parameters
derivThe position derivative to add, this must be greater than 0. If 2 is specified, only the acceleration groups of the alread present position groups will be added.
adddeltatimeIf true will add the 'deltatime' tag, which is necessary for trajectory sampling
virtual int OpenRAVE::ConfigurationSpecification::AddGroup ( const std::string &  name,
int  dof,
const std::string &  interpolation = "" 
)
virtual

Adds a new group to the specification and returns its new offset.

If the new group's semantic name does not exist in the current specification, adds it and returns the new offset. If the new group's semantic name exists in the current specification and it exactly matches, then function returns the old group's index. If the semantic names match, but parameters do not match, then an openrave_exception is thrown. This method is not responsible for merging semantic information

virtual int OpenRAVE::ConfigurationSpecification::AddGroup ( const Group g)
virtual

Adds a new group to the specification and returns its new offset.

Parameters
gthe group whose name, dof, and interpolation are extracted. If the new group's semantic name does not exist in the current specification, adds it and returns the new offset. If the new group's semantic name exists in the current specification and it exactly matches, then function returns the old group's index. If the semantic names match, but parameters do not match, then an openrave_exception is thrown. This method is not responsible for merging semantic information
void OpenRAVE::ConfigurationSpecification::AddVelocityGroups ( bool  adddeltatime)
inline
Deprecated:
(12/07/30)

Definition at line 1085 of file openrave.h.

static void OpenRAVE::ConfigurationSpecification::ConvertData ( std::vector< dReal >::iterator  ittargetdata,
const ConfigurationSpecification targetspec,
std::vector< dReal >::const_iterator  itsourcedata,
const ConfigurationSpecification sourcespec,
size_t  numpoints,
EnvironmentBaseConstPtr  penv,
bool  filluninitialized = true 
)
static

Converts from one specification to another.

Parameters
ittargetdataiterator pointing to start of target group data that should be overwritten
targetspecthe target configuration specification
itsourcedataiterator pointing to start of source group data that should be read
sourcespecthe source configuration specification
numpointsthe number of points to convert. The target and source strides are gtarget.dof and gsource.dof
penv[optional] The environment which might be needed to fill in unknown data. Assumes environment is locked.
filluninitializedIf there exists target groups that cannot be initialized, then will set default values using the current environment. For example, the current joint values of the body will be used.
static void OpenRAVE::ConfigurationSpecification::ConvertGroupData ( std::vector< dReal >::iterator  ittargetdata,
size_t  targetstride,
const Group gtarget,
std::vector< dReal >::const_iterator  itsourcedata,
size_t  sourcestride,
const Group gsource,
size_t  numpoints,
EnvironmentBaseConstPtr  penv,
bool  filluninitialized = true 
)
static

given two compatible groups, convers data represented in the source group to data represented in the target group

Parameters
ittargetdataiterator pointing to start of target group data that should be overwritten
targetstridethe number of elements that to go from the next target point. Necessary if numpoints > 1.
gtargetthe target configuration group
itsourcedataiterator pointing to start of source group data that should be read
sourcestridethe number of elements that to go from the next source point. Necessary if numpoints > 1.
gsourcethe source configuration group
numpointsthe number of points to convert. The target and source strides are gtarget.dof and gsource.dof
penv[optional] The environment which might be needed to fill in unknown data. Assumes environment is locked.
filluninitializedIf there exists target groups that cannot be initialized, then will set default values using the current environment. For example, the current joint values of the body will be used.
Exceptions
openrave_exceptionthrow f groups are incompatible
virtual ConfigurationSpecification OpenRAVE::ConfigurationSpecification::ConvertToVelocitySpecification ( ) const
virtual

converts all the groups to the corresponding velocity groups and returns the specification

The velocity configuration space will have a one-to-one correspondence with the original configuration. The interpolation of each of the groups will correspondingly represent the derivative as returned by GetInterpolationDerivative. Only position specifications will be converted, any other groups will be left untouched.

virtual bool OpenRAVE::ConfigurationSpecification::ExtractAffineValues ( std::vector< dReal >::iterator  itvalues,
std::vector< dReal >::const_iterator  itdata,
KinBodyConstPtr  pbody,
int  affinedofs,
int  timederivative = 0 
) const
virtual

extracts the affine values

Looks for 'affine_X' groups. If pbody is not initialized, will choose the first affine_X found.

Parameters
inout]itvalues iterator to vector that holds the default values and will be overwritten with the new values. must be initialized
[in]itdatadata in the format of this configuration specification.
[in]affinedofsthe format of the affine dofs requested
[in]timederivativethe time derivative of the data to extract
Returns
true if at least one group was found for extracting
virtual bool OpenRAVE::ConfigurationSpecification::ExtractDeltaTime ( dReal deltatime,
std::vector< dReal >::const_iterator  itdata 
) const
virtual

extracts the delta time from the configuration if one exists

Returns
true if deltatime exists in the current configuration, otherwise false
virtual bool OpenRAVE::ConfigurationSpecification::ExtractIkParameterization ( IkParameterization ikparam,
std::vector< dReal >::const_iterator  itdata,
int  timederivative = 0 
) const
virtual

extracts an ikparameterization given the start of a configuration space point

Looks for 'ikparam' groups.

Parameters
inout]ikparam filled with ikparameterization (if found)
[in]itdatadata in the format of this configuration specification
[in]timederivativethe time derivative of the data to extract
Returns
true if at least one group was found for extracting
virtual bool OpenRAVE::ConfigurationSpecification::ExtractJointValues ( std::vector< dReal >::iterator  itvalues,
std::vector< dReal >::const_iterator  itdata,
KinBodyConstPtr  pbody,
const std::vector< int > &  indices,
int  timederivative = 0 
) const
virtual

extracts a body's joint values given the start of a configuration space point

Looks for 'joint_X' groups. If pbody is not initialized, will choose the first joint_X found.

Parameters
inout]itvalues iterator to vector that holds the default values and will be overwritten with the new values. must be initialized
[in]itdatadata in the format of this configuration specification.
[in]indicesthe set of DOF indices of the body to extract and write into itvalues.
[in]timederivativethe time derivative of the data to extract
Returns
true if at least one group was found for extracting
virtual bool OpenRAVE::ConfigurationSpecification::ExtractTransform ( Transform t,
std::vector< dReal >::const_iterator  itdata,
KinBodyConstPtr  pbody,
int  timederivative = 0 
) const
virtual

extracts an affine transform given the start of a configuration space point

Looks for 'affine_transform' groups. If pbody is not initialized, will choose the first affine_transform found.

Parameters
inout]t the transform holding the default values, which will be overwritten with the new values.
[in]itdatadata in the format of this configuration specification.
[in]timederivativethe time derivative of the data to extract
Returns
true if at least one group was found for extracting
virtual std::vector<Group>::const_iterator OpenRAVE::ConfigurationSpecification::FindCompatibleGroup ( const Group g,
bool  exactmatch = false 
) const
virtual

finds the most compatible group to the given group

Parameters
gthe group to query, only the Group::name and Group::dof values are used
exactmatchif true, will only return groups whose name exactly matches with g.name
Returns
an iterator part of _vgroups that represents the most compatible group. If no group is found, will return _vgroups.end()
virtual std::vector<Group>::const_iterator OpenRAVE::ConfigurationSpecification::FindCompatibleGroup ( const std::string &  name,
bool  exactmatch = false 
) const
virtual

finds the most compatible group to the given group

Parameters
namethe name of the group to query
exactmatchif true, will only return groups whose name exactly matches with g.name
Returns
an iterator part of _vgroups that represents the most compatible group. If no group is found, will return _vgroups.end()
virtual std::vector<Group>::const_iterator OpenRAVE::ConfigurationSpecification::FindTimeDerivativeGroup ( const Group g,
bool  exactmatch = false 
) const
virtual

Return the most compatible group that represents the time-derivative data of the group.

For example given a 'joint_values' group, this will return the closest 'joint_velocities' group.

Parameters
gthe group to query, only the Group::name and Group::dof values are used
exactmatchif true, will only return groups whose name exactly matches with g.name
Returns
an iterator part of _vgroups that represents the most compatible group. If no group is found, will return _vgroups.end()
virtual std::vector<Group>::const_iterator OpenRAVE::ConfigurationSpecification::FindTimeDerivativeGroup ( const std::string &  name,
bool  exactmatch = false 
) const
virtual

Return the most compatible group that represents the time-derivative data of the group.

For example given a 'joint_values' group, this will return the closest 'joint_velocities' group.

Parameters
namethe name of the group to query
exactmatchif true, will only return groups whose name exactly matches with g.name
Returns
an iterator part of _vgroups that represents the most compatible group. If no group is found, will return _vgroups.end()
virtual int OpenRAVE::ConfigurationSpecification::GetDOF ( ) const
virtual

return the dimension of the configuraiton space (degrees of freedom)

Examples:
ormulticontrol.cpp.
virtual boost::shared_ptr<GetConfigurationStateFn> OpenRAVE::ConfigurationSpecification::GetGetFn ( EnvironmentBasePtr  penv) const
virtual

return a function to get the states of the configuration in the environment

virtual const Group& OpenRAVE::ConfigurationSpecification::GetGroupFromName ( const std::string &  name) const
virtual

return the group whose name begins with a particular string.

If multiple groups exist that begin with the same string, then the shortest one is returned.

Exceptions
openrave_exceptionif a group is not found
virtual Group& OpenRAVE::ConfigurationSpecification::GetGroupFromName ( const std::string &  name)
virtual

return the group whose name begins with a particular string.

If multiple groups exist that begin with the same string, then the shortest one is returned.

Exceptions
openrave_exceptionif a group is not found
static std::string OpenRAVE::ConfigurationSpecification::GetInterpolationDerivative ( const std::string &  interpolation,
int  deriv = 1 
)
static

gets the name of the interpolation that represents the derivative of the passed in interpolation.

For example GetInterpolationDerivative("quadratic") -> "linear"

Parameters
interpolationthe interpolation to start at
derivthe number of derivatives to take, should be > 0
virtual boost::shared_ptr<SetConfigurationStateFn> OpenRAVE::ConfigurationSpecification::GetSetFn ( EnvironmentBasePtr  penv) const
virtual

return a function to set the states of the configuration in the environment

virtual ConfigurationSpecification OpenRAVE::ConfigurationSpecification::GetTimeDerivativeSpecification ( int  timederivative) const
virtual

returns a new specification of just particular time-derivative groups.

Parameters
timederivativethe time derivative to query groups from. 0 is positions/joint values, 1 is velocities, 2 is accelerations, etc
virtual bool OpenRAVE::ConfigurationSpecification::InsertDeltaTime ( std::vector< dReal >::iterator  itdata,
dReal  deltatime 
) const
virtual

sets the deltatime field of the data if one exists

Parameters
inout]itdata data in the format of this configuration specification.
[in]deltatimethe delta time of the time stamp (from previous point)
Returns
true if at least one group was found for inserting
virtual bool OpenRAVE::ConfigurationSpecification::InsertJointValues ( std::vector< dReal >::iterator  itdata,
std::vector< dReal >::const_iterator  itvalues,
KinBodyConstPtr  pbody,
const std::vector< int > &  indices,
int  timederivative = 0 
) const
virtual

inserts a set of joint values into a configuration space point

Looks for 'joint_X' groups. If pbody is not initialized, will use the first joint_X found.

Parameters
inout]itdata data in the format of this configuration specification.
[in]itvaluesiterator to joint values to write
[in]indicesthe set of DOF indices that itvalues represents.
[in]timederivativethe time derivative of the data to insert
Returns
true if at least one group was found for inserting
virtual bool OpenRAVE::ConfigurationSpecification::IsValid ( ) const
virtual

check if the groups form a continguous space

If there are two or more groups with the same semantic names, will fail. Theese groups should be merged into one.

Returns
true if valid, otherwise false
virtual bool OpenRAVE::ConfigurationSpecification::operator!= ( const ConfigurationSpecification r) const
virtual
virtual ConfigurationSpecification OpenRAVE::ConfigurationSpecification::operator+ ( const ConfigurationSpecification r) const
virtual

Return a new specification that holds the merged information from the current and input specification and the input parameter..

For groups that are merged, the interpolation either has to match for both groups, or one of the groups needs an empty interpolation.

Exceptions
openrave_exceptionthrows if groups do not contain enough information to be merged or interpolations do not match.
virtual ConfigurationSpecification& OpenRAVE::ConfigurationSpecification::operator+= ( const ConfigurationSpecification r)
virtual

Merges all the information from the input group into this group.

For groups that are merged, the interpolation is overwritten if the source group has an empty string.

Exceptions
openrave_exceptionthrows if groups do not contain enough information to be merged or interpolations do not match.
virtual bool OpenRAVE::ConfigurationSpecification::operator== ( const ConfigurationSpecification r) const
virtual
virtual void OpenRAVE::ConfigurationSpecification::ResetGroupOffsets ( )
virtual

set the offsets of each group in order to get a contiguous configuration space

virtual void OpenRAVE::ConfigurationSpecification::Validate ( ) const
virtual

check if the groups form a continguous space

If there are two or more groups with the same semantic names, will fail. Theese groups should be merged into one.

Exceptions
openrave_exceptionif not valid

Member Data Documentation

std::vector<Group> OpenRAVE::ConfigurationSpecification::_vgroups

Definition at line 1249 of file openrave.h.


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