Matthew's Portfolio
All Classes Files Functions Variables Pages
touchPanelDriver.touchPanelDriver Class Reference

Position finder for the ball. More...

Public Member Functions

def __init__ (self, debugFlag=True, xm=Pin.cpu.A1, xp=Pin.cpu.A7, ym=Pin.cpu.A0, yp=Pin.cpu.A6, boardLength=const(176), boardWidth=const(107), centerXPos=const(88), centerYPos=const(53))
 Create an encoder object to find position and speeds. More...
 
def allPositions (self)
 Optimally return the position of the ball in 3 coordinates. More...
 
def getXPos (self)
 Get the X position of the ball. More...
 
def getYPos (self)
 Get the Y position of the ball. More...
 
def getZPos (self)
 Use the Z position to determine if the ball is touching. More...
 
def calibration (self)
 Calibrate the board for position. More...
 

Public Attributes

 debugFlag
 Debugging flag for detailed analysis while running.
 
 xm
 Pin object for the negative x direction circuit.
 
 xp
 Pin object for the positive x direction circuit.
 
 ym
 Pin object for the negative y direction circuit.
 
 yp
 Pin object for the positive y direction circuit.
 
 boardLength
 Length of the board (x direction) in mm.
 
 boardWidth
 Length of the board (y direction) in mm.
 
 centerXPos
 Center coordinate (x direction) in mm.
 
 centerYPos
 Center coordinate (y direction) in mm.
 
 xmPin
 definition of pyb.Pin object for xm (x minus)
 
 xpPin
 definition of pyb.Pin object for xp (x plus)
 
 ymPin
 definition of pyb.Pin object for ym (y minus)
 
 ypPin
 definition of pyb.Pin object for yp (y plus)
 
 ymADC
 Analog to digital converter for determining x and z positions.
 
 XPos
 x-position of the ball in millimeters
 
 xmADC
 Analog to digital converter for determining y position.
 
 YPos
 y-position of the ball in millimeters
 
 ZPos
 z-position of the ball More...
 

Detailed Description

Position finder for the ball.

This class will allow for the position and velocity of the ball to be calculated using the resisive touch pad.

Constructor & Destructor Documentation

◆ __init__()

def touchPanelDriver.touchPanelDriver.__init__ (   self,
  debugFlag = True,
  xm = Pin.cpu.A1,
  xp = Pin.cpu.A7,
  ym = Pin.cpu.A0,
  yp = Pin.cpu.A6,
  boardLength = const(176),
  boardWidth = const(107),
  centerXPos = const(88),
  centerYPos = const(53) 
)

Create an encoder object to find position and speeds.

This object will be called in order to find the current positions of the ball, or to calibrate the pad.

Parameters
debugFlagEnables or prevents certain print statements from appearing.
xmThe pin associated with the negative x terminal of the resistive pad.
xpThe pin associated with the positive x terminal of the resistive pad.
ymThe pin associated with the negative y terminal of the resistive pad.
ypThe pin associated with the positive y terminal of the resistive pad.
boardLengthThe length of the long side of the board in mm
boardWidthThe width of the short side of the board in mm
centerXPosThe horizontal distance from the edge of the board to the center, which should be about half the boardLength
centerYPosThe vertical distance from the edge of the board to the center, which should be about half the boardWidth

Member Function Documentation

◆ allPositions()

def touchPanelDriver.touchPanelDriver.allPositions (   self)

Optimally return the position of the ball in 3 coordinates.

This method gets the x and y positions of the ball as well as the the 'z' coordinate, which will tell whether the platform has something on it. The order is run by getting X, then Z, then Y in order to reduce the number of pin-switching. This should produce a fast enough response to accurately run the controller (under 500 microseconds).

◆ calibration()

def touchPanelDriver.touchPanelDriver.calibration (   self)

Calibrate the board for position.

This method allows the user to calibrate the board since the resistive touch panel is not perfect. The data will then be used to find the position of the ball for the rest of the driver. This method is utilized by the touchPanelCalibration_main.py file to run multiple tests and perform averaging to get better data.

◆ getXPos()

def touchPanelDriver.touchPanelDriver.getXPos (   self)

Get the X position of the ball.

This method gets the x position of the ball from reading the details given from the resistive touch panel.

◆ getYPos()

def touchPanelDriver.touchPanelDriver.getYPos (   self)

Get the Y position of the ball.

This method gets the y position of the ball from reading the details given from the resistive touch panel.

◆ getZPos()

def touchPanelDriver.touchPanelDriver.getZPos (   self)

Use the Z position to determine if the ball is touching.

This method gets the z position of the ball from reading the details given from the resistive touch panel. A "True" means the ball is on the platform.

Member Data Documentation

◆ ZPos

touchPanelDriver.touchPanelDriver.ZPos

z-position of the ball

True if the ball is on the platform, and False if the ball is not on the platform


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