I need help with this part of a program. i need to have the cobot go to the start of the program if the part fails. right now if a part fails it rejects and then goes to the next line and continues through the rest of the inspection.
conveyor
MoveJ
Set Laser_Bit_0=Off
Set Laser_Bit_2=Off
Set RH_Trigger=Off
Set LH_Trigger=Off
Above_Conveyor
Waypoint_5
Wait: 0.4
Set LH_Trigger=On
Set RH_Trigger=On
Wait: 1.0
If LH_Laser_Bad or RH_Laser_Bad≟ True
Bef_Above_Bad
Above_Bad_Part
Drop_Bad_Part
Set Vac_1_on=Off
Set Vac_2_On=Off
Above_Bad_Part
Aft_Badpart
Waypoint_1
Set RH_Trigger=Off
Set LH_Trigger=Off
Set Laser_Bit_0=On
Wait: 0.3
Waypoint_6
Wait: 0.6
Set LH_Trigger=On
Set RH_Trigger=On
Wait: 1.0
If LH_Laser_Bad or RH_Laser_Bad≟ True
Bef_Above_Bad
Above_Bad_Part
Drop_Bad_Part
Set Vac_1_on=Off
Set Vac_2_On=Off
Above_Bad_Part
Aft_Badpart
Waypoint_1
MoveL
Drop_Off
Wait: 0.2
Set Vac_1_on=Off
Set Vac_2_On=Off
Wait: 0.2
Above_Conveyor
I have found success using a basic Switch/Case structure, and segmenting the entire process up into “Steps.” Divide your program into smaller pieces and contain each piece into a single Step. Something like this:
I know the “if false” is unrealistic, I was just too lazy to name a variable. Use Assignment nodes to write the value of the Switch variable to control the program flow. So at the end of Case 1, I should put “var1 = 2” and from Case 2 I should put Var1 = 3. Case 3 should have an If statement that sets it to 4 (good part, carry on with the rest of the program) or (in my example) 11 to signify the 1st step of a part reject sequence. After the rejection sequence, I set Var1 = 1 to restart.