robosuite.models.grippers package

Contents

robosuite.models.grippers package#

Submodules#

robosuite.models.grippers.gripper_factory module#

Defines a string based method of initializing grippers

robosuite.models.grippers.gripper_factory.gripper_factory(name: str | None, idn=0) GripperModel#

Generator for grippers

Creates a GripperModel instance with the provided name.

Parameters:
  • name (None or str) – the name of the gripper class

  • idn (int or str) – Number or some other unique identification string for this gripper instance

Returns:

requested gripper instance

Return type:

GripperModel

Raises:

XMLError – [invalid XML]

robosuite.models.grippers.gripper_model module#

Defines the base class of all grippers

class robosuite.models.grippers.gripper_model.GripperModel(fname, idn=0)#

Bases: MujocoXMLModel

Base class for grippers

Parameters:
  • fname (str) – Path to relevant xml file to create this gripper instance

  • idn (int or str) – Number or some other unique identification string for this gripper instance

property bottom_offset#

Returns vector from model root body to model bottom. Useful for, e.g. placing models on a surface. By default, this corresponds to the root_body’s base offset.

Returns:

(dx, dy, dz) offset vector

Return type:

np.array

property contact_geom_rgba#

RGBA color to assign to all contact geoms for this model

Returns:

(r,g,b,a) values from 0 to 1 for this model’s set of contact geoms

Return type:

4-array

property dof#

Defines the number of DOF of the gripper

Returns:

gripper DOF

Return type:

int

format_action(action)#

Given (-1,1) abstract control as np-array returns the (-1,1) control signals for underlying actuators as 1-d np array

property horizontal_radius#

Returns maximum distance from model root body to any radial point of the model.

Helps us put models programmatically without them flying away due to a huge initial contact force. Must be defined by subclass.

Returns:

radius

Return type:

float

property init_qpos#

Defines the default rest (open) qpos of the gripper

Returns:

Default init qpos of this gripper

Return type:

np.array

property naming_prefix#

Generates a standardized prefix to prevent naming collisions

Returns:

Prefix unique to this model.

Return type:

str

property speed#

How quickly the gripper opens / closes

Returns:

Speed of the gripper

Return type:

float

property top_offset#

Returns vector from model root body to model top. Useful for, e.g. placing models on a surface. Must be defined by subclass.

Returns:

(dx, dy, dz) offset vector

Return type:

np.array

robosuite.models.grippers.gripper_tester module#

Defines GripperTester that is used to test the physical properties of various grippers

class robosuite.models.grippers.gripper_tester.GripperTester(gripper, pos, quat, gripper_low_pos, gripper_high_pos, box_size=None, box_density=10000, step_time=400, render=True)#

Bases: object

A class that is used to test gripper

Parameters:
  • gripper (GripperModel) – A gripper instance to be tested

  • pos (str) – (x y z) position to place the gripper in string form, e.g. ‘0 0 0.3’

  • quat (str) – rotation to apply to gripper in string form, e.g. ‘0 0 1 0’ to flip z axis

  • gripper_low_pos (float) – controls the gipper y position, larger -> higher

  • gripper_high_pos (float) – controls the gipper y high position larger -> higher, must be larger than gripper_low_pos

  • box_size (None or 3-tuple of int) – the size of the box to grasp, None defaults to [0.02, 0.02, 0.02]

  • box_density (int) – the density of the box to grasp

  • step_time (int) – the interval between two gripper actions

  • render (bool) – if True, show rendering

close()#

Close the viewer if it exists

loop(total_iters=1, test_y=False, y_baseline=0.01)#
Performs lower, grip, raise and release actions of a gripper,

each separated with T timesteps

Parameters:
  • total_iters (int) – Iterations to perform before exiting

  • test_y (bool) – test if object is lifted

  • y_baseline (float) – threshold for determining that object is lifted

property object_height#

Queries the height (z) of the object compared to on the ground

Returns:

Object height relative to default (ground) object position

Return type:

float

reset()#

Resets the simulation to the initial state

start_simulation()#

Starts simulation of the test world

step()#

Forward the simulation by one timestep

Raises:

RuntimeError – if start_simulation is not yet called.

robosuite.models.grippers.jaco_three_finger_gripper module#

Gripper for Kinova’s Jaco robot arm (has three fingers).

class robosuite.models.grippers.jaco_three_finger_gripper.JacoThreeFingerDexterousGripper(idn=0)#

Bases: JacoThreeFingerGripperBase

Dexterous variation of the Jaco gripper in which all finger are actuated independently

property dof#

Defines the number of DOF of the gripper

Returns:

gripper DOF

Return type:

int

format_action(action)#

Maps continuous action into binary output all -1 => open, all 1 => closed

Parameters:

