Task to call the motor drivers for setting duty cycles. More...
Public Member Functions | |
| def | __init__ (self, mTaskFlag=False) |
| Create a motor task. More... | |
| def | motorTaskFcn (self) |
| State machine for running the motor drivers. More... | |
| def | transitionTo (self, state, newState) |
| Method for transitioning states. More... | |
Public Attributes | |
| mTaskFlag | |
| Debugging flag for detailed analysis while running. | |
| motorDriverObj | |
| Create an instance of the motor driver. More... | |
| motX | |
| Create a channel for motor X. More... | |
| motY | |
| Create a channel for motor Y. More... | |
Static Public Attributes | |
| S0_INIT = const(0) | |
| The initial state to set up the task. | |
| S1_MOVE_MOTORS = const(1) | |
| Main state to read data from the motors. | |
| S2_LATCH = const(2) | |
| When the motor hits a fault, the user can restart the program. | |
Task to call the motor drivers for setting duty cycles.
This task will be called from the priority scheduler to set the duty cycles. This class also will disable the motors under two conditions a fault occurs, which will cause an interrupt in the motor driver, or if the user presses the s key.
| def motorTask.motorTask.__init__ | ( | self, | |
mTaskFlag = False |
|||
| ) |
Create a motor task.
This task will be called from the priority scheduler to set the duty cycles. This class also will disable the motors under two conditions a fault occurs, which will cause an interrupt in the motor driver, or if the user presses the s key.
| mTaskFlag | Enables or prevents certain print statements from appearing. |
| def motorTask.motorTask.motorTaskFcn | ( | self | ) |
State machine for running the motor drivers.
This generator is used to run the motor task. The main states are initializing the motors, sending them new duty cycles, and allowing the user to restart the motors if they were to hit a fault or a stop command.
| def motorTask.motorTask.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. |
| motorTask.motorTask.motorDriverObj |
Create an instance of the motor driver.
The motor driver contains the functionality for both motors. Specific motors will be called using the .channel method within the motor driver.
| motorTask.motorTask.motX |
Create a channel for motor X.
Using the channel method within the motor driver, the X motor will be created using channels 3 and 4 to allow for the X motor to have its own duty cycles.
| motorTask.motorTask.motY |
Create a channel for motor Y.
Using the channel method within the motor driver, the Y motor will be created using channels 1 and 2 to allow for the Y motor to have its own duty cycles.