14 namespace mrpt {
namespace srba {
17 template <
class KF2KF_POSE_TYPE,
class LM_TYPE,
class OBS_TYPE,
class RBA_OPTIONS>
21 const size_t max_depth,
22 std::vector<bool> * aux_ws
29 set<TKeyFrameID> visited;
30 queue<TKeyFrameID> pending;
31 map<TKeyFrameID,TBFSEntryEdges> preceding;
37 pending.push(root_id);
38 visited.insert(root_id);
39 preceding[root_id].dist = 0;
41 while (!pending.empty())
46 const topo_dist_t cur_dist = preceding[next_kf].dist;
48 if (cur_dist>=max_depth)
52 ASSERTDEB_(next_kf < rba_state.keyframes.size())
55 for (
size_t i=0;i<kfi.adjacent_k2k_edges.size();i++)
57 const k2k_edge_t* ed = kfi.adjacent_k2k_edges[i];
59 if (!visited.count(new_kf))
62 visited.insert(new_kf);
66 if (p.
dist>cur_dist+1)
79 multimap<topo_dist_t,pair<TKeyFrameID,TBFSEntryEdges> > kfs_by_depth;
82 kfs_by_depth.insert( make_pair( it->second.dist, *it ) );
88 for (
typename multimap<
topo_dist_t,pair<TKeyFrameID,TBFSEntryEdges> >::
const_iterator it=kfs_by_depth.begin();it!=kfs_by_depth.end();++it)
98 span_tree[ kf_id ].pose =
pose_t();
106 const pose_t & parent_pose = span_tree[ bfs_data.
prev ].pose;
109 pose_t & my_pose = span_tree[ kf_id ].pose;
112 if (bfs_data.
edge->
to==kf_id)
116 my_pose.composeFrom(parent_pose, -bfs_data.
edge->
inv_pose );
122 my_pose.composeFrom(parent_pose, bfs_data.
edge->
inv_pose );
const Scalar * const_iterator
KF2KF_POSE_TYPE::pose_t pose_t
The type of relative poses (e.g. mrpt::poses::CPose3D)
Keyframe-to-keyframe edge: an unknown of the problem.
uint64_t topo_dist_t
Unsigned integral type for topological distances in a graph/tree.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
Private aux structure for BFS searches.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
pose_t inv_pose
Inverse pose: pose_from (-) pose_to , that is: "from" as seen from "to".
kf2kf_pose_traits_t::frameid2pose_map_t frameid2pose_map_t
void create_complete_spanning_tree(const TKeyFrameID root_id, frameid2pose_map_t &span_tree, const size_t max_depth=std::numeric_limits< size_t >::max(), std::vector< bool > *aux_ws=NULL) const
Creates a numeric spanning tree between a given root keyframe and the entire graph, returning it into a user-supplied data structure Note that this method does NOT use the depth-limited spanning trees which are built incrementally with the graph.
Information per key-frame needed for RBA.
V getTheOtherFromPair2(const V one, const K2K_EDGE &p)
For usage with K2K_EDGE = typename kf2kf_pose_traits
::k2k_edge_t.
uint64_t TKeyFrameID
Numeric IDs for key-frames (KFs)