Main MRPT website > C++ reference
MRPT logo
srba_types.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 
15 #include <mrpt/utils/TEnumType.h>
16 #include <mrpt/system/memory.h> // for MRPT_MAKE_ALIGNED_OPERATOR_NEW
17 #include <set>
18 
19 // (If you use Visual Studio 2008 and the "std::deque<k2f_edge_t>" line raises the error "error C2719: '_Val': formal parameter with __declspec(align('16')) won't be aligned",
20 // it's caused by this bug in either Eigen or VS2008 compiler, still to be fixed: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=83 )
21 // Meanwhile, let's just breath slow, count to 10, and go on with a workaround:
22 #if defined(_MSC_VER) && (_MSC_VER < 1700 ) && (MRPT_WORD_SIZE==32) // handle MSVC versions older than 2012
23 # define SRBA_WORKAROUND_MSVC9_DEQUE_BUG
24 #endif
25 
26 
27 namespace mrpt
28 {
29 namespace srba
30 {
31  typedef uint64_t TKeyFrameID; //!< Numeric IDs for key-frames (KFs)
32  typedef uint64_t TLandmarkID; //!< Numeric IDs for landmarks
33  typedef uint64_t topo_dist_t; //!< Unsigned integral type for topological distances in a graph/tree.
34  typedef std::pair<TKeyFrameID,TKeyFrameID> TPairKeyFrameID; //!< Used to represent the IDs of a directed edge (first --> second)
35 
36  // -------------------------------------------------------------------------------
37  /** @name Generic traits for observations, kf-to-kf poses, landmarks, etc.
38  @{ */
39 
40  /** Generic declaration, of which specializations are defined for each combination of LM+OBS type.
41  * \sa Implementations are in srba/models/sensors.h
42  */
43  template <class LANDMARK_TYPE,class OBS_TYPE>
44  struct sensor_model;
45 
46  /** The argument "POSE_TRAITS" can be any of those defined in srba/models/kf2kf_poses.h (typically, either kf2kf_poses::SE3 or kf2kf_poses::SE2).
47  * \sa landmark_traits, observation_traits
48  */
49  template <class POSE_TRAITS>
50  struct kf2kf_pose_traits: public POSE_TRAITS
51  {
53  typedef typename POSE_TRAITS::pose_t pose_t; //!< Will be mrpt::poses::CPose3D, ...
54  typedef typename mrpt::math::CArrayDouble<POSE_TRAITS::REL_POSE_DIMS> array_pose_t; //!< A fixed-length array of the size of the relative poses between keyframes
55 
56  /** A joint structure for one relative pose + an "up-to-date" flag (needed for spanning trees numeric updates) */
57  struct pose_flag_t
58  {
59  pose_t pose;
60  mutable bool updated;
61 
62  pose_flag_t() : updated(false) { }
63  pose_flag_t(const pose_t &pose_, const bool updated_) : pose(pose_),updated(updated_) { }
64 
65  inline void mark_outdated() const { updated=false; }
66 
67  MRPT_MAKE_ALIGNED_OPERATOR_NEW // Needed because we have fixed-length Eigen matrices (within CPose3D)
68  };
69 
70  /** "numeric" values of spanning tree poses: */
72 
73  // Use special map-like container with an underlying planar deque container, which avoid reallocations
74  // and still provides map-like [] access at O(1).
78  typename std::deque<std::pair<TKeyFrameID,frameid2pose_map_t> >
80 
81  /** Keyframe-to-keyframe edge: an unknown of the problem */
82  struct k2k_edge_t
83  {
84  TKeyFrameID from;
85  TKeyFrameID to;
86  pose_t inv_pose; //!< Inverse pose: pose_from (-) pose_to , that is: "from" as seen from "to".
87 
88  size_t id; //!< 0-based index of this edge, in the std::list "k2k_edges".
89 
90  MRPT_MAKE_ALIGNED_OPERATOR_NEW // Needed because we have fixed-length Eigen matrices (within CPose3D)
91  };
92 
93  typedef std::deque<k2k_edge_t*> k2k_edge_vector_t; //!< A sequence of edges (a "path")
94  }; // end of kf2kf_pose_traits
95 
96  /** The argument "LM_TRAITS" can be any of those defined in srba/models/landmarks.h (typically, either landmarks::Euclidean3D or landmarks::Euclidean2D).
97  * \sa landmark_traits, observation_traits
98  */
99  template <class LM_TRAITS>
100  struct landmark_traits: public LM_TRAITS
101  {
103  typedef typename mrpt::math::CArrayDouble<LM_TRAITS::LM_DIMS> array_landmark_t; //!< A fixed-length array of the size of the parameters of one landmark in the map (e.g. if Euclidean coordinates are used, this will hold the coordinates)
104 
105  /** One relative feature observation entry, used with some relative bundle-adjustment functions. */
107  {
108  inline TRelativeLandmarkPos() { }
109  /** Constructor from a base KF ID "_id_frame_base" and any object "_pos" that offers a read [] operator and has the correct length of "LM_TRAITS::LM_DIMS"
110  * \tparam LANDMARK_POS Could be: "array_landmark_t", "double *", "mrpt::math::TPoint3D", etc.
111  */
112  template <typename LANDMARK_POS>
113  inline TRelativeLandmarkPos(const TKeyFrameID _id_frame_base, const LANDMARK_POS &_pos) : id_frame_base(_id_frame_base) {
114  for (size_t i=0;i<LM_TRAITS::LM_DIMS;i++) pos[i]=_pos[i];
115  }
116 
117  TKeyFrameID id_frame_base; //!< The ID of the camera frame which is the coordinate reference of \a pos
118  array_landmark_t pos; //!< The parameterization of the feature location, wrt to the camera frame \a id_frame_base - For example, this could simply be Euclidean coordinates (x,y,z)
119 
120  MRPT_MAKE_ALIGNED_OPERATOR_NEW // Needed because we have fixed-length Eigen matrices ("array_landmark_t")
121  };
122 
123  /** An index of feature IDs and their relative locations */
124  typedef std::map<TLandmarkID, TRelativeLandmarkPos> TRelativeLandmarkPosMap;
125 
126  /** Used in the vector \a "all_lms" */
128  {
129  bool has_known_pos; //!< true: This landmark has a fixed (known) relative position. false: The relative pos of this landmark is an unknown of the problem.
130  TRelativeLandmarkPos *rfp; //!< Pointers to elements in \a unknown_lms and \a known_lms.
131 
132  TLandmarkEntry() : has_known_pos(true), rfp(NULL) {}
133  TLandmarkEntry(bool has_known_pos_, TRelativeLandmarkPos *rfp_) : has_known_pos(has_known_pos_), rfp(rfp_)
134  {}
135  };
136 
137  }; // end of landmark_traits
138 
139  template <class OBS_TRAITS>
140  struct observation_traits : public OBS_TRAITS
141  {
142  typedef typename mrpt::math::CArrayDouble<OBS_TRAITS::OBS_DIMS> array_obs_t; //!< A fixed-length array of the size of one residual (=the size of one observation).
143  typedef typename mrpt::math::CArrayDouble<OBS_TRAITS::OBS_DIMS> residual_t; //!< A fixed-length array of the size of one residual (=the size of one observation).
144 
146 
147  /** Elemental observation data */
149  {
150  TLandmarkID feat_id; //!< Observed what
151  typename OBS_TRAITS::obs_data_t obs_data; //!< Observed data
152  };
153 
155 
156  }; // end of "observation_traits"
157 
158  /** @} */
159  // --------------------------------------------------------------
160 
161  /** For usage in RbaEngine.parameters
162  * \note Implements mrpt::utils::TEnumType
163  */
165  /** The sub-map method introduced in the ICRA2013 paper */
167  /** Each keyframe is only connected to its predecessor (no loop closures) */
169  /** All keyframes are connected to the first one (it can be used to emulate global coordinates) */
171  };
172 
173  /** Covariances recovery from Hessian matrix policy, for usage in RbaEngine.parameters
174  * \note Implements mrpt::utils::TEnumType
175  */
177  /** Don't recover any covariance information */
178  crpNone = 0,
179  /** Approximate covariances of landmarks as the inverse of the hessian diagonal blocks */
181  };
182 
183  /** Aux function for getting, from a std::pair, "the other" element which is different to a known given one. */
184  template <typename PAIR,typename V>
185  V getTheOtherFromPair(const V one, const PAIR &p) {
186  return p.first==one ? p.second : p.first;
187  }
188 
189  /** For usage with K2K_EDGE = typename kf2kf_pose_traits<POSE_TRAITS>::k2k_edge_t */
190  template <typename K2K_EDGE,typename V>
191  V getTheOtherFromPair2(const V one, const K2K_EDGE &p) {
192  return p.from==one ? p.to: p.from;
193  }
194 
195  /** Used in TNewKeyFrameInfo */
197  {
198  size_t id; //!< The new edge ID
199  /** Whether the edge was assigned an approximated initial value. If not, it will need an independent optimization step before getting into the complete problem optimization.
200  */
202  };
203 
204  /** Symbolic information of each Jacobian dh_dAp
205  */
206  template <class KF2KF_POSE_TYPE, class LANDMARK_TYPE>
208  {
211 
212  /** The two relative poses used in this Jacobian (see papers)
213  * Pointers to the elements in the "numeric" part of the spanning tree ( TRBA_Problem_state::TSpanningTree )
214  */
215  const typename kf2kf_traits_t::pose_flag_t * rel_pose_d1_from_obs, * rel_pose_base_from_d1;
216 
217  /** If true, the edge direction points in the "canonical" direction: from "d" towards the direction of "obs"
218  * If false, this fact should be taking into account while computing the derivatives...
219  */
221 
222  /** Pointer to the relative feature position wrt its base KF */
224 
225  /** The ID of the keyframe *before* the edge wrt which we are taking derivatives (before if going
226  * backwards from the observer KF towards the base KF of the feature). "d+1" in paper figures.
227  */
228  TKeyFrameID kf_d;
229 
230  /** The ID of the base keyframe of the observed feature */
231  TKeyFrameID kf_base;
232 
233  /** The ID (0-based index in \a k2k_edges) of the edge wrt we are taking derivatives */
234  size_t k2k_edge_id;
235 
236  /** The global index of the observation that generates this Jacobian. */
237  size_t obs_idx;
238 
239  char * is_valid; //!< A reference to the validity bit in the global list \a TRBA_Problem_state::all_observations_Jacob_validity
240  };
241 
242 
243  /** Symbolic information of each Jacobian dh_df
244  */
245  template <class KF2KF_POSE_TYPE, class LANDMARK_TYPE>
247  {
250 
251  /** A pointer to the relative position structure within rba_state.unknown_lms[] for this feature
252  */
254 
255  /** The relative poses used in this Jacobian (see papers)
256  * Pointers to the elements in the "numeric" part of the spanning tree ( TRBA_Problem_state::TSpanningTree )
257  */
258  const typename kf2kf_traits_t::pose_flag_t * rel_pose_base_from_obs;
259 
260  /** The global index of the observation that generates this Jacobian. */
261  size_t obs_idx;
262 
263  char* is_valid; //!< A reference to the validity bit in the global list \a TRBA_Problem_state::all_observations_Jacob_validity
264  };
265 
266  /** Symbolic information of each Hessian block
267  * \tparam Scalar Typ.=double
268  * \tparam N Observation size
269  * \tparam M1 Left-hand Jacobian column count
270  * \tparam M2 Right-hand Jacobian column count
271  */
272  template <typename Scalar,int N,int M1,int M2>
274  {
275  typedef Eigen::Matrix<Scalar,N,M1> matrix1_t;
276  typedef Eigen::Matrix<Scalar,N,M2> matrix2_t;
277 
278  /** This Hessian block equals the sum of all J1^t * \Lambda * J2, with J1=first, J2=second in each std::pair
279  * "const char *" are pointers to the validity bit of each Jacobian, so if it evaluates to false we
280  * should discard the Hessian entry.
281  */
283  {
284  const matrix1_t * J1;
285  const matrix2_t * J2;
286  const char * J1_valid;
287  const char * J2_valid;
288  size_t obs_idx; //!< Global index of the observation that generated this Hessian entry (used to retrieve the \Lambda in "J1^t * \Lambda * J2", if applicable).
289 
290  THessianSymbolicInfoEntry(const matrix1_t * const J1_, const matrix2_t * const J2_, const char * const J1_valid_, const char * const J2_valid_, const size_t obs_idx_ ) :
291  J1(J1_), J2(J2_),J1_valid(J1_valid_),J2_valid(J2_valid_),obs_idx(obs_idx_)
292  { }
293 
294  // Default ctor: should not be invoked under normal usage, but just in case:
295  THessianSymbolicInfoEntry() : J1(NULL),J2(NULL),J1_valid(NULL),J2_valid(NULL),obs_idx(static_cast<size_t>(-1)) {}
296  };
297 
298  typedef std::vector<THessianSymbolicInfoEntry> list_jacob_blocks_t;
299 
300  list_jacob_blocks_t lst_jacob_blocks; //!< The list of Jacobian blocks itself
301  };
302 
303  /** Types for the Jacobians:
304  * \code
305  * J = [ dh_dAp | dh_df ]
306  * \endcode
307  */
308  template <class KF2KF_POSE_TYPE, class LANDMARK_TYPE,class OBS_TYPE>
310  {
311  static const size_t OBS_DIMS = OBS_TYPE::OBS_DIMS;
312  static const size_t REL_POSE_DIMS = KF2KF_POSE_TYPE::REL_POSE_DIMS;
313  static const size_t LM_DIMS = LANDMARK_TYPE::LM_DIMS;
314 
317 
320  };
321 
322  /** Types for the Hessian blocks:
323  * \code
324  * [ H_Ap | H_Apf ]
325  * H = [ ---------+-------- ]
326  * [ H_Apf^t | Hf ]
327  * \endcode
328  */
329  template <class KF2KF_POSE_TYPE, class LANDMARK_TYPE,class OBS_TYPE>
331  {
332  static const size_t OBS_DIMS = OBS_TYPE::OBS_DIMS;
333  static const size_t REL_POSE_DIMS = KF2KF_POSE_TYPE::REL_POSE_DIMS;
334  static const size_t LM_DIMS = LANDMARK_TYPE::LM_DIMS;
335 
339 
340  // (the final "false" in all types is because we don't need remapping of indices in hessians)
344 
345  /** The list with all the information matrices (estimation uncertainty) for each unknown landmark. */
347  TLandmarkID,
350 #if !defined(SRBA_WORKAROUND_MSVC9_DEQUE_BUG)
351  deque_t // Use a deque for all compilers
352 #else
353  vector_t // except for MSVC9, for "this" little bug
354 #endif
356  };
357 
358 
359  /** Useful data structures that depend of a combination of "OBSERVATION_TYPE"+"LANDMARK_PARAMETERIZATION_TYPE"+"RELATIVE_POSE_PARAMETERIZATION"
360  */
361  template <class KF2KF_POSE_TYPE,class LM_TYPE,class OBS_TYPE>
363  {
367 
368  typedef typename kf2kf_traits_t::k2k_edge_t k2k_edge_t;
369 
370  /** Observations, as provided by the user. The following combinations are possible:
371  * \code
372  * +-----------+---------------------------------------------+---------------------------------+
373  * | DATA FIELDS | |
374  * +-----------+-------------------------+-------------------+ RESULTING OBSERVATION |
375  * | is_fixed | is_unknown_with_init_val| feat_rel_pos | |
376  * +-----------+-------------------------+-------------------+---------------------------------+
377  * | | | | First observation of a landmark |
378  * | true | ( IGNORED ) | Landmark position | with a fixed (known) relative |
379  * | | | | position wrt this keyframe |
380  * +-----------+-------------------------+-------------------+---------------------------------+
381  * | | | | First observation of a landmark |
382  * | false | true | Landmark position | with unknown relative position |
383  * | | | | whose guess is given in feat_rel_pos |
384  * +-----------+-------------------------+-------------------+---------------------------------+
385  * | | | | Either: |
386  * | | | | * First observation of a LM |
387  * | false | false | (IGNORED) | with unknown relative pos. |
388  * | | | | In this case we'll call sensor_model<>::inverse_sensor_model()
389  * | | | | * Subsequent observations of |
390  * | | | | any fixed or unknown LM. |
391  * +-----------+-------------------------+-------------------+---------------------------------+
392  * \endcode
393  */
395  {
396  /** Default ctor */
398 
400 
401  /** If true, \a feat_rel_pos has the fixed relative position of this landmark (Can be set to true only upon the FIRST observation of a fixed landmark)
402  */
403  bool is_fixed;
404 
405  /** Can be set to true only upon FIRST observation of a landmark with UNKNOWN relative position (the normal case).
406  * If set to true, \a feat_rel_pos has the fixed relative position of this landmark.
407  */
409 
410  typename lm_traits_t::array_landmark_t feat_rel_pos; //!< Ignored unless \a is_fixed OR \a is_unknown_with_init_val are true (only one of them at once).
411 
412  /** Sets \a feat_rel_pos from any object that offers a [] operator and has the expected length "LM_TYPE::LM_DIMS" */
413  template <class REL_POS> inline void setRelPos(const REL_POS &pos) {
414  for (size_t i=0;i<LM_TYPE::LM_DIMS;i++) feat_rel_pos[i]=pos[i];
415  }
416  };
417 
418  /** A set of all the observations made from a new KF, as provided by the user */
419 #ifdef SRBA_WORKAROUND_MSVC9_DEQUE_BUG
420  typedef std::vector<new_kf_observation_t> new_kf_observations_t;
421 #else
422  typedef std::deque<new_kf_observation_t> new_kf_observations_t;
423 #endif
424 
425 
426 
427  /** Keyframe-to-feature edge: observations in the problem */
429  {
430  inline kf_observation_t() {}
431  inline kf_observation_t(const typename obs_traits_t::observation_t &obs_, const TKeyFrameID kf_id_) : obs(obs_), kf_id(kf_id_) {}
432 
433  typename obs_traits_t::observation_t obs; //!< Observation data
434  typename obs_traits_t::array_obs_t obs_arr; //!< Observation data, summarized as an array of its parameters: obs.obs_data.getAsArray(obs_arr);
435  TKeyFrameID kf_id; //!< Observed from
436 
437  MRPT_MAKE_ALIGNED_OPERATOR_NEW // This forces aligned mem allocation
438  };
439 
440 
441  /** Keyframe-to-feature edge: observation data stored for each keyframe */
442  struct k2f_edge_t
443  {
445  bool feat_has_known_rel_pos; //!< whether it's a known or unknown relative position feature
446  bool is_first_obs_of_unknown; //!< true if this is the first observation of a feature with unknown relative position
447  typename lm_traits_t::TRelativeLandmarkPos *feat_rel_pos; //!< Pointer to the known/unknown rel.pos. (always!=NULL)
448 
449  MRPT_MAKE_ALIGNED_OPERATOR_NEW // This forces aligned mem allocation
450  };
451 
452  /** Information per key-frame needed for RBA */
454  {
455  std::deque<k2k_edge_t*> adjacent_k2k_edges;
456  std::deque<k2f_edge_t*> adjacent_k2f_edges;
457  };
458 
459  }; // end of "rba_joint_parameterization_traits_t"
460 
461 
462  /** Used in TRBA_Problem_state */
464  {
465  TKeyFrameID next; //!< The next keyframe in the tree
466  topo_dist_t distance; //!< Remaining distance until the given target from this point.
467  };
468 
469  /** All the important data of a RBA problem at any given instant of time
470  * Operations on this structure are performed via the public API of srba::RbaEngine
471  * \sa RbaEngine
472  */
473  template <class KF2KF_POSE_TYPE,class LM_TYPE,class OBS_TYPE,class RBA_OPTIONS>
475  {
476  typedef typename KF2KF_POSE_TYPE::pose_t pose_t;
488 
489 #ifdef SRBA_WORKAROUND_MSVC9_DEQUE_BUG
490  typedef typename std::deque< stlplus::smart_ptr<k2k_edge_t> > k2k_edges_deque_t; // Note: A std::deque() does not invalidate pointers/references, as we always insert elements at the end; we'll exploit this...
491  typedef std::deque< stlplus::smart_ptr<k2f_edge_t> > all_observations_deque_t;
492 #else
493  typedef typename mrpt::aligned_containers<k2k_edge_t>::deque_t k2k_edges_deque_t; // Note: A std::deque() does not invalidate pointers/references, as we always insert elements at the end; we'll exploit this...
495 #endif
496 
497  typedef std::deque<keyframe_info> keyframe_vector_t; //!< Index are "TKeyFrameID" IDs. There's no NEED to make this a deque<> for preservation of references, but is an efficiency improvement
498 
500  {
501  /** The definition seems complex but behaves just like: std::map< TKeyFrameID, std::map<TKeyFrameID,TSpanTreeEntry> > */
503  TKeyFrameID,
504  std::map<TKeyFrameID,TSpanTreeEntry>,
505  std::deque<std::pair<TKeyFrameID,std::map<TKeyFrameID,TSpanTreeEntry> > >
507 
508  /** The definition seems complex but behaves just like: std::map< TKeyFrameID, std::map<TKeyFrameID, k2k_edge_vector_t> > */
510  TKeyFrameID,
511  std::map<TKeyFrameID, k2k_edge_vector_t>,
512  std::deque<std::pair<TKeyFrameID,std::map<TKeyFrameID, k2k_edge_vector_t > > >
514 
516 
517  /** @name Data structures
518  * @{ */
519 
520  /** The "symbolic" part of the spanning tree */
522  {
523  /** Given all interesting spanning tree roots (=SOURCE), this structure holds:
524  * map[SOURCE] |-> map[TARGET] |-> next node to follow
525  *
526  * \note This defines a table with symmetric distances D(i,j)=D(j,i) but with asymetric next nodes N(i,j)!=N(j,i).
527  * So, we store both [i][j] and [j][i] in all cases.
528  */
530 
531  /** From the previous data, we can build this alternative, more convenient representation:
532  * map[SOURCE] |-> map[TARGET] |-> vector of edges to follow.
533  *
534  * \note This table is symmetric since the shortest path i=>j is the same (in reverse order) than that for j=>i.
535  * So, we only store the entries for [i][j], i>j.
536  */
538  }
539  sym;
540 
541  /** "Numeric" spanning tree: the SE(3) pose of each node wrt to any other:
542  * num[SOURCE] |--> map[TARGET] = CPose3D of TARGET as seen from SOURCE
543  * (typ: SOURCE is the observing KF, TARGET is the reference base of the observed landmark)
544  *
545  * Numeric poses are valid after calling \a update_numeric()
546  *
547  * NOTE: Both symmetric poses, e.g. (i,j) and also (j,i), are stored for convenience of
548  * being able to get references/pointers to them.
549  */
551 
552  /** @} */
553 
554 
555  /** @name Spanning tree main operations
556  * @{ */
557 
558  /** Empty all sym & num data */
559  void clear();
560 
561  /** Incremental update of spanning trees after the insertion of ONE new node and ONE OR MORE edges
562  * \param[in] max_distance Is the maximum distance at which a neighbor can be so we store the shortest path to it.
563  */
565  const TKeyFrameID new_node_id,
566  const TPairKeyFrameID & new_edge,
567  const topo_dist_t max_depth,
568  const bool check_all_obs_are_connected = false,
569  const new_kf_observations_t * obs = NULL
570  );
571 
572  /** Updates all the numeric SE(3) poses from ALL the \a sym.all_edges
573  * \return The number of updated poses.
574  */
575  size_t update_numeric(bool skip_marked_as_uptodate = false);
576 
577  /** idem, for the set of edges that have as "from" node any of the IDs in the passed set. */
578  size_t update_numeric(const std::set<TKeyFrameID> & kfs_to_update,bool skip_marked_as_uptodate = false);
579 
580  /** Updates all the numeric SE(3) poses from a given entry from \a sym.all_edges[i]
581  * \return The number of updated poses.
582  */
583  size_t update_numeric_only_all_from_node( const typename all_edges_maps_t::const_iterator & it,bool skip_marked_as_uptodate = false);
584 
585  /** @} */
586 
587  /** @name Spanning tree misc. operations
588  * @{ */
589 
590  /** Useful for debugging */
591  void dump_as_text(std::string &s) const;
592 
593  /** Useful for debugging \return false on error */
594  bool dump_as_text_to_file(const std::string &sFileName) const;
595 
596  /** Saves all (or a subset of all) the spanning trees
597  * If kf_roots_to_save is left empty, all STs are saved. Otherwise, only those with the given roots.
598  * \return false on error
599  */
600  bool save_as_dot_file(const std::string &sFileName, const std::vector<TKeyFrameID> &kf_roots_to_save = std::vector<TKeyFrameID>() ) const;
601 
602  /** Returns min/max and mean/std stats on the number of nodes found on all the spanning trees. Runs in O(N), N=number of keyframes. */
603  void get_stats(
604  size_t &num_nodes_min,
605  size_t &num_nodes_max,
606  double &num_nodes_mean,
607  double &num_nodes_std) const;
608 
609  /** @} */
610 
611  }; // end of TSpanningTree
612 
613 
615  {
617  dh_dAp(),
618  dh_df()
619  {
620  }
621 
622  typename jacobian_traits<KF2KF_POSE_TYPE,LM_TYPE,OBS_TYPE>::TSparseBlocksJacobians_dh_dAp dh_dAp; //!< Both symbolic & numeric info on the sparse Jacobians wrt. the edges
623  typename jacobian_traits<KF2KF_POSE_TYPE,LM_TYPE,OBS_TYPE>::TSparseBlocksJacobians_dh_df dh_df; //!< Both symbolic & numeric info on the sparse Jacobians wrt. the observations
624 
625  void clear() {
626  dh_dAp.clearAll();
627  dh_df.clearAll();
628  }
629 
630  }; // end of TLinearSystem
631 
632  /** @name Data
633  @{ */
634 
635  keyframe_vector_t keyframes; //!< All key frames (global poses are not included in an RBA problem). Vector indices are "TKeyFrameID" IDs.
636  k2k_edges_deque_t k2k_edges; //!< (unknowns) All keyframe-to-keyframe edges
637  TRelativeLandmarkPosMap unknown_lms; //!< (unknown values) Landmarks with an unknown fixed 3D position relative to their base frame_id
638  landmarks2infmatrix_t unknown_lms_inf_matrices; //!< Information matrices that model the uncertainty in each XYZ position for the unknown LMs - these matrices should be already scaled according to the camera noise in pixel standard deviations.
639  TRelativeLandmarkPosMap known_lms; //!< (known values) Landmarks with a known, fixed 3D position relative to their base frame_id
640 
641  /** Index (by feat ID) of ALL landmarks stored in \a unknown_lms and \a known_lms.
642  * Note that if gaps occur in the observed feature IDs, some pointers here will be NULL and some mem will be wasted, but in turn we have a O(1) search mechanism for all LMs. */
644 
646  all_observations_deque_t all_observations; //!< All raw observation data (k2f edges)
647  TLinearSystem lin_system; //!< The sparse linear system of equations
648 
649  /** Its size grows simultaneously to all_observations, its values are updated during optimization to
650  * reflect invalid conditions in some Jacobians so we can completely discard their information
651  * while building the Hessian.
652  * \note Kept as deque so we can have references to this.
653  */
655 
656  /** @} */
657 
658  /** Empties all members */
659  void clear() {
660  keyframes.clear();
661  k2k_edges.clear();
662  unknown_lms.clear();
663  unknown_lms_inf_matrices.clear();
664  known_lms.clear();
665  all_lms.clear();
666  spanning_tree.clear();
667  all_observations.clear();
668  lin_system.clear();
669  }
670 
671  /** Ctor */
673  spanning_tree.m_parent=this; // Not passed as ctor argument to avoid compiler warnings...
674  }
675 
676  /** Auxiliary, brute force (BFS) method for finding the shortest path between any two Keyframes.
677  * Use only when the distance between nodes can be larger than the maximum depth of incrementally-built spanning trees
678  * \param[in,out] out_path_IDs (Ignored if ==NULL) Just leave this vector uninitialized at input, it'll be automatically initialized to the right size and values.
679  * \param[in,out] out_path_edges (Ignored if ==NULL) Just like out_path_IDs, but here you'll receive the list of traversed edges, instead of the IDs of the visited KFs.
680  * \return false if no path was found.
681  */
682  bool find_path_bfs(
683  const TKeyFrameID from,
684  const TKeyFrameID to,
685  std::vector<TKeyFrameID> * out_path_IDs,
686  typename kf2kf_pose_traits<KF2KF_POSE_TYPE>::k2k_edge_vector_t * out_path_edges = NULL) const;
687 
688 
689  /** Computes stats on the degree (# of adjacent nodes) of all the nodes in the graph. Runs in O(N) with N=# of keyframes */
691  double &out_mean_degree,
692  double &out_std_degree,
693  double &out_max_degree) const;
694 
695  /** Returns true if the pair of KFs are connected thru a kf2kf edge, no matter the direction of the edge. Runs in worst-case O(D) with D the degree of the KF graph (that is, the maximum number of edges adjacent to one KF) */
696  bool are_keyframes_connected(const TKeyFrameID id1, const TKeyFrameID id2) const;
697 
698  /** Creates a new kf2kf edge variable. Called from create_kf2kf_edge()
699  *
700  * \param[in] init_inv_pose_val The initial value for the inverse pose stored in edge first->second, i.e. the pose of first wrt. second.
701  * \return The ID of the new kf2kf edge, which coincides with the 0-based index of the new entry in "rba_state.k2k_edges"
702  *
703  * \note Runs in O(1)
704  */
705  size_t alloc_kf2kf_edge(
706  const TPairKeyFrameID &ids,
707  const pose_t &init_inv_pose_val = pose_t() );
708 
709  private:
710  // Forbid making copies of this object, since it heavily relies on internal lists of pointers:
713 
714  }; // end of TRBA_Problem_state
715 
716 
717 } // end of namespace "srba"
718 
719 // Specializations MUST occur at the same namespace:
720 namespace utils
721 {
722  template <>
724  {
726  static void fill(bimap<enum_t,std::string> &m_map)
727  {
728  m_map.insert(srba::ecpICRA2013, "ecpICRA2013");
729  m_map.insert(srba::ecpLinearGraph, "ecpLinearGraph");
730  m_map.insert(srba::ecpStarGraph, "ecpStarGraph");
731  }
732  };
733 
734  template <>
736  {
738  static void fill(bimap<enum_t,std::string> &m_map)
739  {
740  m_map.insert(srba::crpNone, "crpNone");
741  m_map.insert(srba::crpLandmarksApprox, "crpLandmarksApprox");
742  }
743  };
744 
745 } // End of namespace
746 
747 } // end of namespace
kf2kf_pose_traits< KF2KF_POSE_TYPE >::pose_flag_t pose_flag_t
Definition: srba_types.h:480
kf2kf_pose_traits< KF2KF_POSE_TYPE >::frameid2pose_map_t frameid2pose_map_t
Definition: srba_types.h:479
next_edge_maps_t next_edge
Given all interesting spanning tree roots (=SOURCE), this structure holds: map[SOURCE] |-> map[TARGET...
Definition: srba_types.h:529
mrpt::utils::map_as_vector< TKeyFrameID, std::map< TKeyFrameID, k2k_edge_vector_t >, std::deque< std::pair< TKeyFrameID, std::map< TKeyFrameID, k2k_edge_vector_t > > > > all_edges_maps_t
The definition seems complex but behaves just like: std::map< TKeyFrameID, std::map >
Definition: srba_types.h:513
mrpt::aligned_containers< TLandmarkEntry >::deque_t all_lms
Index (by feat ID) of ALL landmarks stored in unknown_lms and known_lms.
Definition: srba_types.h:643
const kf2kf_traits_t::pose_flag_t * rel_pose_base_from_obs
The relative poses used in this Jacobian (see papers) Pointers to the elements in the "numeric" part ...
Definition: srba_types.h:258
TJacobianSymbolicInfo_dh_df< KF2KF_POSE_TYPE, LANDMARK_TYPE > jacob_dh_df_info_t
Definition: srba_types.h:316
const kf2kf_traits_t::pose_flag_t * rel_pose_base_from_d1
Definition: srba_types.h:215
A STL-like container which looks and behaves (almost exactly) like a std::map<> but is implemented as...
Definition: map_as_vector.h:46
obs_traits_t::observation_t obs
Observation data.
Definition: srba_types.h:433
Symbolic information of each Jacobian dh_df.
Definition: srba_types.h:246
mrpt::math::CArrayDouble< LM_TRAITS::LM_DIMS > array_landmark_t
A fixed-length array of the size of the parameters of one landmark in the map (e.g. if Euclidean coordinates are used, this will hold the coordinates)
Definition: srba_types.h:103
OBS_TRAITS::obs_data_t obs_data
Observed data.
Definition: srba_types.h:151
struct mrpt::srba::TRBA_Problem_state::TSpanningTree::TSpanningTreeSym sym
void setRelPos(const REL_POS &pos)
Sets feat_rel_pos from any object that offers a [] operator and has the expected length "LM_TYPE::LM_...
Definition: srba_types.h:413
static const size_t LM_DIMS
Definition: srba_types.h:334
size_t alloc_kf2kf_edge(const TPairKeyFrameID &ids, const pose_t &init_inv_pose_val=pose_t())
Creates a new kf2kf edge variable.
rba_joint_parameterization_traits_t< KF2KF_POSE_TYPE, LM_TYPE, OBS_TYPE >::new_kf_observations_t new_kf_observations_t
Definition: srba_types.h:486
size_t k2k_edge_id
The ID (0-based index in k2k_edges) of the edge wrt we are taking derivatives.
Definition: srba_types.h:234
#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
Definition: memory.h:112
size_t obs_idx
The global index of the observation that generates this Jacobian.
Definition: srba_types.h:261
uint64_t TLandmarkID
Numeric IDs for landmarks.
Definition: srba_types.h:32
Types for the Jacobians:
Definition: srba_types.h:309
Types for the Hessian blocks:
Definition: srba_types.h:330
THessianSymbolicInfo< double, OBS_DIMS, REL_POSE_DIMS, LM_DIMS > hessian_Apf_info_t
Definition: srba_types.h:338
mrpt::utils::map_as_vector< TKeyFrameID, frameid2pose_map_t, typename std::deque< std::pair< TKeyFrameID, frameid2pose_map_t > > > TRelativePosesForEachTarget
Definition: srba_types.h:79
kf2kf_pose_traits< KF2KF_POSE_TYPE >::k2k_edge_vector_t k2k_edge_vector_t
Definition: srba_types.h:478
TEdgeCreationPolicy
For usage in RbaEngine.parameters.
Definition: srba_types.h:164
kf2kf_pose_traits< KF2KF_POSE_TYPE > kf2kf_traits_t
Definition: srba_types.h:209
bool edge_normal_dir
If true, the edge direction points in the "canonical" direction: from "d" towards the direction of "o...
Definition: srba_types.h:220
const char * J2_valid
Definition: srba_types.h:287
Don't recover any covariance information.
Definition: srba_types.h:178
kf2kf_pose_traits< KF2KF_POSE_TYPE >::k2k_edge_t k2k_edge_t
Definition: srba_types.h:477
TKeyFrameID kf_base
The ID of the base keyframe of the observed feature.
Definition: srba_types.h:231
std::deque< char > all_observations_Jacob_validity
Its size grows simultaneously to all_observations, its values are updated during optimization to refl...
Definition: srba_types.h:654
std::map< TYPE1, TYPE2, std::less< TYPE1 >, Eigen::aligned_allocator< std::pair< const TYPE1, TYPE2 > > > map_t
The sub-map method introduced in the ICRA2013 paper.
Definition: srba_types.h:166
size_t id
0-based index of this edge, in the std::list "k2k_edges".
Definition: srba_types.h:88
static const size_t REL_POSE_DIMS
Definition: srba_types.h:333
mrpt::math::CArrayDouble< POSE_TRAITS::REL_POSE_DIMS > array_pose_t
A fixed-length array of the size of the relative poses between keyframes.
Definition: srba_types.h:54
Only specializations of this class are defined for each enum type of interest.
Definition: TEnumType.h:23
TLandmarkEntry(bool has_known_pos_, TRelativeLandmarkPos *rfp_)
Definition: srba_types.h:133
Keyframe-to-keyframe edge: an unknown of the problem.
Definition: srba_types.h:82
std::deque< TYPE1, Eigen::aligned_allocator< TYPE1 > > deque_t
bool has_aprox_init_val
Whether the edge was assigned an approximated initial value.
Definition: srba_types.h:201
size_t obs_idx
The global index of the observation that generates this Jacobian.
Definition: srba_types.h:237
uint64_t topo_dist_t
Unsigned integral type for topological distances in a graph/tree.
Definition: srba_types.h:33
void clear()
Empties all members.
Definition: srba_types.h:659
std::deque< new_kf_observation_t > new_kf_observations_t
A set of all the observations made from a new KF, as provided by the user.
Definition: srba_types.h:422
Helper types for STL containers with Eigen memory allocators.
landmark_traits< LM_TYPE >::TRelativeLandmarkPosMap TRelativeLandmarkPosMap
Definition: srba_types.h:481
landmark_traits< LM_TYPE >::TLandmarkEntry TLandmarkEntry
Definition: srba_types.h:482
std::deque< k2k_edge_t * > k2k_edge_vector_t
A sequence of edges (a "path")
Definition: srba_types.h:93
Keyframe-to-feature edge: observations in the problem.
Definition: srba_types.h:428
array_landmark_t pos
The parameterization of the feature location, wrt to the camera frame id_frame_base - For example...
Definition: srba_types.h:118
THessianSymbolicInfo< double, OBS_DIMS, LM_DIMS, LM_DIMS > hessian_f_info_t
Definition: srba_types.h:337
rba_joint_parameterization_traits_t< KF2KF_POSE_TYPE, LM_TYPE, OBS_TYPE >::keyframe_info keyframe_info
Definition: srba_types.h:484
TKeyFrameID next
The next keyframe in the tree.
Definition: srba_types.h:465
This Hessian block equals the sum of all J1^t * * J2, with J1=first, J2=second in each std::pair "co...
Definition: srba_types.h:282
lm_traits_t::TRelativeLandmarkPos * feat_rel_pos
Pointer to the known/unknown rel.pos. (always!=NULL)
Definition: srba_types.h:447
obs_traits_t::array_obs_t obs_arr
Observation data, summarized as an array of its parameters: obs.obs_data.getAsArray(obs_arr);.
Definition: srba_types.h:434
landmarks2infmatrix_t unknown_lms_inf_matrices
Information matrices that model the uncertainty in each XYZ position for the unknown LMs - these matr...
Definition: srba_types.h:638
TCovarianceRecoveryPolicy
Covariances recovery from Hessian matrix policy, for usage in RbaEngine.parameters.
Definition: srba_types.h:176
TRelativeLandmarkPos(const TKeyFrameID _id_frame_base, const LANDMARK_POS &_pos)
Constructor from a base KF ID "_id_frame_base" and any object "_pos" that offers a read [] operator a...
Definition: srba_types.h:113
Generic declaration, of which specializations are defined for each combination of LM+OBS type...
Definition: srba_types.h:44
Useful data structures that depend of a combination of "OBSERVATION_TYPE"+"LANDMARK_PARAMETERIZATION_...
Definition: srba_types.h:362
The argument "POSE_TRAITS" can be any of those defined in srba/models/kf2kf_poses.h (typically, either kf2kf_poses::SE3 or kf2kf_poses::SE2).
Definition: srba_types.h:50
pose_flag_t(const pose_t &pose_, const bool updated_)
Definition: srba_types.h:63
rba_joint_parameterization_traits_t< KF2KF_POSE_TYPE, LM_TYPE, OBS_TYPE >::k2f_edge_t k2f_edge_t
Definition: srba_types.h:485
mrpt::math::CArrayDouble< OBS_TRAITS::OBS_DIMS > residual_t
A fixed-length array of the size of one residual (=the size of one observation).
Definition: srba_types.h:143
std::map< TLandmarkID, TRelativeLandmarkPos > TRelativeLandmarkPosMap
An index of feature IDs and their relative locations.
Definition: srba_types.h:124
bool save_as_dot_file(const std::string &sFileName, const std::vector< TKeyFrameID > &kf_roots_to_save=std::vector< TKeyFrameID >()) const
Saves all (or a subset of all) the spanning trees If kf_roots_to_save is left empty, all STs are saved.
TLinearSystem lin_system
The sparse linear system of equations.
Definition: srba_types.h:647
bool is_fixed
If true, feat_rel_pos has the fixed relative position of this landmark (Can be set to true only upon ...
Definition: srba_types.h:403
k2k_edges_deque_t k2k_edges
(unknowns) All keyframe-to-keyframe edges
Definition: srba_types.h:636
mrpt::math::MatrixBlockSparseCols< double, REL_POSE_DIMS, LM_DIMS, hessian_Apf_info_t, false > TSparseBlocksHessian_Apf
Definition: srba_types.h:343
bool is_first_obs_of_unknown
true if this is the first observation of a feature with unknown relative position ...
Definition: srba_types.h:446
A bidirectional version of std::map, declared as bimap and which actually contains two std...
Definition: bimap.h:27
void update_symbolic_new_node(const TKeyFrameID new_node_id, const TPairKeyFrameID &new_edge, const topo_dist_t max_depth, const bool check_all_obs_are_connected=false, const new_kf_observations_t *obs=NULL)
Incremental update of spanning trees after the insertion of ONE new node and ONE OR MORE edges...
const char * J1_valid
Definition: srba_types.h:286
kf_observation_t(const typename obs_traits_t::observation_t &obs_, const TKeyFrameID kf_id_)
Definition: srba_types.h:431
size_t obs_idx
Global index of the observation that generated this Hessian entry (used to retrieve the in "J1^t * \...
Definition: srba_types.h:288
kf2kf_pose_traits< POSE_TRAITS > me_t
Definition: srba_types.h:52
Each keyframe is only connected to its predecessor (no loop closures)
Definition: srba_types.h:168
jacobian_traits< KF2KF_POSE_TYPE, LM_TYPE, OBS_TYPE >::TSparseBlocksJacobians_dh_df dh_df
Both symbolic & numeric info on the sparse Jacobians wrt. the observations.
Definition: srba_types.h:623
all_edges_maps_t all_edges
From the previous data, we can build this alternative, more convenient representation: map[SOURCE] |-...
Definition: srba_types.h:537
void compute_all_node_degrees(double &out_mean_degree, double &out_std_degree, double &out_max_degree) const
Computes stats on the degree (# of adjacent nodes) of all the nodes in the graph. ...
Used in TRBA_Problem_state.
Definition: srba_types.h:463
Eigen::Matrix< Scalar, N, M2 > matrix2_t
Definition: srba_types.h:276
V getTheOtherFromPair(const V one, const PAIR &p)
Aux function for getting, from a std::pair, "the other" element which is different to a known given o...
Definition: srba_types.h:185
kf2kf_pose_traits< KF2KF_POSE_TYPE > kf2kf_traits_t
Definition: srba_types.h:364
A templated column-indexed efficient storage of block-sparse Jacobian or Hessian matrices, together with other arbitrary information.
TKeyFrameID kf_d
The ID of the keyframe before the edge wrt which we are taking derivatives (before if going backwards...
Definition: srba_types.h:228
mrpt::aligned_containers< k2k_edge_t >::deque_t k2k_edges_deque_t
Definition: srba_types.h:493
char * is_valid
A reference to the validity bit in the global list TRBA_Problem_state::all_observations_Jacob_validit...
Definition: srba_types.h:263
TRBA_Problem_state & operator=(const TRBA_Problem_state &)
mrpt::math::MatrixBlockSparseCols< double, OBS_DIMS, REL_POSE_DIMS, jacob_dh_dAp_info_t, false > TSparseBlocksJacobians_dh_dAp
The "false" is since we don't need to "remap" indices.
Definition: srba_types.h:318
All the important data of a RBA problem at any given instant of time Operations on this structure are...
Definition: srba_types.h:474
static void fill(bimap< enum_t, std::string > &m_map)
Definition: srba_types.h:726
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void get_stats(size_t &num_nodes_min, size_t &num_nodes_max, double &num_nodes_mean, double &num_nodes_std) const
Returns min/max and mean/std stats on the number of nodes found on all the spanning trees...
TKeyFrameID id_frame_base
The ID of the camera frame which is the coordinate reference of pos.
Definition: srba_types.h:117
const matrix2_t * J2
Definition: srba_types.h:285
TJacobianSymbolicInfo_dh_dAp< KF2KF_POSE_TYPE, LANDMARK_TYPE > jacob_dh_dAp_info_t
Definition: srba_types.h:315
mrpt::math::MatrixBlockSparseCols< double, REL_POSE_DIMS, REL_POSE_DIMS, hessian_Ap_info_t, false > TSparseBlocksHessian_Ap
Definition: srba_types.h:341
const TRBA_Problem_state< KF2KF_POSE_TYPE, LM_TYPE, OBS_TYPE, RBA_OPTIONS > * m_parent
Definition: srba_types.h:515
The "symbolic" part of the spanning tree.
Definition: srba_types.h:521
static const size_t REL_POSE_DIMS
Definition: srba_types.h:312
mrpt::utils::map_as_vector< TKeyFrameID, std::map< TKeyFrameID, TSpanTreeEntry >, std::deque< std::pair< TKeyFrameID, std::map< TKeyFrameID, TSpanTreeEntry > > > > next_edge_maps_t
The definition seems complex but behaves just like: std::map< TKeyFrameID, std::map >
Definition: srba_types.h:506
pose_t inv_pose
Inverse pose: pose_from (-) pose_to , that is: "from" as seen from "to".
Definition: srba_types.h:86
A joint structure for one relative pose + an "up-to-date" flag (needed for spanning trees numeric upd...
Definition: srba_types.h:57
size_t update_numeric_only_all_from_node(const typename all_edges_maps_t::const_iterator &it, bool skip_marked_as_uptodate=false)
Updates all the numeric SE(3) poses from a given entry from sym.all_edges[i].
std::pair< TKeyFrameID, TKeyFrameID > TPairKeyFrameID
Used to represent the IDs of a directed edge (first –> second)
Definition: srba_types.h:34
all_observations_deque_t all_observations
All raw observation data (k2f edges)
Definition: srba_types.h:646
const kf2kf_traits_t::pose_flag_t * rel_pose_d1_from_obs
The two relative poses used in this Jacobian (see papers) Pointers to the elements in the "numeric" p...
Definition: srba_types.h:215
landmark_traits< LM_TRAITS > me_t
Definition: srba_types.h:102
static void fill(bimap< enum_t, std::string > &m_map)
Definition: srba_types.h:738
list_jacob_blocks_t lst_jacob_blocks
The list of Jacobian blocks itself.
Definition: srba_types.h:300
bool find_path_bfs(const TKeyFrameID from, const TKeyFrameID to, std::vector< TKeyFrameID > *out_path_IDs, typename kf2kf_pose_traits< KF2KF_POSE_TYPE >::k2k_edge_vector_t *out_path_edges=NULL) const
Auxiliary, brute force (BFS) method for finding the shortest path between any two Keyframes...
The argument "LM_TRAITS" can be any of those defined in srba/models/landmarks.h (typically, either landmarks::Euclidean3D or landmarks::Euclidean2D).
Definition: srba_types.h:100
mrpt::math::CArrayDouble< OBS_TRAITS::OBS_DIMS > array_obs_t
A fixed-length array of the size of one residual (=the size of one observation).
Definition: srba_types.h:142
const lm_traits_t::TRelativeLandmarkPos * feat_rel_pos
Pointer to the relative feature position wrt its base KF.
Definition: srba_types.h:223
char * is_valid
A reference to the validity bit in the global list TRBA_Problem_state::all_observations_Jacob_validit...
Definition: srba_types.h:239
observation_traits< OBS_TYPE > obs_traits_t
Definition: srba_types.h:365
THessianSymbolicInfo< double, OBS_DIMS, REL_POSE_DIMS, REL_POSE_DIMS > hessian_Ap_info_t
Definition: srba_types.h:336
A partial specialization of CArrayNumeric for double numbers.
Definition: CArrayNumeric.h:74
mrpt::utils::map_as_vector< TLandmarkID, typename TSparseBlocksHessian_f::matrix_t, typename mrpt::aligned_containers< std::pair< TLandmarkID, typename TSparseBlocksHessian_f::matrix_t > >::deque_t > landmarks2infmatrix_t
The list with all the information matrices (estimation uncertainty) for each unknown landmark...
Definition: srba_types.h:355
Eigen::Matrix< Scalar, NROWS, NCOLS > matrix_t
bool are_keyframes_connected(const TKeyFrameID id1, const TKeyFrameID id2) const
Returns true if the pair of KFs are connected thru a kf2kf edge, no matter the direction of the edge...
size_t id
The new edge ID.
Definition: srba_types.h:198
void clear()
Empty all sym & num data.
Definition: spantree_misc.h:19
THessianSymbolicInfoEntry(const matrix1_t *const J1_, const matrix2_t *const J2_, const char *const J1_valid_, const char *const J2_valid_, const size_t obs_idx_)
Definition: srba_types.h:290
mrpt::math::MatrixBlockSparseCols< double, LM_DIMS, LM_DIMS, hessian_f_info_t, false > TSparseBlocksHessian_f
Definition: srba_types.h:342
mrpt::math::MatrixBlockSparseCols< double, OBS_DIMS, LM_DIMS, jacob_dh_df_info_t, true > TSparseBlocksJacobians_dh_df
Definition: srba_types.h:319
TRelativeLandmarkPos * rfp
Pointers to elements in unknown_lms and known_lms.
Definition: srba_types.h:130
std::deque< keyframe_info > keyframe_vector_t
Index are "TKeyFrameID" IDs. There's no NEED to make this a deque<> for preservation of references...
Definition: srba_types.h:497
landmark_traits< LANDMARK_TYPE > lm_traits_t
Definition: srba_types.h:249
std::vector< THessianSymbolicInfoEntry > list_jacob_blocks_t
Definition: srba_types.h:298
Symbolic information of each Jacobian dh_dAp.
Definition: srba_types.h:207
Used in the vector "all_lms".
Definition: srba_types.h:127
kf2kf_pose_traits< KF2KF_POSE_TYPE >::TRelativePosesForEachTarget num
"Numeric" spanning tree: the SE(3) pose of each node wrt to any other: num[SOURCE] |–> map[TARGET] =...
Definition: srba_types.h:550
keyframe_vector_t keyframes
All key frames (global poses are not included in an RBA problem). Vector indices are "TKeyFrameID" ID...
Definition: srba_types.h:635
mrpt::aligned_containers< k2f_edge_t >::deque_t all_observations_deque_t
Definition: srba_types.h:494
jacobian_traits< KF2KF_POSE_TYPE, LM_TYPE, OBS_TYPE >::TSparseBlocksJacobians_dh_dAp dh_dAp
Both symbolic & numeric info on the sparse Jacobians wrt. the edges.
Definition: srba_types.h:622
Used in TNewKeyFrameInfo.
Definition: srba_types.h:196
TRelativeLandmarkPosMap unknown_lms
(unknown values) Landmarks with an unknown fixed 3D position relative to their base frame_id ...
Definition: srba_types.h:637
Information per key-frame needed for RBA.
Definition: srba_types.h:453
void insert(const KEY &k, const VALUE &v)
Insert a new pair KEY<->VALUE in the bi-map.
Definition: bimap.h:68
lm_traits_t::array_landmark_t feat_rel_pos
Ignored unless is_fixed OR is_unknown_with_init_val are true (only one of them at once)...
Definition: srba_types.h:410
TLandmarkEntry()
Definition: srba_types.h:132
mrpt::aligned_containers< residual_t >::vector_t vector_residuals_t
Definition: srba_types.h:145
landmark_traits< LANDMARK_TYPE > lm_traits_t
Definition: srba_types.h:210
void dump_as_text(std::string &s) const
Useful for debugging.
Definition: spantree_misc.h:28
Approximate covariances of landmarks as the inverse of the hessian diagonal blocks.
Definition: srba_types.h:180
Keyframe-to-feature edge: observation data stored for each keyframe.
Definition: srba_types.h:442
TRelativeLandmarkPosMap known_lms
(known values) Landmarks with a known, fixed 3D position relative to their base frame_id ...
Definition: srba_types.h:639
All keyframes are connected to the first one (it can be used to emulate global coordinates) ...
Definition: srba_types.h:170
rba_joint_parameterization_traits_t< KF2KF_POSE_TYPE, LM_TYPE, OBS_TYPE >::new_kf_observation_t new_kf_observation_t
Definition: srba_types.h:487
bool is_unknown_with_init_val
Can be set to true only upon FIRST observation of a landmark with UNKNOWN relative position (the norm...
Definition: srba_types.h:408
topo_dist_t distance
Remaining distance until the given target from this point.
Definition: srba_types.h:466
bool feat_has_known_rel_pos
whether it's a known or unknown relative position feature
Definition: srba_types.h:445
hessian_traits< KF2KF_POSE_TYPE, LM_TYPE, OBS_TYPE >::landmarks2infmatrix_t landmarks2infmatrix_t
Definition: srba_types.h:483
const matrix1_t * J1
Definition: srba_types.h:284
size_t update_numeric(bool skip_marked_as_uptodate=false)
Updates all the numeric SE(3) poses from ALL the sym.all_edges.
static const size_t OBS_DIMS
Definition: srba_types.h:332
std::vector< TYPE1, Eigen::aligned_allocator< TYPE1 > > vector_t
kf2kf_pose_traits< KF2KF_POSE_TYPE > kf2kf_traits_t
Definition: srba_types.h:248
bool dump_as_text_to_file(const std::string &sFileName) const
Useful for debugging.
Definition: spantree_misc.h:71
bool has_known_pos
true: This landmark has a fixed (known) relative position. false: The relative pos of this landmark i...
Definition: srba_types.h:129
mrpt::aligned_containers< TKeyFrameID, pose_flag_t >::map_t frameid2pose_map_t
"numeric" values of spanning tree poses:
Definition: srba_types.h:71
POSE_TRAITS::pose_t pose_t
Will be mrpt::poses::CPose3D, ...
Definition: srba_types.h:53
Eigen::Matrix< Scalar, N, M1 > matrix1_t
Definition: srba_types.h:275
static const size_t OBS_DIMS
Definition: srba_types.h:311
KF2KF_POSE_TYPE::pose_t pose_t
Definition: srba_types.h:476
Symbolic information of each Hessian block.
Definition: srba_types.h:273
lm_traits_t::TRelativeLandmarkPos * feat_rel_pos
A pointer to the relative position structure within rba_state.unknown_lms[] for this feature...
Definition: srba_types.h:253
One relative feature observation entry, used with some relative bundle-adjustment functions...
Definition: srba_types.h:106
THessianSymbolicInfoEntry()
Definition: srba_types.h:295
V getTheOtherFromPair2(const V one, const K2K_EDGE &p)
For usage with K2K_EDGE = typename kf2kf_pose_traits::k2k_edge_t.
Definition: srba_types.h:191
static const size_t LM_DIMS
Definition: srba_types.h:313
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