From 9f20b9535d1ec1fefb76b3075424d0d87b5f8c4f Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Mon, 10 Jul 2017 13:23:37 +0200 Subject: [PATCH] Script execution --- script/test/TestLayout.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/script/test/TestLayout.py b/script/test/TestLayout.py index 8cf9c1e..2da2ebe 100644 --- a/script/test/TestLayout.py +++ b/script/test/TestLayout.py @@ -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) \ No newline at end of file