Fawkes API  Fawkes Development Version
NavGraphClustersDistanceCostConstraint Class Reference

Constraint apply linearly scaled costs based on the distance. More...

#include "clusters_distance_cost_constraint.h"

Inheritance diagram for NavGraphClustersDistanceCostConstraint:

Public Member Functions

 NavGraphClustersDistanceCostConstraint (const char *name, NavGraphClustersThread *parent, float cost_min, float cost_max, float dist_min, float dist_max)
 Constructor. More...
 
virtual ~NavGraphClustersDistanceCostConstraint ()
 Virtual empty destructor. More...
 
virtual bool compute (void) throw ()
 Perform compuations before graph search and to indicate re-planning. More...
 
virtual float cost_factor (const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to) throw ()
 Get cost factor for given edge. More...
 
- Public Member Functions inherited from fawkes::NavGraphEdgeCostConstraint
 NavGraphEdgeCostConstraint (std::string &name)
 Constructor. More...
 
 NavGraphEdgeCostConstraint (const char *name)
 Constructor. More...
 
virtual ~NavGraphEdgeCostConstraint ()
 Virtual empty destructor. More...
 
std::string name ()
 Get name of constraint. More...
 
bool operator== (const std::string &name) const
 Check if constraint matches name. More...
 

Additional Inherited Members

- Protected Attributes inherited from fawkes::NavGraphEdgeCostConstraint
std::string name_
 Name of constraint. More...
 

Detailed Description

Constraint apply linearly scaled costs based on the distance.

Author
Tim Niemueller

Definition at line 34 of file clusters_distance_cost_constraint.h.

Constructor & Destructor Documentation

◆ NavGraphClustersDistanceCostConstraint()

NavGraphClustersDistanceCostConstraint::NavGraphClustersDistanceCostConstraint ( const char *  name,
NavGraphClustersThread parent,
float  cost_min,
float  cost_max,
float  dist_min,
float  dist_max 
)

Constructor.

Parameters
nameconstraint name
parentparent to call for blocked edges
cost_minminimum cost for centroids in range
cost_maxmaximum cost for close centroids
dist_minminimum distance, for cost scaling, anything closer will be assigned cost_max
dist_maxmaximum distance for costs, anything farther will be assigned 1.0.

Definition at line 44 of file clusters_distance_cost_constraint.cpp.

◆ ~NavGraphClustersDistanceCostConstraint()

NavGraphClustersDistanceCostConstraint::~NavGraphClustersDistanceCostConstraint ( )
virtual

Virtual empty destructor.

Definition at line 68 of file clusters_distance_cost_constraint.cpp.

Member Function Documentation

◆ compute()

bool NavGraphClustersDistanceCostConstraint::compute ( void  )
throw (
)
virtual

Perform compuations before graph search and to indicate re-planning.

The compute method is called on all constraints just before a path search is performed and to check if re-planning should be tried.

It can be used for example to cache results for the coming search run. The search guarantees that for each complete search run compute() is called once and only once and that no two search runs overlap, i.e., compute() will not be called while another search is still running.

Constraints must indicate whether any change has occured during computation or since the last compute() call through the return value. This is used to determine if re-planning should be attempted.

Returns
true if a change has occured during computation or since the last call, false otherwise

Reimplemented from fawkes::NavGraphEdgeCostConstraint.

Definition at line 74 of file clusters_distance_cost_constraint.cpp.

References NavGraphClustersThread::blocked_edges_centroids(), and NavGraphClustersThread::robot_pose().

◆ cost_factor()

float NavGraphClustersDistanceCostConstraint::cost_factor ( const fawkes::NavGraphNode from,
const fawkes::NavGraphNode to 
)
throw (
)
virtual

Get cost factor for given edge.

This method must be implemented by constraint classes. It is called to determine a cost factor for an edge. That is, the path costs from the originating node to the destination node are multiplied with this factor and thus the chance of following that specific edge is decreased. The factor must be greater or equal to 1. That is a requirement to keep heuristics admissible and thus the search optimal.

Note that the nodes may be passed in either ordering, therefore you should not rely on a particular order, not even for directed nodes!

Further note that the method may not throw an exception. Handle this internally appropriately.

Parameters
fromnode from which the edge originates
tonode to which the edge leads
Returns
cost factor, a number x >= 1.0

Implements fawkes::NavGraphEdgeCostConstraint.

Definition at line 83 of file clusters_distance_cost_constraint.cpp.

References fawkes::distance().


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