|
Ball Balancer Project
|
The class for initializing, reading, filtering, and calibrating the 3-wire resistive touch panel. More...
Public Member Functions | |
| def | __init__ (self) |
| Initializes the touch panel, creating necessary objects and variables. More... | |
| def | xScan (self) |
| Scans the touch panel for the x-position of the ball. More... | |
| def | yScan (self) |
| Scans the touch panel for the y-position of the ball. More... | |
| def | zScan (self) |
| Scans the touch panel to see if the ball is making contact. More... | |
| def | Scan (self) |
| Scans the touch panel for the total position of the ball. More... | |
| def | Filter (self, ADC_Data) |
| An alpha-beta filter for removing "noise" from the ADC position measurements. More... | |
| def | Calibrate (self) |
| This function walks the user through the steps to calibrate the touchpanel. More... | |
| def | Beta (self) |
| This function uses the 5 data points from the calibration procedure to calculate the matrix of calibration coefficients. More... | |
| def | Read_Panel (self, Beta) |
| This fucntion is a combination of the scan, filter, and calibration fucntions defined earlier. More... | |
The class for initializing, reading, filtering, and calibrating the 3-wire resistive touch panel.
This class is responsible for alll of the basic fucntionality of the touch panel.
| def touchpanel.TouchPanel.__init__ | ( | self | ) |
Initializes the touch panel, creating necessary objects and variables.
This function initialzes the touch panel pins, creates a few variables for future use, and creates the Y matrix containing the calibration points.
| def touchpanel.TouchPanel.Beta | ( | self | ) |
This function uses the 5 data points from the calibration procedure to calculate the matrix of calibration coefficients.
Using the ADC data from the 5 points tapped on the touch panel, this function calculates the matrix Beta, which contains the calibration coefficients for the panel.
| def touchpanel.TouchPanel.Calibrate | ( | self | ) |
This function walks the user through the steps to calibrate the touchpanel.
As the user is instructed to tap 5 points on the touchpanel, this fucntion stores the ADC data points associated with points that were touched. These data points will be used in Beta(), which will calculate the calibration coefficients based on the positions and ADC data.
| def touchpanel.TouchPanel.Filter | ( | self, | |
| ADC_Data | |||
| ) |
An alpha-beta filter for removing "noise" from the ADC position measurements.
This function uses predictions to filter values from the touchpanel, making the data more cohesive.
| ADC_Data | is an input to this fucntion: a tuple containing xpos, ypos (ADC units), and contact (boolean). |
| def touchpanel.TouchPanel.Read_Panel | ( | self, | |
| Beta | |||
| ) |
This fucntion is a combination of the scan, filter, and calibration fucntions defined earlier.
This will scan the x, y, and z components of the touch panel, and filter the data. The filtered data will then be scaled with the calibration coefficients from the Beta matrix.
| Beta | is the matrix containing the 6 numbers used to calibrate the touch panel and convert the ADC units to units of mm. |
| def touchpanel.TouchPanel.Scan | ( | self | ) |
Scans the touch panel for the total position of the ball.
This function sets up the touch panel pins to be able to read the position of the ball in the x-direction, y-direction, and z-direction (contact).
| def touchpanel.TouchPanel.xScan | ( | self | ) |
Scans the touch panel for the x-position of the ball.
This function sets up the touch panel pins to be able to read the position of the ball in the x-direction.
| def touchpanel.TouchPanel.yScan | ( | self | ) |
Scans the touch panel for the y-position of the ball.
This function sets up the touch panel pins to be able to read the position of the ball in the y-direction.
| def touchpanel.TouchPanel.zScan | ( | self | ) |
Scans the touch panel to see if the ball is making contact.
This function sets up the touch panel pins to be able to read read if something is contacting the panel.