Main MRPT website > C++ reference
MRPT logo

mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION > Class Template Reference


Detailed Description

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
class mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >

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 $ p_{ij} $, 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:

See also:
mrpt::graphslam

Definition at line 93 of file CNetworkOfPoses.h.

#include <mrpt/poses/CNetworkOfPoses.h>

Inheritance diagram for mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >:
Inheritance graph
[legend]

List of all members.

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 .

Member Typedef Documentation

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.


Constructor & Destructor Documentation

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::CNetworkOfPoses ( ) [inline]

Default constructor (just sets root to "0")

Definition at line 223 of file CNetworkOfPoses.h.

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
mrpt::poses::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION >::~CNetworkOfPoses ( ) [inline]

Definition at line 224 of file CNetworkOfPoses.h.


Member Function Documentation

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.

Returns:
Overall number of removed edges.

Definition at line 173 of file CNetworkOfPoses.h.

Referenced by mrpt::poses::CNetworkOfPoses< CPosePDFGaussianInf, map_traits_stdmap >::loadFromTextFile().

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.

See also:
node, root

Definition at line 167 of file CNetworkOfPoses.h.

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.

Exceptions:
std::exceptionOn edge not existing or global poses not in nodes

Definition at line 198 of file CNetworkOfPoses.h.

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.

Exceptions:
std::exceptionOn global poses not in nodes

Definition at line 192 of file CNetworkOfPoses.h.

Referenced by mrpt::poses::CNetworkOfPoses< CPosePDFGaussianInf, map_traits_stdmap >::getEdgeSquareError().

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.

See also:
getEdgeSquareError
Exceptions:
std::exceptionOn global poses not in nodes

Definition at line 180 of file CNetworkOfPoses.h.

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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).

Parameters:
fileNameThe file to load.
collapse_dup_edgesIf true, collapseDuplicatedEdges will be called automatically after loading (note that this operation may take significant time for very large graphs).
See also:
loadFromBinaryFile, saveToTextFile
Exceptions:
Onany error, as a malformed line or loading a 3D graph in a 2D graph.

Definition at line 153 of file CNetworkOfPoses.h.

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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)

See also:
mrpt::math::CDirectedGraph::countDifferentNodesInEdges

Definition at line 215 of file CNetworkOfPoses.h.

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.

See also:
saveToBinaryFile, loadFromTextFile
Exceptions:
Onany error

Definition at line 140 of file CNetworkOfPoses.h.


Member Data Documentation

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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.

See also:
dijkstra_nodes_estimate

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().

template<class CPOSE, class MAPS_IMPLEMENTATION = map_traits_stdmap>
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