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 38 of file navgraph_node.h.
fawkes::NavGraphNode::NavGraphNode | ( | ) |
Constructor for invalid node.
Definition at line 36 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 48 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 64 of file navgraph_node.cpp.
|
inline |
Get euclidean distance from this node to another.
n | node to get distance to |
Definition at line 75 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 82 of file navgraph_node.h.
|
inline |
Check if node has specified property.
property | property key |
Definition at line 95 of file navgraph_node.h.
Referenced by fawkes::NavGraph::apply_default_properties(), NavGraphVisualizationThread::loop(), NavGraphThread::loop(), NavGraphInteractiveThread::loop(), and fawkes::EclExternalRCSoftMapGraph::map_graph().
|
inline |
Check if node is valid, i.e.
it has a name.
Definition at line 101 of file navgraph_node.h.
References property(), set_properties(), and set_property().
Referenced by NavGraphThread::loop(), and fawkes::NavGraph::reachable_nodes().
|
inline |
Get name of node.
Definition at line 49 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(), fawkes::NavGraph::cost(), NavGraphThread::fam_event(), fawkes::NavGraphSearchState::is_goal(), NavGraphVisualizationThread::loop(), NavGraphThread::loop(), NavGraphInteractiveThread::loop(), fawkes::EclExternalRCSoftMapGraph::map_graph(), NavGraphNode(), fawkes::NavGraphSearchState::NavGraphSearchState(), fawkes::NavGraph::remove_node(), 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 153 of file navgraph_node.h.
References reachable_nodes(), and set_reachable_nodes().
|
inline |
Check nodes for inequality.
Nodes are inequal if they have different names.
n | node to compare with |
Definition at line 146 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 138 of file navgraph_node.h.
|
inline |
Get all properties.
Definition at line 88 of file navgraph_node.h.
Referenced by NavGraphInteractiveThread::loop(), 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 122 of file navgraph_node.cpp.
Referenced by is_valid(), property_as_bool(), property_as_float(), property_as_int(), and set_property().
|
inline |
Get property converted to bol.
prop | property key |
Definition at line 130 of file navgraph_node.h.
References property(), and fawkes::StringConversions::to_bool().
|
inline |
Get property converted to float.
prop | property key |
Definition at line 116 of file navgraph_node.h.
References property(), and fawkes::StringConversions::to_float().
Referenced by NavGraphThread::fam_event(), NavGraphVisualizationThread::loop(), NavGraphThread::loop(), NavGraphInteractiveThread::loop(), and fawkes::EclExternalRCSoftMapGraph::map_graph().
|
inline |
Get property converted to int.
prop | property key |
Definition at line 123 of file navgraph_node.h.
References property(), and fawkes::StringConversions::to_int().
|
inline |
Get reachable nodes.
Definition at line 161 of file navgraph_node.h.
Referenced by fawkes::NavGraph::cost(), fawkes::NavGraphSearchState::is_goal(), NavGraphGeneratorThread::loop(), fawkes::EclExternalRCSoftMapGraph::map_graph(), operator bool(), and set_reachable_nodes().
void fawkes::NavGraphNode::set_name | ( | const std::string & | name | ) |
Set name of node.
name | new name for node |
Definition at line 96 of file navgraph_node.cpp.
References name().
Referenced by fawkes::operator>>(), and unconnected().
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 137 of file navgraph_node.cpp.
References properties().
Referenced by is_valid().
void fawkes::NavGraphNode::set_property | ( | const std::string & | property, |
const std::string & | value | ||
) |
Set property.
property | property key |
value | property value |
Definition at line 148 of file navgraph_node.cpp.
References property().
Referenced by fawkes::NavGraph::apply_default_properties(), is_valid(), NavGraphThread::loop(), fawkes::operator>>(), and NavGraphInteractiveThread::~NavGraphInteractiveThread().
void fawkes::NavGraphNode::set_property | ( | const std::string & | property, |
float | value | ||
) |
Set property.
property | property key |
value | property value |
Definition at line 159 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 169 of file navgraph_node.cpp.
References property(), and fawkes::StringConversions::to_string().
void fawkes::NavGraphNode::set_property | ( | const std::string & | property, |
bool | value | ||
) |
Set property.
property | property key |
value | property value |
Definition at line 179 of file navgraph_node.cpp.
References property().
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 189 of file navgraph_node.cpp.
References reachable_nodes().
Referenced by operator bool().
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 111 of file navgraph_node.cpp.
References unconnected().
Referenced by fawkes::load_yaml_navgraph(), NavGraphGeneratorThread::loop(), fawkes::operator>>(), and unconnected().
void fawkes::NavGraphNode::set_x | ( | float | x | ) |
Set X position.
x | X coordinate in global frame for node. |
Definition at line 77 of file navgraph_node.cpp.
References x().
Referenced by fawkes::operator>>(), unconnected(), and NavGraphInteractiveThread::~NavGraphInteractiveThread().
void fawkes::NavGraphNode::set_y | ( | float | y | ) |
Set Y position.
y | Y coordinate in global frame for node. |
Definition at line 86 of file navgraph_node.cpp.
References y().
Referenced by fawkes::operator>>(), unconnected(), and NavGraphInteractiveThread::~NavGraphInteractiveThread().
|
inline |
Check if this node shall be unconnected.
Definition at line 64 of file navgraph_node.h.
References set_name(), set_unconnected(), set_x(), and set_y().
Referenced by fawkes::NavGraph::cost(), and set_unconnected().
|
inline |
Get X coordinate in global frame.
Definition at line 54 of file navgraph_node.h.
Referenced by fawkes::NavGraph::closest_node_to(), fawkes::NavGraph::connect_node_to_closest_edge(), fawkes::NavGraph::cost(), fawkes::NavGraphSearchState::euclidean_cost(), NavGraphThread::fam_event(), NavGraphVisualizationThread::loop(), NavGraphThread::loop(), NavGraphInteractiveThread::loop(), fawkes::EclExternalRCSoftMapGraph::map_graph(), NavGraphNode(), fawkes::save_yaml_navgraph(), set_x(), and fawkes::NavGraphSearchState::straight_line_estimate().
|
inline |
Get Y coordinate in global frame.
Definition at line 59 of file navgraph_node.h.
Referenced by fawkes::NavGraph::closest_node_to(), fawkes::NavGraph::connect_node_to_closest_edge(), fawkes::NavGraph::cost(), fawkes::NavGraphSearchState::euclidean_cost(), NavGraphThread::fam_event(), NavGraphVisualizationThread::loop(), NavGraphThread::loop(), NavGraphInteractiveThread::loop(), fawkes::EclExternalRCSoftMapGraph::map_graph(), NavGraphNode(), fawkes::save_yaml_navgraph(), set_y(), and fawkes::NavGraphSearchState::straight_line_estimate().