ME 305
|
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... | |
ADC_Driver Class.
Class to directly interface with touch panel. See file details for more details. Pin configurations change depending on coordinate reading.
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
xm_pin | Contains pin object to set voltage to read position. Connected to ground or floated. |
xp_pin | Contains pin object to set voltage to read position. Connected to 3.3V or configured for ADC |
ym_pin | Contains pin object to set voltage to read position. Connected to ground or floated. |
yp_pin | Contains pin object to set voltage to read position. Connected to 3.3V or configured for ADC |
def ADC_driver.ADC_Driver.calibrate | ( | self, | |
x | |||
) |
Calibrates touch panel.
Receives list of calibration measurements to calculate calibration coefficient matrix
x | List of calibration measurements |
def ADC_driver.ADC_Driver.readBeta | ( | self | ) |
Reads from and stores value of calibration coefficient text file.
def ADC_driver.ADC_Driver.scanX | ( | self | ) |
Configures pins read x-position of ball.
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.
def ADC_driver.ADC_Driver.scanY | ( | self | ) |
Configures pins to read y-position of ball.
def ADC_driver.ADC_Driver.scanZ | ( | self | ) |
Determines whether ball is in contact with touch sensor.
def ADC_driver.ADC_Driver.writeBeta | ( | self | ) |
Writes calibration coefficient matrix to text file.
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
ADC_driver.ADC_Driver.ii |
Index for iteration.
Controls when loss of ball contact, causes platform to self balance
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