Controller for the system. More...
Public Member Functions | |
def | __init__ (self, kMatrixX, kMatrixY, debugFlag=True) |
Create a controller task. More... | |
def | ctrlTaskFcn (self) |
State machine for running the controller. More... | |
def | transitionTo (self, state, newState) |
Method for transitioning states. More... | |
Public Attributes | |
debugFlag | |
Debugging flag for detailed analysis while running. | |
kPrimeFactor | |
Conversion factor for going from torque to duty cycle. | |
kMatrixX | |
K matrix for motor X as derived analytically and tuned. | |
kMatrixY | |
K matrix for motor X as derived analytically and tuned. | |
xThresh | |
Threshold to determine if the ball is balanced in the center (mm) | |
yThresh | |
Threshold to determine if the ball is balanced in the center (mm) | |
dataToSave | |
A flag to determine if we're saving x or y data. More... | |
Controller for the system.
This class implements the full-state feedback control algorithm to balance the platform with the ball in the center.
def ctrlTask.ctrlTask.__init__ | ( | self, | |
kMatrixX, | |||
kMatrixY, | |||
debugFlag = True |
|||
) |
Create a controller task.
This task will be called from the priority scheduler to read from shares.py in order to get the ball's newest position and velocity as well as the platform's angle and angular velocity.
kMatrixX | K matrix for the x motor for the full-state feedback controller. |
kMatrixY | K matrix for the y motor for the full-state feedback controller. |
debugFlag | Enables or prevents certain print statements from appearing. |
def ctrlTask.ctrlTask.ctrlTaskFcn | ( | self | ) |
State machine for running the controller.
This generator is used to run the controller. It will read commands from the uiTask as well as send new duty cycles to the motors.
def ctrlTask.ctrlTask.transitionTo | ( | self, | |
state, | |||
newState | |||
) |
Method for transitioning states.
The method will reassign the state
variable when directed to transition.
state | The current state of the system. |
newState | The new desired state for the system. |
ctrlTask.ctrlTask.dataToSave |
A flag to determine if we're saving x or y data.
The corrected K value for multiplying against the x position.
The corrected K value for multiplying against the y theta.
The corrected K value for multiplying against the x velocity.
The corrected K value for multiplying against the y angular velocity.
The corrected K value for multiplying against the y position.
The corrected K value for multiplying against the x theta.
The corrected K value for multiplying against the y velocity.
The corrected K value for multiplying against the x angular velocity.
Contains the information for which state its in.
Flag to determine if x or y data will be stored
The current command as sent from the uiTask
The current x position of the ball
The current y theta of the platform (as read by encoders)
The current x velocity of the ball
The current y angular velocity of the platform (as read by encoders)
The current y position of the ball
The current x theta of the platform (as read by encoders)
The current y velocity of the ball
The current x angular velocity of the platform (as read by encoders)