Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
dynamicgraph::sot::GainAdaptive Class Reference

#include <gain-adaptive.hh>

Inheritance diagram for dynamicgraph::sot::GainAdaptive:
Inheritance graph
[legend]

Public Member Functions

virtual void display (std::ostream &os) const
 
void forceConstant (void)
 
 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)
 
virtual const std::string & getClassName (void) const
 
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...
 
- Public Member Functions inherited from dynamicgraph::Entity
std::ostream & displaySignalList (std::ostream &os) const
 
 Entity (const std::string &name)
 
const std::string & getCommandList () const
 
virtual std::string getDocString () const
 
LoggerVerbosity getLoggerVerbosityLevel ()
 
LoggerVerbosity getLoggerVerbosityLevel ()
 
const std::string & getName () const
 
command::CommandgetNewStyleCommand (const std::string &cmdName)
 
CommandMap_t getNewStyleCommandMap ()
 
SignalBase< int > & getSignal (const std::string &signalName)
 
const SignalBase< int > & getSignal (const std::string &signalName) const
 
SignalMap getSignalMap () const
 
double getStreamPrintPeriod ()
 
double getStreamPrintPeriod ()
 
double getTimeSample ()
 
double getTimeSample ()
 
bool hasSignal (const std::string &signame) const
 
Loggerlogger ()
 
Logger const & logger () const
 
Loggerlogger ()
 
Logger const & logger () const
 
void sendMsg (const std::string &msg, MsgType t=MSG_TYPE_INFO, const std::string &lineId="")
 
void sendMsg (const std::string &msg, MsgType t=MSG_TYPE_INFO, const std::string &lineId="")
 
void setLoggerVerbosityLevel (LoggerVerbosity lv)
 
void setLoggerVerbosityLevel (LoggerVerbosity lv)
 
bool setStreamPrintPeriod (double t)
 
bool setStreamPrintPeriod (double t)
 
bool setTimeSample (double t)
 
bool setTimeSample (double t)
 
virtual SignalBase< int > * test ()
 
virtual void test2 (SignalBase< int > *)
 
virtual std::ostream & writeCompletionList (std::ostream &os) const
 
virtual std::ostream & writeGraph (std::ostream &os) const
 
virtual ~Entity ()
 

Public Attributes

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

Static Public Attributes

static const std::string CLASS_NAME
 
static const double INFTY_DEFAULT = .1
 
static const double TAN_DEFAULT = 1
 
static const double ZERO_DEFAULT = .1
 

Protected Member Functions

doublecomputeGain (double &res, int t)
 
- Protected Member Functions inherited from dynamicgraph::Entity
void addCommand (const std::string &name, command::Command *command)
 
void entityDeregistration ()
 
void entityRegistration ()
 
void signalDeregistration (const std::string &name)
 
void signalRegistration (const SignalArray< int > &signals)
 

Protected Attributes

double coeff_a
 
double coeff_b
 
double coeff_c
 
- Protected Attributes inherited from dynamicgraph::Entity
CommandMap_t commandMap
 
Logger logger_
 
std::string name
 
SignalMap signalMap
 

Private Member Functions

void addCommands ()
 

Additional Inherited Members

- Public Types inherited from dynamicgraph::Entity
typedef std::map< const std::string, command::Command *> CommandMap_t
 
typedef std::map< std::string, SignalBase< int > *> SignalMap
 

Detailed Description

Exponentially decreasing gain. It follows the law

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

.

The default values for

Definition at line 53 of file gain-adaptive.hh.

Constructor & Destructor Documentation

◆ GainAdaptive() [1/3]

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

Definition at line 80 of file gain-adaptive.cpp.

◆ 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

◆ addCommands()

void GainAdaptive::addCommands ( )
private

Definition at line 42 of file gain-adaptive.cpp.

◆ computeGain()

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

Definition at line 166 of file gain-adaptive.cpp.

◆ display()

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

Reimplemented from dynamicgraph::Entity.

Definition at line 154 of file gain-adaptive.cpp.

◆ forceConstant()

void GainAdaptive::forceConstant ( void  )

Definition at line 148 of file gain-adaptive.cpp.

◆ getClassName()

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

Reimplemented from dynamicgraph::Entity.

Definition at line 63 of file gain-adaptive.hh.

◆ init() [1/3]

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

Definition at line 79 of file gain-adaptive.hh.

◆ init() [2/3]

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

Definition at line 80 of file gain-adaptive.hh.

◆ init() [3/3]

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

◆ initFromPassingPoint()

void 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()

Definition at line 133 of file gain-adaptive.cpp.

Member Data Documentation

◆ CLASS_NAME

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

Definition at line 61 of file gain-adaptive.hh.

◆ coeff_a

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

Definition at line 68 of file gain-adaptive.hh.

◆ coeff_b

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

Definition at line 69 of file gain-adaptive.hh.

◆ coeff_c

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

Definition at line 70 of file gain-adaptive.hh.

◆ errorSIN

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

Definition at line 119 of file gain-adaptive.hh.

◆ gainSOUT

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

Definition at line 120 of file gain-adaptive.hh.

◆ INFTY_DEFAULT

const double GainAdaptive::INFTY_DEFAULT = .1
static

Definition at line 57 of file gain-adaptive.hh.

◆ TAN_DEFAULT

const double GainAdaptive::TAN_DEFAULT = 1
static

Definition at line 58 of file gain-adaptive.hh.

◆ ZERO_DEFAULT

const double GainAdaptive::ZERO_DEFAULT = .1
static

Definition at line 56 of file gain-adaptive.hh.


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


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Wed Jun 21 2023 02:51:27