openrave.org

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

Describes a common and serializable interface for planning parameters. More...

#include <planner.h>

Inheritance diagram for OpenRAVE::PlannerBase::PlannerParameters:
Inheritance graph
[legend]
Collaboration diagram for OpenRAVE::PlannerBase::PlannerParameters:
Collaboration graph
[legend]

Classes

class  StateSaver
 saves and restores the state using PlannerParameters::_setstatefn and PlannerParameters::_getstatefn More...
 

Public Types

typedef boost::shared_ptr
< StateSaver
StateSaverPtr
 
typedef boost::function< dReal(const
std::vector< dReal > &)> 
CostFn
 Cost function on the state pace (optional).
 
typedef boost::function< dReal(const
std::vector< dReal > &)> 
GoalFn
 Goal heuristic function.(optional)
 
typedef boost::function< dReal(const
std::vector< dReal > &, const
std::vector< dReal > &)> 
DistMetricFn
 Distance metric between configuration spaces (optional)
 
typedef boost::function< bool(const
std::vector< dReal > &, const
std::vector< dReal >
&, IntervalType,
PlannerBase::ConfigurationListPtr)> 
CheckPathConstraintFn
 Checks that all the constraints are satisfied between two configurations.
 
typedef boost::function< bool(std::vector
< dReal > &)> 
SampleFn
 Samples a random configuration (mandatory)
 
typedef boost::function< bool(std::vector
< dReal > &)> 
SampleGoalFn
 Samples a valid goal configuration (optional).
 
typedef boost::function< bool(std::vector
< dReal > &)> 
SampleInitialFn
 Samples a valid initial configuration (optional).
 
typedef boost::function< bool(std::vector
< dReal > &, const std::vector
< dReal > &, dReal)> 
SampleNeighFn
 Returns a random configuration around a neighborhood (optional).
 
typedef boost::function< void(const
std::vector< dReal > &)> 
SetStateFn
 Sets the state of the robot. Default is active robot joints (mandatory).
 
typedef boost::function< void(std::vector
< dReal > &)> 
GetStateFn
 Gets the state of the robot. Default is active robot joints (mandatory).
 
typedef boost::function< void(std::vector
< dReal > &, const std::vector
< dReal > &)> 
DiffStateFn
 Computes the difference of two states.
 
typedef boost::function< bool(std::vector
< dReal > &, const std::vector
< dReal > &, int)> 
NeighStateFn
 Adds a delta state to a curent state, acting like a next-nearest-neighbor function along a given direction.
 
- Public Types inherited from OpenRAVE::BaseXMLReader
enum  ProcessElement { PE_Pass =0, PE_Support =1, PE_Ignore =2 }
 

Public Member Functions

 PlannerParameters ()
 
virtual ~PlannerParameters ()
 
virtual PlannerParametersoperator= (const PlannerParameters &r)
 Attemps to copy data from one set of parameters to another in the safest manner.
 
virtual void copy (boost::shared_ptr< PlannerParameters const > r)
 
virtual void SetRobotActiveJoints (RobotBasePtr robot)
 sets up the planner parameters to use the active joints of the robot
 
virtual void SetConfigurationSpecification (EnvironmentBasePtr env, const ConfigurationSpecification &spec)
 sets up the planner parameters to use the configuration specification space
 
virtual void Validate () const
 veriries that the configuration space and all parameters are consistent
 
virtual int GetDOF () const
 Return the degrees of freedom of the planning configuration space.
 
- Public Member Functions inherited from OpenRAVE::BaseXMLReader
 BaseXMLReader ()
 
virtual ~BaseXMLReader ()
 
virtual XMLReadablePtr GetReadable ()
 
- Public Member Functions inherited from OpenRAVE::XMLReadable
 XMLReadable (const std::string &xmlid)
 
virtual ~XMLReadable ()
 
virtual const std::string & GetXMLId () const
 
virtual void Serialize (BaseXMLWriterPtr writer, int options=0) const
 serializes the interface
 
- Public Member Functions inherited from OpenRAVE::UserData
virtual ~UserData ()
 

Public Attributes

