Implementation:ARISE Initiative Robosuite HingedBox
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, MJCF_Modeling |
| Last Updated | 2026-02-15 07:00 GMT |
Overview
HingedBoxObject is a composite body object that demonstrates the CompositeBodyObject functionality, consisting of two box bodies connected by a hinge joint.
Description
The HingedBoxObject class extends CompositeBodyObject to create an articulated object composed of two boxes joined by a hinge. The first box (box1) serves as the base body and is positioned at the origin. The second box (box2) is attached to box1 with a hinge joint that rotates about the y-axis, creating a door-like or flip-top opening mechanism. A visual cylinder geom represents the hinge pin itself.
The hinge joint is positioned at the edge where the two boxes meet, with a limited range of [0, 1.57] radians (0 to 90 degrees) and a small stiffness of 0.0001 to provide slight resistance. Box2 is positioned on top of box1 with edges aligned at the hinge point, calculated as [-(box2_size[0] - box1_size[0]), 0, box1_size[2] + box2_size[2]]. The hinge cylinder is rotated 90 degrees about the x-axis and positioned at the hinge joint location.
When use_texture=True (default), box1 uses a red wood texture ("WoodRed") and box2 uses a blue wood texture ("WoodBlue"). Without textures, the boxes use solid red and blue RGBA colors respectively. The hinge cylinder is always rendered as a yellow-green visual-only geom with no collision properties. The parent-child hierarchy is: box1 at the top level, box2 attached to box1, and the hinge visual attached to box2.
Usage
Use HingedBoxObject as a reference implementation for creating articulated composite objects with CompositeBodyObject, or directly in tasks involving hinged containers, doors, or flip mechanisms that require manipulation of articulated objects.
Code Reference
Source Location
Signature
class HingedBoxObject(CompositeBodyObject):
def __init__(
self,
name,
box1_size=(0.025, 0.025, 0.025),
box2_size=(0.025, 0.025, 0.0125),
use_texture=True,
):
Import
from robosuite.models.objects.composite_body.hinged_box import HingedBoxObject
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| name | str | Yes | Name of this object |
| box1_size | tuple(3) | No | (L, W, H) half-sizes for the first (base) box. Default: (0.025, 0.025, 0.025) |
| box2_size | tuple(3) | No | (L, W, H) half-sizes for the second (hinged) box. Default: (0.025, 0.025, 0.0125) |
| use_texture | bool | No | If True, use wood textures (WoodRed/WoodBlue). Default: True |
Outputs
| Name | Type | Description |
|---|---|---|
| HingedBoxObject instance | CompositeBodyObject | Articulated two-box object with y-axis hinge joint |
Usage Examples
from robosuite.models.objects.composite_body.hinged_box import HingedBoxObject
# Create a default hinged box with wood textures
hinged_box = HingedBoxObject(name="my_hinged_box")
# Create a hinged box with custom sizes and solid colors
hinged_box = HingedBoxObject(
name="large_hinged_box",
box1_size=(0.05, 0.05, 0.05),
box2_size=(0.05, 0.05, 0.025),
use_texture=False,
)
# The hinge joint allows rotation from 0 to 90 degrees about the y-axis
# Joint name: "box_hinge" (with appropriate naming prefix)