DoF - a Robotiq Community
Warning sign
The Dof Community was shut down in June 2023. This is a read-only archive.
If you have questions about Robotiq products please reach our support team.
David_Gariepy

Hi @Nerials

To do this kind of logic, you could simply use a variable for each part and update it in the camera locate node.
In the first example here, the robot will continue searching until it finds the needed part. 

 Program
   BeforeStart
     'initialize variable'
     part_1_detected≔ False 
     part_2_detected≔ False 
     part_3_detected≔ False 
   Robot Program
     MoveJ
       Home
     If part_1_detected≟ False 
       MoveJ
         snapshot1
         Camera Locate
           part_1_detected≔ True 
           'put in assembly station'
     If (part_1_detected≟ True ) and part_2_detected≟ False 
       MoveJ
         snapshot2
       Camera Locate
         part_2_detected≔ True 
         'put in assembly station'
     If (part_1_detected≟ True ) and (part_2_detected≟ True ) and (part_3_detected≟ False )
       MoveJ
         snapshot3
       Camera Locate
         part_3_detected≔ True 
         'put in assembly station'
     If (part_1_detected≟ True ) and (part_2_detected≟ True ) and (part_3_detected≟ True )
       'Do something when assembly is done then reset variable'
       part_1_detected≔ False 
       part_2_detected≔ False 
       part_3_detected≔ False 


In the second example here, the robot could execute your extraordinary code if a part isn't found.

Program
   BeforeStart
     'initialize variable'
     part_1_detected≔ False 
     part_2_detected≔ False 
     part_3_detected≔ False 
   Robot Program
     MoveJ
       Home
     If part_1_detected≟ False 
       MoveJ
         snapshot1
         Camera Locate
           part_1_detected≔ True 
           'put in assembly station'
     If part_1_detected≟ False 
       'part 1 was not detected. execute your extraordinary code here'
     If (part_1_detected≟ True ) and part_2_detected≟ False 
       MoveJ
         snapshot2
       Camera Locate
         part_2_detected≔ True 
         'put in assembly station'
     If (part_1_detected ≟ True ) and (part_2_detected≟ False )
       'part 2 was not detected. execute your extraordinary code here'
     If (part_1_detected≟ True ) and (part_2_detected≟ True ) and (part_3_detected≟ False )
       MoveJ
         snapshot3
       Camera Locate
         part_3_detected≔ True 
         'put in assembly station'
     If (part_1_detected ≟ True ) and (part_2_detected≟ True ) and (part_3_detected≟ False )
       'part 3 was not detected. execute your extraordinary code here'
     If (part_1_detected≟ True ) and (part_2_detected≟ True ) and (part_3_detected≟ True )
       'Do something when assembly is done then reset variable'
       part_1_detected≔ False 
       part_2_detected≔ False 
       part_3_detected≔ False 



You'll find the 2 programs example attached if needed.
Regards

Nerials

 Hi @David_Gariepy

Thank you for you input with the code example it was really helpfull ! :)

But now I bumped into some other issue: I used example No. 1 of your template for my script and when I wrote all comands it worked smoothly. But when I SAVED it, it got all messed up. (P.S. Actually I have 4 parts in assembly and two of them are the same Part2 and Part3) . So when I saved my script and run it again the reference frame for Camera Locate node became something totaly different... So when camera detects an object robot dosn't go to pick it up as taught but goes into weird directions nothing like I tought him. 
Somehow  I managed to get back to initial reference frames (in camera locate node) for Part1 detection and Part2 dectetion by changing Features for Move to some other and then back to what is should be. Never the less it did not helped me to do the same for Part3 even thou it is totaly same part in a same location as Part2 and I even copied Move node with waypoints from Part2 to Part3. So now all the waypoints, features, TCP and settings are identical in Part2 and Part3 but when the time comes to pick up Part3 camera detects part and then robot goes nuts direction...
Any tips how to solve this?