action (np.array) – gripper-specific action

Raises:

AssertionError – [Invalid action dimension size]

property speed#

How quickly the gripper opens / closes

Returns:

Speed of the gripper

Return type:

float

class robosuite.models.grippers.jaco_three_finger_gripper.JacoThreeFingerGripper(idn=0)#

Bases: JacoThreeFingerGripperBase

Modifies JacoThreeFingerGripperBase to only take one action.

property dof#

Defines the number of DOF of the gripper

Returns:

gripper DOF

Return type:

int

format_action(action)#

Maps continuous action into binary output -1 => open, 1 => closed

Parameters:

action (np.array) – gripper-specific action

Raises:

AssertionError – [Invalid action dimension size]

property speed#

How quickly the gripper opens / closes

Returns:

Speed of the gripper

Return type:

float

class robosuite.models.grippers.jaco_three_finger_gripper.JacoThreeFingerGripperBase(idn=0)#

Bases: GripperModel

Gripper for Kinova’s Jaco robot arm (has three fingers).

Parameters:

idn (int or str) – Number or some other unique identification string for this gripper instance

format_action(action)#

Given (-1,1) abstract control as np-array returns the (-1,1) control signals for underlying actuators as 1-d np array

property init_qpos#

Defines the default rest (open) qpos of the gripper

Returns:

Default init qpos of this gripper

Return type:

np.array

robosuite.models.grippers.null_gripper module#

Null Gripper (if we don’t want to attach gripper to robot eef).

class robosuite.models.grippers.null_gripper.NullGripper(idn=0)#

Bases: GripperModel

Dummy Gripper class to represent no gripper

Parameters:

idn (int or str) – Number or some other unique identification string for this gripper instance

format_action(action)#

Given (-1,1) abstract control as np-array returns the (-1,1) control signals for underlying actuators as 1-d np array

property init_qpos#

Defines the default rest (open) qpos of the gripper

Returns:

Default init qpos of this gripper

Return type:

np.array

robosuite.models.grippers.panda_gripper module#

Gripper for Franka’s Panda (has two fingers).

class robosuite.models.grippers.panda_gripper.PandaGripper(idn=0)#

Bases: PandaGripperBase

Modifies PandaGripperBase to only take one action.

property dof#

Defines the number of DOF of the gripper

Returns:

gripper DOF

Return type:

int

format_action(action)#

Maps continuous action into binary output -1 => open, 1 => closed

Parameters:

action (np.array) – gripper-specific action

Raises:

AssertionError – [Invalid action dimension size]

property speed#

How quickly the gripper opens / closes

Returns:

Speed of the gripper

Return type:

float

class robosuite.models.grippers.panda_gripper.PandaGripperBase(idn=0)#

Bases: GripperModel

Gripper for Franka’s Panda (has two fingers).

Parameters:

idn (int or str) – Number or some other unique identification string for this gripper instance

format_action(action)#

Given (-1,1) abstract control as np-array returns the (-1,1) control signals for underlying actuators as 1-d np array

property init_qpos#

Defines the default rest (open) qpos of the gripper

Returns:

Default init qpos of this gripper

Return type:

np.array

robosuite.models.grippers.rethink_gripper module#

Gripper with two fingers for Rethink Robots.

class robosuite.models.grippers.rethink_gripper.RethinkGripper(idn=0)#

Bases: RethinkGripperBase

Modifies two finger base to only take one action.

property dof#

Defines the number of DOF of the gripper

Returns:

gripper DOF

Return type:

int

format_action(action)#

Maps continuous action into binary output -1 => open, 1 => closed

Parameters:

action (np.array) – gripper-specific action

Raises:

AssertionError – [Invalid action dimension size]

property speed#

How quickly the gripper opens / closes

Returns:

Speed of the gripper

Return type:

float

class robosuite.models.grippers.rethink_gripper.RethinkGripperBase(idn=0)#

Bases: GripperModel

Gripper with long two-fingered parallel jaw.

Parameters:

idn (int or str) – Number or some other unique identification string for this gripper instance

format_action(action)#

Given (-1,1) abstract control as np-array returns the (-1,1) control signals for underlying actuators as 1-d np array

property init_qpos#

Defines the default rest (open) qpos of the gripper

Returns:

Default init qpos of this gripper

Return type:

np.array

robosuite.models.grippers.robotiq_140_gripper module#

Gripper with 140mm Jaw width from Robotiq (has two fingers).

class robosuite.models.grippers.robotiq_140_gripper.Robotiq140Gripper(idn=0)#

Bases: Robotiq140GripperBase

Modifies Robotiq140GripperBase to only take one action.

property dof#

Defines the number of DOF of the gripper

Returns:

gripper DOF

Return type:

int

format_action(action)#

