Class for implementing Mechatronic Zen Garden control system. More...
#include <Control.h>
Public Member Functions | |
| Control (float vel_gain, float pos_gain) | |
| Instantiates control system object. More... | |
| void | run (float pos_ref, float pos, float vel_ref, float vel) |
| Computes PWM based on positional error and velocity error. More... | |
Public Attributes | |
| float | Kd = 1.003 |
| Derivative gain. | |
| float | Kp = 0.0203 |
| Proportional gain. | |
| float | PWM_vel |
| velocity error contribution to PWM | |
| float | PWM_pos |
| position error contribution to PWM | |
| float | PWM |
| PWM sent to motors. | |
Class for implementing Mechatronic Zen Garden control system.
| Control::Control | ( | float | vel_gain, |
| float | pos_gain | ||
| ) |
Instantiates control system object.
| vel_gain | positional derivative gain, or velocity gain |
| pos_gain | positional proportional gain, or positional gain |
| void Control::run | ( | float | pos_ref, |
| float | pos, | ||
| float | vel_ref, | ||
| float | vel | ||
| ) |
Computes PWM based on positional error and velocity error.
This controller makes use of positional PD control. It also tries to correct for the deadzone observed in the system due to stiction. The PWM values saturate at +/- 100%.
| pos_ref | reference posiotional value |
| pos | postional reading value |
| vel_ref | reference velocity value |
| vel | velocity reading value |