EEROS  1.0.0.0
API for the EEROS Real-Time Robotics Framework
eeros::control::Gain< Tout, Tgain, elementWise > Class Template Reference

#include <Gain.hpp>

Inheritance diagram for eeros::control::Gain< Tout, Tgain, elementWise >:
Collaboration diagram for eeros::control::Gain< Tout, Tgain, elementWise >:

Public Member Functions

 Gain ()
 
 Gain (Tgain c)
 
 Gain (Tgain c, Tgain maxGain, Tgain minGain)
 
virtual void run ()
 
virtual void enable ()
 
virtual void disable ()
 
virtual void enableSmoothChange (bool enable)
 
virtual void setGain (Tgain c)
 
virtual void setMaxGain (Tgain maxGain)
 
virtual void setMinGain (Tgain minGain)
 
virtual void setGainDiff (Tgain gainDiff)
 
- Public Member Functions inherited from eeros::control::Block1i1o< Tout >
 Block1i1o ()
 
virtual Input< Tout > & getIn ()
 
virtual Output< Tout > & getOut ()
 
- Public Member Functions inherited from eeros::control::Block
virtual void setName (std::string name)
 
virtual std::string getName ()
 
- Public Member Functions inherited from eeros::Runnable
virtual ~Runnable ()
 

Protected Attributes

Tgain gain
 
Tgain maxGain
 
Tgain minGain
 
Tgain targetGain
 
Tgain gainDiff
 
bool enabled {true}
 
bool smoothChange {false}
 
- Protected Attributes inherited from eeros::control::Block1i1o< Tout >
Input< Tout > in
 
Output< Tout > out
 

Friends

template<typename Xout , typename Xgain >
std::ostream & operator<< (std::ostream &os, Gain< Xout, Xgain > &gain)
 

Detailed Description

template<typename Tout = double, typename Tgain = double, bool elementWise = false>
class eeros::control::Gain< Tout, Tgain, elementWise >

A gain block is used to amplify an input signal. This is basically done by multiplying the gain with the input signal value. The following term represents the operation performed in this block.

output = gain * input

Gain is a class template with two type and one non-type template arguments. The two type template arguments specify the types which are used for the output type and the gain type when the class template is instanciated. The non-type template argument specifies if the multiplication will be done element wise in case the gain is used with matrices.

Template Parameters
Tout- output type (double - default type)
Tgain- gain type (double - default type)
elementWise- amplify element wise (false - default value)
Since
v0.6

Constructor & Destructor Documentation

template<typename Tout = double, typename Tgain = double, bool elementWise = false>
eeros::control::Gain< Tout, Tgain, elementWise >::Gain ( )
inline

Constructs a default gain instance with a gain of 1.
Calls Gain(Tgain c).

See also
Gain(Tgain c)
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
eeros::control::Gain< Tout, Tgain, elementWise >::Gain ( Tgain  c)
inline

Constructs a gain instance with a gain of the value of the parameter c.
Calls Gain(Tgain c, Tgain maxGain, Tgain minGain).

See also
Gain(Tgain c, Tgain maxGain, Tgain minGain)
Parameters
c- initial gain value
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
eeros::control::Gain< Tout, Tgain, elementWise >::Gain ( Tgain  c,
Tgain  maxGain,
Tgain  minGain 
)
inline

Constructs a gain instance with a gain of the value of the parameter c, a maximum gain of maxGain and a minimum gain of minGain.
Sets the target gain to the value of the parameter c.
Sets the gain diff to 0.

Parameters
c- initial gain value
maxGain- initial maximum gain value
minGain- initial minimum gain value

Member Function Documentation

template<typename Tout = double, typename Tgain = double, bool elementWise = false>
virtual void eeros::control::Gain< Tout, Tgain, elementWise >::disable ( )
inlinevirtual

Disables the gain.

If disabled, run() will set the output signal to the input signal.

Does not disable smooth change. This is done by calling enableSmoothChange(bool).

See also
run()
enableSmoothChange(bool)
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
virtual void eeros::control::Gain< Tout, Tgain, elementWise >::enable ( )
inlinevirtual

Enables the gain.

If enabled, run() will set the output signal to the amplified value calculated by multiplying gain * input.

Does not enable smooth change. This is done by calling enableSmoothChange(bool).

See also
run()
enableSmoothChange(bool)
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
virtual void eeros::control::Gain< Tout, Tgain, elementWise >::enableSmoothChange ( bool  enable)
inlinevirtual

Enables or disables a smooth change of the gain.

If enabled, run() will perform a smooth change of the gain value.

Does not enable or disable the gain. This is done by calling enable() and disable() respectively.

Parameters
enable- enables or disables a smooth change of the gain
See also
run()
enable()
disable()
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
virtual void eeros::control::Gain< Tout, Tgain, elementWise >::run ( )
inlinevirtual

Runs the amplification algorithm.

Performs the smooth change if smooth change is enabled with enableSmoothChange(bool). A smooth change of the gain is performed by adding or subtracting a gain differential specifiable by setGainDiff(Tgain).

Checks if gain is in the band in between minGain and maxGain or correct it otherwise. The correction is done by setting the maxGain or minGain to gain.

Sets the output signal value to the amplified value calculated by multiplying gain * input if the gain instance is enabled by enable().

See also
enableSmoothChange(bool)
setGainDiff(Tgain)
enable()
disable()

Implements eeros::Runnable.

template<typename Tout = double, typename Tgain = double, bool elementWise = false>
virtual void eeros::control::Gain< Tout, Tgain, elementWise >::setGain ( Tgain  c)
inlinevirtual

Sets the gain value if smooth change is disabled and c is in the band in between minGain and maxGain.

Sets the target gain value if smooth change is enabled and c is in the band in between minGain and maxGain.

Does not change gain or target gain value otherwise.

Parameters
c- gain value
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
virtual void eeros::control::Gain< Tout, Tgain, elementWise >::setGainDiff ( Tgain  gainDiff)
inlinevirtual

Sets the gain differential needed by run() to perform a smooth gain change.

Parameters
gainDiff- gain differential
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
virtual void eeros::control::Gain< Tout, Tgain, elementWise >::setMaxGain ( Tgain  maxGain)
inlinevirtual

Sets the maximum allowed gain.

Parameters
maxGain- maximum allowed gain value
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
virtual void eeros::control::Gain< Tout, Tgain, elementWise >::setMinGain ( Tgain  minGain)
inlinevirtual

Sets the minimum allowed gain.

Parameters
minGain- minimum allowed gain value

Friends And Related Function Documentation

template<typename Tout = double, typename Tgain = double, bool elementWise = false>
template<typename Xout , typename Xgain >
std::ostream& operator<< ( std::ostream &  os,
Gain< Xout, Xgain > &  gain 
)
friend

Member Data Documentation

template<typename Tout = double, typename Tgain = double, bool elementWise = false>
bool eeros::control::Gain< Tout, Tgain, elementWise >::enabled {true}
protected
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
Tgain eeros::control::Gain< Tout, Tgain, elementWise >::gain
protected
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
Tgain eeros::control::Gain< Tout, Tgain, elementWise >::gainDiff
protected
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
Tgain eeros::control::Gain< Tout, Tgain, elementWise >::maxGain
protected
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
Tgain eeros::control::Gain< Tout, Tgain, elementWise >::minGain
protected
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
bool eeros::control::Gain< Tout, Tgain, elementWise >::smoothChange {false}
protected
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
Tgain eeros::control::Gain< Tout, Tgain, elementWise >::targetGain
protected

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