Mujoco Model
The MujocoModel
class is the foundational class from which all other model classes extend from in robosuite. This class represents a standardized API for all models used in simulation and is the core modeling component that other model classes build upon. The MujocoXMLModel
is an extension of this class that represents models based on an XML file.
Base Mujoco Model
- class robosuite.models.base.MujocoModel
Base class for all simulation models used in mujoco.
Standardizes core API for accessing models’ relevant geoms, names, etc.
- correct_naming(names)
Corrects all strings in @names by adding the naming prefix to it and returns the name-corrected values
- Parameters
names (str, list, or dict) – Name(s) to be corrected
- Raises
TypeError – [Invalid input type]
- set_sites_visibility(sim, visible)
Set all site visual states for this model.
- Parameters
sim (MjSim) – Current active mujoco simulation instance
visible (bool) – If True, will visualize model sites. Else, will hide the sites.
- exclude_from_prefixing(inp)
A function that should take in an arbitrary input and return either True or False, determining whether the corresponding name to @inp should have naming_prefix added to it. Must be defined by subclass.
- Parameters
inp (any) – Arbitrary input, depending on subclass. Can be str, ET.Element, etc.
- Returns
True if we should exclude the associated name(s) with @inp from being prefixed with naming_prefix
- Return type
bool
- property name
Name for this model. Should be unique.
- Returns
Unique name for this model.
- Return type
str
- property naming_prefix
Generates a standardized prefix to prevent naming collisions
- Returns
Prefix unique to this model.
- Return type
str
- property root_body
Root body name for this model. This should correspond to the top-level body element in the equivalent mujoco xml tree for this object.
- property bodies
Returns: list: Body names for this model
- property joints
Returns: list: Joint names for this model
- property actuators
Returns: list: Actuator names for this model
- property sites
Returns: list: Site names for this model
- property sensors
Returns: list: Sensor names for this model
- property contact_geoms
List of names corresponding to the geoms used to determine contact with this model.
- Returns
relevant contact geoms for this model
- Return type
list
- property visual_geoms
List of names corresponding to the geoms used for visual rendering of this model.
- Returns
relevant visual geoms for this model
- Return type
list
- property important_geoms
Geoms corresponding to important components of this model. String keywords should be mapped to lists of geoms.
- Returns
Important set of geoms, where each set of geoms are grouped as a list and are organized by keyword string entries into a dict
- Return type
dict of list
- property important_sites
used to aid visualization during sim).
- Returns
- Important site geoms, where each specific geom name is mapped from keyword string entries
in the dict
- Return type
dict
- Type
Dict of sites corresponding to the important site geoms (e.g.
- property important_sensors
Dict of important sensors enabled for this model.
- Returns
- Important sensors for this model, where each specific sensor name is mapped from keyword string
entries in the dict
- Return type
dict
- property bottom_offset
Returns vector from model root body to model bottom. Useful for, e.g. placing models on a surface. Must be defined by subclass.
- Returns
(dx, dy, dz) offset vector
- Return type
np.array
- 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
- 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
XML Mujoco Model
- class robosuite.models.base.MujocoXMLModel(fname, idn=0)
Base class for all MujocoModels that are based on a raw XML file.
- Parameters
fname (str) – Path to relevant xml file from which to create this robot instance
idn (int or str) – Number or some other unique identification string for this model instance
- property base_offset
Provides position offset of root body.
- Returns
(x,y,z) pos value of root_body body element. If no pos in element, returns all zeros.
- Return type
3-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