Home Programming

Discussion

Left ArrowBack to discussions page
bcastetsbcastets Vacuum Beta tester Posts: 236 Handy
Clients ask us form time to time how to control the gripper from a PC using UR controller client interface.

Here is an example of Python script made by my colleague to control the gripper remotely by the port 30002.

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 30003, 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.

If you look at the attached example where the python program sends a file called gripper.script, there is 650 line of function definitions to achieve a single activate and a move function of the gripper.  These 650 includes all the gripper functions.  At the end of the file, the desired commands are there.



The definition of gripper function is evolving with time. You can find the latest gripper function definition in the .script file save with your program on the controller. You can get it using UR backup magic file or using FTP.

For more information about client interface you can have a look to UR documentation:
https://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/overview-of-client-interfaces-21744/

Comments

  • albertgoalbertgo Posts: 5 Apprentice
    So, to make the gripper move, I put in a command at the bottom of the Gripper.script file and send it to the correct port?
  • bcastetsbcastets Vacuum Beta tester Posts: 236 Handy
    albertgo said:
    So, to make the gripper move, I put in a command at the bottom of the Gripper.script file and send it to the correct port?
    Yes, that it. It should work but may take some time to send the script.
  • albertgoalbertgo Posts: 5 Apprentice
    How do I know if the script was sent properly?
  • ief12ief12 Unconfirmed Posts: 1 Recruit
    I know this post is not brand new, but thanks for the really useful script!
    I have two Questions to this topic:

    - Is it possiple to run the script inside a thread on the controller, so i do not have to transmitt the whole script every time? Or is this out of scope?

    - Any ideas how to check parameters of the gripper (f.e. object detected)? Open a additional Socket or use RPC?

    Thanks in advance


  • bcastetsbcastets Vacuum Beta tester Posts: 236 Handy
    ief12 said:
    I know this post is not brand new, but thanks for the really useful script!
    I have two Questions to this topic:

    - Is it possiple to run the script inside a thread on the controller, so i do not have to transmitt the whole script every time? Or is this out of scope?

    - Any ideas how to check parameters of the gripper (f.e. object detected)? Open a additional Socket or use RPC?

    Thanks in advance


    1/ You could save gripper parameters in robot modbus register and have a program running on the robot with a thread to monitor value change and trigger gripper when needed. Then from your PC you can write the modbus register of the robot to register a gripper action.
    2/ You would also use robot modbus register. You can write in robot register the result of object detection and access this information from your PC.
Sign In or Register to comment.
Left ArrowBack to discussions page