Main MRPT website > C++ reference
MRPT logo
get_global_graphslam_problem.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2015, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 namespace mrpt { namespace srba {
13 
14 /** Exports all the keyframes and landmarks as a directed graph in DOT (graphviz) format */
15 template <class KF2KF_POSE_TYPE,class LM_TYPE,class OBS_TYPE,class RBA_OPTIONS>
16 template <class POSE_GRAPH>
18  POSE_GRAPH &global_graph,
19  const ExportGraphSLAM_Params &params
20  ) const
21 {
22  global_graph.clear();
23  if (rba_state.keyframes.empty())
24  return; // Nothing to do
25 
26  // 1) Initialize global poses with a Spanning-tree:
27  // ------------------------------------------------
28  frameid2pose_map_t spantree;
29  create_complete_spanning_tree(params.root_kf_id,spantree); // Go thru COMPLETE graph (unbounded complexity, non O(1) )
30 
31  // For each key-frame, add a 3D corner:
32  for (typename frameid2pose_map_t::const_iterator itP = spantree.begin();itP!=spantree.end();++itP)
33  {
34  const TKeyFrameID kf_id = itP->first;
35  global_graph.nodes[kf_id] = itP->second.pose;
36  }
37 
38  // 2) Save KF-to-KF relative poses as edges:
39  // ------------------------------------------------
40  for (typename k2k_edges_deque_t::const_iterator itEdge=rba_state.k2k_edges.begin();itEdge!=rba_state.k2k_edges.end();++itEdge)
41  {
42  const k2k_edge_t & edge = *itEdge;
43  // Edges in RBA store *inverse* poses "from"->"to".
44  // Save as "normal" poses "to"->"from"
45  global_graph.insertEdgeAtEnd(edge.to, edge.from, edge.inv_pose);
46  }
47 
48 }
49 
50 
51 } } // end namespaces
const Scalar * const_iterator
Definition: eigen_plugins.h:24
Keyframe-to-keyframe edge: an unknown of the problem.
Definition: srba_types.h:82
void get_global_graphslam_problem(POSE_GRAPH &global_graph, const ExportGraphSLAM_Params &params=ExportGraphSLAM_Params()) const
Build a graph-slam problem suitable for recovering the (consistent) global pose (vs.
TKeyFrameID root_kf_id
The KF to use as a root for the spanning tree to init global poses (default=0)
Definition: RbaEngine.h:268
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
pose_t inv_pose
Inverse pose: pose_from (-) pose_to , that is: "from" as seen from "to".
Definition: srba_types.h:86
kf2kf_pose_traits_t::frameid2pose_map_t frameid2pose_map_t
Definition: RbaEngine.h:95
uint64_t TKeyFrameID
Numeric IDs for key-frames (KFs)
Definition: srba_types.h:31



Page generated by Doxygen 1.8.9.1 for MRPT 1.3.0 SVN: at Sun Sep 13 03:55:12 UTC 2015