Fawkes API
Fawkes Development Version
|
#include <>>
Public Member Functions | |
Traversal () | |
Constructor. More... | |
Traversal (const NavGraphPath *path) | |
Constructor. More... | |
const NavGraphNode & | current () const |
Get current node in path. More... | |
const NavGraphNode & | peek_next () const |
Peek on the next node. More... | |
size_t | current_index () const |
Get index of current node in path. More... | |
bool | next () |
Move on traversal to next node. More... | |
void | reset () |
Reset an ongoing traversal. More... | |
bool | last () const |
Check if the current node is the last node in the path. More... | |
size_t | remaining () const |
Get the number of remaining nodes in path traversal. More... | |
float | remaining_cost () const |
Get the remaining cost to the goal. More... | |
bool | running () const |
Check if traversal is currently runnung. More... | |
void | invalidate () |
Invalidate this traversal. More... | |
void | set_current (size_t new_current) |
Set the current node. More... | |
const NavGraphPath & | path () const |
Get parent path the traversal belongs to. More... | |
operator bool () const | |
Check if traversal is initialized. More... | |
Sub-class representing a navgraph path traversal. A traversal is a step-by-step run through the node sequence (in order). There maybe any number of traversal open for a given path. But they become invalid should new nodes be set on the path. After creating a new traversal, you always need to call next for each new node including the first one. Code could look like this.
Definition at line 44 of file navgraph_path.h.
fawkes::NavGraphPath::Traversal::Traversal | ( | ) |
Constructor.
Definition at line 240 of file navgraph_path.cpp.
fawkes::NavGraphPath::Traversal::Traversal | ( | const NavGraphPath * | path | ) |
Constructor.
path | parent path to traverse |
Definition at line 247 of file navgraph_path.cpp.
const NavGraphNode & fawkes::NavGraphPath::Traversal::current | ( | ) | const |
Get current node in path.
Exception | if no traversal is active, i.e. next() has not been called after a traversal reset or if the path has already been traversed completley. |
Definition at line 276 of file navgraph_path.cpp.
Referenced by NavGraphThread::loop().
size_t fawkes::NavGraphPath::Traversal::current_index | ( | ) | const |
Get index of current node in path.
Exception | if no traversal is active, i.e. next() has not been called after a traversal reset or if the path has already been traversed completley. |
Definition at line 320 of file navgraph_path.cpp.
void fawkes::NavGraphPath::Traversal::invalidate | ( | ) |
Invalidate this traversal.
This will reset the parent path and the current node. This traversal can now longer be used afterwards other than assigning a new traversal.
Definition at line 257 of file navgraph_path.cpp.
Referenced by NavGraphVisualizationThread::reset_plan(), and NavGraphVisualizationThread::set_graph().
bool fawkes::NavGraphPath::Traversal::last | ( | ) | const |
Check if the current node is the last node in the path.
Definition at line 348 of file navgraph_path.cpp.
Referenced by NavGraphThread::loop().
bool fawkes::NavGraphPath::Traversal::next | ( | ) |
Move on traversal to next node.
Definition at line 334 of file navgraph_path.cpp.
Referenced by NavGraphThread::loop().
|
inline |
Check if traversal is initialized.
Definition at line 76 of file navgraph_path.h.
|
inline |
Get parent path the traversal belongs to.
Definition at line 69 of file navgraph_path.h.
Referenced by NavGraphThread::loop().
const NavGraphNode & fawkes::NavGraphPath::Traversal::peek_next | ( | ) | const |
Peek on the next node.
Get the node following the current node without advancing the current index (the current node remains the same).
OutOfBoundsException | if the traversal has not been started with an initial call to next() or if the traversal has already ended or is currently at the last node. |
Definition at line 295 of file navgraph_path.cpp.
size_t fawkes::NavGraphPath::Traversal::remaining | ( | ) | const |
Get the number of remaining nodes in path traversal.
The number of remaining nodes is the number of nodes including the current node up until the last node in the path.
Definition at line 360 of file navgraph_path.cpp.
Referenced by NavGraphThread::loop().
float fawkes::NavGraphPath::Traversal::remaining_cost | ( | ) | const |
Get the remaining cost to the goal.
This sums the costs from the current to the goal node using the default registered cost function of the parent navgraph.
Definition at line 374 of file navgraph_path.cpp.
void fawkes::NavGraphPath::Traversal::reset | ( | ) |
Reset an ongoing traversal.
A new traversal afterwards will start the traversal from the beginning.
Definition at line 396 of file navgraph_path.cpp.
bool fawkes::NavGraphPath::Traversal::running | ( | ) | const |
Check if traversal is currently runnung.
Definition at line 309 of file navgraph_path.cpp.
void fawkes::NavGraphPath::Traversal::set_current | ( | size_t | new_current | ) |
Set the current node.
new_current | new current node |
OutOfBoundsException | thrown if new current node is beyond number of nodes in path. |
Definition at line 407 of file navgraph_path.cpp.
Referenced by NavGraphThread::loop().