ME 305
Public Member Functions | Public Attributes | List of all members
ADC_driver.ADC_Driver Class Reference

ADC_Driver Class. More...

Public Member Functions

def __init__ (self, xm_pin, xp_pin, ym_pin, yp_pin)
 Initializes ADC_Driver class. More...
 
def scanX (self)
 Configures pins read x-position of ball. More...
 
def scanY (self)
 Configures pins to read y-position of ball. More...
 
def scanZ (self)
 Determines whether ball is in contact with touch sensor. More...
 
def scanXYZ (self)
 Finds x,y, and contact measurements of ball. More...
 
def calibrate (self, x)
 Calibrates touch panel. More...
 
def writeBeta (self)
 Writes calibration coefficient matrix to text file. More...
 
def readBeta (self)
 Reads from and stores value of calibration coefficient text file. More...
 

Public Attributes

 xm
 Pin object.
 
 xp
 Pin object.
 
 ym
 Pin object.
 
 yp
 Pin object.
 
 Beta
 Calibration coefficient matrix. More...
 
 oldTime
 Measured time in microseconds when class first initialized.
 
 newTime
 Measured time in microseconds when scanXYZ() method ran. More...
 
 deltatime
 Difference in time between each class call.
 
 xest
 Estimated x-position of ball.
 
 vxest
 Estimated x-direction velocity of ball.
 
 yest
 Estimated y-position of ball.
 
 vyest
 Estimated y-direction velocity of ball.
 
 A
 Alpha value for alpha-beta filter.
 
 B
 Beta value for alpha-beta filter.
 
 vx
 x-direction velocity of ball
 
 vy
 y-direction velocity of ball
 
 xnext
 Predicted x-position of ball.
 
 vxnext
 Predicted x-direction velocity of ball.
 
 ynext
 Predicted y-position of ball.
 
 vynext
 Predicted y-direction velocity of ball.
 
 ii
 Index for iteration. More...
 

Detailed Description

ADC_Driver Class.

Class to directly interface with touch panel. See file details for more details. Pin configurations change depending on coordinate reading.

Constructor & Destructor Documentation

◆ __init__()

def ADC_driver.ADC_Driver.__init__ (   self,
  xm_pin,
  xp_pin,
  ym_pin,
  yp_pin 
)

Initializes ADC_Driver class.

Initializes pin objects, calibration coefficients, and estimated position/velocities

Parameters
xm_pinContains pin object to set voltage to read position. Connected to ground or floated.
xp_pinContains pin object to set voltage to read position. Connected to 3.3V or configured for ADC
ym_pinContains pin object to set voltage to read position. Connected to ground or floated.
yp_pinContains pin object to set voltage to read position. Connected to 3.3V or configured for ADC
Returns
None

Member Function Documentation

◆ calibrate()

def ADC_driver.ADC_Driver.calibrate (   self,
  x 
)

Calibrates touch panel.

Receives list of calibration measurements to calculate calibration coefficient matrix

Parameters
xList of calibration measurements
Returns
None

◆ readBeta()

def ADC_driver.ADC_Driver.readBeta (   self)

Reads from and stores value of calibration coefficient text file.

Returns
None

◆ scanX()

def ADC_driver.ADC_Driver.scanX (   self)

Configures pins read x-position of ball.

Returns
X-position of ball

◆ scanXYZ()

def ADC_driver.ADC_Driver.scanXYZ (   self)

Finds x,y, and contact measurements of ball.

Calculates position and velocity of ball using alpha-beta filtering.

Returns
x and y position and velocities of ball

◆ scanY()

def ADC_driver.ADC_Driver.scanY (   self)

Configures pins to read y-position of ball.

Returns
Y-position of ball

◆ scanZ()

def ADC_driver.ADC_Driver.scanZ (   self)

Determines whether ball is in contact with touch sensor.

Returns
True(contact) or False(no contact)

◆ writeBeta()

def ADC_driver.ADC_Driver.writeBeta (   self)

Writes calibration coefficient matrix to text file.

Returns
None

Member Data Documentation

◆ Beta

ADC_driver.ADC_Driver.Beta

Calibration coefficient matrix.

Read string of calibration text file.

Calibration position measurements.

Expected position measurents

Calibration coefficient matrix

Conversion of string data to list of floats

◆ ii

ADC_driver.ADC_Driver.ii

Index for iteration.

Controls when loss of ball contact, causes platform to self balance

◆ newTime

ADC_driver.ADC_Driver.newTime

Measured time in microseconds when scanXYZ() method ran.

X-measurement.

Y-measurement

selts xp Pin to ADC configuration

selts ym Pin to ADC configuration

3 by 1 matrix of ball position measurements

Matrix multiplication of measurements with calibration matrix


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