AdaptiveGain

class AdaptiveGain(*args, **kwargs)

Bases: pybind11_object

Adaptive gain computation.

As described in [21] , a varying gain \(\lambda\) could be used in the visual servoing control law

\[{\bf v}_c = -\lambda {\bf L}^{+}_{e} {\bf e}\]

with

\[\lambda (|| {\bf e}||) = (\lambda_0 - \lambda_\infty) e^{ -\frac{ \lambda'_0}{\lambda_0 - \lambda_\infty}||{\bf e}||} + \lambda_\infty \]

where:

  • \(\lambda_0 = \lambda(0)\) is the gain in 0, that is for very small values of \(||{\bf e}||\)

  • \(\lambda_\infty = \lambda_{||{\bf e}|| \rightarrow \infty}\lambda(||{\bf e}||)\) is the gain to infinity, that is for very high values of \(||{\bf e}||\)

  • \(\lambda'_0\) is the slope of \(\lambda\) at \(||{\bf e}|| = 0\)

As described in tutorial-boost-vs, the interest of adaptive_gain is to reduce the time to convergence in order to speed up the servo.

The following example shows how to use this class in order to use an adaptive gain with the following parameters \(\lambda_0 = 4\) , \(\lambda_\infty = 0.4\) and \(\lambda'_0 = 30\) .

#include <visp3/vs/vpAdaptiveGain.h>
#include <visp3/vs/vpServo.h>

int main()
{
  vpAdaptiveGain lambda(4, 0.4, 30);   // lambda(0)=4, lambda(oo)=0.4 and lambda'(0)=30

  vpServo servo;
  servo.setLambda(lambda);

  while(1) {
    vpColVector v = servo.computeControlLaw();
  }
}

This other example shows how to use this class in order to set a constant gain \(\lambda = 0.5\) that will ensure an exponential decrease of the task error.

#include <visp3/vs/vpAdaptiveGain.h>
#include <visp3/vs/vpServo.h>

int main()
{
  vpAdaptiveGain lambda(0.5);

  vpServo servo;
  servo.setLambda(lambda);

  while(1) {
    vpColVector v = servo.computeControlLaw();
  }
}

Overloaded function.

  1. __init__(self: visp._visp.vs.AdaptiveGain) -> None

Basic constructor which initializes all the parameters with their default value:

  • \(\lambda_0 = 1.666\) using vpAdaptiveGain::DEFAULT_LAMBDA_ZERO

  • \(\lambda_\infty = 0.1666\) using vpAdaptiveGain::DEFAULT_LAMBDA_INFINITY

  • \(\lambda'_0 = 1.666\) using vpAdaptiveGain::DEFAULT_LAMBDA_SLOPE

  1. __init__(self: visp._visp.vs.AdaptiveGain, c: float) -> None

Constructor that initializes the gain as constant. In that case \(\lambda(||{\bf e}||) = c\) .

Parameters:
c

Value of the constant gain. A typical value is 0.5.

  1. __init__(self: visp._visp.vs.AdaptiveGain, gain_at_zero: float, gain_at_infinity: float, slope_at_zero: float) -> None

Constructor that initializes the gain as adaptive.

Parameters:
gain_at_zero

the expected gain when \(||{\bf e}||=0\) : \(\lambda_0\) .

gain_at_infinity

the expected gain when \(||{\bf e}||\rightarrow\infty\) : \(\lambda_\infty\) .

slope_at_zero

the expected slope of \(\lambda(||{\bf e}||)\) when \(||{\bf e}||=0\) : \(\lambda'_0\) .

Methods

__init__

Overloaded function.

getLastValue

Gets the last adaptive gain value which was stored in the class.

initFromConstant

Initializes the parameters to have a constant gain.

initFromVoid

Initializes the parameters with the default value :

initStandard

Set the parameters \(\lambda_0, \lambda_\infty, \lambda'_0\) used to compute \(\lambda(||{\bf e}||)\) .

limitValue

Gets the value of the gain at infinity (ie the value of \(\lambda_\infty = c\) ) and stores it as a parameter of the class.

limitValue_const

Gets the value of the gain at infinity (ie the value of \(\lambda_\infty = c\) ).

setConstant

Sets the internal parameters in order to obtain a constant gain equal to the gain in 0 set through the parameter \(\lambda_0\) .

value

Computes the value of the adaptive gain \(\lambda(x)\) using:

value_const

Computes the value of the adaptive gain \(\lambda(x)\) using:

Inherited Methods

Operators

__doc__

__init__

Overloaded function.

__module__

__repr__

Attributes

DEFAULT_LAMBDA_INFINITY

DEFAULT_LAMBDA_SLOPE

DEFAULT_LAMBDA_ZERO

__annotations__

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: visp._visp.vs.AdaptiveGain) -> None

Basic constructor which initializes all the parameters with their default value:

  • \(\lambda_0 = 1.666\) using vpAdaptiveGain::DEFAULT_LAMBDA_ZERO

  • \(\lambda_\infty = 0.1666\) using vpAdaptiveGain::DEFAULT_LAMBDA_INFINITY

  • \(\lambda'_0 = 1.666\) using vpAdaptiveGain::DEFAULT_LAMBDA_SLOPE

  1. __init__(self: visp._visp.vs.AdaptiveGain, c: float) -> None

Constructor that initializes the gain as constant. In that case \(\lambda(||{\bf e}||) = c\) .

Parameters:
c

Value of the constant gain. A typical value is 0.5.

  1. __init__(self: visp._visp.vs.AdaptiveGain, gain_at_zero: float, gain_at_infinity: float, slope_at_zero: float) -> None

Constructor that initializes the gain as adaptive.

Parameters:
gain_at_zero

the expected gain when \(||{\bf e}||=0\) : \(\lambda_0\) .

gain_at_infinity

the expected gain when \(||{\bf e}||\rightarrow\infty\) : \(\lambda_\infty\) .

slope_at_zero

the expected slope of \(\lambda(||{\bf e}||)\) when \(||{\bf e}||=0\) : \(\lambda'_0\) .

getLastValue(self) float

Gets the last adaptive gain value which was stored in the class.

Returns:

It returns the last adaptive gain value which was stored in the class.

initFromConstant(self, c: float) None

Initializes the parameters to have a constant gain. In that case \(\lambda(||{\bf e}||) = c\) .

Parameters:
c: float

Value of the constant gain. A typical value is 0.5.

initFromVoid(self) None

Initializes the parameters with the default value :

  • \(\lambda_0 = 1.666\) using vpAdaptiveGain::DEFAULT_LAMBDA_ZERO

  • \(\lambda_\infty = 0.1666\) using vpAdaptiveGain::DEFAULT_LAMBDA_INFINITY

  • \(\lambda'_0 = 1.666\) using vpAdaptiveGain::DEFAULT_LAMBDA_SLOPE

initStandard(self, gain_at_zero: float, gain_at_infinity: float, slope_at_zero: float) None

Set the parameters \(\lambda_0, \lambda_\infty, \lambda'_0\) used to compute \(\lambda(||{\bf e}||)\) .

Parameters:
gain_at_zero: float

the expected gain when \(||{\bf e}||=0\) : \(\lambda_0\) .

gain_at_infinity: float

the expected gain when \(||{\bf e}||\rightarrow\infty\) : \(\lambda_\infty\) .

slope_at_zero: float

the expected slope of \(\lambda(||{\bf e}||)\) when \(||{\bf e}||=0\) : \(\lambda'_0\) .

limitValue(self) float

Gets the value of the gain at infinity (ie the value of \(\lambda_\infty = c\) ) and stores it as a parameter of the class.

Returns:

It returns the value of the gain at infinity.

limitValue_const(self) float

Gets the value of the gain at infinity (ie the value of \(\lambda_\infty = c\) ). This function is similar to limitValue() except that here the value is not stored as a parameter of the class.

Returns:

It returns the value of the gain at infinity.

setConstant(self) float

Sets the internal parameters in order to obtain a constant gain equal to the gain in 0 set through the parameter \(\lambda_0\) .

Returns:

It returns the value of the constant gain \(\lambda_0\) .

value(self, x: float) float

Computes the value of the adaptive gain \(\lambda(x)\) using:

\[\lambda (x) = (\lambda_0 - \lambda_\infty) e^{ -\frac{ \lambda'_0}{\lambda_0 - \lambda_\infty}x} + \lambda_\infty \]

This value is stored as a parameter of the class.

Parameters:
x: float

Input value to consider. During a visual servo this value can be the Euclidean norm \(||{\bf e}||\) or the infinity norm \(||{\bf e}||_{\infty}\) of the task function.

Returns:

It returns the value of the computed gain.

value_const(self, x: float) float

Computes the value of the adaptive gain \(\lambda(x)\) using:

\[\lambda (x) = (\lambda_0 - \lambda_\infty) e^{ -\frac{ \lambda'_0}{\lambda_0 - \lambda_\infty}x} + \lambda_\infty \]
Parameters:
x: float

Input value to consider. During a visual servo this value can be the Euclidean norm \(||{\bf e}||\) or the infinity norm \(||{\bf e}||_{\infty}\) of the task function.

Returns:

It returns the value of the computed gain.