Defines optimization objectives where path cost can be represented as a path integral over a cost function defined over the state space. This cost function is specified by implementing the stateCost() method. More...
#include <ompl/base/objectives/StateCostIntegralObjective.h>
Public Member Functions  
StateCostIntegralObjective (const SpaceInformationPtr &si, bool enableMotionCostInterpolation=false)  
If enableMotionCostInterpolation is set to true, then calls to motionCost() will divide the motion segment into smaller parts (the number of parts being defined by StateSpace::validSegmentCount()) for more accurate cost integral computation (but this takes more computation time). If enableMotionCostInterpolation is false (the default), only the two endpoint states are used for motion cost computation.  
Cost  stateCost (const State *s) const override 
Returns a cost with a value of 1.  
Cost  motionCost (const State *s1, const State *s2) const override 
Compute the cost of a path segment from s1 to s2 (including endpoints) More...  
bool  isMotionCostInterpolationEnabled () const 
Returns whether this objective subdivides motions into smaller segments for more accurate motion cost computation. Motion cost interpolation is disabled by default.  
Public Member Functions inherited from ompl::base::OptimizationObjective  
OptimizationObjective (const OptimizationObjective &)=delete  
OptimizationObjective &  operator= (const OptimizationObjective &)=delete 
OptimizationObjective (SpaceInformationPtr si)  
Constructor. The objective must always know the space information it is part of. The cost threshold for objective satisfaction defaults to 0.0.  
const std::string &  getDescription () const 
Get the description of this optimization objective.  
virtual bool  isSatisfied (Cost c) const 
Check if the the given cost c satisfies the specified cost objective, defined as better than the specified threshold.  
Cost  getCostThreshold () const 
Returns the cost threshold currently being checked for objective satisfaction.  
void  setCostThreshold (Cost c) 
Set the cost threshold for objective satisfaction. When a path is found with a cost better than the cost threshold, the objective is considered satisfied.  
virtual bool  isCostBetterThan (Cost c1, Cost c2) const 
Check whether the the cost c1 is considered better than the cost c2. By default, this returns true if if c1 is less than c2.  
virtual bool  isCostEquivalentTo (Cost c1, Cost c2) const 
Compare whether cost c1 and cost c2 are equivalent. By default defined as !isCostBetterThan(c1, c2) && !isCostBetterThan(c2, c1), as if c1 is not better than c2, and c2 is not better than c1, then they are equal.  
virtual bool  isFinite (Cost cost) const 
Returns whether the cost is finite or not.  
virtual Cost  betterCost (Cost c1, Cost c2) const 
Return the minimum cost given c1 and c2. Uses isCostBetterThan.  
virtual Cost  combineCosts (Cost c1, Cost c2) const 
Get the cost that corresponds to combining the costs c1 and c2. Default implementation defines this combination as an addition.  
virtual Cost  identityCost () const 
Get the identity cost value. The identity cost value is the cost c_i such that, for all costs c, combineCosts(c, c_i) = combineCosts(c_i, c) = c. In other words, combining a cost with the identity cost does not change the original cost. By default, a cost with the value 0.0 is returned. It's very important to override this with the proper identity value for your optimization objectives, or else optimal planners may not work.  
virtual Cost  infiniteCost () const 
Get a cost which is greater than all other costs in this OptimizationObjective; required for use in Dijkstra/Astar. Defaults to returning the double value inf.  
virtual Cost  initialCost (const State *s) const 
Returns a cost value corresponding to starting at a state s. No optimal planners currently support this method. Defaults to returning the objective's identity cost.  
virtual Cost  terminalCost (const State *s) const 
Returns a cost value corresponding to a path ending at a state s. No optimal planners currently support this method. Defaults to returning the objective's identity cost.  
virtual bool  isSymmetric () const 
Check if this objective has a symmetric cost metric, i.e. motionCost(s1, s2) = motionCost(s2, s1). Default implementation returns whether the underlying state space has symmetric interpolation.  
virtual Cost  averageStateCost (unsigned int numStates) const 
Compute the average state cost of this objective by taking a sample of numStates states.  
void  setCostToGoHeuristic (const CostToGoHeuristic &costToGo) 
Set the costtogo heuristic function for this objective. The costtogo heuristic is a function which returns an admissible estimate of the optimal path cost from a given state to a goal, where "admissible" means that the estimated cost is always less than the true optimal cost.  
bool  hasCostToGoHeuristic () const 
Check if this objective has a costtogo heuristic function.  
Cost  costToGo (const State *state, const Goal *goal) const 
Uses a costtogo heuristic to calculate an admissible estimate of the optimal cost from a given state to a given goal. If no costtogo heuristic has been specified with setCostToGoHeuristic(), this function just returns the identity cost, which is sure to be an admissible heuristic if there are no negative costs.  
virtual Cost  motionCostHeuristic (const State *s1, const State *s2) const 
Defines an admissible estimate on the optimal cost on the motion between states s1 and s2. An admissible estimate always undervalues the true optimal cost of the motion. Used by some planners to speed up planning. The default implementation of this method returns this objective's identity cost, which is sure to be an admissible heuristic if there are no negative costs.  
const SpaceInformationPtr &  getSpaceInformation () const 
Returns this objective's SpaceInformation. Needed for operators in MultiOptimizationObjective.  
virtual InformedSamplerPtr  allocInformedStateSampler (const ProblemDefinitionPtr &probDefn, unsigned int maxNumberCalls) const 
Allocate a heuristicsampling state generator for this cost function, defaults to a basic rejection sampling scheme when the derived class does not provide a better method.  
virtual void  print (std::ostream &out) const 
Print information about this optimization objective.  
Protected Member Functions  
Cost  trapezoid (Cost c1, Cost c2, double dist) const 
Helper method which uses the trapezoidal rule to approximate the integral of the cost between two states of distance dist and costs c1 and c2.  
Protected Attributes  
bool  interpolateMotionCost_ 
If true, then motionCost() will more accurately compute the cost of a motion by taking small steps along the motion and accumulating the cost. This sacrifices speed for accuracy. If false, the motion cost will be approximated by taking the average of the costs at the two end points, and normalizing by the distance between the two end points.  
Protected Attributes inherited from ompl::base::OptimizationObjective  
SpaceInformationPtr  si_ 
The space information for this objective.  
std::string  description_ 
The description of this optimization objective.  
Cost  threshold_ 
The cost threshold used for checking whether this objective has been satisfied during planning.  
CostToGoHeuristic  costToGoFn_ 
The function used for returning admissible estimates on the optimal cost of the path between a given state and goal.  
Detailed Description
Defines optimization objectives where path cost can be represented as a path integral over a cost function defined over the state space. This cost function is specified by implementing the stateCost() method.
Definition at line 50 of file StateCostIntegralObjective.h.
Member Function Documentation
◆ motionCost()

overridevirtual 
Compute the cost of a path segment from s1 to s2 (including endpoints)
 Parameters

s1 start state of the motion to be evaluated s2 final state of the motion to be evaluated cost the cost of the motion segment
By default, this function computes
If enableMotionCostInterpolation was specified as true in constructing this object, the cost will be computed by separating the motion into StateSpace::validSegmentCount() segments, using the above formula to compute the cost of each of those segments, and adding them up.
Implements ompl::base::OptimizationObjective.
Definition at line 51 of file StateCostIntegralObjective.cpp.
The documentation for this class was generated from the following files:
 ompl/base/objectives/StateCostIntegralObjective.h
 ompl/base/objectives/src/StateCostIntegralObjective.cpp