Matthew's Portfolio
encoderTask.encoderTask Class Reference

Task to call the encoder driver for current angles and velocities. More...

Public Member Functions

def __init__ (self, debugFlag=True)
 Create an encoder task to find position and speeds. More...
 
def encTaskFcn (self)
 Main run function of encoder task. More...
 
def transitionTo (self, state, newState)
 Method for transitioning states. More...
 

Public Attributes

 debugFlag
 Debugging flag for detailed analysis while running.
 

Static Public Attributes

 S0_INIT = const(0)
 The initial state to set up the task.
 
 S1_ZERO_ENCODERS = const(1)
 State to zero the encoders at the start of the program.
 
 S2_READ_ENCODERS = const(2)
 Main state to read from the encoders.
 

Detailed Description

Task to call the encoder driver for current angles and velocities.

This task will be called from the priority scheduler to get the current angles and angular speeds of both encoders. This will be shared to the shares.py file for the controller task to read.

Constructor & Destructor Documentation

◆ __init__()

def encoderTask.encoderTask.__init__ (   self,
  debugFlag = True 
)

Create an encoder task to find position and speeds.

This task will be called from the priority scheduler to get the current angles and angular speeds of both encoders. This will be shared to the shares.py file for the controller task to read.

Parameters
debugFlagEnables or prevents certain print statements from appearing.

Member Function Documentation

◆ encTaskFcn()

def encoderTask.encoderTask.encTaskFcn (   self)

Main run function of encoder task.

This function serves as a generator to run the finite state machine of the encoder task. It has three states, and uses an alpha-beta filter to determine position and velocity of the platform.

◆ transitionTo()

def encoderTask.encoderTask.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.

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