Home General

Discussion

Left ArrowBack to discussions page
David_GariepyDavid_Gariepy Beta Tester Beetle, Wrist Camera URCap 1.3.0, Vacuum Beta tester Posts: 190 Handy
edited February 2020 in General

Hello everyone, 

The following describes the procedure If you are looking to remotely control a Robotiq Gripper through port 30002 on universal robot. 

Native UR command like moveL or servoJ can be sent directly to port 30002.  All functions implemented by a URCap like the Robotiq Gripper function are unknown even if the URCap is installed.  When a program is written on the teach pendant, all URCap function definitions are implemented in this program each time it is compiled and executed by the UR controller.  This means if you try to send the command line rq_move_and_wait(58) function to the controller by the port 30002, it will never work because it's unknown to the controller.  To achieve a gripper function, the definition of this function must also be sent.  

In the compressed file included below, you’ll find a file named gripper.script. The file contains the definition of all the available Robotiq gripper functions. At the bottom of the file, you’ll see a list of all the functions ready to be used. If the file is sent as is to the controller, the connected gripper will open and close based on lines 2364 and 2366, assuming the gripper is already activated. 


Simply insert an “#” sign in front of the function you want to be ignored and remove the “#” sign in front of the functions you want to be executed. 


The file can then be sent to the controller and be executed. To do so, we’ll use python program which can be downloaded here. In the compressed file, you’ll also find a small python program called socket UR send file.py used to send the gripper.script file to the UR controller through port 30002. You’ll need to change the IP address of the robot in the socket UR send file.py to match your robot IP address.


Be sure to have both the socket UR send file.py and gripper.script file in the same folder and execute socket UR send file.py. The action(s) enabled in the gripper.script file will then be executed. 

Enjoy!

David Gariépy
Integration Coach

