Home Programming


Left ArrowBack to discussions page
Catherine_BernierCatherine_Bernier Posts: 144 Handy
edited September 2016 in Programming
Did you know that our grippers have an object detection feature built in? For some, this feature might sound useless but in some applications, this feature will simplify a lot the programming and even save your robotic cell from serious damages.

In this video, you see that the robot is looking for a part before completing its program. As soon as an object is picked up, a pop-up ask the operator  that the part was detected and ask to continue. The pop-up was used in this case but upon detection, any action can be performed.

Here is the program used:
<code><b>Robot Program</b>
 Gripper Open
  Gripper Close
 Loop detected≟0
  if rq_is_object_detected()
     Gripper Open
     Gripper Close
    Gripper Open
Script Functions
First, you can load the file gripper_tutorial.urp included in the gripper URcaps which contains all the Script Functions available to control the gripper. However, you can start with an empty program if you recall the name of the functions that you also find Here. For the object detection, you need to use the line rq_is_object_detected(). You can either call it as a script or include it in an if statement as I did in this example. By using the line in an if statement, you are now able to perform an action if the gripper grabbed a part and another if it didn't.

In this case, the gripper keeps reaching to grab the part until it actually does. When it happens a popup is generated saying: "Object detected, continue?" Then, by pressing "Ok", the robot continues the program.

This can help to send a notification or to stop the program if no part are detected.

Any application you can see for this feature?

See here, How to configure pop-ups with Universal Robot Polyscope.

Catherine Bernier, Jr. Eng. 


  • Catherine_BernierCatherine_Bernier Posts: 144 Handy
    Object detection can also be done with our camera as an inspection task. See this Discussion Here!

    Catherine Bernier, Jr. Eng. 
  • Samuel_BouchardSamuel_Bouchard Posts: 150 Handy
    @MDeBlois do you want to share your recent story to explain how checking for a part presence in the gripper can be useful in machine tending?

  • Ryan_WeaverRyan_Weaver Founding Pro, Partner, Beta Tester VIsion 1.1 Program, Wrist Camera URCap 1.3.0 Posts: 50 Handy
    @Catherine_Bernier  - do you first need to load rq_script.script in order to have access to these variables within the program?  Or do you simply need to call them by their syntax and they will work?  

    Ryan Weaver   |   Automation Engineer   |   Axis New England
    [email protected]xisne.com

  • Catherine_BernierCatherine_Bernier Posts: 144 Handy
    edited August 2016
    @Ryan_Weaver This file is needed if you use the previous version without the URcaps. Now, you simply need to call them with the right syntax when you use the URcaps version.

    My link is now updated in the post. ;)Here

    Catherine Bernier, Jr. Eng. 
  • MDeBloisMDeBlois Posts: 2 Recruit
    Object detection is very useful.
    It's quit simple to add in your program. It's secure your process and surly can save you money and time ! 
    We did experience a little incident before using the object detection...
    It is now active !


  • SebastienSebastien Posts: 219 Handy
    Hi Pros,
    here is my sample program and video showing object detection!! Really nice feature! Specially because it can be done at any positions without any hardware modifications like read switch!!!

  • C_ROEHLC_ROEHL Beta Tester Beetle Posts: 3 Apprentice
    Ok Pros,

    I have a question for you guys,

    How do I get my UR5 robot to continue my pallet sequence on to the next location after a part was not located in the first position in my pallet sequence?

    example = part has fallen over or was not placed there by an operator in an array order tray...

    I want the robot to move to the next location in the pallet sequence to grab the next part in the sequence and verify the grab by part present...

    I know there is a Variable --> Var.=0 - 4  that I can pick up on the location of where the robot is in the pallet sequence. But not sure How or what to write to continue the operation.

    say I have 4 parts I'm picking from in a pattern. How do I continue the program of picking the part if say part #2 in the sequence is not there? and have it continue to part #3 and so on..

    Much thanks, Hope I haven't created any confusion
  • abeachy_HG24abeachy_HG24 Posts: 79 Handy
    @C_ROEHl I have found a way that has been very successful for me. I create a variable called i_correct_part, I will then place inside of the loop the pallet wizard. The loop will continue to execute as long as the i_correct_part variable does not equal 1. Whenever the robot finds the part I set that variable equal to 1 and the robot goes on to the next step in the process. If the robot does not find a part it will continue on to your next location in the sequence.
    Here is an example of one of my pallet wizards.

    Robot Program
         51100 Nest(folder)
           Loop i_correct_part≠1
               Pattern: List
                 Gripper Move65% (1)
                 Gripper Close (1)
                 If RQ_pos≥193 and RQ_pos≤195
                   Correct part
                 ElseIf RQ_pos≥228 and RQ_pos≤230
                   Missing part
                     Gripper Move65% (1)
                     51100 Status
                       Set i_no_or_bad_par=i_no_or_bad_par+1
                       Set C_M_part_51100=C_M_part_51100+1
                       If i_no_or_bad_par≥2
                   Wrong part
                       51100 Status
                         Set i_no_or_bad_par=i_no_or_bad_par+1
                         Set C_W_part_51100=C_W_part_51100+1
                         If i_no_or_bad_par≥2
    In this pallet wizard I used the list feature of the pallet wizard. In order for the robot to exit the loop the if statement must be met and then the variable is assigned 1 and the loop is complete. The else-if and the else are for missing and wrong parts. If it finds a wrong part or the part is incorrect, it will try twice before alerting the operator with a popup.

    It is important to note that before you enter this loop to always be sure the variable you are using gets assigned a value other than 1. If it doesn't the loop will never execute.

    I hope this helps!
Sign In or Register to comment.
Left ArrowBack to discussions page