robotiqGripper module

Created on Wed Oct 17 17:33:20 2018 Python class to control robotiq gripper via python @author: Benoit CASTETS

class robotiqGripper.RobotiqGripper(portname='auto', slaveAddress=9)[source]

Bases: Instrument

“Class to control Robotiq grippers (2F85, 2F140, hande,…). Suppose that the gripper is connected via the USB/RS485 adapter to the PC executing this code.

Some general information about robotiq gripper.

Modbus RTU function code supported by robotiq gripper ===================================== ==================== Description Modbus function code ===================================== ==================== Read registers 4 Write registers 16 Master read & write multiple registers 23 ================== ====================

For more information for gripper communication please check gripper manual on Robotiq website. https://robotiq.com/support/2f-85-2f-140

activate()[source]

If not already activated. Activate the gripper

calibrate(closemm, openmm)[source]

Calibrate the gripper for mm positionning

closeGripper(speed=255, force=255)[source]

Close the gripper

Parameters

speed:

Gripper speed between 0 and 255

force:

Gripper force between 0 and 255

getPosition()[source]

Return the position of the gripper in bit.

Return

position:

Gripper position in bit

current:

Motor current in bit. 1bit is about 10mA.

getPositionmm()[source]

Return the position of the gripper in mm. Calibration is need to use this function.

goTo(position, speed=255, force=255)[source]

Go to the position with determined speed and force.

Parameters

position:

Position of the gripper. Integer between 0 and 255. 0 being the open position and 255 being the close position.

speed:

Gripper speed between 0 and 255

force:

Gripper force between 0 and 255

Return

objectDetected:

True if object detected

position:

End position of the gripper

goTomm(positionmm, speed=255, force=255)[source]

Go to the requested opening expressed in mm

Parameters

positionmm:

Gripper opening in mm.

speed:

Gripper speed between 0 and 255

force:

Gripper force between 0 and 255

Return

Return 0 if succeed, 1 if failed.

isActivated()[source]

Tells if the gripper is activated

Return

activated - bool:

True is the gripper is activated. False otherwise.

isCalibrated()[source]

Return if the gripper is qualibrated

openGripper(speed=255, force=255)[source]

Open the gripper

Parameters

speed:

Gripper speed between 0 and 255

force:

Gripper force between 0 and 255

printInfo()[source]

Print gripper register info in the python treminal

readAll()[source]

Retrieve gripper output register information and save it the parameter dictionnary

Dictionnary keys are: - gOBJ Object detection status, is a built-in feature that provides information on possible object pick-up. Ignore if gGTO == 0. - gSTA Gripper status, returns the current status and motion of the gripper fingers. - gGTO Action status, echo of the rGTO bit (go to bit). - gACT Activation status, echo of the rACT bit (activation bit). - kFLT See your optional controller manual (input registers and status). - gFLT Fault status returns general error messages that are useful for troubleshooting.

Fault LED (red) is present on the gripper chassis,LED can be blue, red or both and be solid or blinking.

  • gPR Echo of the requested position for the gripper, value between 0x00 and 0xFF.

  • gPO Actual position of the gripper obtained via the encoders, value between 0x00 and 0xFF.

  • gCU The current is read instantaneously from the motor drive, value between 0x00 and 0xFF,

    approximate current equivalent is 10 *value read in mA.

reset()[source]

Reset the gripper (clear previous activation if any)

resetActivate()[source]

Reset the gripper (clear previous activation if any) and activate the gripper. During this operation the gripper will open and close.