I am programming a pretty simple application. Depalletizing parts and placing on a conveyor. If the camera does not detect a part, I want the program to jump to the next position in the palletizing routine. I know I need to use an if statement, but am struggling to figure out what commands to use.
Probably lots of ways to do this, and some depends on how the camera outputs data. If the camera just outputs a found/failed value, then use that to set a variable such as camera_fail to True or False.
Or, the camera might give you a confidence value in, say percentage, so you set a threshold value of say 70% for found part, and set the camera_fail variable that way.
At that point, you can program it something like this:
if camera_fail == False:
palletize
etc
etc
etc . . . . everything you want it to do with the found part
else:
. . . . everything you want it to do if it didn’t find a part
end program