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... | |
ProportionalController & | operator= (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
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
-
k the value of the gain of the controller maxVelocity the value of the maximum velocity parameter
Definition at line 129 of file motors.cpp.
ProportionalController | ( | const ProportionalController & | other | ) |
Destructor.
Definition at line 153 of file motors.cpp.
Member Function Documentation
|
inline |
|
inline |
ProportionalController & operator= | ( | const ProportionalController & | other | ) |
Copy operator.
- Parameters
-
other the object to copy
- Returns
- a reference to this
Definition at line 141 of file motors.cpp.
References ProportionalController::m_k, and ProportionalController::m_maxVelocity.
|
inline |
|
inline |
double velocityForJoint | ( | double | desired, |
double | current | ||
) | const |
Returns the velocity to apply to a joint to reach the desired position.
- Parameters
-
desired the desired position of the joint current the 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
|
protected |
The gain of the controller.
Definition at line 252 of file motors.h.
Referenced by ProportionalController::operator=(), and ProportionalController::velocityForJoint().
|
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:
- experiments/include/motors.h
- experiments/src/motors.cpp