ViSP  2.8.0
vpAdaptativeGain.h
1 /****************************************************************************
2  *
3  * $Id: vpAdaptativeGain.h 4317 2013-07-17 09:40:17Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Adaptative gain.
36  *
37  * Authors:
38  * Nicolas Mansard
39  *
40  *****************************************************************************/
48 #ifndef __VP_ADAPTATIVE_GAIN_H
49 #define __VP_ADAPTATIVE_GAIN_H
50 
51 #include <visp/vpConfig.h>
52 #include <iostream>
53 
54 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
55 
56 class vpColVector;
85 class VISP_EXPORT vpAdaptativeGain
86 {
87 
88 public: /* constantes */
89 
90  static const double DEFAULT_LAMBDA_ZERO;
91  static const double DEFAULT_LAMBDA_INFINI;
92  static const double DEFAULT_LAMBDA_PENTE;
93 
94 
95 private: /* Attributs*/
96  /* Coefficient de la fonction de calcul de lambda.
97  * lambda (x) = a * exp (-b*x) + c. */
98  double coeff_a;
99  double coeff_b;
100  double coeff_c;
101 
102  /* Derniere valeur calculee. */
103  mutable double lambda;
104 
105 
106 
107 public: /* Methodes*/
108 
109  /* --- CONSTRUCTOR -------------------------------------------------------- */
110 
111  vp_deprecated vpAdaptativeGain (void);
112 
113  /* --- INIT --------------------------------------------------------------- */
114  void initFromConstant (double lambda);
115  void initFromVoid (void);
116  void initStandard (double en_zero,
117  double en_infini,
118  double pente_en_zero);
119 
120 
121  /* --- MODIFIORS ---------------------------------------------------------- */
122  double setConstant (void);
123 
124 
125  /* --- COMPUTE ------------------------------------------------------------ */
126  /* \brief Calcule la valeur de lambda au point courrant.
127  *
128  * Determine la valeur du lambda adaptatif en fonction de la valeur
129  * de la norme de la fonction de tache e par extrapolation exponentielle.
130  * La fonction est : (en_infini - en_zero) * exp (-pente * ||e|| ) + en_infini.
131  * On a bien :
132  * - lambda(10^5) = en_infini ;
133  * - lambda(0) = en_zero ;
134  * - lambda(x ~ 0) ~ - pente * x + en_zero.
135  * \param val_e: valeur de la norme de l'erreur.
136  * \return: valeur de gain au point courrant.
137  */
138  double value_const (double val_e) const;
139 
140  /* \brief Calcule la valeur de lambda au point courrant et stockage du
141  * resultat.
142  *
143  * La fonction calcule la valeur de lambda d'apres la valeur de la norme
144  * de l'erreur, comme le fait la fonction valeur_const.
145  * La fonction non constante stocke de plus le resultat dans this ->lambda.
146  * \param val_e: valeur de la norme de l'erreur.
147  * \return: valeur de gain au point courrant.
148  */
149  double value (double val_e) const;
150 
151  double limitValue_const (void) const;
152 
153  double limitValue (void) const;
154 
155  /* --- ACCESSORS ---------------------------------------------------------- */
156 
162  inline double getLastValue (void) const {return this ->lambda;}
163 
164  double operator() (double val_e) const;
165 
166  /* \brief Lance la fonction valeur avec la norme INFINIE du vecteur. */
167  double operator() (const vpColVector & e) const;
168 
169  /* \brief Idem function limitValue. */
170  double operator() (void) const;
171 
172 
173  /* --- IOSTREAM ----------------------------------------------------------- */
174 
175  friend VISP_EXPORT std::ostream& operator<< (std::ostream &os,
176  const vpAdaptativeGain& lambda);
177 };
178 
179 #endif
180 
181 #endif /* __VP_ADAPTATIVE_GAIN_H */
182 
183 
184 
185 
186 /*
187  * Local variables:
188  * c-basic-offset: 4
189  * End:
190  */
static const double DEFAULT_LAMBDA_INFINI
static const double DEFAULT_LAMBDA_PENTE
Adaptative gain computation.
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
static const double DEFAULT_LAMBDA_ZERO
double getLastValue(void) const