Mechatronic Zen Garden  0.1
This webpage contains documentation for the ME 507 term project: Mechatronic Zen Garden.
Control Class Reference

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.
 

Detailed Description

Class for implementing Mechatronic Zen Garden control system.

Constructor & Destructor Documentation

◆ Control()

Control::Control ( float  vel_gain,
float  pos_gain 
)

Instantiates control system object.

Parameters
vel_gainpositional derivative gain, or velocity gain
pos_gainpositional proportional gain, or positional gain

Member Function Documentation

◆ run()

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

Parameters
pos_refreference posiotional value
pospostional reading value
vel_refreference velocity value
velvelocity reading value

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