Home Programming

Discussion

Left ArrowBack to discussions page
MinchanMinchan Posts: 2 Recruit
Is there any command as script to return some values like checking whether the object is on the area or not?
We are using UR robots.

Best Answer

Comments

  • balpetterbalpetter Posts: 2 Recruit
    Is it possible to extract the location coordinates of the object and use it as a variable?
    I was wondering if the robot could continuously follow the object when it is moving.


  • Annick_MottardAnnick_Mottard Posts: 147 Handy
    @balpetter
    The detected part's position is stored in the "object_location" variable. You do not need to define it, the Vision server updates its value when a part is detected by a Camera Locate node in a program. "object_location" is a pose that contains the position and orientation of the object relative to the base reference frame. The part's z-axis actually points downwards. Note that this feature is not documented and not supported as of today. Its name and function might change in the future. 

    Annick Mottard
    Product Expert
    Robotiq
    [email protected] 
  • cbrissettecbrissette Posts: 8 Apprentice

    I am trying to pick 4 parts off of a conveyor. After the 1st part is picked the output turns on and the remaining 3 parts get run onto the floor. I need the cam locate to run until the conveyor is empty of parts then turn on the output. I was trying to do this with an if: statement but cannot find the camera output for no parts present. Any help would be appreciated.

  • Annick_MottardAnnick_Mottard Posts: 147 Handy
    Hi @cbrissette ,

    As of today, the Camera Locate node does not update any variable when it finds a part or not. I suggest you use your own variable (like a flag) inside the Camera Locate node that is set to True when the program enters the node, otherwise this variable should be False. You can then track if a part has been detected or no. If you know you have four parts, you can also verify with an incremented variable if the Camera found the part four times.

    Hope this helps!
    Annick Mottard
    Product Expert
    Robotiq
    [email protected] 
  • cbrissettecbrissette Posts: 8 Apprentice
    Thank you Annick_Mottard. Will you be able to direct me to some instruction on setting up the variables you are talking about.
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,267 Handy
    Thank you Annick_Mottard. Will you be able to direct me to some instruction on setting up the variables you are talking about.
    To set up the flag variable you're just going to use the assignment mode from the advanced tab. This will allow you to create a variable and call it found_part_flag or something. You will assign this as False before your locate node, then inside your locate node you will assign it True if you enter the node. That way the robot will know I have found a part. Then you can use the value of this to determine if you run the conveyor or not. You can go to the installation tab and create a variable there that you will use as the counter. This is so that the value is saved to memory between program starts and stops. You can use a set command to automatically increment installation variables. 

    Pseudo code would look something like this. 

    found_part_flag = False
    Camera Locate
       found_part_flag = True
       Increment number_of_times +1

    if found_part_flag == False or number_of_times > 3
      number_of_times = 0
      run the conveyor


    I'd also recommend just as a safeguard placing a sensor on the end of the conveyor that causes the conveyornto not be able to run if a part reaches the end. Are you running the conveyor in a thread or in the main program?
  • cbrissettecbrissette Posts: 8 Apprentice
    Currently I am using an output in from the UR to index the conveyor based on time.  The conveyor will have parts and runners, so a sensor for detection may not be an option. I will try and set up my flag this morning and post my progress shortly. Thank you.
  • cbrissettecbrissette Posts: 8 Apprentice
    Thank you Matthewd92. With your help I was able to accomplish what I set out to do, and it was a lot easier than I had anticipated.
  • Ruben_SpeybrouckRuben_Speybrouck Posts: 18 Apprentice
    I know this is an old post, but I have a similar question: can you run cam locate from script? 

    I want to read a QR code on a table. This QR code contains the part number of the part I want to find. Then I want to pass that part as an argument/parameter/variable for the cam locate function. How could I do this? 

    I have 100's of parts and hypothetically many different parts on the same table at the same time. So I need to be able to do something like this: 

    PARTNUMBER  =part_01

    cam_locate(PARTNUMBER):
    - move to (X,Y,Z)
    - gripper(close)
    - move to (X,Y,Z)

Sign In or Register to comment.
Left ArrowBack to discussions page