ConfigurationSpecification _configurationspecification
 the configuration specification in which the planner works in. This specification is passed to the trajecotry creation modules.
 
CostFn _costfn
 
GoalFn _goalfn
 
DistMetricFn _distmetricfn
 
CheckPathConstraintFn _checkpathconstraintsfn
 
SampleFn _samplefn
 
SampleGoalFn _samplegoalfn
 
SampleInitialFn _sampleinitialfn
 
SampleNeighFn _sampleneighfn
 
SetStateFn _setstatefn
 
GetStateFn _getstatefn
 
DiffStateFn _diffstatefn
 
NeighStateFn _neighstatefn
 
std::vector< dRealvinitialconfig
 
std::vector< dRealvgoalconfig
 
std::vector< dReal_vConfigLowerLimit
 the absolute limits of the configuration space.
 
std::vector< dReal_vConfigUpperLimit
 
std::vector< dReal_vConfigVelocityLimit
 the absolute velocity limits of each DOF of the configuration space.
 
std::vector< dReal_vConfigAccelerationLimit
 the absolute acceleration limits of each DOF of the configuration space.
 
std::vector< dReal_vConfigResolution
 the discretization resolution of each dimension of the configuration space
 
dReal _fStepLength
 a discretization between the path that connects two configurations
 
int _nMaxIterations
 maximum number of iterations before the planner gives up. If 0 or less, planner chooses best iterations.
 
std::string _sPostProcessingPlanner
 Specifies the planner that will perform the post-processing path smoothing before returning.
 
std::string _sPostProcessingParameters
 The serialized planner parameters to pass to the path optimizer.
 
std::string _sExtraParameters
 Extra parameters data that does not fit within this planner parameters structure, but is still important not to lose all the information.
 
- Public Attributes inherited from OpenRAVE::BaseXMLReader
std::string _filename
 XML filename/resource used for this class (can be empty)
 

Protected Member Functions

boost::shared_ptr
< PlannerBase::PlannerParameters
shared_parameters ()
 
boost::shared_ptr
< PlannerBase::PlannerParameters
const > 
shared_parameters_const () const
 
virtual bool serialize (std::ostream &O, int options=0) const
 output the planner parameters in a string (in XML format)
 

Friends

OPENRAVE_API std::ostream & operator<< (std::ostream &O, const PlannerParameters &v)
 outputs the data and surrounds it with
 
OPENRAVE_API std::istream & operator>> (std::istream &I, PlannerParameters &v)
 expects
 
std::stringstream _ss
 holds the data read by characters
 
boost::shared_ptr
< std::stringstream > 
_sslocal
 
std::vector< std::string > _vXMLParameters
 all the top-level XML parameter tags (lower case) that are handled by this parameter structure, should be registered in the constructor
 
virtual ProcessElement startElement (const std::string &name, const AttributesList &atts)
 
virtual bool endElement (const std::string &name)
 
virtual void characters (const std::string &ch)
 

Detailed Description

Describes a common and serializable interface for planning parameters.

The class is serializable to XML, so can be loaded from file or passed around the network. If extra parameters need to be specified, derive from this class and

Also allows the parameters and descriptions to be serialized to reStructuredText for documentation purposes.

Examples:
orplanning_door.cpp, orplanning_multirobot.cpp, and orplanning_planner.cpp.

Definition at line 63 of file planner.h.

Member Typedef Documentation

typedef boost::function<bool (const std::vector<dReal>&, const std::vector<dReal>&, IntervalType, PlannerBase::ConfigurationListPtr)> OpenRAVE::PlannerBase::PlannerParameters::CheckPathConstraintFn

Checks that all the constraints are satisfied between two configurations.

The simplest and most fundamental constraint is line-collision checking. The robot goes from q0 to q1.

success = _checkpathconstraints(q0,q1,interval,configurations)

When called, q0 is guaranteed to be set on the robot. The function returns true if the path to q1 satisfies all the constraints of the planner. If q0==q1, and interval==IT_OpenStart or IT_OpenEnd, then only one configuration should be checked. It is recommended to use IT_OpenStart. Because this function can internally use neighstatefn, need to make sure that Q0->Q1 is going from initial to goal direction.

