Metadata-Version: 2.3
Name: pyrobotiqgripper
Version: 3.2.7
Summary: Python Driver for Robotiq Grippers
Author: Benoit CASTETS
Author-email: Benoit CASTETS <opensourceeng@gmail.com>
License: MIT License
         
         Copyright (c) [2024] [Benoit CASTETS]
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Dist: pymodbus>=3.12.1
Requires-Dist: pyserial>=3.5
Requires-Dist: numpy>=1.28
Requires-Dist: pandas>=1.5 ; extra == 'all'
Requires-Dist: pygame-ce>=2.5.2 ; extra == 'all'
Requires-Dist: pynput>=1.7.6 ; extra == 'all'
Requires-Dist: pyautogui>=0.9.54 ; extra == 'all'
Requires-Dist: sphinx ; extra == 'dev'
Requires-Dist: sphinx-rtd-theme ; extra == 'dev'
Requires-Dist: sphinxcontrib-youtube ; extra == 'dev'
Requires-Python: >=3.10.0
Project-URL: homepage, https://github.com/castetsb/pyRobotiqGripper
Project-URL: tracker, https://github.com/castetsb/pyRobotiqGripper/issues
Provides-Extra: all
Provides-Extra: dev
Description-Content-Type: text/x-rst

pyRobotiqGripper
================
.. list-table::
   :align: center
   :class: borderless

   * - .. image:: https://static.pepy.tech/personalized-badge/pyrobotiqgripper?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads
         :target: https://pepy.tech/projects/pyrobotiqgripper
         :alt: PyPI Downloads

     - .. image:: https://img.shields.io/pypi/dm/pyrobotiqgripper
         :alt: PyPI Monthly Downloads

     - .. image:: https://img.shields.io/github/stars/castetsb/pyrobotiqgripper
         :alt: GitHub Stars

**Python Driver for Robotiq Grippers.**



.. figure:: https://raw.githubusercontent.com/castetsb/pyRobotiqGripper/master/docs/_static/logo.png
   :alt: PyRobotiqGripper Logo
   :align: center

Python Driver for Robotiq Grippers.

pyRobotiqGripper is a Python library designed to facilitate control of Robotiq grippers using Modbus RTU communication via serial port or over ethernet.
It is compatible with 2F85, 2F140, and Hande.

Documentation: `pyRobotiqGripper Documentation <https://pyrobotiqgripper.readthedocs.io/en/latest/>`_



1-Disclaimer
------------

This library can be seen as a starting point for a Robotiq integration project.
You are responsible for what you do with this library.
The author takes no responsibility for any malfunction.

.. warning::
    This library is not maintained by Robotiq.

2-How to Install
----------------

Install the pyRobotiqGripper python package using PIP.

.. code-block:: bash

    python3 -m pip install "pyRobotiqGripper[all]"

The `all` extra includes the optional dependencies used by the joystick CLI and \
history/data helper methods.

.. note::
    The way python is called (python3 vs python) may depend on your system configuration. \
    If the above command does not work, try replacing `python3` with `python`.

3-Typical Usage:
----------------

3-1-Robotiq gripper connected at PC USB port via a USB to RS485 converter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: python

    import pyrobotiqgripper as rq

    #Create a Robotiq gripper object.
    gripper = rq.RobotiqGripper()

By default, the serial port on which the gripper is connected is automatically detected. \
However, you can manually specify the serial port name if you want to. Refer to the API \
documentation for more information.

3-2-Robotiq gripper connected to a UR robot with RS485 URCAP installed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Replace <UR_ROBOT_IP> with the actual IP address of your UR robot.

.. code-block:: python

    import pyrobotiqgripper as rq

    #Create a Robotiq gripper object.
    gripper = rq.RobotiqGripper(connection_type="RTU_VIA_TCP", tcp_host=<UR_ROBOT_IP>)

3-3-Gripper control
~~~~~~~~~~~~~~~~~~~
Activate the gripper and do whatever you want with the gripper: open, close, get position feedback, etc.

.. code-block:: python

    gripper.activate()
    gripper.calibrate(closemm=0, openmm=40)
    gripper.open()
    gripper.close()
    gripper.move(100)
    position_in_bit = gripper.position()
    print(position_in_bit)
    gripper.move_mm(25)
    position_in_mm = gripper.positionmm()
    print(position_in_mm)

Note: During activation, the gripper is going to fully open and close. Do not disturb this process. Do not place an object inside the gripper.

Note: Position, Speed and Force varie from 0 to 255. It is coded on 8 bits.

You can print the current status of gripper registers using `printStatus()`.

.. code-block:: python

    gripper.printStatus()

For realtime control use the realTimeMove method.

.. code-block:: python

    gripper.realTimeMove(requestedPosition=100)

The realTimeMove method is designed to be called in a loop with a high frequency. It will move the gripper to the requested position with a speed that depends on the distance to the target position. This allows for a smooth and responsive control of the gripper.

4-Joystick CLI Feature
----------------------

pyRobotiqGripper includes a command-line interface (CLI) tool for controlling the \
gripper using a joystick or gamepad.

This CLI requires the `all` extra.

To use the Joystick CLI, run:

.. code-block:: bash

    pyrobotiqgripper-joystick

You can also check the available options:
.. code-block:: bash

    pyrobotiqgripper-joystick --help
