ME405 Portfolio
The following documentation details each step of the ME 405 term project.
Encoder_Driver.EncoderDriver Class Reference

This class defines the three functions of the encoder driver. More...

Public Member Functions

def __init__ (self, timer_number, ch1_pin, ch2_pin)
 Defines parameters needed for an encoder object. More...
 
def update (self)
 Function which consistently updates motor position. More...
 
def get_position (self)
 This function returns the current position of the motor. More...
 
def set_position (self)
 This function sets the position of the motor to zero. More...
 
def get_delta (self)
 This function returns the most recent delta. More...
 

Public Attributes

 ch1_pin
 
 ch2_pin
 
 tim1
 
 delt1
 
 zero1
 
 pos1
 
 position1
 
 delta1
 
 position
 

Detailed Description

This class defines the three functions of the encoder driver.

The three functions defined by this class are the initialization function, the get position function, the set position function, and the zero function. All three are intended to be called by another file.

Constructor & Destructor Documentation

◆ __init__()

def Encoder_Driver.EncoderDriver.__init__ (   self,
  timer_number,
  ch1_pin,
  ch2_pin 
)

Defines parameters needed for an encoder object.

This function accepts 5 inputs to define the appropriate pins and channels needed to use any encoder. Also defines variables needed when updating encoder outputs.

Parameters
timer_numberVariable for desired timer number
ch1_pinVariable for desired chanel 1 pin
ch2_pinVariable for desired chanel 2 pin
ch1_numVariable for desired chanel 1 number
ch2_numVariable for desired chanel 2 number

Member Function Documentation

◆ get_delta()

def Encoder_Driver.EncoderDriver.get_delta (   self)

This function returns the most recent delta.

Returns the difference between the motor position at the last two position updates.

◆ get_position()

def Encoder_Driver.EncoderDriver.get_position (   self)

This function returns the current position of the motor.

This function converts the position value into units of degrees and then returns the most recent position.

◆ set_position()

def Encoder_Driver.EncoderDriver.set_position (   self)

This function sets the position of the motor to zero.

Sets the zero value to the current position of the motor so that during the next update the position will reflect the zero.

◆ update()

def Encoder_Driver.EncoderDriver.update (   self)

Function which consistently updates motor position.

Creates an array of two variables which upon every update is changed to reflect the most recent position and the last position. This array makes it easy to access the most recent position as well as the delta between the last update.


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