Parameters
q0is the configuration the robot is coming from (currently set).
q1is the configuration the robot should move to.
intervalSpecifies whether to check the end points of the interval for constraints
configurationsOptional argument that will hold the intermediate configuraitons checked between q0 and q1 configurations. The appended configurations will be all valid and in free space. They are appended after the items already stored on the list.

Definition at line 179 of file planner.h.

typedef boost::function<dReal(const std::vector<dReal>&)> OpenRAVE::PlannerBase::PlannerParameters::CostFn

Cost function on the state pace (optional).

cost = _costfn(config)

Parameters
costthe cost of being in the current state

Definition at line 142 of file planner.h.

typedef boost::function<void (std::vector<dReal>&,const std::vector<dReal>&)> OpenRAVE::PlannerBase::PlannerParameters::DiffStateFn

Computes the difference of two states.

_diffstatefn(q1,q2) -> q1 -= q2

An explicit difference function is necessary for correct interpolation when there are circular joints. Default is regular subtraction.

Definition at line 236 of file planner.h.

typedef boost::function<dReal(const std::vector<dReal>&, const std::vector<dReal>&)> OpenRAVE::PlannerBase::PlannerParameters::DistMetricFn

Distance metric between configuration spaces (optional)

distmetric(config1,config2)

Two configurations are considered the same when function returns 0.

Definition at line 160 of file planner.h.

typedef boost::function<void (std::vector<dReal>&)> OpenRAVE::PlannerBase::PlannerParameters::GetStateFn

Gets the state of the robot. Default is active robot joints (mandatory).

Definition at line 226 of file planner.h.

typedef boost::function<dReal(const std::vector<dReal>&)> OpenRAVE::PlannerBase::PlannerParameters::GoalFn

Goal heuristic function.(optional)

distance = _goalfn(config)

Goal is complete when returns 0

Parameters
distance- distance to closest goal

Definition at line 152 of file planner.h.

typedef boost::function<bool (std::vector<dReal>&,const std::vector<dReal>&, int)> OpenRAVE::PlannerBase::PlannerParameters::NeighStateFn

Adds a delta state to a curent state, acting like a next-nearest-neighbor function along a given direction.

success = _neighstatefn(q,qdelta,fromgoal) -> q = Filter(q+qdelta)

Parameters
qthe current state. In order to save computation, assumes this state is the currently set configuration.
qdeltathe delta to add
fromgoal1 if q is coming from a goal state, 0 if it is coming from an initial state

In RRTs this is used for the extension operation. The new state is stored in the first parameter q. Note that the function can also add a filter to the final destination (like projecting onto a constraint manifold).

Definition at line 249 of file planner.h.

typedef boost::function<bool (std::vector<dReal>&)> OpenRAVE::PlannerBase::PlannerParameters::SampleFn

Samples a random configuration (mandatory)

The dimension of the returned sample is the dimension of the configuration space. success = samplefn(newsample)

Definition at line 187 of file planner.h.

typedef boost::function<bool (std::vector<dReal>&)> OpenRAVE::PlannerBase::PlannerParameters::SampleGoalFn

Samples a valid goal configuration (optional).

If valid, the function should be called at every iteration. Any type of sampling probabilities and conditions can be encoded inside the function. The dimension of the returned sample is the dimension of the configuration space. success = samplegoalfn(newsample)

Definition at line 197 of file planner.h.

typedef boost::function<bool (std::vector<dReal>&)> OpenRAVE::PlannerBase::PlannerParameters::SampleInitialFn

Samples a valid initial configuration (optional).

If valid, the function should be called at every iteration. Any type of sampling probabilities and conditions can be encoded inside the function. The dimension of the returned sample is the dimension of the configuration space. success = sampleinitialfn(newsample)

Definition at line 207 of file planner.h.

typedef boost::function<bool (std::vector<dReal>&, const std::vector<dReal>&, dReal)> OpenRAVE::PlannerBase::PlannerParameters::SampleNeighFn

Returns a random configuration around a neighborhood (optional).

_sampleneighfn(newsample,pCurSample,fRadius)

