Script execution

This commit is contained in:
gac-S_Changer
2017-07-10 13:23:37 +02:00
parent 69a4c6e686
commit 9f20b9535d

View File

@@ -1,6 +1,6 @@
from plotutils import *
def plot_base_plate(title = None)
def plot_base_plate(title = None):
colors = (Color.RED, Color.BLUE, Color.MAGENTA, Color(128,0,128), Color(0,128,0), Color(255,128,0))
p = plot(None, title=title)[0]
plot_point(p, 0, 0, size = 10, color = Color.GRAY, name = "Center")
@@ -27,9 +27,29 @@ def plot_base_plate(title = None)
p.addText((xu+xm)/2, (yu+ym)/2, str(puck.number), r.color)
plot_circle(p, xm, ym, PUCK_SIZE/2, width = 0, color = Color.GRAY, name = str(puck.number))
def plot_cross(plot, x, y, size = 3, width = 1, color = None, name = "Cross"):
s = LinePlotSeries(name, color)
plot.addSeries(s)
s.setLineWidth(width)
s.setPointsVisible(False)
s.appendData(x-size/2, y)
s.appendData(x+size/2, y)
s.appendData(float('nan'), float('nan'))
s.appendData(x, y-size/2)
s.appendData(x, y+size/2)
return s
def plot_detected_leds(points):
for point in points:
plot_cross(p,point[0], point[1], size = 5, width = 1, color = Color.BLACK, name = "P"+ str(points().index(point)))
#plot_point(p, xu, yu, size = 8, color = Color.BLACK, name = str(puck.number)+"u")
plot_base_plate()
points = [(100, 140), (120, 77), (120, 130), (110, 100))]
plot_detected_leds(points)