Fawkes API
Fawkes Development Version
|
#include <>>
Public Types | |
typedef std::vector< fawkes::NavGraphNodeConstraint * > | NodeConstraintList |
List of navgraph node constraints. More... | |
typedef std::vector< fawkes::NavGraphEdgeConstraint * > | EdgeConstraintList |
List of navgraph edge constraints. More... | |
typedef std::vector< fawkes::NavGraphEdgeCostConstraint * > | EdgeCostConstraintList |
List of navgraph edge cost constraints. More... | |
Public Member Functions | |
NavGraphConstraintRepo () | |
Constructor. More... | |
~NavGraphConstraintRepo () | |
Destructor. More... | |
void | register_constraint (NavGraphNodeConstraint *constraint) |
Register a constraint. More... | |
void | register_constraint (NavGraphEdgeConstraint *constraint) |
Register a constraint. More... | |
void | register_constraint (NavGraphEdgeCostConstraint *constraint) |
Register an edge cost constraint. More... | |
void | unregister_constraint (std::string name) |
Unregister a constraint by name. More... | |
bool | has_constraint (std::string &name) |
Check by name if a constraint has been registered. More... | |
fawkes::NavGraphNodeConstraint * | get_node_constraint (std::string &name) |
Get a node constraint by name. More... | |
fawkes::NavGraphEdgeConstraint * | get_edge_constraint (std::string &name) |
Get an edge constraint by name. More... | |
fawkes::NavGraphEdgeCostConstraint * | get_edge_cost_constraint (std::string &name) |
Get an edge cost constraint by name. More... | |
const NodeConstraintList & | node_constraints () const |
Get a list of registered node constraints. More... | |
const EdgeConstraintList & | edge_constraints () const |
Get a list of registered edge constraints. More... | |
const EdgeCostConstraintList & | edge_cost_constraints () const |
Get a list of registered edge cost constraints. More... | |
bool | has_constraints () const |
Check if there are any constraints at all. More... | |
bool | compute () |
Call compute method on all registered constraints. More... | |
NavGraphNodeConstraint * | blocks (const fawkes::NavGraphNode &node) |
Check if any constraint in the repo blocks the node. More... | |
NavGraphEdgeConstraint * | blocks (const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to) |
Check if any constraint in the repo blocks the edge. More... | |
NavGraphEdgeCostConstraint * | increases_cost (const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to) |
Check if any constraint in the repo increases the cost of the edge. More... | |
NavGraphEdgeCostConstraint * | increases_cost (const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to, float &cost_factor) |
Check if any constraint in the repo increases the cost of the edge. More... | |
float | cost_factor (const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to) |
Get the highest increasing cost factor for an edge. More... | |
std::map< std::string, std::string > | blocks (const std::vector< fawkes::NavGraphNode > &nodes) |
Check if any constraint in the repo blocks (some) nodes. More... | |
std::map< std::pair< std::string, std::string >, std::string > | blocks (const std::vector< fawkes::NavGraphEdge > &edges) |
Check if any constraint in the repo blocks (some) edges. More... | |
std::list< std::tuple< std::string, std::string, std::string, float > > | cost_factor (const std::vector< fawkes::NavGraphEdge > &edges) |
Get the highest increasing cost factor for an edge. More... | |
bool | modified (bool reset_modified=false) |
Check if the constraint repo has been modified. More... | |
Constraint repository to maintain blocks on nodes.
Definition at line 41 of file constraint_repo.h.
typedef std::vector<fawkes::NavGraphEdgeConstraint *> fawkes::NavGraphConstraintRepo::EdgeConstraintList |
List of navgraph edge constraints.
Definition at line 52 of file constraint_repo.h.
typedef std::vector<fawkes::NavGraphEdgeCostConstraint *> fawkes::NavGraphConstraintRepo::EdgeCostConstraintList |
List of navgraph edge cost constraints.
Definition at line 54 of file constraint_repo.h.
typedef std::vector<fawkes::NavGraphNodeConstraint *> fawkes::NavGraphConstraintRepo::NodeConstraintList |
List of navgraph node constraints.
Definition at line 50 of file constraint_repo.h.
fawkes::NavGraphConstraintRepo::NavGraphConstraintRepo | ( | ) |
Constructor.
Definition at line 35 of file constraint_repo.cpp.
fawkes::NavGraphConstraintRepo::~NavGraphConstraintRepo | ( | ) |
Destructor.
Definition at line 41 of file constraint_repo.cpp.
fawkes::NavGraphEdgeConstraint * fawkes::NavGraphConstraintRepo::blocks | ( | const fawkes::NavGraphNode & | from, |
const fawkes::NavGraphNode & | to | ||
) |
Check if any constraint in the repo blocks the edge.
from | node from which the edge originates |
to | node to which the edge leads |
Definition at line 299 of file constraint_repo.cpp.
fawkes::NavGraphNodeConstraint * fawkes::NavGraphConstraintRepo::blocks | ( | const fawkes::NavGraphNode & | node | ) |
Check if any constraint in the repo blocks the node.
node | Node to check for a block |
Definition at line 260 of file constraint_repo.cpp.
Referenced by fawkes::NavGraphSearchState::is_goal().
std::map< std::pair< std::string, std::string >, std::string > fawkes::NavGraphConstraintRepo::blocks | ( | const std::vector< fawkes::NavGraphEdge > & | edges | ) |
Check if any constraint in the repo blocks (some) edges.
edges | vector of edges to check for a block |
edges
that are not blocked will not appear in the map. Definition at line 366 of file constraint_repo.cpp.
std::map< std::string, std::string > fawkes::NavGraphConstraintRepo::blocks | ( | const std::vector< fawkes::NavGraphNode > & | nodes | ) |
Check if any constraint in the repo blocks (some) nodes.
nodes | vector of nodes to check for a block |
nodes
that are not blocked will not appear in the map. Definition at line 278 of file constraint_repo.cpp.
bool fawkes::NavGraphConstraintRepo::compute | ( | ) |
Call compute method on all registered constraints.
Definition at line 235 of file constraint_repo.cpp.
Referenced by NavGraphThread::loop().
float fawkes::NavGraphConstraintRepo::cost_factor | ( | const fawkes::NavGraphNode & | from, |
const fawkes::NavGraphNode & | to | ||
) |
Get the highest increasing cost factor for an edge.
This methods goes through all of the given edges and queries all edge cost constraints. If any constraint increases the cost of an edge (cost >= 1.00001), it adds a tuple of the start node name, end node name, constraint name, and cost factor of the constraint that returned the highest cost factor to the list.
from | start node of the edge |
to | destination node of edge |
Definition at line 429 of file constraint_repo.cpp.
std::list< std::tuple< std::string, std::string, std::string, float > > fawkes::NavGraphConstraintRepo::cost_factor | ( | const std::vector< fawkes::NavGraphEdge > & | edges | ) |
Get the highest increasing cost factor for an edge.
This methods goes through all of the given edges and queries all edge cost constraints. If any constraint increases the cost of an edge (cost >= 1.00001), it adds a tuple of the start node name, end node name, constraint name, and cost factor of the constraint that returned the highest cost factor to the list.
edges | vector of edges to check for a block |
Definition at line 395 of file constraint_repo.cpp.
References fawkes::NavGraphEdgeCostConstraint::cost_factor(), and fawkes::NavGraphEdgeCostConstraint::name().
const NavGraphConstraintRepo::EdgeConstraintList & fawkes::NavGraphConstraintRepo::edge_constraints | ( | ) | const |
Get a list of registered edge constraints.
Definition at line 207 of file constraint_repo.cpp.
const NavGraphConstraintRepo::EdgeCostConstraintList & fawkes::NavGraphConstraintRepo::edge_cost_constraints | ( | ) | const |
Get a list of registered edge cost constraints.
Definition at line 216 of file constraint_repo.cpp.
fawkes::NavGraphEdgeConstraint * fawkes::NavGraphConstraintRepo::get_edge_constraint | ( | std::string & | name | ) |
Get an edge constraint by name.
name | name of constraint to retrieve |
Definition at line 163 of file constraint_repo.cpp.
fawkes::NavGraphEdgeCostConstraint * fawkes::NavGraphConstraintRepo::get_edge_cost_constraint | ( | std::string & | name | ) |
Get an edge cost constraint by name.
name | name of constraint to retrieve |
Definition at line 181 of file constraint_repo.cpp.
fawkes::NavGraphNodeConstraint * fawkes::NavGraphConstraintRepo::get_node_constraint | ( | std::string & | name | ) |
Get a node constraint by name.
name | name of constraint to retrieve |
Definition at line 145 of file constraint_repo.cpp.
bool fawkes::NavGraphConstraintRepo::has_constraint | ( | std::string & | name | ) |
Check by name if a constraint has been registered.
name | name of constraint to look for |
Definition at line 114 of file constraint_repo.cpp.
bool fawkes::NavGraphConstraintRepo::has_constraints | ( | ) | const |
Check if there are any constraints at all.
Definition at line 225 of file constraint_repo.cpp.
fawkes::NavGraphEdgeCostConstraint * fawkes::NavGraphConstraintRepo::increases_cost | ( | const fawkes::NavGraphNode & | from, |
const fawkes::NavGraphNode & | to | ||
) |
Check if any constraint in the repo increases the cost of the edge.
from | node from which the edge originates |
to | node to which the edge leads |
Definition at line 317 of file constraint_repo.cpp.
Referenced by fawkes::NavGraphSearchState::is_goal().
fawkes::NavGraphEdgeCostConstraint * fawkes::NavGraphConstraintRepo::increases_cost | ( | const fawkes::NavGraphNode & | from, |
const fawkes::NavGraphNode & | to, | ||
float & | cost_factor | ||
) |
Check if any constraint in the repo increases the cost of the edge.
from | node from which the edge originates |
to | node to which the edge leads |
cost_factor | upon return with a non-NULL edge cost constraints contains the cost increase. |
Definition at line 338 of file constraint_repo.cpp.
References fawkes::NavGraphEdgeCostConstraint::cost_factor().
bool fawkes::NavGraphConstraintRepo::modified | ( | bool | reset_modified = false | ) |
Check if the constraint repo has been modified.
reset_modified | true to reset the modified flag, false to leave it |
Definition at line 448 of file constraint_repo.cpp.
Referenced by NavGraphThread::loop().
const NavGraphConstraintRepo::NodeConstraintList & fawkes::NavGraphConstraintRepo::node_constraints | ( | ) | const |
Get a list of registered node constraints.
Definition at line 198 of file constraint_repo.cpp.
void fawkes::NavGraphConstraintRepo::register_constraint | ( | NavGraphEdgeConstraint * | constraint | ) |
Register a constraint.
constraint | edge constraint to register |
Definition at line 59 of file constraint_repo.cpp.
void fawkes::NavGraphConstraintRepo::register_constraint | ( | NavGraphEdgeCostConstraint * | constraint | ) |
Register an edge cost constraint.
constraint | edge cost constraint to register |
Definition at line 69 of file constraint_repo.cpp.
void fawkes::NavGraphConstraintRepo::register_constraint | ( | NavGraphNodeConstraint * | constraint | ) |
Register a constraint.
constraint | node constraint to register |
Definition at line 49 of file constraint_repo.cpp.
void fawkes::NavGraphConstraintRepo::unregister_constraint | ( | std::string | name | ) |
Unregister a constraint by name.
name | name of constraint to remove. |
Definition at line 79 of file constraint_repo.cpp.