Parameters
pCurSample- the neighborhood to sample around
fRadius- specifies the max distance of sampling. The higher the value, the farther the samples will go The distance metric can be arbitrary, but is usually PlannerParameters::pdistmetric.
Returns
if sample was successfully generated return true, otherwise false

Definition at line 219 of file planner.h.

typedef boost::function<void (const std::vector<dReal>&)> OpenRAVE::PlannerBase::PlannerParameters::SetStateFn

Sets the state of the robot. Default is active robot joints (mandatory).

Definition at line 223 of file planner.h.

Definition at line 87 of file planner.h.

Constructor & Destructor Documentation

OpenRAVE::PlannerBase::PlannerParameters::PlannerParameters ( )

Definition at line 89 of file planner.cpp.

virtual OpenRAVE::PlannerBase::PlannerParameters::~PlannerParameters ( )
inlinevirtual

Definition at line 67 of file planner.h.

Member Function Documentation

void OpenRAVE::PlannerBase::PlannerParameters::characters ( const std::string &  ch)
protectedvirtual

gets called for all data in between tags.

Parameters
cha string to the data

Implements OpenRAVE::BaseXMLReader.

Reimplemented in OpenRAVE::WorkspaceTrajectoryParameters.

Definition at line 321 of file planner.cpp.

void OpenRAVE::PlannerBase::PlannerParameters::copy ( boost::shared_ptr< PlannerParameters const >  r)
virtual

Definition at line 153 of file planner.cpp.

bool OpenRAVE::PlannerBase::PlannerParameters::endElement ( const std::string &  name)
protectedvirtual

Gets called at the end of each "</type>" expression. In this case, name is "type"

Parameters
nameof the tag, will be always lower case
Returns
true if XMLReader has finished parsing (one condition is that name==_fieldname) , otherwise false

Implements OpenRAVE::BaseXMLReader.

Reimplemented in OpenRAVE::BasicRRTParameters, OpenRAVE::RRTParameters, OpenRAVE::WorkspaceTrajectoryParameters, OpenRAVE::ConstraintTrajectoryTimingParameters, OpenRAVE::TrajectoryTimingParameters, OpenRAVE::GraspParameters, OpenRAVE::GraspSetParameters, OpenRAVE::RAStarParameters, and OpenRAVE::ExplorationParameters.

Definition at line 261 of file planner.cpp.

virtual int OpenRAVE::PlannerBase::PlannerParameters::GetDOF ( ) const
inlinevirtual

Return the degrees of freedom of the planning configuration space.

Definition at line 294 of file planner.h.

PlannerBase::PlannerParameters & OpenRAVE::PlannerBase::PlannerParameters::operator= ( const PlannerParameters r)
virtual

Attemps to copy data from one set of parameters to another in the safest manner.

First serializes the data of the right hand into a string, then initializes the current parameters via >> pointers to functions are copied directly

have to do this or otherwise precision gets lost and planners' initial conditions can vioalte constraints

Definition at line 114 of file planner.cpp.

bool OpenRAVE::PlannerBase::PlannerParameters::serialize ( std::ostream &  O,
int  options = 0 
) const
protectedvirtual

output the planner parameters in a string (in XML format)

Parameters
optionsif 1 will skip writing the extra parameters don't use PlannerParameters as a tag!

Reimplemented in OpenRAVE::BasicRRTParameters, OpenRAVE::RRTParameters, OpenRAVE::WorkspaceTrajectoryParameters, OpenRAVE::ConstraintTrajectoryTimingParameters, OpenRAVE::TrajectoryTimingParameters, OpenRAVE::GraspParameters, OpenRAVE::GraspSetParameters, OpenRAVE::RAStarParameters, and OpenRAVE::ExplorationParameters.

Definition at line 158 of file planner.cpp.

void OpenRAVE::PlannerBase::PlannerParameters::SetConfigurationSpecification ( EnvironmentBasePtr  env,
const ConfigurationSpecification spec 
)
virtual

sets up the planner parameters to use the configuration specification space

