From 93dfdc84858373fcd1bfbc07c17611e299cc2ac7 Mon Sep 17 00:00:00 2001 From: "alexandre.letourneux" Date: Tue, 26 Nov 2024 09:38:47 +0100 Subject: [PATCH] Pixel matrix functionnality added --- image_drawer.py | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/image_drawer.py b/image_drawer.py index 320ec5e..9fbe787 100644 --- a/image_drawer.py +++ b/image_drawer.py @@ -1,35 +1,39 @@ import matplotlib.pyplot as plt -import sys import dobot import time -import math DRAW_MODE = 1 -SPEED = 1 -SIZE = 30 -INIT_POSITION = [200, -50] +DRAW_SPEED = 1 +DRAW_SIZE = 40 +DRAW_DEPTH = -69 +DRAW_RES = 2 + +INIT_POSITION = [240, -10] dobot.setQueuedCmdClear() dobot.setQueuedCmdStartExec() -dobot.setPTPJumpParams(10, 50, 1) -for x in range(INIT_POSITION[0], INIT_POSITION[0]+SIZE, 1): - for y in range(INIT_POSITION[1], INIT_POSITION[1]+SIZE, 1): - dobot.setPTPCmd(0, x, y, -68, 1, 1) - print(x, y) +dobot.setPTPJumpParams(5, 3, 1) -for i in range(10): - dobot.setCPCmd(1, 200, 0, -68, 1, 1) - dobot.setCPCmd(1, 200, -50, -68, 1, 1) - dobot.setCPCmd(1, 250, -50, -68, 1, 1) - dobot.setCPCmd(1, 250, 0, -68, 1, 1) +matrix = [] +for x in range(INIT_POSITION[0], INIT_POSITION[0]+DRAW_SIZE, DRAW_RES): + for y in range(INIT_POSITION[1], INIT_POSITION[1]+DRAW_SIZE, DRAW_RES): + matrix.append((x,y)) + +for point in matrix: + dobot.setPTPCmd(1, point[0], point[1], DRAW_DEPTH+5, 0, 1) + dobot.setPTPCmd(1, point[0], point[1], DRAW_DEPTH, 0, 1) + dobot.setPTPCmd(1, point[0], point[1], DRAW_DEPTH+5, 0, 1) + + dobot.setWaitCmd(3) + time.sleep(0.8) def pixel_draw(resolution): pass def vector_draw(array): for vector in array: - dobot.setCPCmd(DRAW_MODE, array.x, array.y, array.z, SPEED, 1) + dobot.setCPCmd(DRAW_MODE, array.x, array.y, array.z, DRAW_SPEED, 1) # Stop the current execution if input("Appuyez sur Entrer pour arrĂȘter.") == "":