Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:ARISE Initiative Robosuite GripperModel Base

From Leeroopedia
Revision as of 11:59, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/ARISE_Initiative_Robosuite_GripperModel_Base.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Robotics, Simulation, MJCF_Modeling
Last Updated 2026-02-15 07:00 GMT

Overview

GripperModel is the abstract base class for all gripper models in robosuite, defining the common interface and properties that all gripper implementations must provide.

Description

The GripperModel class extends MujocoXMLModel to serve as the foundation for every gripper in the robosuite framework. During initialization, it loads a gripper from an MJCF XML file, initializes the current action state to zeros (sized according to the gripper's DOF), and computes the rotation_offset quaternion by compounding the base body quaternion with the end-effector (eef) body quaternion using quat_multiply. This compounded rotation accounts for any rotational offsets between the gripper's root and its effective end-effector frame.

The class defines several key abstract and default properties. The format_action method must be overridden by subclasses to map abstract (-1, 1) control signals to the specific actuator commands. The dof property by default returns the number of actuators in the model, while speed defaults to 0.0. The naming_prefix uses the pattern "gripper{idn}_" for namespace isolation.

Important site definitions include grip_site, grip_cylinder, ee, ee_x, ee_y, and ee_z for visualization and reference frame tracking. The _important_geoms property defines four groups: left_finger, right_finger, left_fingerpad, and right_fingerpad, which subclasses populate with their specific collision geometry names. Sensor defaults include force_ee and torque_ee for end-effector force/torque sensing.

Usage

Use GripperModel as the base class when implementing new gripper models. Subclasses must implement format_action and init_qpos, and should override _important_geoms with their specific collision geometry names. All built-in robosuite grippers (Panda, Rethink, Robotiq, Jaco, etc.) inherit from this class.

Code Reference

Source Location

Signature

class GripperModel(MujocoXMLModel):
    def __init__(self, fname, idn=0):

Import

from robosuite.models.grippers.gripper_model import GripperModel

I/O Contract

Inputs

Name Type Required Description
fname str Yes Path to relevant XML file to create this gripper instance
idn int or str No Unique identification number or string for this gripper instance. Default: 0

Outputs

Name Type Description
GripperModel instance GripperModel Abstract gripper model with rotation offset and action tracking
rotation_offset np.array Compounded quaternion (x, y, z, w) of base body and eef body rotations
current_action np.array Array of zeros with length equal to DOF, tracking the current action state
naming_prefix str Returns "gripper{idn}_" prefix for namespace isolation
dof int Number of degrees of freedom (defaults to number of actuators)
speed float Gripper open/close speed (default: 0.0)
init_qpos np.array Default rest (open) qpos of the gripper (abstract, must be implemented)

Usage Examples

from robosuite.models.grippers.gripper_model import GripperModel
import numpy as np

# GripperModel is abstract; used through concrete subclasses.
# Example subclass pattern:
class MyGripper(GripperModel):
    def __init__(self, idn=0):
        super().__init__("path/to/gripper.xml", idn=idn)

    def format_action(self, action):
        assert len(action) == self.dof
        return action

    @property
    def init_qpos(self):
        return np.zeros(2)

    @property
    def _important_geoms(self):
        return {
            "left_finger": ["left_col"],
            "right_finger": ["right_col"],
            "left_fingerpad": ["left_pad_col"],
            "right_fingerpad": ["right_pad_col"],
        }

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment