A directed graph of pose constraints, with edges being the relative pose between pairs of nodes indentified by their numeric IDs (of type TNodeID).
A link or edge between two nodes "i" and "j", that is, the pose
, holds the relative position of "j" with respect to "i". These poses are stored in the edges in the format specified by the template argument CPOSE. Users should employ the following derived classes depending on the desired representation of edges:
Two main members store all the information in this class:
Graphs can be loaded and saved to text file in the format used by TORO & HoG-man (more on the format here ), using loadFromTextFile and saveToTextFile.
This class is the base for representing networks of poses, which are the main data type of a series of SLAM algorithms implemented in the library mrpt-slam, in the namespace mrpt::graphslam.
For tools to visualize graphs as 2D/3D plots, see the namespace mrpt::opengl::graph_tools in the library mrpt-opengl.
The template arguments are:
#include <mrpt/graphs/CNetworkOfPoses.h>

Classes | |
| struct | global_pose_t |
| The type of each global pose in nodes: an extension of the constraint_no_pdf_t pose with any optional user-defined data. More... | |
Public Types | |
Typedef's | |
| typedef mrpt::graphs::CDirectedGraph < CPOSE, EDGE_ANNOTATIONS > | BASE |
| The base class "CDirectedGraph<CPOSE,EDGE_ANNOTATIONS>" */. | |
| typedef CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS > | self_t |
| My own type. | |
| typedef CPOSE | constraint_t |
| The type of PDF poses in the contraints (edges) (=CPOSE template argument) | |
| typedef NODE_ANNOTATIONS | node_annotations_t |
| The extra annotations in nodes, apart from a constraint_no_pdf_t. | |
| typedef EDGE_ANNOTATIONS | edge_annotations_t |
| The extra annotations in edges, apart from a constraint_t. | |
| typedef MAPS_IMPLEMENTATION | maps_implementation_t |
| The type of map's implementation (=MAPS_IMPLEMENTATION template argument) | |
| typedef CPOSE::type_value | constraint_no_pdf_t |
| The type of edges or their means if they are PDFs (that is, a simple "edge" value) | |
| typedef MAPS_IMPLEMENTATION::template map< TNodeID, CPOSE > | global_poses_pdf_t |
| A map from pose IDs to their global coordinates estimates, with uncertainty. | |
| typedef MAPS_IMPLEMENTATION::template map< TNodeID, global_pose_t > | global_poses_t |
| A map from pose IDs to their global coordinates estimates, without uncertainty (the "most-likely value") | |
Public Member Functions | |
I/O file methods | |
| void | saveToTextFile (const std::string &fileName) const |
| Saves to a text file in the format used by TORO & HoG-man (more on the format here ) For 2D graphs only VERTEX2 & EDGE2 entries will be saved, and VERTEX3 & EDGE3 entries for 3D graphs. | |
| void | loadFromTextFile (const std::string &fileName, bool collapse_dup_edges=true) |
| Loads from a text file in the format used by TORO & HoG-man (more on the format here ) Recognized line entries are: VERTEX2, VERTEX3, EDGE2, EDGE3, EQUIV. | |
Utility methods | |
| void | dijkstra_nodes_estimate () |
| Spanning tree computation of a simple estimation of the global coordinates of each node just from the information in all edges, sorted in a Dijkstra tree based on the current "root" node. | |
| size_t | collapseDuplicatedEdges () |
| Look for duplicated edges (even in opposite directions) between all pairs of nodes and fuse them. | |
| double | getGlobalSquareError (bool ignoreCovariances=true) const |
| Computes the overall square error from all the pose constraints (edges) with respect to the global poses in If ignoreCovariances is false, the squared Mahalanobis distance will be computed instead of the straight square error. | |
| double | getEdgeSquareError (const typename BASE::edges_map_t::const_iterator &itEdge, bool ignoreCovariances=true) const |
| Computes the square error of one pose constraints (edge) with respect to the global poses in If ignoreCovariances is false, the squared Mahalanobis distance will be computed instead of the straight square error. | |
| double | getEdgeSquareError (const TNodeID from_id, const TNodeID to_id, bool ignoreCovariances=true) const |
| Computes the square error of one pose constraints (edge) with respect to the global poses in If ignoreCovariances is false, the squared Mahalanobis distance will be computed instead of the straight square error. | |
| void | clear () |
| Empty all edges, nodes and set root to ID 0. | |
| size_t | nodeCount () const |
| Return number of nodes in the list of global coordinates (may be differente that all nodes appearing in edges) | |
Ctors & Dtors | |
| CNetworkOfPoses () | |
| Default constructor (just sets root to "0" and edges_store_inverse_poses to "false") | |
| ~CNetworkOfPoses () | |
Public Attributes | |
Data members | |
| global_poses_t | nodes |
| The nodes (vertices) of the graph, with their estimated "global" (with respect to root) position, without an associated covariance. | |
| TNodeID | root |
| The ID of the node that is the origin of coordinates, used as reference by all coordinates in . | |
| bool | edges_store_inverse_poses |
False (default) if an edge i->j stores the normal relative pose of j as seen from i: True if an edge i->j stores the inverse relateive pose, that is, i as seen from j: . | |
| typedef mrpt::graphs::CDirectedGraph<CPOSE,EDGE_ANNOTATIONS> mrpt::graphs::CNetworkOfPoses::BASE |
The base class "CDirectedGraph<CPOSE,EDGE_ANNOTATIONS>" */.
Definition at line 111 of file CNetworkOfPoses.h.
| typedef CPOSE::type_value mrpt::graphs::CNetworkOfPoses::constraint_no_pdf_t |
The type of edges or their means if they are PDFs (that is, a simple "edge" value)
Definition at line 119 of file CNetworkOfPoses.h.
| typedef CPOSE mrpt::graphs::CNetworkOfPoses::constraint_t |
The type of PDF poses in the contraints (edges) (=CPOSE template argument)
Definition at line 114 of file CNetworkOfPoses.h.
| typedef EDGE_ANNOTATIONS mrpt::graphs::CNetworkOfPoses::edge_annotations_t |
The extra annotations in edges, apart from a constraint_t.
Definition at line 116 of file CNetworkOfPoses.h.
| typedef MAPS_IMPLEMENTATION::template map<TNodeID,CPOSE> mrpt::graphs::CNetworkOfPoses::global_poses_pdf_t |
A map from pose IDs to their global coordinates estimates, with uncertainty.
Definition at line 131 of file CNetworkOfPoses.h.
| typedef MAPS_IMPLEMENTATION::template map<TNodeID,global_pose_t> mrpt::graphs::CNetworkOfPoses::global_poses_t |
A map from pose IDs to their global coordinates estimates, without uncertainty (the "most-likely value")
Definition at line 134 of file CNetworkOfPoses.h.
| typedef MAPS_IMPLEMENTATION mrpt::graphs::CNetworkOfPoses::maps_implementation_t |
The type of map's implementation (=MAPS_IMPLEMENTATION template argument)
Definition at line 118 of file CNetworkOfPoses.h.
| typedef NODE_ANNOTATIONS mrpt::graphs::CNetworkOfPoses::node_annotations_t |
The extra annotations in nodes, apart from a constraint_no_pdf_t.
Definition at line 115 of file CNetworkOfPoses.h.
| typedef CNetworkOfPoses<CPOSE,MAPS_IMPLEMENTATION,NODE_ANNOTATIONS,EDGE_ANNOTATIONS> mrpt::graphs::CNetworkOfPoses::self_t |
My own type.
Definition at line 112 of file CNetworkOfPoses.h.
| mrpt::graphs::CNetworkOfPoses::CNetworkOfPoses | ( | ) | [inline] |
Default constructor (just sets root to "0" and edges_store_inverse_poses to "false")
Definition at line 252 of file CNetworkOfPoses.h.
| mrpt::graphs::CNetworkOfPoses::~CNetworkOfPoses | ( | ) | [inline] |
Definition at line 253 of file CNetworkOfPoses.h.
| void mrpt::graphs::CNetworkOfPoses::clear | ( | void | ) | [inline] |
Empty all edges, nodes and set root to ID 0.
Definition at line 234 of file CNetworkOfPoses.h.
| size_t mrpt::graphs::CNetworkOfPoses::collapseDuplicatedEdges | ( | ) | [inline] |
Look for duplicated edges (even in opposite directions) between all pairs of nodes and fuse them.
Upon return, only one edge remains between each pair of nodes with the mean & covariance (or information matrix) corresponding to the Bayesian fusion of all the Gaussians.
Definition at line 201 of file CNetworkOfPoses.h.
| void mrpt::graphs::CNetworkOfPoses::dijkstra_nodes_estimate | ( | ) | [inline] |
Spanning tree computation of a simple estimation of the global coordinates of each node just from the information in all edges, sorted in a Dijkstra tree based on the current "root" node.
Note that "global" coordinates are with respect to the node with the ID specified in root.
Definition at line 195 of file CNetworkOfPoses.h.
| double mrpt::graphs::CNetworkOfPoses::getEdgeSquareError | ( | const typename BASE::edges_map_t::const_iterator & | itEdge, |
| bool | ignoreCovariances = true |
||
| ) | const [inline] |
Computes the square error of one pose constraints (edge) with respect to the global poses in If ignoreCovariances is false, the squared Mahalanobis distance will be computed instead of the straight square error.
| std::exception | On global poses not in nodes |
Definition at line 220 of file CNetworkOfPoses.h.
| double mrpt::graphs::CNetworkOfPoses::getEdgeSquareError | ( | const TNodeID | from_id, |
| const TNodeID | to_id, | ||
| bool | ignoreCovariances = true |
||
| ) | const [inline] |
Computes the square error of one pose constraints (edge) with respect to the global poses in If ignoreCovariances is false, the squared Mahalanobis distance will be computed instead of the straight square error.
| std::exception | On edge not existing or global poses not in nodes |
Definition at line 226 of file CNetworkOfPoses.h.
| double mrpt::graphs::CNetworkOfPoses::getGlobalSquareError | ( | bool | ignoreCovariances = true | ) | const [inline] |
Computes the overall square error from all the pose constraints (edges) with respect to the global poses in If ignoreCovariances is false, the squared Mahalanobis distance will be computed instead of the straight square error.
| std::exception | On global poses not in nodes |
Definition at line 208 of file CNetworkOfPoses.h.
| void mrpt::graphs::CNetworkOfPoses::loadFromTextFile | ( | const std::string & | fileName, |
| bool | collapse_dup_edges = true |
||
| ) | [inline] |
Loads from a text file in the format used by TORO & HoG-man (more on the format here ) Recognized line entries are: VERTEX2, VERTEX3, EDGE2, EDGE3, EQUIV.
If an unknown entry is found, a warning is dumped to std::cerr (only once for each unknown keyword). An exception will be raised if trying to load a 3D graph into a 2D class (in the opposite case, missing 3D data will default to zero).
| fileName | The file to load. |
| collapse_dup_edges | If true, collapseDuplicatedEdges will be called automatically after loading (note that this operation may take significant time for very large graphs). |
| On | any error, as a malformed line or loading a 3D graph in a 2D graph. |
Definition at line 180 of file CNetworkOfPoses.h.
| size_t mrpt::graphs::CNetworkOfPoses::nodeCount | ( | ) | const [inline] |
Return number of nodes in the list of global coordinates (may be differente that all nodes appearing in edges)
Definition at line 244 of file CNetworkOfPoses.h.
| void mrpt::graphs::CNetworkOfPoses::saveToTextFile | ( | const std::string & | fileName | ) | const [inline] |
Saves to a text file in the format used by TORO & HoG-man (more on the format here ) For 2D graphs only VERTEX2 & EDGE2 entries will be saved, and VERTEX3 & EDGE3 entries for 3D graphs.
Note that EQUIV entries will not be saved, but instead several EDGEs will be stored between the same node IDs.
| On | any error |
Definition at line 167 of file CNetworkOfPoses.h.
False (default) if an edge i->j stores the normal relative pose of j as seen from i:
True if an edge i->j stores the inverse relateive pose, that is, i as seen from j:
.
Definition at line 153 of file CNetworkOfPoses.h.
The nodes (vertices) of the graph, with their estimated "global" (with respect to root) position, without an associated covariance.
Definition at line 145 of file CNetworkOfPoses.h.
Referenced by mrpt::graphs::detail::graph_ops::load_graph_of_poses_from_text_file().
The ID of the node that is the origin of coordinates, used as reference by all coordinates in .
By default, root is the ID "0".
Definition at line 148 of file CNetworkOfPoses.h.
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Sun Oct 16 12:16:33 UTC 2011 |