The configuraiton groups should point to controllable target objects. By default, this includes:

  • joint_values
  • joint_velocities
  • affine_transform
  • affine_velocities
  • grab The following internal parameters will be set:
  • _diffstatefn
  • _distmetricfn - weights used for distance metric are retrieved at this time and stored
  • _samplefn
  • _sampleneighfn
  • _setstatefn
  • _getstatefn
  • _neighstatefn
  • _checkpathconstraintsfn
  • _vConfigLowerLimit
  • _vConfigUpperLimit
  • _vConfigVelocityLimit
  • _vConfigAccelerationLimit
  • _vConfigResolution
  • vinitialconfig
  • _configurationspecification
    Exceptions
    openrave_exceptionIf the configuration specification is invalid or points to targets that are not present in the environment.

Definition at line 552 of file planner.cpp.

void OpenRAVE::PlannerBase::PlannerParameters::SetRobotActiveJoints ( RobotBasePtr  robot)
virtual

sets up the planner parameters to use the active joints of the robot

Definition at line 340 of file planner.cpp.

boost::shared_ptr<PlannerBase::PlannerParameters> OpenRAVE::PlannerBase::PlannerParameters::shared_parameters ( )
inlineprotected

Definition at line 299 of file planner.h.

boost::shared_ptr<PlannerBase::PlannerParameters const > OpenRAVE::PlannerBase::PlannerParameters::shared_parameters_const ( ) const
inlineprotected

Definition at line 302 of file planner.h.

BaseXMLReader::ProcessElement OpenRAVE::PlannerBase::PlannerParameters::startElement ( const std::string &  name,
const AttributesList atts 
)
protectedvirtual

Gets called in the beginning of each "<type>" expression. In this case, name is "type"

Parameters
nameof the tag, will be always lower case
attsstring of attributes where the first std::string is the attribute name and second is the value
Returns
true if tag is accepted and this class will process it, otherwise false

Implements OpenRAVE::BaseXMLReader.

Reimplemented in OpenRAVE::BasicRRTParameters, OpenRAVE::RRTParameters, OpenRAVE::WorkspaceTrajectoryParameters, OpenRAVE::ConstraintTrajectoryTimingParameters, OpenRAVE::TrajectoryTimingParameters, OpenRAVE::GraspParameters, OpenRAVE::GraspSetParameters, OpenRAVE::RAStarParameters, and OpenRAVE::ExplorationParameters.

Definition at line 206 of file planner.cpp.

void OpenRAVE::PlannerBase::PlannerParameters::Validate ( ) const
virtual

veriries that the configuration space and all parameters are consistent

Assumes at minimum that _setstatefn and _getstatefn are set. Correct environment should be locked when this function is called since _getstatefn will be called.

Exceptions
openrave_exceptionIf not consistent, will throw an exception

Definition at line 664 of file planner.cpp.

Friends And Related Function Documentation

OPENRAVE_API std::ostream& operator<< ( std::ostream &  O,
const PlannerParameters v 
)
friend

outputs the data and surrounds it with

<PlannerParameters> 

tags

OPENRAVE_API std::istream& operator>> ( std::istream &  I,
PlannerBase::PlannerParameters v 
)
friend

expects

<PlannerParameters> 

to be the first token. Parses stream until

</PlannerParameters> 

reached

Member Data Documentation

CheckPathConstraintFn OpenRAVE::PlannerBase::PlannerParameters::_checkpathconstraintsfn

Definition at line 180 of file planner.h.

ConfigurationSpecification OpenRAVE::PlannerBase::PlannerParameters::_configurationspecification

the configuration specification in which the planner works in. This specification is passed to the trajecotry creation modules.

Definition at line 136 of file planner.h.

CostFn OpenRAVE::PlannerBase::PlannerParameters::_costfn

Definition at line 143 of file planner.h.

DiffStateFn OpenRAVE::PlannerBase::PlannerParameters::_diffstatefn

Definition at line 237 of file planner.h.

DistMetricFn OpenRAVE::PlannerBase::PlannerParameters::_distmetricfn

Definition at line 161 of file planner.h.

dReal OpenRAVE::PlannerBase::PlannerParameters::_fStepLength

a discretization between the path that connects two configurations

