Fawkes API
Fawkes Development Version
|
Topological graph node. More...
#include <>>
Public Member Functions | |
NavGraphNode () | |
Constructor for invalid node. More... | |
NavGraphNode (const std::string &name, float x, float y, std::map< std::string, std::string > properties) | |
Constructor. More... | |
NavGraphNode (const std::string &name, float x, float y) | |
Constructor. More... | |
const std::string & | name () const |
Get name of node. More... | |
float | x () const |
Get X coordinate in global frame. More... | |
float | y () const |
Get Y coordinate in global frame. More... | |
bool | unconnected () const |
Check if this node shall be unconnected. More... | |
void | set_x (float x) |
Set X position. More... | |
void | set_y (float y) |
Set Y position. More... | |
void | set_name (const std::string &name) |
Set name of node. More... | |
void | set_unconnected (bool unconnected) |
Set unconnected state of the node. More... | |
float | distance (const NavGraphNode &n) |
Get euclidean distance from this node to another. More... | |
float | distance (float x, float y) |
Get euclidean distance from this node to a point. More... | |
const std::map< std::string, std::string > & | properties () const |
Get all properties. More... | |
bool | has_property (const std::string &property) const |
Check if node has specified property. More... | |
bool | is_valid () const |
Check if node is valid, i.e. More... | |
void | set_properties (const std::map< std::string, std::string > &properties) |
Overwrite properties with given ones. More... | |
void | set_property (const std::string &property, const std::string &value) |
Set property. More... | |
void | set_property (const std::string &property, float value) |
Set property. More... | |
void | set_property (const std::string &property, int value) |
Set property. More... | |
void | set_property (const std::string &property, bool value) |
Set property. More... | |
std::string | property (const std::string &prop) const |
Get specified property as string. More... | |
float | property_as_float (const std::string &prop) const |
Get property converted to float. More... | |
int | property_as_int (const std::string &prop) const |
Get property converted to int. More... | |
bool | property_as_bool (const std::string &prop) const |
Get property converted to bol. More... | |
bool | operator== (const NavGraphNode &n) const |
Check nodes for equality. More... | |
bool | operator!= (const NavGraphNode &n) const |
Check nodes for inequality. More... | |
operator bool () const | |
Check if node is valid. More... | |
void | set_reachable_nodes (std::vector< std::string > reachable_nodes) |
Set directly reachable nodes of node. More... | |
const std::vector< std::string > & | reachable_nodes () const |
Get reachable nodes. More... | |
Topological graph node.
Definition at line 35 of file navgraph_node.h.
fawkes::NavGraphNode::NavGraphNode | ( | ) |
Constructor for invalid node.
Definition at line 33 of file navgraph_node.cpp.
fawkes::NavGraphNode::NavGraphNode | ( | const std::string & | name, |
float | x, | ||
float | y, | ||
std::map< std::string, std::string > | properties | ||
) |
Constructor.
name | name of the node |
x | x coordinate in global frame of node |
y | y coordinate in global frame of node |
properties | properties for the new node |
Definition at line 43 of file navgraph_node.cpp.
References name(), properties(), x(), and y().
fawkes::NavGraphNode::NavGraphNode | ( | const std::string & | name, |
float | x, | ||
float | y | ||
) |
Constructor.
name | name of the node |
x | x coordinate in global frame of node |
y | y coordinate in global frame of node |
Definition at line 60 of file navgraph_node.cpp.
|
inline |
Get euclidean distance from this node to another.
n | node to get distance to |
Definition at line 88 of file navgraph_node.h.
Referenced by fawkes::NavGraph::connect_node_to_closest_edge().
|
inline |
Get euclidean distance from this node to a point.
x | point X coordinate |
y | point Y coordinate |
Definition at line 98 of file navgraph_node.h.
|
inline |
Check if node has specified property.
property | property key |
Definition at line 117 of file navgraph_node.h.
References property().
Referenced by fawkes::NavGraph::apply_default_properties(), and NavGraphThread::loop().
|
inline |
Check if node is valid, i.e.
it has a name.
Definition at line 126 of file navgraph_node.h.
Referenced by fawkes::NavGraph::reachable_nodes().
|
inline |
Get name of node.
Definition at line 50 of file navgraph_node.h.
Referenced by fawkes::NavGraphTimedReservationListNodeConstraint::add_node(), fawkes::NavGraph::add_node(), fawkes::NavGraph::connect_node_to_closest_edge(), fawkes::NavGraph::connect_node_to_closest_node(), NavGraphThread::fam_event(), fawkes::NavGraphSearchState::is_goal(), NavGraphThread::loop(), NavGraphNode(), fawkes::NavGraphSearchState::NavGraphSearchState(), fawkes::save_yaml_navgraph(), set_name(), fawkes::NavGraphEdge::set_nodes(), and fawkes::NavGraph::update_node().
|
inline |
Check if node is valid.
A node is valid if it has a name set.
Definition at line 195 of file navgraph_node.h.
|
inline |
Check nodes for inequality.
Nodes are inequal if they have different names.
n | node to compare with |
Definition at line 186 of file navgraph_node.h.
|
inline |
Check nodes for equality.
Nodes are equal if they have the same name.
n | node to compare with |
Definition at line 175 of file navgraph_node.h.
|
inline |
Get all properties.
Definition at line 107 of file navgraph_node.h.
Referenced by NavGraphNode(), fawkes::save_yaml_navgraph(), and set_properties().
std::string fawkes::NavGraphNode::property | ( | const std::string & | prop | ) | const |
Get specified property as string.
prop | property key |
Definition at line 114 of file navgraph_node.cpp.
Referenced by has_property(), property_as_bool(), property_as_float(), property_as_int(), and set_property().
|
inline |
Get property converted to bol.
prop | property key |
Definition at line 164 of file navgraph_node.h.
References property(), and fawkes::StringConversions::to_bool().
|
inline |
Get property converted to float.
prop | property key |
Definition at line 144 of file navgraph_node.h.
References property(), and fawkes::StringConversions::to_float().
Referenced by NavGraphThread::fam_event(), and NavGraphThread::loop().
|
inline |
Get property converted to int.
prop | property key |
Definition at line 154 of file navgraph_node.h.
References property(), and fawkes::StringConversions::to_int().
|
inline |
Get reachable nodes.
Definition at line 206 of file navgraph_node.h.
Referenced by set_reachable_nodes().
void fawkes::NavGraphNode::set_name | ( | const std::string & | name | ) |
Set name of node.
name | new name for node |
Definition at line 89 of file navgraph_node.cpp.
References name().
Referenced by fawkes::operator>>().
void fawkes::NavGraphNode::set_properties | ( | const std::map< std::string, std::string > & | properties | ) |
Overwrite properties with given ones.
properties | map of properties to set |
Definition at line 128 of file navgraph_node.cpp.
References properties().
void fawkes::NavGraphNode::set_property | ( | const std::string & | property, |
bool | value | ||
) |
Set property.
property | property key |
value | property value |
Definition at line 168 of file navgraph_node.cpp.
References property().
void fawkes::NavGraphNode::set_property | ( | const std::string & | property, |
const std::string & | value | ||
) |
Set property.
property | property key |
value | property value |
Definition at line 138 of file navgraph_node.cpp.
References property().
Referenced by fawkes::NavGraph::apply_default_properties(), and fawkes::operator>>().
void fawkes::NavGraphNode::set_property | ( | const std::string & | property, |
float | value | ||
) |
Set property.
property | property key |
value | property value |
Definition at line 148 of file navgraph_node.cpp.
References property(), and fawkes::StringConversions::to_string().
void fawkes::NavGraphNode::set_property | ( | const std::string & | property, |
int | value | ||
) |
Set property.
property | property key |
value | property value |
Definition at line 158 of file navgraph_node.cpp.
References property(), and fawkes::StringConversions::to_string().
void fawkes::NavGraphNode::set_reachable_nodes | ( | std::vector< std::string > | reachable_nodes | ) |
Set directly reachable nodes of node.
reachable_nodes | vector of directly reachable nodes |
Definition at line 177 of file navgraph_node.cpp.
References reachable_nodes().
void fawkes::NavGraphNode::set_unconnected | ( | bool | unconnected | ) |
Set unconnected state of the node.
A node must be marked as unconnected explicitly or otherwise it is an error that the graph will report as an error. On other hand, unconnected nodes may not have any connection. By default nodes are expected to have at least one connection (behaving as though this function had been called with "false").
unconnected | true to make this node a unconnected node, false otherwise |
Definition at line 104 of file navgraph_node.cpp.
References unconnected().
Referenced by fawkes::load_yaml_navgraph(), NavGraphGeneratorThread::loop(), and fawkes::operator>>().
void fawkes::NavGraphNode::set_x | ( | float | x | ) |
Set X position.
x | X coordinate in global frame for node. |
Definition at line 71 of file navgraph_node.cpp.
References x().
Referenced by fawkes::operator>>().
void fawkes::NavGraphNode::set_y | ( | float | y | ) |
Set Y position.
y | Y coordinate in global frame for node. |
Definition at line 80 of file navgraph_node.cpp.
References y().
Referenced by fawkes::operator>>().
|
inline |
Check if this node shall be unconnected.
Definition at line 74 of file navgraph_node.h.
Referenced by fawkes::save_yaml_navgraph(), and set_unconnected().
|
inline |
Get X coordinate in global frame.
Definition at line 58 of file navgraph_node.h.
Referenced by fawkes::NavGraph::closest_edge(), fawkes::NavGraph::closest_node_to(), fawkes::NavGraphEdge::closest_point_on_edge(), fawkes::NavGraph::connect_node_to_closest_edge(), distance(), fawkes::NavGraphSearchState::euclidean_cost(), NavGraphThread::fam_event(), fawkes::NavGraphEdge::intersection(), fawkes::NavGraphEdge::intersects(), NavGraphNode(), fawkes::save_yaml_navgraph(), set_x(), and fawkes::NavGraphSearchState::straight_line_estimate().
|
inline |
Get Y coordinate in global frame.
Definition at line 66 of file navgraph_node.h.
Referenced by fawkes::NavGraph::closest_edge(), fawkes::NavGraph::closest_node_to(), fawkes::NavGraphEdge::closest_point_on_edge(), fawkes::NavGraph::connect_node_to_closest_edge(), distance(), fawkes::NavGraphSearchState::euclidean_cost(), NavGraphThread::fam_event(), fawkes::NavGraphEdge::intersection(), fawkes::NavGraphEdge::intersects(), NavGraphNode(), fawkes::save_yaml_navgraph(), set_y(), and fawkes::NavGraphSearchState::straight_line_estimate().