Fawkes API
Fawkes Development Version
|
Constraint apply linearly scaled costs based on the distance. More...
#include "clusters_distance_cost_constraint.h"
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... | |
![]() | |
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 | |
![]() | |
std::string | name_ |
Name of constraint. More... | |
Constraint apply linearly scaled costs based on the distance.
Definition at line 34 of file clusters_distance_cost_constraint.h.
NavGraphClustersDistanceCostConstraint::NavGraphClustersDistanceCostConstraint | ( | const char * | name, |
NavGraphClustersThread * | parent, | ||
float | cost_min, | ||
float | cost_max, | ||
float | dist_min, | ||
float | dist_max | ||
) |
Constructor.
name | constraint name |
parent | parent to call for blocked edges |
cost_min | minimum cost for centroids in range |
cost_max | maximum cost for close centroids |
dist_min | minimum distance, for cost scaling, anything closer will be assigned cost_max |
dist_max | maximum distance for costs, anything farther will be assigned 1.0. |
Definition at line 44 of file clusters_distance_cost_constraint.cpp.
|
virtual |
Virtual empty destructor.
Definition at line 68 of file clusters_distance_cost_constraint.cpp.
|
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.
Reimplemented from fawkes::NavGraphEdgeCostConstraint.
Definition at line 74 of file clusters_distance_cost_constraint.cpp.
References NavGraphClustersThread::blocked_edges_centroids(), and NavGraphClustersThread::robot_pose().
|
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.
from | node from which the edge originates |
to | node to which the edge leads |
Implements fawkes::NavGraphEdgeCostConstraint.
Definition at line 83 of file clusters_distance_cost_constraint.cpp.
References fawkes::distance().