![]() |
ME 305 Group 6 Documentation
|
Driver class for a Closed Loop Controller. More...
Public Member Functions | |
| def | __init__ (self, shares.Share position_signal, shares.Share deriv_signal, shares.Share target_pos, shares.Share target_deriv, float prop_gain, float deriv_gain, float int_gain, int sat_limit_low, int sat_limit_high, int integral_limit=None, int integral_influence_limit=None, shares.Share controller_signals=None, int integral_limit_region=None) |
| Initializes the ClosedLoop object. More... | |
| def | update (self) |
| Returns an output signal based on the initialized share variables. More... | |
| def | set_Kp (self, new_Kp) |
| Sets the Kp to a new value. More... | |
| def | set_Kd (self, new_Kd) |
| Sets the Kd to a new value. More... | |
| def | set_Ki (self, new_Ki) |
| Sets the Ki to a new value. More... | |
Driver class for a Closed Loop Controller.
Used to control a signal and provide output to achieve desired steady state
| def closedloop.ClosedLoop.__init__ | ( | self, | |
| shares.Share | position_signal, | ||
| shares.Share | deriv_signal, | ||
| shares.Share | target_pos, | ||
| shares.Share | target_deriv, | ||
| float | prop_gain, | ||
| float | deriv_gain, | ||
| float | int_gain, | ||
| int | sat_limit_low, | ||
| int | sat_limit_high, | ||
| int | integral_limit = None, |
||
| int | integral_influence_limit = None, |
||
| shares.Share | controller_signals = None, |
||
| int | integral_limit_region = None |
||
| ) |
Initializes the ClosedLoop object.
Objects of this class act as a PID Controller, taking in an input signal and target value, along with a proportional, integral, and differential gain.
| position_signal | Share object containing the position input signal to the controller. |
| deriv_signal | Share object containing the input derivative signal for the controller. |
| target_pos | Share object containing the desired reference value for the controller position. |
| target_deriv | Share object containing the desired reference value for controller velocity. |
| prop_gain | Float value for the Kp for the controller. |
| deriv_gain | Float value for the Kd for the controller. |
| int_gain | Float value fot the Ki for the controller. |
| sat_limit_low | Minimum value to saturate the controller output at. |
| sat_limit_high | Maximum value to saturate the controller output at. |
| integral_limit | Optional parameter to specify limit to how much build-up can occur in the integral term |
| integral_influence_limit | Optional parameter to specify the maximum value the integral term (Ki * integral) can contribute to the output signal |
| controller_signals | Shared object to encapsulate the controller term values (prop, deriv, integral) to pass to user interface for easier debugging |
| integral_limit_region | Integer limiting the region where integral term has any effect. An input signal with absolute value greater than this value will have no integral term in the output signal. |
| def closedloop.ClosedLoop.set_Kd | ( | self, | |
| new_Kd | |||
| ) |
Sets the Kd to a new value.
Replaces the existing Kd with a new value.
| new_Kd | The new value of Kd (derivative gain) to be set. |
| def closedloop.ClosedLoop.set_Ki | ( | self, | |
| new_Ki | |||
| ) |
Sets the Ki to a new value.
Replaces the existing Ki with a new value.
| new_Ki | The new value of Ki (integral gain) to be set. |
| def closedloop.ClosedLoop.set_Kp | ( | self, | |
| new_Kp | |||
| ) |
Sets the Kp to a new value.
Replaces the existing Kp with a new value.
| new_Kp | The new value of Kp (proportional gain) to be set. |
| def closedloop.ClosedLoop.update | ( | self | ) |
Returns an output signal based on the initialized share variables.
Multiplies the error signal by the proportional gain and adds the velocity/derivitive error signal to obtain an output signal. If the output signal exceeds the saturation limits, return the saturation limit instead.