RoboDK Forum
Sort Boxes by Color可打印版本

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: Sort Boxes by Color (/Thread-Sort-Boxes-by-Color)



Sort Boxes by Color-SmarterStudent-07-04-2020

Dear RoboDK Support and Community,

i just started to use your software for college.

I already have done the tutorials for pick and place of boxes from a table to a pallet.
Now i would like to sort my boxes (white and blue) to 2 pallets. On one pallet all white on the other all blue boxes.
Is there any sensor/camera i can use to detect the actual color to get my target position?
Is that possible? Can you suggest me any step-by-step solution? Maybe another tutorial?

Best wishes
"maybe not so smart student"


再保险:年代ort Boxes by Color-Albert-07-06-2020

Yes, you can retrieve the color of an object or a tool using the Color command:
//www.sinclairbody.com/doc/en/PythonAPI/robolink.html#robolink.Item.Color

In Python, assuming you have your tool item it would be something like this:

Code:
# Get all the items attached to a tool
picked_objects = tool.Childs()

# Iterate through all objects
for object in picked_objects:
rgba_color = object.Color()
print("Color: " + str(rgba_color))
RDK.RunProgram("Program2")
break

This question is related to the API so I'm moving it to the RoboDK API section.