Comments

  • David_GariepyDavid_Gariepy Beta Tester Beetle, Wrist Camera URCap 1.3.0, Vacuum Beta tester Posts: 190 Handy
    You could also generate your own script file if needed, for example you would like to use a new function added to a future release of the URCap. You could create a simple .urp program that contains only the script function you want to execute and saved it to a flash drive. You’ll then find a .urp version of your program, a .txt version, and a .script version.  You can then use the .script version of that program and sent it to the robot controller.
    David Gariépy
    Integration Coach
  • KarthikKarthik Posts: 5 Apprentice
    Hi,

    Thanks for the explanation!

    I am working on ROS to control the UR and gripper. I tried your method through ROS as well as tried it as a standalone, the way you explained. The python script executes but the gripper doesn't open and close as the script file says. I activated the gripper before sending the script file. May I know if there is workaround or am I missing something?


  • David_GariepyDavid_Gariepy Beta Tester Beetle, Wrist Camera URCap 1.3.0, Vacuum Beta tester Posts: 190 Handy
    Hi @Karthik

    Did you verify that the robot is accessible on the network? Try to ping the IP address to be sure you can communicate with the robot.  
    Also be sure that if you are on e-series, the remote mode is enabled, otherwise, it won't allow the script to be executed on the robot. 

    Best regards
    David Gariépy
    Integration Coach
  • KarthikKarthik Posts: 5 Apprentice
    The remote mode was disabled. It works!
    But since I am controlling through ROS, disabling the local mode will not connect the UR and the PC.

    This is a good method, but not suitable for my application. Thanks a lot for your support!

    Do you happen to know how to send this whole gripper script through a secondary program?
    Can I do it as below.

    sec secondaryProgram():
         def Gripper():
         .
         .
         .
         .
        end
    end

    I will give this a try. will this work?


  • Lukas97Lukas97 Posts: 4 Apprentice
    Hi @David_Gariepy,

    can I use this script to controll the gripper at the same time as using the ur_robot_driver, which controlls the arm?

    If I try it my way with the headless mode of the ur_robot_driver package, my ur_robot_driver loses connection.

    Thanks!
  • David_GariepyDavid_Gariepy Beta Tester Beetle, Wrist Camera URCap 1.3.0, Vacuum Beta tester Posts: 190 Handy
    edited June 2020
    Hi @Lukas97

    Sorry, I have no idea. I haven't have the chance to play with it yet.

    Regards

    David Gariépy
    Integration Coach
  • MaeliseCMaeliseC Unconfirmed Posts: 1 Recruit

    I'm currently working on a UR5e with a robotiq gripper and I am using the python library urx to control the UR5e but I can't manage to control the gripper (even if it is supposed to be possible). Do you have any idea of why it doesn't work ?
    (in this python library, the following is written :
    """The gripper is controlled by connecting to the robot's computer (TCP/IP) and
    then communicating with the gripper via a socket (127.0.0.1:63352).  The scope
    of the socket is at the program level."""
    But I don't know how to check if it's true or not because it could eventually be problem if it isn't)


    Thanks for opening up the discussion !

    Best regards

  • BobLaBobLa Posts: 4 Apprentice
    Hey @David_Gariepy ,

    I am currently testing with your .script file and it is wonderful. But I am wonder can you explain or help me understand how to use the rq_is_object_detected() function. The reason is that I am trying to find a way to detect is there an object or not on the gripper via Python code. I can see that in the .script file this function will return a value but I do not know how to access the returned value.
    And also may I ask what language is the .script file ? or maybe where did you learn to do use that to access to the gripper ? as I have tried to look for it for weeks now but no results return :<

    Thank you!
    Bob
  • bcastetsbcastets Vacuum Beta tester Posts: 674 Expert
    rq_is_object_detected() return True or False.
    The .script file is Universal Robot programming code.

    I am not sure you can retreive the resultat of rq_is_object_detected() via the client interface.

    Maybe you can send a script via client interface which send the result of rq_is_object_detected() via a socket ?
    You could also make a script which save the result of rq_is_object_detected() in robot modbus register and then access robot modbus register via python.
  • Ruben_SpeybrouckRuben_Speybrouck Posts: 18 Apprentice
    @David_Gariepy Thank you soooo much for this. It works like a charm. 
  • Ruben_SpeybrouckRuben_Speybrouck Posts: 18 Apprentice
    Just wanted to report back on this. Sadly I experience that in about 1/10 cases, my command will be ignored or partially ignored. Example: If I make a loop in python of 100 actions where I send gripper activate wait 4 seconds, gripper close, wait 4 seconds, gripper open wait 4 seconds: multiple of these will not execute or weird things might happen, like the gripper partially opening or closing. T

    his has made my entire program unusable so far, as the gripper has dropped valuable things on the floor for no apparent reason. Anyone else experience this? I have also experienced my robot crashing after sending a gripper command, where it will say 'no controller found'. 


  • bcastetsbcastets Vacuum Beta tester Posts: 674 Expert
    @Ruben_Speybrouck
    I think it may be elated to the processing speed of the robot.
    If you send 100 actions to the robot, the robot have to receive those 100 actions. If they are send too quickly one after the other or if an action is requested while the last action is still on going this may lead to some interruption.

    Maybe you could have the robot send some feedback to you when the action is complete before you send the next one.
    You could send the script to open the gripper and at the end of it send a message back to your PC via a socket.
  • FarahKamalFarahKamal Posts: 2 Recruit
    @David_Gariepy In my GUI I need to repeatedly send commands for the HandE gripper and Epick vacuum, sending the whole file to the robot works depending on which commands I uncomment. However, do I need to resend the whole file every time I want to send a command or is there a way where I only send it once and then control the tools though the commands when needed.
  • David_GariepyDavid_Gariepy Beta Tester Beetle, Wrist Camera URCap 1.3.0, Vacuum Beta tester Posts: 190 Handy
    Hello @FarahKamal
    Yes, unfortunately the whole file has to be sent. 
    The reason is that even if the URCap is installed, these functions are unknown to the robot as they are loaded at the beginning of every program. So you need to send the whole file so the robot know what to do with theses commands. Otherwise it would receives commands but have no instruction on how to use them

    Best regards
    David Gariépy
    Integration Coach
  • FarahKamalFarahKamal Posts: 2 Recruit
    @David_Gariepy, thank you for your response it was very helpful. I wanted to ask however how it is that I can record the response to a function like 
    rq_is_object_detected ()
    
    since the primary interface sends the response in a form of a byte array with fixed size and types(clarified in photo attached) and there is no information about decoding the tool's state in the Primary Client Interface manual. 

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