Implementation:ARISE Initiative Robosuite XmlObjects
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, MJCF_Modeling |
| Last Updated | 2026-02-15 07:00 GMT |
Overview
The xml_objects module provides a collection of concrete MujocoXMLObject subclasses that load pre-defined simulation objects from MJCF XML files, including everyday items, task-specific objects, and visual fiducial markers.
Description
This module contains 15 ready-to-use object classes that wrap MJCF XML model files. Each class extends MujocoXMLObject and specifies its corresponding XML file path (resolved via xml_path_completion()), default joint configuration, geom type, and collision geom duplication settings.
The physical objects include: BottleObject, CanObject (coke can for PickPlace), LemonObject, MilkObject (milk carton for PickPlace), BreadObject (bread loaf for PickPlace), CerealObject (cereal box for PickPlace), SquareNutObject (for NutAssembly), RoundNutObject (for NutAssembly), PlateWithHoleObject (for PegInHole), and DoorObject (for Door task). Most physical objects use a free joint with a small damping value (0.0005), while PlateWithHoleObject and DoorObject have no top-level joints since they are fixed in their respective tasks.
Visual fiducial objects include MilkVisualObject, BreadVisualObject, CerealVisualObject, and CanVisualObject. These are visual-only (no physics) objects with no joints, used in the PickPlace task as goal position indicators. They are created with obj_type="visual" and joints=None.
The DoorObject is the most complex class, supporting configurable friction and damping parameters that are applied directly to the hinge joint in the XML. It also supports a lock variant that loads a different XML file, and exposes named body references (door_body, frame_body, latch_body) and a hinge joint name. Both SquareNutObject and RoundNutObject override important_sites to include a "handle" site for nut placement detection. DoorObject similarly adds a "handle" important site.
Usage
Use these classes to instantiate standard robosuite task objects. They are the primary objects used in built-in tasks like PickPlace, NutAssembly, PegInHole, and Door. Use the visual fiducial variants as goal markers that do not participate in physics simulation.
Code Reference
Source Location
- Repository: ARISE_Initiative_Robosuite
- File: robosuite/models/objects/xml_objects.py
Signature
class BottleObject(MujocoXMLObject):
def __init__(self, name)
class CanObject(MujocoXMLObject):
def __init__(self, name)
class LemonObject(MujocoXMLObject):
def __init__(self, name)
class MilkObject(MujocoXMLObject):
def __init__(self, name)
class BreadObject(MujocoXMLObject):
def __init__(self, name)
class CerealObject(MujocoXMLObject):
def __init__(self, name)
class SquareNutObject(MujocoXMLObject):
def __init__(self, name)
class RoundNutObject(MujocoXMLObject):
def __init__(self, name)
class PlateWithHoleObject(MujocoXMLObject):
def __init__(self, name)
class DoorObject(MujocoXMLObject):
def __init__(self, name, friction=None, damping=None, lock=False)
# Visual fiducial objects:
class MilkVisualObject(MujocoXMLObject):
def __init__(self, name)
class BreadVisualObject(MujocoXMLObject):
def __init__(self, name)
class CerealVisualObject(MujocoXMLObject):
def __init__(self, name)
class CanVisualObject(MujocoXMLObject):
def __init__(self, name)
Import
from robosuite.models.objects.xml_objects import (
BottleObject, CanObject, LemonObject, MilkObject,
BreadObject, CerealObject, SquareNutObject, RoundNutObject,
PlateWithHoleObject, DoorObject,
MilkVisualObject, BreadVisualObject, CerealVisualObject, CanVisualObject,
)
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| name | str | Yes | Unique name for this object instance |
Inputs (DoorObject additional)
| Name | Type | Required | Description |
|---|---|---|---|
| friction | 3-tuple of float or None | No | Friction parameters to override the XML-defined hinge friction |
| damping | float or None | No | Damping parameter to override the XML-defined hinge damping |
| lock | bool | No | If True, loads the locked door variant. Default: False |
Outputs
| Name | Type | Description |
|---|---|---|
| root_body | str | Prefix-corrected root body name |
| contact_geoms | list of str | Collision geom names |
| visual_geoms | list of str | Visual geom names |
| important_sites | dict | Task-relevant sites. SquareNutObject and RoundNutObject include "handle" site. DoorObject includes "handle" site. |
| bottom_offset | np.array | From bottom_site in the XML |
| top_offset | np.array | From top_site in the XML |
| horizontal_radius | float | From horizontal_radius_site in the XML |
Usage Examples
from robosuite.models.objects.xml_objects import CanObject, DoorObject, CanVisualObject
# Create a can object
can = CanObject(name="soda_can")
can_xml = can.get_obj()
print(can.root_body) # "soda_can_main"
print(can.contact_geoms) # collision geoms
# Create a door with custom friction
door = DoorObject(name="front_door", friction=0.5, damping=0.1, lock=True)
print(door.door_body) # "front_door_door"
print(door.hinge_joint) # "front_door_hinge"
print(door.important_sites) # includes "handle" key
# Create a visual-only can as a goal marker
can_goal = CanVisualObject(name="can_goal")
# This object has no physics, only visual rendering