austin.robotiq_gripper

Module to control Robotiq’s grippers - tested with HAND-E

Functions:

RobotiqGripper

class austin.robotiq_gripper.RobotiqGripper[source]

Bases: object

Communicates with the gripper directly, via socket with string commands, leveraging string names for variables.

ACT = 'ACT'
ADR = 'ADR'
ATR = 'ATR'
ENCODING = 'UTF-8'
FLT = 'FLT'
FOR = 'FOR'
GTO = 'GTO'
class GripperStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Gripper status reported by the gripper. The integer values have to match what the gripper sends.

ACTIVATING = 1
ACTIVE = 3
RESET = 0
OBJ = 'OBJ'
class ObjectStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Object status reported by the gripper. The integer values have to match what the gripper sends.

AT_DEST = 3
MOVING = 0
STOPPED_INNER_OBJECT = 2
STOPPED_OUTER_OBJECT = 1
POS = 'POS'
PRE = 'PRE'
SPE = 'SPE'
STA = 'STA'
activate(auto_calibrate: bool = True)[source]
auto_calibrate(log: bool = True) None[source]

Attempts to calibrate the open and closed positions, by slowly closing and opening the gripper. :param log: Whether to print the results to log.

connect(hostname: str, port: int, socket_timeout: float = 2.0) None[source]

Connects to a gripper at the given address. :param hostname: Hostname or ip. :param port: Port. :param socket_timeout: Timeout for blocking socket operations.

disconnect() None[source]

Closes the connection with the gripper.

get_closed_position() int[source]

Returns what is considered the closed position for gripper (maximum position value).

get_current_position() int[source]

Returns the current position as returned by the physical hardware.

get_max_position() int[source]

Returns the maximum position the gripper can reach (closed position).

get_min_position() int[source]

Returns the minimum position the gripper can reach (open position).

get_open_position() int[source]

Returns what is considered the open position for gripper (minimum position value).

is_active()[source]

Returns whether the gripper is active.

is_closed()[source]

Returns whether the current position is considered as being fully closed.

is_open()[source]

Returns whether the current position is considered as being fully open.

move(position: int, speed: int, force: int) Tuple[bool, int][source]

Sends commands to start moving towards the given position, with the specified speed and force. :param position: Position to move to [min_position, max_position] :param speed: Speed to move at [min_speed, max_speed] :param force: Force to use [min_force, max_force] :return: A tuple with a bool indicating whether the action it was successfully sent, and an integer with the actual position that was requested, after being adjusted to the min/max calibrated range.

move_and_wait_for_pos(position: int, speed: int, force: int) Tuple[int, ObjectStatus][source]

Sends commands to start moving towards the given position, with the specified speed and force, and then waits for the move to complete. :param position: Position to move to [min_position, max_position] :param speed: Speed to move at [min_speed, max_speed] :param force: Force to use [min_force, max_force] :return: A tuple with an integer representing the last position returned by the gripper after it notified that the move had completed, a status indicating how the move ended (see ObjectStatus enum for details). Note that it is possible that the position was not reached, if an object was detected during motion.