Describes a common and serializable interface for planning parameters.
More...
#include <planner.h>
|
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.
|
|
enum | ProcessElement { PE_Pass =0,
PE_Support =1,
PE_Ignore =2
} |
|
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.
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
-
q0 | is the configuration the robot is coming from (currently set). |
q1 | is the configuration the robot should move to. |
interval | Specifies whether to check the end points of the interval for constraints |
configurations | Optional 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.
Cost function on the state pace (optional).
cost = _costfn(config)
- Parameters
-
cost | the cost of being in the current state |
Definition at line 142 of file planner.h.
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.
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.
Gets the state of the robot. Default is active robot joints (mandatory).
Definition at line 226 of file planner.h.
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.
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
-
q | the current state. In order to save computation, assumes this state is the currently set configuration. |
qdelta | the delta to add |
fromgoal | 1 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.
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.
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.
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.
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.
Sets the state of the robot. Default is active robot joints (mandatory).
Definition at line 223 of file planner.h.
OpenRAVE::PlannerBase::PlannerParameters::PlannerParameters |
( |
| ) |
|
virtual OpenRAVE::PlannerBase::PlannerParameters::~PlannerParameters |
( |
| ) |
|
|
inlinevirtual |
void OpenRAVE::PlannerBase::PlannerParameters::characters |
( |
const std::string & |
ch | ) |
|
|
protectedvirtual |
void OpenRAVE::PlannerBase::PlannerParameters::copy |
( |
boost::shared_ptr< PlannerParameters const > |
r | ) |
|
|
virtual |
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
-
name | of 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.
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 |
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_exception | If 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.
Gets called in the beginning of each "<type>" expression. In this case, name is "type"
- Parameters
-
name | of the tag, will be always lower case |
atts | string 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
-
Definition at line 664 of file planner.cpp.
outputs the data and surrounds it with
<PlannerParameters>
tags
expects
<PlannerParameters>
to be the first token. Parses stream until
</PlannerParameters>
reached
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 |
DiffStateFn OpenRAVE::PlannerBase::PlannerParameters::_diffstatefn |
DistMetricFn OpenRAVE::PlannerBase::PlannerParameters::_distmetricfn |
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 |
GoalFn OpenRAVE::PlannerBase::PlannerParameters::_goalfn |
NeighStateFn OpenRAVE::PlannerBase::PlannerParameters::_neighstatefn |
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 |
SampleGoalFn OpenRAVE::PlannerBase::PlannerParameters::_samplegoalfn |
SampleNeighFn OpenRAVE::PlannerBase::PlannerParameters::_sampleneighfn |
SetStateFn OpenRAVE::PlannerBase::PlannerParameters::_setstatefn |
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 |
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 |
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 |
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: