Matthew's Portfolio
motorTask.motorTask Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

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.

Parameters
mTaskFlagEnables or prevents certain print statements from appearing.

Member Function Documentation

◆ motorTaskFcn()

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.

◆ transitionTo()

def motorTask.motorTask.transitionTo (   self,
  state,
  newState 
)

Method for transitioning states.

The method will reassign the state variable when directed to transition.

Parameters
stateThe current state of the system.
newStateThe new desired state for the system.
Returns
The new state of the finite state machine.

Member Data Documentation

◆ motorDriverObj

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.

◆ motX

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.

◆ motY

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.


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