Main MRPT website > C++ reference
MRPT logo
srba_options_noise.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 #include <mrpt/poses/CPose2D.h>
13 #include <mrpt/poses/CPose3D.h>
15 
16 namespace mrpt { namespace srba {
17 namespace options
18 {
19  /** \defgroup mrpt_srba_options_noise Types for RBA_OPTIONS::obs_noise_matrix_t
20  * \ingroup mrpt_srba_options */
21 
22  /** Usage: A possible type for RBA_OPTIONS::obs_noise_matrix_t.
23  * Meaning: The sensor noise matrix is the same for all observations and equal to \sigma * I(identity).
24  * \ingroup mrpt_srba_options_noise */
26  {
27  /** Observation noise parameters to be filled by the user in srba.parameters.obs_noise */
28  struct parameters_t
29  {
30  /** One sigma of the Gaussian noise assumed for every component of observations (Default value: 1) */
32 
33  parameters_t() : std_noise_observations (1.)
34  { }
35  };
36 
37  /** Internal struct for data that must be stored for each observation */
39  {
40  // None: all obs. have the same value="std_noise_observations"
41  };
42 
43  /** Must execute H+= J1^t * \Lambda * J2 */
44  template <class MATRIX_H,class MATRIX_J1,class MATRIX_J2>
45  inline static void accum_JtJ(MATRIX_H & H, const MATRIX_J1 & J1, const MATRIX_J2 &J2, const size_t obs_idx, const parameters_t & obs_noise_params)
46  {
47  MRPT_UNUSED_PARAM(obs_idx); MRPT_UNUSED_PARAM(obs_noise_params);
48  H.noalias() += J1.transpose() * J2; // The constant scale factor 1/sigma will be applied in the end (below)
49  }
50  /** Do scaling, if applicable, to H after end of all calls to accum_JtJ() */
51  template <class MATRIX_H>
52  inline static void scale_H(MATRIX_H & H, const parameters_t & obs_noise_params)
53  {
54  ASSERTDEB_(obs_noise_params.std_noise_observations>0)
55  H *= 1.0/obs_noise_params.std_noise_observations;
56  }
57 
58  /** Must execute grad+= J^t * \Lambda * r */
59  template <class VECTOR_GRAD,class MATRIX_J,class VECTOR_R>
60  inline static void accum_Jtr(VECTOR_GRAD & g, const MATRIX_J & J, const VECTOR_R &r, const size_t obs_idx, const parameters_t & obs_noise_params)
61  {
62  MRPT_UNUSED_PARAM(obs_idx); MRPT_UNUSED_PARAM(obs_noise_params);
63  g.noalias() += J.transpose() * r; // The constant scale factor 1/sigma will be applied in the end (below)
64  }
65  /** Do scaling, if applicable, to GRAD after end of all calls to accum_Jtr() */
66  template <class VECTOR_GRAD>
67  inline static void scale_Jtr(VECTOR_GRAD & g, const parameters_t & obs_noise_params)
68  {
69  ASSERTDEB_(obs_noise_params.std_noise_observations>0)
70  g *= 1.0/obs_noise_params.std_noise_observations;
71  }
72 
73  }; // end of "observation_noise_identity"
74 
75  /** Usage: A possible type for RBA_OPTIONS::obs_noise_matrix_t.
76  * Meaning: The sensor noise matrix is an arbitrary matrix and the same for all observations.
77  * \ingroup mrpt_srba_options_noise */
78  template <class OBS_TYPE>
80  {
81  static const size_t OBS_DIMS = OBS_TYPE::OBS_DIMS; //!< The dimension of one observation
82 
83  typedef Eigen::Matrix<double,OBS_DIMS,OBS_DIMS> obs_noise_matrix_t; //!< Type for symetric, positive-definite noise matrices.
84 
85  /** Observation noise parameters to be filled by the user in srba.parameters.obs_noise */
86  struct parameters_t
87  {
88  /** The constant information matrix (inverse of covariance) for all the observations (\Lambda in common SLAM notation) */
89  obs_noise_matrix_t lambda;
90 
91  parameters_t() : lambda( obs_noise_matrix_t::Identity() )
92  { }
93  };
94 
95  /** Internal struct for data that must be stored for each observation */
97  {
98  // None: all obs. have the same value
99  };
100 
101  /** Must execute H+= J1^t * \Lambda * J2 */
102  template <class MATRIX_H,class MATRIX_J1,class MATRIX_J2>
103  inline static void accum_JtJ(MATRIX_H & H, const MATRIX_J1 & J1, const MATRIX_J2 &J2,
104  const size_t obs_idx, const parameters_t & obs_noise_params)
105  {
106  MRPT_UNUSED_PARAM(obs_idx);
107  H.noalias() += J1.transpose() * obs_noise_params.lambda * J2;
108  }
109 
110  /** Do scaling, if applicable, to H after end of all calls to accum_JtJ() */
111  template <class MATRIX_H>
112  inline static void scale_H(MATRIX_H & H, const parameters_t & obs_noise_params)
113  { // Nothing else to do.
115  MRPT_UNUSED_PARAM(obs_noise_params);
116  }
117 
118  /** Must execute grad+= J^t * \Lambda * r */
119  template <class VECTOR_GRAD,class MATRIX_J,class VECTOR_R>
120  inline static void accum_Jtr(VECTOR_GRAD & g, const MATRIX_J & J, const VECTOR_R &r,
121  const size_t obs_idx, const parameters_t & obs_noise_params)
122  {
123  MRPT_UNUSED_PARAM(obs_idx);
124  g.noalias() += J.transpose() * obs_noise_params.lambda * r;
125  }
126  /** Do scaling, if applicable, to GRAD after end of all calls to accum_Jtr() */
127  template <class VECTOR_GRAD>
128  inline static void scale_Jtr(VECTOR_GRAD & g, const parameters_t & obs_noise_params)
129  { // Nothing else to do.
130  MRPT_UNUSED_PARAM(g); MRPT_UNUSED_PARAM(obs_noise_params);
131  }
132 
133  }; // end of "observation_noise_constant_matrix"
134 
135 } } } // End of namespaces
static void scale_H(MATRIX_H &H, const parameters_t &obs_noise_params)
Do scaling, if applicable, to H after end of all calls to accum_JtJ()
static void scale_H(MATRIX_H &H, const parameters_t &obs_noise_params)
Do scaling, if applicable, to H after end of all calls to accum_JtJ()
Eigen::Matrix< double, OBS_DIMS, OBS_DIMS > obs_noise_matrix_t
Type for symetric, positive-definite noise matrices.
Internal struct for data that must be stored for each observation.
static void accum_JtJ(MATRIX_H &H, const MATRIX_J1 &J1, const MATRIX_J2 &J2, const size_t obs_idx, const parameters_t &obs_noise_params)
Must execute H+= J1^t * * J2.
Usage: A possible type for RBA_OPTIONS::obs_noise_matrix_t.
static const size_t OBS_DIMS
The dimension of one observation.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
static void accum_Jtr(VECTOR_GRAD &g, const MATRIX_J &J, const VECTOR_R &r, const size_t obs_idx, const parameters_t &obs_noise_params)
Must execute grad+= J^t * * r.
Internal struct for data that must be stored for each observation.
static void scale_Jtr(VECTOR_GRAD &g, const parameters_t &obs_noise_params)
Do scaling, if applicable, to GRAD after end of all calls to accum_Jtr()
Observation noise parameters to be filled by the user in srba.parameters.obs_noise.
static void accum_JtJ(MATRIX_H &H, const MATRIX_J1 &J1, const MATRIX_J2 &J2, const size_t obs_idx, const parameters_t &obs_noise_params)
Must execute H+= J1^t * * J2.
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.
Usage: A possible type for RBA_OPTIONS::obs_noise_matrix_t.
static void accum_Jtr(VECTOR_GRAD &g, const MATRIX_J &J, const VECTOR_R &r, const size_t obs_idx, const parameters_t &obs_noise_params)
Must execute grad+= J^t * * r.
Observation noise parameters to be filled by the user in srba.parameters.obs_noise.
static void scale_Jtr(VECTOR_GRAD &g, const parameters_t &obs_noise_params)
Do scaling, if applicable, to GRAD after end of all calls to accum_Jtr()
double std_noise_observations
One sigma of the Gaussian noise assumed for every component of observations (Default value: 1) ...
obs_noise_matrix_t lambda
The constant information matrix (inverse of covariance) for all the observations ( in common SLAM not...



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