adding some tests for measurement

This commit is contained in:
Adam Mayer 2017-12-15 10:49:53 -05:00
parent 5dbfe37f24
commit b0b0d42f8c
2 changed files with 69 additions and 0 deletions

33
test_scripts/ellipse_test.py Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/python3
import apple410
import random
import math
# 2394 x 1700
w=2394
h=1700
import sys
ring1 = 1
ring2 = 4
if len(sys.argv) > 2:
ring1 = int(sys.argv[1])
ring2 = int(sys.argv[2])
a = apple410.Apple410('/dev/ttyUSB0')
a.send("VP0,0,{},{}".format(w,h))
for i in range(ring1, ring2+1):
a.send("PS{}".format(i))
for x in range(2):
vw = 5 + (random.random() * 100)
vh = 5 + (random.random() * 100)
cx = vw/2
cy = vh/2
r = (min(vw,vh)-1)/2
a.send("WD0,0,{},{}".format(math.floor(vw),math.floor(vh)))
a.send("CA{:.2f},{:.2f},{:.2f}".format(r,cx,cy))
a.send("CH")
a.send("RS")

36
test_scripts/ruler.py Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/python3
import apple410
import random
import math
import sys
ring1 = 1
ring2 = 4
def label(point):
(x,y) = point
a.send("MA{},{}".format(x-100,y-40))
a.send("PL({},{})".format(x,y))
def line(f,t):
a.send("MA{},{}".format(f[0],f[1]))
a.send("DA{},{}".format(t[0],t[1]))
a = apple410.Apple410('/dev/ttyUSB0')
a.send("CH")
a.send("RS")
a.send("VP0,0,1500,1500")
a.send("WD0,0,1200,1200")
a.send("LS30")
ps = [(100,100),(1100,100),(1100,1100),(100,1100)]
for p in ps:
label(p)
for i in range(4):
line(ps[i],ps[(i+1)%4])
a.send("CH")
a.send("RS")