Tọa độ Robo
Tọa độ Robo
000000 ]
Tọa độ box: [ 70.000000, -176.832000, 50.000000, 0.000000, 0.000000, 0.000000 ]
Tọa độ băng tải vật: [ -400.000000, -430.000000, 0.000000, 0.000000, 0.000000, -
90.000000 ]
Tọa độ băng tải box: [ 1190.000000, -310.000000, 0.000000, 0.000000, 0.000000,
0.000000 ]
Tọa độ cánh tay robot: [ 672.947510, 7.719360, 0.000000, 0.000000, 0.000000,
0.000000 ]
Tọa độ bàn: [ 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000 ]
# Move objects that reached the end of the conveyor and were not picked:
FALLEN_OBJECTS = [0,0,-500]
# One second in real life means 1 second of simulation. The simulation speed is taken from the station
SIMULATION_SPEED = 1
def is_inside_conveyor(pose):
"""Checks if a pose is inside the conveyor workspace"""
pos = pose.Pos()
if pos[0] > CONV_SZ_X_MIN and pos[0] < CONV_SZ_X_MAX and pos[1] >
CONV_SZ_Y_MIN and pos[1] < CONV_SZ_Y_MAX and pos[2] > CONV_SZ_Z_MIN and pos[2]
< CONV_SZ_Z_MAX:
return True
return False
# Check if the object has already been taken by a tool. If so, do not take it in the conveyor
if obj_i.Parent().Type() == ITEM_TYPE_TOOL:
continue
# Take a break...
pause(REFRESH_RATE)
if current_time>5:
objects[0].Copy()
newObject =RDK.Paste()
nameXXX='Part '+str(len(objects)+1)
newObject.setName(nameXXX)
newObject.setPose(poseiXXX)
break
CODE BOX:
# Type help("robolink") or help("robodk") for more information
# Press F5 to run the script
# Note: you do not need to keep a copy of this file, your python script is saved with the station
from robolink import * # API to communicate with RoboDK
from robodk import * # basic matrix operations
RDK = Robolink()
# Move objects that reached the end of the conveyor and were not picked:
FALLEN_OBJECTS = [0, 0, -500]
# One second in real life means 1 second of simulation. The simulation speed is taken from the station
SIMULATION_SPEED = 1
def is_inside_conveyor(pose):
"""Checks if a pose is inside the conveyor workspace"""
pos = pose.Pos()
return (CONV_SZ_X_MIN < pos[0] < CONV_SZ_X_MAX and
CONV_SZ_Y_MIN < pos[1] < CONV_SZ_Y_MAX and
CONV_SZ_Z_MIN < pos[2] < CONV_SZ_Z_MAX)
for i in range(len(all_objects)):
for keyword in PICKABLE_OBJECTS_KEYWORD:
if keyword in all_objects[i]:
objects.append(RDK.Item(all_objects[i]))
objects_name.append(all_objects[i])
objects_active.append(False)
break # Break after finding the first match
while True:
# First: Look for objects that are not in the conveyor but are in the conveyor workspace
for i in range(nobjects):
obj_i = objects[i]
# Check if the object has already been taken by a tool. If so, do not take it in the conveyor
if obj_i.Parent().Type() == ITEM_TYPE_TOOL:
continue
obj_items.append(obj_i)
obj_poses_abs.append(poseconv * newposei)
# Take a break...
pause(REFRESH_RATE)
CODE XÓA:
from robodk import robolink
# Tạo danh sách tên đối tượng "Part" từ "Part 2" đến "Part 100"
part_names = [f'Part {i}' for i in range(11, 100)]
# Tạo danh sách tên đối tượng "Box" từ "Box 2" đến "Box 100"
box_names = [f'Box {i}' for i in range(2, 100)]