Visual Servoing Platform  version 3.6.1 under development (2024-12-06)
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 
39 #ifndef _vpAdaptiveGain_h_
40 #define _vpAdaptiveGain_h_
41 
42 #include <iostream>
43 #include <visp3/core/vpConfig.h>
44 
45 BEGIN_VISP_NAMESPACE
46 class vpColVector;
47 
121 class VISP_EXPORT vpAdaptiveGain
122 {
123 public:
124  static const double DEFAULT_LAMBDA_ZERO;
125  static const double DEFAULT_LAMBDA_INFINITY;
126  static const double DEFAULT_LAMBDA_SLOPE;
127 
128 private:
129  // Coefficient such as lambda (x) = a * exp (-b*x) + c
130  double coeff_a; // \f$ a = \lambda(0) - \lambda(\infty) \f$
131  double coeff_b; // \f$ b = {\dot \lambda}(0) / a \f$
132  double coeff_c; // \f$ c = \lambda(\infty) \f$
133 
134  // Last computed value
135  mutable double lambda;
136 
137 public:
146  vpAdaptiveGain();
147 
154  VP_EXPLICIT vpAdaptiveGain(double c);
155 
167  vpAdaptiveGain(double gain_at_zero, double gain_at_infinity, double slope_at_zero);
168 
175  void initFromConstant(double c);
176 
184  void initFromVoid(void);
185 
198  void initStandard(double gain_at_zero, double gain_at_infinity, double slope_at_zero);
199 
206  double setConstant(void);
207 
220  double value_const(double x) const;
221 
236  double value(double x) const;
237 
245  double limitValue_const(void) const;
246 
253  double limitValue(void) const;
254 
261  inline double getLastValue(void) const { return this->lambda; }
262 
277  double operator()(double x) const;
278 
290  double operator()(const vpColVector &x) const;
291 
300  double operator()(void) const;
301 
309  friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, const vpAdaptiveGain &lambda);
310 };
311 END_VISP_NAMESPACE
312 #endif
Adaptive gain computation.
double getLastValue(void) const
static const double DEFAULT_LAMBDA_INFINITY
static const double DEFAULT_LAMBDA_SLOPE
static const double DEFAULT_LAMBDA_ZERO
Implementation of column vector and the associated operations.
Definition: vpColVector.h:191