Lucas Murray ME 305 Portfolio
|
Public Member Functions | |
def | __init__ (self, xP, xM, yP, yM, a, b, x0, y0) |
Initializes and returns a resistive touch panel object. More... | |
def | zScan (self) |
Scans for a voltage in the z-direction from an ADC. More... | |
def | xScan (self) |
Scans for a voltage in the x-direction from an ADC. More... | |
def | yScan (self) |
Scans for a voltage in the y-direction from an ADC. More... | |
def | cart (self) |
Runs all three scans and converts data into usable values. More... | |
def | calibrate (self, hFlag) |
Calibrates the resistive touch panel. More... | |
def | setCalCoefficients (self) |
Writes the newly obtained calibration coefficients of the touch panel to a new file. More... | |
def | getCalCoefficients (self) |
Sets the calibration coefficients of the touch panel from a file or from manual calibration. More... | |
Public Attributes | |
xP | |
xM | |
yP | |
yM | |
Kxx | |
Kxy | |
Kyx | |
Kyy | |
a | |
b | |
x0 | |
y0 | |
count | |
nxt | |
lastScan | |
calStatus | |
coefficients | |
def touch.Touch.__init__ | ( | self, | |
xP, | |||
xM, | |||
yP, | |||
yM, | |||
a, | |||
b, | |||
x0, | |||
y0 | |||
) |
Initializes and returns a resistive touch panel object.
xP | The initial x+ pin configuration |
xM | The initial x- pin configuration |
yP | The initial y+ pin configuration |
yM | The initial y- pin configuration |
a | The alpha value for the alpha-beta filtering |
b | The beta value for the alpha-beta filtering |
x0 | The initial x-direction offset |
y0 | The initial y-direction offset |
def touch.Touch.calibrate | ( | self, | |
hFlag | |||
) |
Calibrates the resistive touch panel.
Takes the average of one hundred measurements at three different board positions to accurately calculate the scaling factors and offsets needed to line up the theoretical board with the actual.
hFlag | Boolean variable shared between taskPanel and taskMotor for the haptic feedback command |
def touch.Touch.cart | ( | self | ) |
Runs all three scans and converts data into usable values.
Takes the average of ten converted position values for each scan and performs alpha-beta filtering to minimize effects of bad measurement values and gather position data. It then accounts for the offsets to get the true positions.
def touch.Touch.getCalCoefficients | ( | self | ) |
Sets the calibration coefficients of the touch panel from a file or from manual calibration.
If the calibration file already exists, it will read it and set the calibration coefficients of the touch panel from the read data, and if the file doesn't exist, it runs the calibration process and sends the new touch panel coefficients over to setCalCoefficients().
def touch.Touch.setCalCoefficients | ( | self | ) |
Writes the newly obtained calibration coefficients of the touch panel to a new file.
Only accessed when getCalCoefficients() doesn't find a calibration file, it will run the calibrate() function and write the necessary values to a new file with the required name.
def touch.Touch.xScan | ( | self | ) |
Scans for a voltage in the x-direction from an ADC.
Sets the touch panel pins and ADC to the necessary configurations and reads the ADC for a voltage in the x-direction
def touch.Touch.yScan | ( | self | ) |
Scans for a voltage in the y-direction from an ADC.
Sets the touch panel pins and ADC to the necessary configurations and reads the ADC for a voltage in the y-direction
def touch.Touch.zScan | ( | self | ) |
Scans for a voltage in the z-direction from an ADC.
Sets the touch panel pins and ADC to the necessary configurations and reads the ADC for contact with the board by measuring z-axis voltage