13 namespace mrpt {
namespace srba {
16 template <
class KF2KF_POSE_TYPE,
class LM_TYPE,
class OBS_TYPE,
class RBA_OPTIONS>
19 const pose_t &init_inv_pose_val )
22 #ifdef SRBA_WORKAROUND_MSVC9_DEQUE_BUG
24 k2k_edge_t & new_edge = *(*k2k_edges.rbegin());
30 new_edge.
from = ids.first;
31 new_edge.
to = ids.second;
35 new_edge.
inv_pose = init_inv_pose_val;
37 new_edge.
id = k2k_edges.size()-1;
42 std::deque<k2k_edge_t*> &edges = keyframes[ids.first ].adjacent_k2k_edges;
43 for (
size_t i=0;i<edges.size();++i)
46 if ( (e.
to==ids.first && e.
from==ids.second) ||
47 (e.
from==ids.first && e.
to==ids.second) )
49 throw std::runtime_error(
mrpt::format(
"[alloc_kf2kf_edge] ERROR: Edge already exists between %u -> %u",static_cast<unsigned int>(ids.first),static_cast<unsigned int>(ids.second) ) );
56 keyframes[ids.first ].adjacent_k2k_edges.push_back(&new_edge);
57 keyframes[ids.second].adjacent_k2k_edges.push_back(&new_edge);
60 const size_t remapIdx = new_edge.
id;
62 lin_system.dh_dAp.appendCol(remapIdx);
size_t alloc_kf2kf_edge(const TPairKeyFrameID &ids, const pose_t &init_inv_pose_val=pose_t())
Creates a new kf2kf edge variable.
size_t id
0-based index of this edge, in the std::list "k2k_edges".
Keyframe-to-keyframe edge: an unknown of the problem.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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".
std::pair< TKeyFrameID, TKeyFrameID > TPairKeyFrameID
Used to represent the IDs of a directed edge (first –> second)
KF2KF_POSE_TYPE::pose_t pose_t