Visual Servoing Platform  version 3.6.1 under development (2024-05-26)
vpAdaptiveGain.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See https://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Adaptive gain.
32  */
33 
34 #ifndef _vpAdaptiveGain_h_
35 #define _vpAdaptiveGain_h_
36 
42 #include <iostream>
43 #include <visp3/core/vpConfig.h>
44 
45 class vpColVector;
46 
116 class VISP_EXPORT vpAdaptiveGain
117 {
118 public:
119  static const double DEFAULT_LAMBDA_ZERO;
120  static const double DEFAULT_LAMBDA_INFINITY;
121  static const double DEFAULT_LAMBDA_SLOPE;
122 
123 private:
124  // Coefficient such as lambda (x) = a * exp (-b*x) + c
125  double coeff_a; // \f$ a = \lambda(0) - \lambda(\infty) \f$
126  double coeff_b; // \f$ b = {\dot \lambda}(0) / a \f$
127  double coeff_c; // \f$ c = \lambda(\infty) \f$
128 
129  // Last computed value
130  mutable double lambda;
131 
132 public:
141  vpAdaptiveGain();
142 
149  explicit vpAdaptiveGain(double c);
150 
162  vpAdaptiveGain(double gain_at_zero, double gain_at_infinity, double slope_at_zero);
163 
170  void initFromConstant(double c);
171 
179  void initFromVoid(void);
180 
193  void initStandard(double gain_at_zero, double gain_at_infinity, double slope_at_zero);
194 
201  double setConstant(void);
202 
215  double value_const(double x) const;
216 
231  double value(double x) const;
232 
240  double limitValue_const(void) const;
241 
248  double limitValue(void) const;
249 
256  inline double getLastValue(void) const { return this->lambda; }
257 
272  double operator()(double x) const;
273 
285  double operator()(const vpColVector &x) const;
286 
295  double operator()(void) const;
296 
304  friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, const vpAdaptiveGain &lambda);
305 };
306 
307 #endif
Adaptive gain computation.
double getLastValue(void) const
static const double DEFAULT_LAMBDA_ZERO
static const double DEFAULT_LAMBDA_INFINITY
static const double DEFAULT_LAMBDA_SLOPE
Implementation of column vector and the associated operations.
Definition: vpColVector.h:163