ME 405 TERM PROJECT
Functions | Variables
main.py File Reference

Main file for polar plotter project. More...

Functions

def main.onButtonpress (IRQ_src)
 
def main.g (x, theta, r)
 
def main.dg_dtheta (theta, r)
 
def main.NewtonRaphson (fcn, jacobian, guess, thresh)
 
def main.iterate (fcn, x, theta, r, thresh)
 
def main.parse (file)
 
def main.extract (insts)
 
def main.draw (instVal)
 

Variables

int main.state = 0
 
 main.PC4 = Pin(Pin.cpu.C4, mode=Pin.OUT_PP, value=0)
 
 main.PB4 = Pin(Pin.cpu.B4, mode=Pin.OUT_PP, value=0)
 
 main.PB5 = Pin(Pin.cpu.B5, mode=Pin.OUT_PP, value=0)
 
 main.drv1 = TMC4210drv(2, SPI.SLAVE, 1_000_000, 1, 1, None, Pin(Pin.cpu.C3, mode=Pin.OUT_PP, value =1), 4, 1, Pin(Pin.cpu.B6, mode = Pin.OUT_PP), Pin(Pin.cpu.C2, mode=Pin.OUT_PP, value =1))
 
 main.drv2 = TMC4210drv(2, SPI.SLAVE, 1_000_000, 1, 1, None, Pin(Pin.cpu.B0, mode=Pin.OUT_PP, value =1), 4, 1, Pin(Pin.cpu.B7, mode = Pin.OUT_PP), Pin(Pin.cpu.C0, mode=Pin.OUT_PP, value =1))
 
 main.uC = SPI(2)
 
 main.MASTER
 
 main.baudrate
 
 main.phase
 
 main.polarity
 
 main.crc
 
 main.uart2 = UART(2)
 
 main.bits
 
 main.parity
 
 main.None
 
 main.stop
 
 main.theta_guess = np.array([5,6])
 
int main.thresh = 1e-6
 
float main.r = 0.24
 
float main.inrad = r/(pi*2)
 
list main.shapes = []
 
string main.file = "susamongus.hpgl"
 
int main.dpi = 240
 
 main.drawingDone = task_share.Share ('i', thread_protect = False, name = "drawingDone")
 
 main.button_int = ExtInt(Pin.cpu.C13, ExtInt.IRQ_FALLING, Pin.PULL_NONE, None)
 
 main.buttonFlag = task_share.Share ('i', thread_protect = False, name = "buttonFlag")
 
 main.drawTask
 
 main.xcoordData
 
 main.ycoordData
 

Detailed Description

Main file for polar plotter project.


Function Documentation

◆ dg_dtheta()

def main.dg_dtheta (   theta,
  r 
)
@breif Calculates the jacobian

◆ draw()

def main.draw (   instVal)
@breif Uses the extracted xy coordinates to calculate motor thetas. Then sends
       motor thetas to respective stepper. Also interprets pen instructions to 
       actuate DC motor.

◆ extract()

def main.extract (   insts)
@breif Splits extracted instructions by commas to generate xy coordinates
@param insts Instructions extracted from parsed file

◆ g()

def main.g (   x,
  theta,
  r 
)
@breif Calculates motor thetas from xy coordinate inputs

◆ iterate()

def main.iterate (   fcn,
  x,
  theta,
  r,
  thresh 
)
@breif Used to iteratively call NewtoRaphson method to find motor thetas

◆ NewtonRaphson()

def main.NewtonRaphson (   fcn,
  jacobian,
  guess,
  thresh 
)
@breif Calculates the new thetas approximated by NewtonRaphson method

◆ onButtonpress()

def main.onButtonpress (   IRQ_src)
@breif Button flag used to start the drawing task

◆ parse()

def main.parse (   file)
@breif Opens the hpgl file defined and extracts pen up/down instructions
       and xy coordinates of each point
@param file The hpgl file to be prsed

Variable Documentation

◆ drawTask

def main.drawTask ( )
Initial value:
1= cotask.Task(drawTask, name = 'Task_2', priority = 1,
2 period = 50, profile = True, trace = False)
Implements multitasking with scheduling and some performance logging.
Definition: cotask.py:36
@breif Calls the draw function and sets flag to represent when drawing is finished

◆ xcoordData

main.xcoordData
Initial value:
1= task_share.Queue ('f', 300, thread_protect = True, overwrite = False,
2 name = "xcoordData")
A queue which is used to transfer data from one task to another.
Definition: task_share.py:80

◆ ycoordData

main.ycoordData
Initial value:
1= task_share.Queue ('f', 300, thread_protect = True, overwrite = False,
2 name = "ycoordData")