ME 405 Romi
Loading...
Searching...
No Matches
controller Namespace Reference

Classes

class  Controller
 This file contains a class to create a PID Controller object. More...

Functions

 change_Ref (self, reference)
 change_Ref changes the set point of the controller.
 get_Ref (self)
 get_Ref returns the current set point of the controller.
 get_Error (self)
 get_Error returns the current Riemann Sum integral of the errors of the controller.
 proportional_Control (self, measure)
 proportional_Control returns a saturated effort value based on the error of the system from the set point using proportional control only.
 pi_Control (self, measure, dt)
 pi_Control returns a saturated effort value based on the error of the system from the set point using proportional and integral control only.
 error_sat (self, err)
 error_sat is a function which returns the saturated integral of the error based on this instance of the controller saturation value.
 effort_sat (self, eff)
 effort_sat is a function which returns the saturated effort of the controller based on this instance of the controllers saturation value.
 change_Gains (self, k_p, k_i, k_d)
 change_Gains changes this instance's gain values.

Variables

 reference = reference
 summed_errors = self.error_sat(self.summed_errors)
 K_p = k_p
 K_i = k_i
 K_d = k_d

Function Documentation

◆ change_Gains()

controller.change_Gains ( self,
k_p,
k_i,
k_d )

change_Gains changes this instance's gain values.


Parameters
k_p: k_p is the new proportional gain.
k_i: k_i is the new integral gain.
k_d: k_d is the new derivative gain.

Definition at line 106 of file controller.py.

◆ change_Ref()

controller.change_Ref ( self,
reference )

change_Ref changes the set point of the controller.

Parameters
reference: reference is the new set point of the controller.

Definition at line 40 of file controller.py.

◆ effort_sat()

controller.effort_sat ( self,
eff )

effort_sat is a function which returns the saturated effort of the controller based on this instance of the controllers saturation value.


Parameters
eff: eff is the effort value being saturated.

Definition at line 94 of file controller.py.

◆ error_sat()

controller.error_sat ( self,
err )

error_sat is a function which returns the saturated integral of the error based on this instance of the controller saturation value.

Parameters
err: err is the error sum value being saturated.

Definition at line 84 of file controller.py.

◆ get_Error()

controller.get_Error ( self)

get_Error returns the current Riemann Sum integral of the errors of the controller.

Definition at line 51 of file controller.py.

◆ get_Ref()

controller.get_Ref ( self)

get_Ref returns the current set point of the controller.

Definition at line 47 of file controller.py.

◆ pi_Control()

controller.pi_Control ( self,
measure,
dt )

pi_Control returns a saturated effort value based on the error of the system from the set point using proportional and integral control only.


@detail The integral of the error is done using a simple Riemann sum that looks at how long it has been since the last time the controller was ran. This integral is saturated to stop the integral from making the motors go insane when some unexpected behavior occurs. The effort is also saturated.

Parameters
measure: measure is the current state of the system being controlled
dt: dt is the time since the last run of pi_Control in ms

Definition at line 72 of file controller.py.

◆ proportional_Control()

controller.proportional_Control ( self,
measure )

proportional_Control returns a saturated effort value based on the error of the system from the set point using proportional control only.

Parameters
measure: measure is the current state of the system being controlled

Definition at line 56 of file controller.py.

Variable Documentation

◆ K_d

controller.K_d = k_d

Definition at line 109 of file controller.py.

◆ K_i

controller.K_i = k_i

Definition at line 108 of file controller.py.

◆ K_p

controller.K_p = k_p

Definition at line 107 of file controller.py.

◆ reference

controller.reference = reference

Definition at line 41 of file controller.py.

◆ summed_errors

controller.summed_errors = self.error_sat(self.summed_errors)

Definition at line 78 of file controller.py.