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:
Definition at line 93 of file CNetworkOfPoses.h.
#include <mrpt/poses/CNetworkOfPoses.h>
Public Types | |
Typedef's | |
typedef mrpt::math::CDirectedGraph < CPOSE > | BASE |
The base class "CDirectedGraph<CPOSE>". | |
typedef CPOSE | constraint_t |
The type of PDF poses in the contraints (edges) (=CPOSE template argument) | |
typedef MAPS_IMPLEMENTATION | maps_implementation_t |
The type of map's implementation (=MAPS_IMPLEMENTATION template argument) | |
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, typename CPOSE::type_value > | 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") | |
~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 . |
typedef mrpt::math::CDirectedGraph< CPOSE > mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::BASE |
The base class "CDirectedGraph<CPOSE>".
Definition at line 100 of file CNetworkOfPoses.h.
typedef CPOSE mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::constraint_t |
The type of PDF poses in the contraints (edges) (=CPOSE template argument)
Definition at line 103 of file CNetworkOfPoses.h.
typedef MAPS_IMPLEMENTATION::template map<TNodeID,CPOSE> mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::global_poses_pdf_t |
A map from pose IDs to their global coordinates estimates, with uncertainty.
Definition at line 109 of file CNetworkOfPoses.h.
typedef MAPS_IMPLEMENTATION::template map<TNodeID,typename CPOSE::type_value> mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::global_poses_t |
A map from pose IDs to their global coordinates estimates, without uncertainty (the "most-likely value")
Definition at line 112 of file CNetworkOfPoses.h.
typedef MAPS_IMPLEMENTATION mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::maps_implementation_t |
The type of map's implementation (=MAPS_IMPLEMENTATION template argument)
Definition at line 106 of file CNetworkOfPoses.h.
mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::CNetworkOfPoses | ( | ) | [inline] |
Default constructor (just sets root to "0")
Definition at line 223 of file CNetworkOfPoses.h.
mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::~CNetworkOfPoses | ( | ) | [inline] |
Definition at line 224 of file CNetworkOfPoses.h.
void mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::clear | ( | void | ) | [inline] |
Empty all edges, nodes and set root to ID 0.
Definition at line 206 of file CNetworkOfPoses.h.
size_t mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::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 173 of file CNetworkOfPoses.h.
Referenced by mrpt::poses::CNetworkOfPoses< CPosePDFGaussianInf, map_traits_stdmap >::loadFromTextFile().
void mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::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 167 of file CNetworkOfPoses.h.
double mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::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 198 of file CNetworkOfPoses.h.
double mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::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 192 of file CNetworkOfPoses.h.
Referenced by mrpt::poses::CNetworkOfPoses< CPosePDFGaussianInf, map_traits_stdmap >::getEdgeSquareError().
double mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::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 180 of file CNetworkOfPoses.h.
void mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::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 153 of file CNetworkOfPoses.h.
size_t mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::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 215 of file CNetworkOfPoses.h.
void mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::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 140 of file CNetworkOfPoses.h.
global_poses_t mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::nodes |
The nodes (vertices) of the graph, with their estimated "global" (with respect to root) position, without an associated covariance.
Definition at line 123 of file CNetworkOfPoses.h.
Referenced by mrpt::poses::CNetworkOfPoses< CPosePDFGaussianInf, map_traits_stdmap >::clear(), and mrpt::poses::CNetworkOfPoses< CPosePDFGaussianInf, map_traits_stdmap >::nodeCount().
TNodeID mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::root |
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 126 of file CNetworkOfPoses.h.
Referenced by mrpt::poses::CNetworkOfPoses< CPosePDFGaussianInf, map_traits_stdmap >::clear().
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011 |