Implementation:ARISE Initiative Robosuite GripperTester
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, MJCF_Modeling |
| Last Updated | 2026-02-15 07:00 GMT |
Overview
GripperTester is a utility class that creates a self-contained MuJoCo simulation environment to test the physical grasping capabilities of gripper models.
Description
The GripperTester class constructs a complete test world consisting of a TableArena, a mounted gripper attached to a vertical slider joint, and a small BoxObject placed on the table surface. The gripper is positioned at a configurable location and orientation, and the slider joint allows it to move vertically between a high and low position. The test environment also includes colored reference boxes (green for x-axis, blue for y-axis) to help with visual orientation during rendering.
The class implements a full grasp-and-lift test cycle through its loop() method, which executes a four-phase sequence: lower the gripper, close the gripper, raise the gripper, and open the gripper. Each phase runs for a configurable number of timesteps (step_time). The simulation applies gravity compensation to the slider joint and rescales normalized gripper actions to the actuator control ranges. The object_height property can be used to verify whether the object was successfully lifted, enabling automated testing with a configurable baseline threshold.
The tester supports both rendered (using OpenCVViewer) and headless operation, making it suitable for both interactive debugging and automated CI testing of gripper models.
Usage
Use GripperTester when developing or validating new gripper models to verify they can physically grasp and lift objects. It is particularly useful for unit testing gripper designs and for debugging grasp mechanics with visual feedback.
Code Reference
Source Location
- Repository: ARISE_Initiative_Robosuite
- File: robosuite/models/grippers/gripper_tester.py
Signature
class GripperTester:
def __init__(
self,
gripper,
pos,
quat,
gripper_low_pos,
gripper_high_pos,
box_size=None,
box_density=10000,
step_time=400,
render=True,
)
Import
from robosuite.models.grippers.gripper_tester import GripperTester
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| gripper | GripperModel | Yes | A gripper model instance to be tested |
| pos | str | Yes | (x y z) position to place the gripper, e.g. '0 0 0.3' |
| quat | str | Yes | Rotation quaternion for gripper orientation, e.g. '0 0 1 0' to flip z axis |
| gripper_low_pos | float | Yes | Controls the gripper's low (descended) z position; larger values mean higher |
| gripper_high_pos | float | Yes | Controls the gripper's high (raised) z position; must be larger than gripper_low_pos |
| box_size | None or 3-tuple | No | Size of the box to grasp. Defaults to [0.02, 0.02, 0.02] |
| box_density | int | No | Density of the box to grasp in kg/m^3. Default: 10000 |
| step_time | int | No | Number of simulation steps between gripper actions. Default: 400 |
| render | bool | No | If True, show visual rendering. Default: True |
Outputs
| Name | Type | Description |
|---|---|---|
| object_height | float | Height of the grasped object relative to its default (ground) position |
| simulation_ready | bool | Whether the simulation has been initialized via start_simulation() |
Usage Examples
from robosuite.models.grippers import PandaGripper
from robosuite.models.grippers.gripper_tester import GripperTester
# Create a gripper and tester
gripper = PandaGripper()
tester = GripperTester(
gripper=gripper,
pos="0 0 0.3",
quat="0 0 1 0",
gripper_low_pos=0.04,
gripper_high_pos=-0.02,
box_size=[0.02, 0.02, 0.02],
box_density=10000,
step_time=400,
render=False,
)
# Initialize and run
tester.start_simulation()
tester.loop(total_iters=1, test_y=True, y_baseline=0.01)
tester.close()