Visual Servoing Platform  version 3.2.0 under development (2018-12-17)

#include <visp3/vs/vpAdaptiveGain.h>

## Public Member Functions

vpAdaptiveGain (double gain_at_zero, double gain_at_infinity, double slope_at_zero)

void initFromConstant (double c)

void initFromVoid (void)

void initStandard (double gain_at_zero, double gain_at_infinity, double slope_at_zero)

double setConstant (void)

double value_const (double x) const

double value (double x) const

double limitValue_const (void) const

double limitValue (void) const

double getLastValue (void) const

double operator() (double x) const

double operator() (const vpColVector &x) const

double operator() (void) const

## Static Public Attributes

static const double DEFAULT_LAMBDA_ZERO = 1.666

static const double DEFAULT_LAMBDA_INFINITY = 0.1666

static const double DEFAULT_LAMBDA_SLOPE = 1.666

## Friends

VISP_EXPORT std::ostream & operator<< (std::ostream &os, const vpAdaptiveGain &lambda)

## Detailed Description

As described in [20], a varying gain could be used in the visual servoing control law

with

where:

• is the gain in 0, that is for very small values of
• is the gain to infinity, that is for very high values of
• is the slope of at

As described in Tutorial: How to boost your visual servo control law, the interest of Using an 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 , and .

#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) {
}
}

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

#include <visp3/vs/vpServo.h>
int main()
{
vpServo servo;
servo.setLambda(lambda);
while(1) {
}
}
Examples:

Definition at line 121 of file vpAdaptiveGain.h.

## Constructor & Destructor Documentation

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

Definition at line 71 of file vpAdaptiveGain.cpp.

References initFromVoid().

explicit

Constructor that initializes the gain as constant. In that case .

Parameters
 c : Value of the constant gain. A typical value is 0.5.

Definition at line 84 of file vpAdaptiveGain.cpp.

References initFromConstant().

Constructor that initializes the gain as adaptive.

Parameters
 gain_at_zero : the expected gain when : . gain_at_infinity : the expected gain when : . slope_at_zero : the expected slope of when : .

Definition at line 96 of file vpAdaptiveGain.cpp.

References initStandard().

## Member Function Documentation

 double vpAdaptiveGain::getLastValue ( void ) const
inline

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.

Definition at line 195 of file vpAdaptiveGain.h.

 void vpAdaptiveGain::initFromConstant ( double c )

Initializes the parameters to have a constant gain. In that case .

Parameters
 c : Value of the constant gain. A typical value is 0.5.
Examples:
servoAfma4Point2DCamVelocityKalman.cpp.

Definition at line 115 of file vpAdaptiveGain.cpp.

Initializes the parameters with the default value :

Definition at line 130 of file vpAdaptiveGain.cpp.

 void vpAdaptiveGain::initStandard ( double gain_at_zero, double gain_at_infinity, double slope_at_zero )

Set the parameters used to compute .

Parameters
 gain_at_zero : the expected gain when : . gain_at_infinity : the expected gain when : . slope_at_zero : the expected slope of when : .
Examples:
mbot-apriltag-2D-half-vs.cpp, mbot-apriltag-ibvs.cpp, mbot-apriltag-pbvs.cpp, servoAfma4Point2DCamVelocityKalman.cpp, and servoViper850Point2DCamVelocityKalman.cpp.

Definition at line 147 of file vpAdaptiveGain.cpp.

 double vpAdaptiveGain::limitValue ( void ) const

Gets the value of the gain at infinity (ie the value of ) and stores it as a parameter of the class.

Returns
It returns the value of the gain at infinity.

Definition at line 252 of file vpAdaptiveGain.cpp.

References limitValue_const().

Referenced by operator()().

 double vpAdaptiveGain::limitValue_const ( void ) const

Gets the value of the gain at infinity (ie the value of ). 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.

Definition at line 218 of file vpAdaptiveGain.cpp.

Referenced by limitValue().

 double vpAdaptiveGain::operator() ( double x ) const

Operator that computes where

Parameters
 x : Input value to consider. During a visual servo this value can be the euclidian norm or the infinity norm of the task function.
Returns
It returns the value of the computed gain.
value()

Definition at line 280 of file vpAdaptiveGain.cpp.

References value().

 double vpAdaptiveGain::operator() ( const vpColVector & x ) const

Operator which computes where

Parameters
 x : Input vector to consider.
Returns
It returns the value of the computed gain.

Definition at line 303 of file vpAdaptiveGain.cpp.

References vpColVector::infinityNorm(), and value().

 double vpAdaptiveGain::operator() ( void ) const

Gets the value of the gain at infinity (ie the value of ).

Returns
It returns the value of the gain at infinity.
limitValue()

Definition at line 290 of file vpAdaptiveGain.cpp.

References limitValue().

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

Returns
It returns the value of the constant gain .

Definition at line 174 of file vpAdaptiveGain.cpp.

 double vpAdaptiveGain::value ( double x ) const

Computes the value of the adaptive gain using:

This value is stored as a parameter of the class.

Parameters
 x : Input value to consider. During a visual servo this value can be the euclidian norm or the infinity norm of the task function.
Returns
It returns the value of the computed gain.

Definition at line 239 of file vpAdaptiveGain.cpp.

References value_const().

Referenced by operator()().

 double vpAdaptiveGain::value_const ( double x ) const

Computes the value of the adaptive gain using:

Parameters
 x : Input value to consider. During a visual servo this value can be the euclidian norm or the infinity norm of the task function.
Returns
It returns the value of the computed gain.

Definition at line 204 of file vpAdaptiveGain.cpp.

Referenced by value().

## Friends And Related Function Documentation

 VISP_EXPORT std::ostream& operator<< ( std::ostream & os, const vpAdaptiveGain & lambda )
friend

Prints the adaptive gain parameters .

Parameters
 os : The stream where to print the adaptive gain parameters. lambda : The adaptive gain containing the parameters to print.

Definition at line 319 of file vpAdaptiveGain.cpp.

## Member Data Documentation

static

Definition at line 125 of file vpAdaptiveGain.h.

Referenced by initFromVoid().

static

Definition at line 126 of file vpAdaptiveGain.h.

Referenced by initFromVoid().

static

Definition at line 124 of file vpAdaptiveGain.h.

Referenced by initFromVoid().