Pixel matrix functionnality added

This commit is contained in:
Alexandre LETOURNEUX 2024-11-26 09:38:47 +01:00
parent 361437f1af
commit 93dfdc8485
1 changed files with 20 additions and 16 deletions

View File

@ -1,35 +1,39 @@
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import sys
import dobot import dobot
import time import time
import math
DRAW_MODE = 1 DRAW_MODE = 1
SPEED = 1 DRAW_SPEED = 1
SIZE = 30 DRAW_SIZE = 40
INIT_POSITION = [200, -50] DRAW_DEPTH = -69
DRAW_RES = 2
INIT_POSITION = [240, -10]
dobot.setQueuedCmdClear() dobot.setQueuedCmdClear()
dobot.setQueuedCmdStartExec() dobot.setQueuedCmdStartExec()
dobot.setPTPJumpParams(10, 50, 1) dobot.setPTPJumpParams(5, 3, 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)
for i in range(10): matrix = []
dobot.setCPCmd(1, 200, 0, -68, 1, 1) for x in range(INIT_POSITION[0], INIT_POSITION[0]+DRAW_SIZE, DRAW_RES):
dobot.setCPCmd(1, 200, -50, -68, 1, 1) for y in range(INIT_POSITION[1], INIT_POSITION[1]+DRAW_SIZE, DRAW_RES):
dobot.setCPCmd(1, 250, -50, -68, 1, 1) matrix.append((x,y))
dobot.setCPCmd(1, 250, 0, -68, 1, 1)
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): def pixel_draw(resolution):
pass pass
def vector_draw(array): def vector_draw(array):
for vector in 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 # Stop the current execution
if input("Appuyez sur Entrer pour arrêter.") == "": if input("Appuyez sur Entrer pour arrêter.") == "":