ProportionalController Class Reference

Implements a prorportional controller. More...

Public Member Functions

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

Protected Attributes

double m_k
 The gain of the controller. More...
 
double m_maxVelocity
 The maximum allowed velocity. More...
 

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

double getK ( ) const
inline

Returns the value of the gain.

Returns
the value of the gain

Definition at line 203 of file motors.h.

double 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.

double velocityForJoint ( double  desired,
double  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.

Member Data Documentation

double m_k
protected

The gain of the controller.

Definition at line 252 of file motors.h.

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

double 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: