ProportionalController Class Reference

Implements a prorportional controller. More...

Public Member Functions

 ProportionalController ()
 Constructor.
 
 ProportionalController (double k, double maxVelocity)
 Constructor.
 
 ProportionalController (const ProportionalController &other)
 Copy constructor.
 
 ~ProportionalController ()
 Destructor.
 
real getK () const
 Returns the value of the gain.
 
real getMaxVelocity () const
 Returns the maximum velocity.
 
ProportionalControlleroperator= (const ProportionalController &other)
 Copy operator.
 
void setK (double k)
 Sets the value of the gain.
 
void setMaxVelocity (double maxVelocity)
 Sets the maximum velocity.
 
real velocityForJoint (real desired, real current) const
 Returns the velocity to apply to a joint to reach the desired position.
 

Protected Attributes

real m_k
 The gain of the controller.
 
real m_maxVelocity
 The maximum allowed velocity.
 

Detailed Description

Implements a prorportional controller.

This class implements a simple proportional controller. It has two parameters: the gain of the controller k and the absolute value of the maximum allowed velocity. It is used to get a velocity to apply to a joint to reach a desired position

Definition at line 158 of file motors.h.

Constructor & Destructor Documentation

Constructor.

The parameters are set to default values:

  • k = 0.3
  • maxVelocity = 20.0

Definition at line 123 of file motors.cpp.

ProportionalController ( double  k,
double  maxVelocity 
)

Constructor.

Parameters
kthe value of the gain of the controller
maxVelocitythe value of the maximum velocity parameter

Definition at line 129 of file motors.cpp.

Copy constructor.

Parameters
otherthe object to copy

Definition at line 135 of file motors.cpp.

Destructor.

Definition at line 153 of file motors.cpp.

Member Function Documentation

real getK ( ) const
inline

Returns the value of the gain.

Returns
the value of the gain

Definition at line 203 of file motors.h.

Referenced by iCubPosToVelMotor::getK().

real getMaxVelocity ( ) const
inline

Returns the maximum velocity.

Returns
the maximum velocity

Definition at line 223 of file motors.h.

ProportionalController & operator= ( const ProportionalController other)

Copy operator.

Parameters
otherthe object to copy
Returns
a reference to this

Definition at line 141 of file motors.cpp.

References ProportionalController::m_k, and ProportionalController::m_maxVelocity.

void setK ( double  k)
inline

Sets the value of the gain.

Parameters
kthe new value of the gain

Definition at line 213 of file motors.h.

void setMaxVelocity ( double  maxVelocity)
inline

Sets the maximum velocity.

Parameters
maxVelocitythe new maximum velocity

Definition at line 233 of file motors.h.

real velocityForJoint ( real  desired,
real  current 
) const

Returns the velocity to apply to a joint to reach the desired position.

Parameters
desiredthe desired position of the joint
currentthe current position of the joint
Returns
the velocity to apply to the joint

Definition at line 158 of file motors.cpp.

References ProportionalController::m_k, and ProportionalController::m_maxVelocity.

Referenced by iCubTorsoPosToVelMotor::update().

Member Data Documentation

real m_k
protected

The gain of the controller.

Definition at line 252 of file motors.h.

Referenced by ProportionalController::operator=(), and ProportionalController::velocityForJoint().

real m_maxVelocity
protected

The maximum allowed velocity.

Definition at line 257 of file motors.h.

Referenced by ProportionalController::operator=(), and ProportionalController::velocityForJoint().


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