This length represents how dense the samples get distributed across the configuration space. It represents the maximum distance between neighbors when adding new configuraitons. If 0 or less, planner chooses best step length.

Definition at line 275 of file planner.h.

GetStateFn OpenRAVE::PlannerBase::PlannerParameters::_getstatefn

Definition at line 227 of file planner.h.

GoalFn OpenRAVE::PlannerBase::PlannerParameters::_goalfn

Definition at line 153 of file planner.h.

NeighStateFn OpenRAVE::PlannerBase::PlannerParameters::_neighstatefn

Definition at line 250 of file planner.h.

int OpenRAVE::PlannerBase::PlannerParameters::_nMaxIterations

maximum number of iterations before the planner gives up. If 0 or less, planner chooses best iterations.

Definition at line 278 of file planner.h.

SampleFn OpenRAVE::PlannerBase::PlannerParameters::_samplefn

Definition at line 188 of file planner.h.

SampleGoalFn OpenRAVE::PlannerBase::PlannerParameters::_samplegoalfn

Definition at line 198 of file planner.h.

SampleInitialFn OpenRAVE::PlannerBase::PlannerParameters::_sampleinitialfn

Definition at line 208 of file planner.h.

SampleNeighFn OpenRAVE::PlannerBase::PlannerParameters::_sampleneighfn

Definition at line 220 of file planner.h.

SetStateFn OpenRAVE::PlannerBase::PlannerParameters::_setstatefn

Definition at line 224 of file planner.h.

std::string OpenRAVE::PlannerBase::PlannerParameters::_sExtraParameters

Extra parameters data that does not fit within this planner parameters structure, but is still important not to lose all the information.

Definition at line 291 of file planner.h.

std::string OpenRAVE::PlannerBase::PlannerParameters::_sPostProcessingParameters

The serialized planner parameters to pass to the path optimizer.

For example: std::stringstream(_sPostProcessingParameters) >> _parameters;

Definition at line 288 of file planner.h.

std::string OpenRAVE::PlannerBase::PlannerParameters::_sPostProcessingPlanner

Specifies the planner that will perform the post-processing path smoothing before returning.

If empty, will not path smooth the returned trajectories (used to measure algorithm time)

Definition at line 283 of file planner.h.

std::stringstream OpenRAVE::PlannerBase::PlannerParameters::_ss
protected

holds the data read by characters

Definition at line 316 of file planner.h.

boost::shared_ptr<std::stringstream> OpenRAVE::PlannerBase::PlannerParameters::_sslocal
protected

Definition at line 317 of file planner.h.

std::vector<dReal> OpenRAVE::PlannerBase::PlannerParameters::_vConfigAccelerationLimit

the absolute acceleration limits of each DOF of the configuration space.

Definition at line 264 of file planner.h.

std::vector<dReal> OpenRAVE::PlannerBase::PlannerParameters::_vConfigLowerLimit

the absolute limits of the configuration space.

Definition at line 258 of file planner.h.

std::vector<dReal> OpenRAVE::PlannerBase::PlannerParameters::_vConfigResolution

the discretization resolution of each dimension of the configuration space

Definition at line 267 of file planner.h.

std::vector<dReal> OpenRAVE::PlannerBase::PlannerParameters::_vConfigUpperLimit

Definition at line 258 of file planner.h.

std::vector<dReal> OpenRAVE::PlannerBase::PlannerParameters::_vConfigVelocityLimit

the absolute velocity limits of each DOF of the configuration space.

Definition at line 261 of file planner.h.

std::vector<std::string> OpenRAVE::PlannerBase::PlannerParameters::_vXMLParameters
protected

all the top-level XML parameter tags (lower case) that are handled by this parameter structure, should be registered in the constructor

Definition at line 319 of file planner.h.

std::vector<dReal> OpenRAVE::PlannerBase::PlannerParameters::vgoalconfig

Definition at line 255 of file planner.h.

std::vector<dReal> OpenRAVE::PlannerBase::PlannerParameters::vinitialconfig

to specify multiple initial or goal configurations, put them into the vector in series size always has to be a multiple of GetDOF() note: not all planners support multiple goals

Definition at line 255 of file planner.h.


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