Maps continuous action into binary output -1 => open, 1 => closed

Parameters:

action (np.array) – gripper-specific action

Raises:

AssertionError – [Invalid action dimension size]

property speed#

How quickly the gripper opens / closes

Returns:

Speed of the gripper

Return type:

float

class robosuite.models.grippers.robotiq_140_gripper.Robotiq140GripperBase(idn=0)#

Bases: GripperModel

Gripper with 140mm Jaw width from Robotiq (has two fingers).

Parameters:

idn (int or str) – Number or some other unique identification string for this gripper instance

format_action(action)#

Given (-1,1) abstract control as np-array returns the (-1,1) control signals for underlying actuators as 1-d np array

property init_qpos#

Defines the default rest (open) qpos of the gripper

Returns:

Default init qpos of this gripper

Return type:

np.array

robosuite.models.grippers.robotiq_85_gripper module#

6-DoF gripper with its open/close variant

class robosuite.models.grippers.robotiq_85_gripper.Robotiq85Gripper(idn=0)#

Bases: Robotiq85GripperBase

1-DoF variant of RobotiqGripperBase.

property dof#

Defines the number of DOF of the gripper

Returns:

gripper DOF

Return type:

int

format_action(action)#

Maps continuous action into binary output -1 => open, 1 => closed

Parameters:

action (np.array) – gripper-specific action

Raises:

AssertionError – [Invalid action dimension size]

property speed#

How quickly the gripper opens / closes

Returns:

Speed of the gripper

Return type:

float

class robosuite.models.grippers.robotiq_85_gripper.Robotiq85GripperBase(idn=0)#

Bases: GripperModel

6-DoF Robotiq gripper.

Parameters:

idn (int or str) – Number or some other unique identification string for this gripper instance

format_action(action)#

Given (-1,1) abstract control as np-array returns the (-1,1) control signals for underlying actuators as 1-d np array

property init_qpos#

Defines the default rest (open) qpos of the gripper

Returns:

Default init qpos of this gripper

Return type:

np.array

robosuite.models.grippers.robotiq_three_finger_gripper module#

Gripper with 11-DoF controlling three fingers and its open/close variant.

class robosuite.models.grippers.robotiq_three_finger_gripper.RobotiqThreeFingerDexterousGripper(idn=0)#

Bases: RobotiqThreeFingerGripperBase

Dexterous variation of the 3-finger Robotiq gripper in which all finger are actuated independently as well as the scissor joint between fingers 1 and 2

property dof#

Defines the number of DOF of the gripper

Returns:

gripper DOF

Return type:

int

format_action(action)#

Maps continuous action into binary output all -1 => open, all 1 => closed

Parameters:

action (np.array) – gripper-specific action

Raises:

AssertionError – [Invalid action dimension size]

property speed#

How quickly the gripper opens / closes

Returns:

Speed of the gripper

Return type:

float

class robosuite.models.grippers.robotiq_three_finger_gripper.RobotiqThreeFingerGripper(idn=0)#

Bases: RobotiqThreeFingerGripperBase

1-DoF variant of RobotiqThreeFingerGripperBase.

property dof#

Defines the number of DOF of the gripper

Returns:

gripper DOF

Return type:

int

format_action(action)#

Maps continuous action into binary output -1 => open, 1 => closed

Parameters:

action (np.array) – gripper-specific action

Raises:

AssertionError – [Invalid action dimension size]

property speed#

How quickly the gripper opens / closes

Returns:

Speed of the gripper

Return type:

float

class robosuite.models.grippers.robotiq_three_finger_gripper.RobotiqThreeFingerGripperBase(idn=0)#

Bases: GripperModel

Gripper with 11 dof controlling three fingers.

Parameters:

idn (int or str) – Number or some other unique identification string for this gripper instance

format_action(action)#

Given (-1,1) abstract control as np-array returns the (-1,1) control signals for underlying actuators as 1-d np array

property init_qpos#

Defines the default rest (open) qpos of the gripper

Returns:

Default init qpos of this gripper

Return type:

np.array

robosuite.models.grippers.wiping_gripper module#

Gripper without fingers to wipe a surface

class robosuite.models.grippers.wiping_gripper.WipingGripper(idn=0)#

Bases: GripperModel

A Wiping Gripper with no actuation and enabled with sensors to detect contact forces

Parameters:

idn (int or str) – Number or some other unique identification string for this gripper instance

format_action(action)#

Given (-1,1) abstract control as np-array returns the (-1,1) control signals for underlying actuators as 1-d np array

property init_qpos#

Defines the default rest (open) qpos of the gripper

Returns:

Default init qpos of this gripper

Return type:

np.array

Module contents#

robosuite.models.grippers.register_gripper(target_class)#