Home Programming

Discussion

Left ArrowBack to discussions page
bcastetsbcastets Vacuum Beta tester Posts: 609 Expert
You may be interested in controlling from your PC Robotiq grippers (2F85, 2F140, Hand-e, ePick, airPick,...) using modbusTCP, Python and Robotiq universal controller.
I made a sample program which activate the gripper. I would like to share it with you.
I hope it will help in your projects !

For more details about how to control Robotiq gripper by reading and writing its memory registers, I recommend to check the user manual.

Comments

  • bcastetsbcastets Vacuum Beta tester Posts: 609 Expert
    Here is the Zip file with the python program.
  • s0972456s0972456 Unconfirmed Posts: 3 Apprentice
    Hi, could you also share a python program to open and close the e-pick gripper? thanks
  • bcastetsbcastets Vacuum Beta tester Posts: 609 Expert
    I will try to add this. Please give me some time to do that.
  • s0972456s0972456 Unconfirmed Posts: 3 Apprentice
    Thank you, that will be very helpful!
  • s0972456s0972456 Unconfirmed Posts: 3 Apprentice
    Hi, wonder if you have any update on that, still haven't figured out a way to control the epick remotely. Thanks
  • bcastetsbcastets Vacuum Beta tester Posts: 609 Expert
    s0972456 said:
    Hi, wonder if you have any update on that, still haven't figured out a way to control the epick remotely. Thanks
    I did not had time to work on this. Will try to do something next week.
  • bcastetsbcastets Vacuum Beta tester Posts: 609 Expert
    Sorry for waiting. I attach a simple program to control ePick using Modbus TCP.
    The program make a automatic grip followed by an automatic release.
    The user manual of ePick remain the best source of information to make this kind of control.
  • FanwangFanwang Unconfirmed Posts: 3 Apprentice
    Hi thank you for the code, I registered another account as for some reason I cannot post comment using my previous account.

    somehow I still cannot get the code to work, I use the robot’s IP address but I am reading just none from the register. If I delete the earlier print output part, I will be able to reach further and print out gripper status and gripper control, but the gripper itself doesn’t respond.

    I wonder whether this has anything to do with the fact that the gripper is connected to the wrist cable ? Should it be a different port then? I also tried to use a random ip but this time even printing gripper status and gripper control fails, so the IP address should be right.

    Any help will be greatly appreciated !
  • bcastetsbcastets Vacuum Beta tester Posts: 609 Expert
    This code will only work if your pc is connected to the gripper via a robotiq modbus tcp universal controller.

    Can you describe the connection between the gripper and the pc ?
    Also give ip of your pc ?
  • FanwangFanwang Unconfirmed Posts: 3 Apprentice
    I see, well I guess the TCP method wouldn't work on my setup. There is no physical form of connection between the gripper and the pc. The gripper is connected to the robot through the wrist cable, and the internet cable of the ur5 is connected to the same network switch where my pc's internet cable is connected to.

    My IP is 192.17.178.227, but I think it doesn't matter if the pc and the gripper is not connected?



  • bcastetsbcastets Vacuum Beta tester Posts: 609 Expert
    Unfortunatelly it cannot work with this setup.
  • FanwangFanwang Unconfirmed Posts: 3 Apprentice
    Thanks for the information though. Do you have other suggestions for driving the epick gripper with a python script? I hacked python_urx's code (send urscripts) that drives the parallel gripper to work on the epick, but it doesn't work completely as the gripper only stay on for a short period of time and shut down, I haven't figured out how to have it stay on until I turn it off.
  • bcastetsbcastets Vacuum Beta tester Posts: 609 Expert
    I am not familiar with this way to communicate with tools connected on ur controller.
    I imagine python code running on the controller should be able to controller gripper over modbus rtu.
  • nicolasmarcstephannicolasmarcstephan Posts: 5 Apprentice
    Hi!
    I'm experiencing some issues with your python script:
    I'm using a Hand-e gripper which is connected to my computer via USB. With the Robotiq User Interface I can access and control the gripper normally. But as soon as I try to use your Python script there seems to be no connection at all. I'm using pyCharm and have the pyModbusTCP library installed.

    I noticed that in the script you are not defining a serial port (like COM6 in my case) but an ip address. Does the gripper have its own ip address and if yes how can I find it? Or do you think there is a different problem?

    I would really appreciate your help!

  • bcastetsbcastets Vacuum Beta tester Posts: 609 Expert
    @nicolasmarcstephan
    This post is about communicating with a robotiq gripper in modbus TCP. It involve the use of a universal controller.

    I suppose that in your case you don't use a universal controller and have the gripper directly connected on your PC and try to communicate in Modbus RTU.

    You can check the following article to learn how to do that:
    https://dof.robotiq.com/discussion/1382/control-grippers-from-python-using-modbus-rtu#latest
  • TXSTUniTXSTUni Posts: 5 Apprentice
    Hi,
    When I run the code it says Module error: Cannot find 'PyModbus TCP'. your help would be appreciated. Thank you

  • bcastetsbcastets Vacuum Beta tester Posts: 609 Expert
    @TXSTUni
    pyModbusTCP is a python library that you need to install to be able to run this script.

    https://pypi.org/project/pyModbusTCP/

    You can PIP install it:
    sudo pip install pyModbusTCP

  • TXSTUniTXSTUni Posts: 5 Apprentice
    edited May 2021
    Hi,

    I was able to open and close the gripper using the activation gripper python code, thank you. 

    I have another question, how can I edit the code to close the gripper and not open it immediately?

    Thank you for your time.


  • bcastetsbcastets Vacuum Beta tester Posts: 609 Expert
    @TXSTUni

    This sample code activate the gripper. It is not a simple closing and opening.
    The gripper activation is necessary before doing any action with the gripper. During activation the gripper check what is its maximum and minimum opening position.

    To control the gripper, you need to read and write its modbus registers. Please check the section control of the manaul to learn more about modbus registers and gripper control.

    https://assets.robotiq.com/website-assets/support_documents/document/2F-85_2F-140_General_PDF_20200211.pdf
  • learningrobotlearningrobot Posts: 1 Recruit
    bcastets said:
    Here is the Zip file with the python program.
    Hi @bcastets
    In your sample, what is the driver for the gripper? Was it on Ubuntu or Windows? Is the code still working?
    I tried to follow the ROS library at http://wiki.ros.org/robotiq, but failed at Modbus TCP installation, as it said "Rosdep cannot find all required resouces of robotiq_modbus_tcp. How to configure it btw? 

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