grippers

Grippers Module.

This module provides the implementation of different gripper types and their functionality.

The gripper class provides a common interface for real or simulated grippers, while the dummygripper class offers a mock implementation for scenarios where no physical hardware is involved.

class robotblockset.grippers.gripper(**kwargs: Any)[source]

Bases: rbs_object

A class representing a gripper attached to a robot, allowing control over the gripper’s state and actions.

Attributes:
  • Name (str) – Name of the gripper, default is “Gripper”.

  • Robot (robot, optional) – The robot to which the gripper is attached, by default None.

Initializes the gripper object with default attributes.

Parameters:

**kwargs (dict) – Additional arguments to initialize the gripper object.

__init__(**kwargs: Any) None[source]

Initializes the gripper object with default attributes.

Parameters:

**kwargs (dict) – Additional arguments to initialize the gripper object.

simtime() float[source]

Returns the current simulation time.

Returns:

The current simulation time.

Return type:

float

abstractmethod Move(width: float, **kwargs: Any) bool[source]

Moves the gripper to a specified width. This is an abstract method that must be implemented.

Parameters:
  • width (float) – The width to which the gripper should move.

  • **kwargs (dict) – Additional arguments for the move operation.

Returns:

True if the gripper successfully moves, False otherwise.

Return type:

bool

Open(**kwargs: Any) bool[source]

Opens the gripper to its maximum width.

Parameters:

**kwargs (dict) – Additional arguments for the open operation.

Returns:

True if the gripper successfully opens, False otherwise.

Return type:

bool

Close(**kwargs: Any) bool[source]

Closes the gripper to a width of 0.

Parameters:

**kwargs (dict) – Additional arguments for the close operation.

Returns:

True if the gripper successfully closes, False otherwise.

Return type:

bool

Grasp(**kwargs: Any) bool[source]

Grasps an object with the gripper at a specified width.

Parameters:

**kwargs (dict) – Additional arguments for the grasp operation, may include a “width” key.

Returns:

True if the gripper successfully grasps, False otherwise.

Return type:

bool

Homing(**kwargs: Any) bool[source]

Resets the gripper to an open state.

Parameters:

**kwargs (dict) – Additional arguments for the homing operation.

Returns:

True if the gripper successfully homes, False otherwise.

Return type:

bool

isOpened() bool[source]

Returns True if the gripper is open.

Returns:

True if the gripper is open, False otherwise.

Return type:

bool

isClosed() bool[source]

Returns True if the gripper is closed.

Returns:

True if the gripper is closed, False otherwise.

Return type:

bool

GetState() str[source]

Returns the current state of the gripper.

Returns:

The state of the gripper, either “Opened”, “Closed”, or “Undefined”.

Return type:

str

AttachTo(robot: robot) None[source]

Attaches the gripper to a robot.

Parameters:

robot (robot) – robot The robot to which the gripper should be attached.

Detach() None[source]

Detaches the gripper from its current robot.

GetAttachedRobot() Tuple[robot | None, str][source]

Returns the robot and its name, or (None, “None”) if no robot is attached.

Returns:

A tuple containing the robot and its name, or (None, “None”) if no robot is attached.

Return type:

tuple

class robotblockset.grippers.dummygripper(**kwargs: Any)[source]

Bases: gripper

A dummy gripper class that simulates a gripper’s basic functionality without actually controlling hardware. This class is a subclass of the gripper class and provides mock implementations for gripper actions.

Attributes:
  • Name (str) – Name of the gripper, default is “DummyGripper”.

  • Robot (robot, optional) – The robot to which the gripper is attached, by default None.

Initializes the dummy gripper object with default attributes.

Parameters:

**kwargs (dict) – Additional arguments for initializing the dummy gripper object.

__init__(**kwargs: Any) None[source]

Initializes the dummy gripper object with default attributes.

Parameters:

**kwargs (dict) – Additional arguments for initializing the dummy gripper object.

Open(**kwargs: Any) bool[source]

Simulates opening the gripper.

Parameters:

**kwargs (dict) – Additional arguments for the open operation.

Returns:

Always returns True to simulate a successful operation.

Return type:

bool

Close(**kwargs: Any) bool[source]

Simulates closing the gripper.

Parameters:

**kwargs (dict) – Additional arguments for the close operation.

Returns:

Always returns True to simulate a successful operation.

Return type:

bool

Grasp(**kwargs: Any) bool[source]

Simulates grasping an object with the gripper.

Parameters:

**kwargs (dict) – Additional arguments for the grasp operation.

Returns:

Always returns True to simulate a successful operation.

Return type:

bool

Move(width: float, **kwargs: Any) bool[source]

Simulates moving the gripper to a specified width.

Parameters:
  • width (float) – The width to which the gripper should move.

  • **kwargs (dict) – Additional arguments for the move operation.

Returns:

Always returns True to simulate a successful operation.

Return type:

bool

Homing(**kwargs: Any) bool[source]

Simulates resetting the gripper to an open state.

Parameters:

**kwargs (dict) – Additional arguments for the homing operation.

Returns:

Always returns True to simulate a successful operation.

Return type:

bool

robotblockset.grippers.isgripper(obj: object) bool[source]

Checks if the given object is an instance of the gripper class.

Parameters:

obj (object) – The object to check.

Returns:

True if the object is an instance of the gripper class, otherwise False.

Return type:

bool

Functions

isgripper(obj)

Checks if the given object is an instance of the gripper class.

Classes

dummygripper(**kwargs)

A dummy gripper class that simulates a gripper's basic functionality without actually controlling hardware.

gripper(**kwargs)

A class representing a gripper attached to a robot, allowing control over the gripper's state and actions.