sot-core  4.11.8
Hierarchical task solver plug-in for dynamic-graph.
dynamicgraph::sot::GainAdaptive Class Reference

#include <sot/core/gain-adaptive.hh>

Inheritance diagram for dynamicgraph::sot::GainAdaptive:

Public Member Functions

virtual void display (std::ostream &os) const
 
virtual const std::string & getClassName (void) const
 
 GainAdaptive (const std::string &name)
 
 GainAdaptive (const std::string &name, const double &lambda)
 
 GainAdaptive (const std::string &name, const double &valueAt0, const double &valueAtInfty, const double &tanAt0)
 
void init (void)
 
void init (const double &lambda)
 
void init (const double &valueAt0, const double &valueAtInfty, const double &tanAt0)
 
void initFromPassingPoint (const double &valueAt0, const double &valueAtInfty, const double &errorReference, const double &percentage)
 Set the gain by providing the value at 0, at \( \infty \) and the percentage of accomplishment between both to be reached when the error is errorReference. More...
 
void forceConstant (void)
 

Public Attributes

dynamicgraph::SignalPtr< dynamicgraph::Vector, int > errorSIN
 
dynamicgraph::SignalTimeDependent< double, int > gainSOUT
 

Static Public Attributes

static const double ZERO_DEFAULT
 
static const double INFTY_DEFAULT
 
static const double TAN_DEFAULT
 
static const std::string CLASS_NAME
 

Protected Member Functions

double & computeGain (double &res, int t)
 

Protected Attributes

double coeff_a
 
double coeff_b
 
double coeff_c
 

Detailed Description

Exponentially decreasing gain. It follows the law

\[ g(e) = a \exp (-b ||e||) + c \]

.

The default values for

  • \( a = 0 \),
  • \( b = 0 \),
  • \( c = 0.1 \).

Constructor & Destructor Documentation

◆ GainAdaptive() [1/3]

dynamicgraph::sot::GainAdaptive::GainAdaptive ( const std::string &  name)

◆ GainAdaptive() [2/3]

dynamicgraph::sot::GainAdaptive::GainAdaptive ( const std::string &  name,
const double &  lambda 
)

◆ GainAdaptive() [3/3]

dynamicgraph::sot::GainAdaptive::GainAdaptive ( const std::string &  name,
const double &  valueAt0,
const double &  valueAtInfty,
const double &  tanAt0 
)

Member Function Documentation

◆ computeGain()

double& dynamicgraph::sot::GainAdaptive::computeGain ( double &  res,
int  t 
)
protected

◆ display()

virtual void dynamicgraph::sot::GainAdaptive::display ( std::ostream &  os) const
virtual

◆ forceConstant()

void dynamicgraph::sot::GainAdaptive::forceConstant ( void  )

◆ getClassName()

virtual const std::string& dynamicgraph::sot::GainAdaptive::getClassName ( void  ) const
inlinevirtual

◆ init() [1/3]

void dynamicgraph::sot::GainAdaptive::init ( const double &  lambda)
inline

◆ init() [2/3]

void dynamicgraph::sot::GainAdaptive::init ( const double &  valueAt0,
const double &  valueAtInfty,
const double &  tanAt0 
)

◆ init() [3/3]

void dynamicgraph::sot::GainAdaptive::init ( void  )
inline

◆ initFromPassingPoint()

void dynamicgraph::sot::GainAdaptive::initFromPassingPoint ( const double &  valueAt0,
const double &  valueAtInfty,
const double &  errorReference,
const double &  percentage 
)

Set the gain by providing the value at 0, at \( \infty \) and the percentage of accomplishment between both to be reached when the error is errorReference.

To visualize the curve of the gain versus the error, use

from dynamic_graph.sot.core.gain_adaptive import GainAdaptive
import numpy, matplotlib.pyplot as plt
g = GainAdaptive('g')
g.setByPoint(4.9, 0.001, 0.01, 0.1)
errors = numpy.linspace(0, 0.1, 1000)
def compute(e):
t = g.error.time + 1
g.error.value = (e,)
g.error.time = t
g.gain.recompute(t)
return g.gain.value
gains = [ compute(e) for e in errors ]
lg = plt.plot(errors, gains, 'r', label="Gain")
ld = plt.twinx().plot(errors, [ g*e for e,g in zip(errors,gains) ], 'b',
label="Derivative")
lines = lg + ld
plt.legend(lines, [l.get_label() for l in lines])
plt.show()

Member Data Documentation

◆ CLASS_NAME

const std::string dynamicgraph::sot::GainAdaptive::CLASS_NAME
static

◆ coeff_a

double dynamicgraph::sot::GainAdaptive::coeff_a
protected

◆ coeff_b

double dynamicgraph::sot::GainAdaptive::coeff_b
protected

◆ coeff_c

double dynamicgraph::sot::GainAdaptive::coeff_c
protected

◆ errorSIN

dynamicgraph::SignalPtr<dynamicgraph::Vector, int> dynamicgraph::sot::GainAdaptive::errorSIN

◆ gainSOUT

dynamicgraph::SignalTimeDependent<double, int> dynamicgraph::sot::GainAdaptive::gainSOUT

◆ INFTY_DEFAULT

const double dynamicgraph::sot::GainAdaptive::INFTY_DEFAULT
static

◆ TAN_DEFAULT

const double dynamicgraph::sot::GainAdaptive::TAN_DEFAULT
static

◆ ZERO_DEFAULT

const double dynamicgraph::sot::GainAdaptive::ZERO_DEFAULT
static

The documentation for this class was generated from the following file: