MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / id2name

Method id2name

dm_control/mujoco/wrapper/core.py:362–379  ·  view source on GitHub ↗

Returns the name associated with a MuJoCo object ID, if there is one. Args: object_id: Integer ID. object_type: The type of the object. Can be either a lowercase string (e.g. 'body', 'geom') or an `mjtObj` enum value. Returns: A string containing the object name,

(self, object_id, object_type)

Source from the content-addressed store, hash-verified

360 return obj_id
361
362 def id2name(self, object_id, object_type):
363 """Returns the name associated with a MuJoCo object ID, if there is one.
364
365 Args:
366 object_id: Integer ID.
367 object_type: The type of the object. Can be either a lowercase string
368 (e.g. 'body', 'geom') or an `mjtObj` enum value.
369
370 Returns:
371 A string containing the object name, or an empty string if the object ID
372 either doesn't exist or has no name.
373
374 Raises:
375 Error: If `object_type` is not a valid MuJoCo object type.
376 """
377 if isinstance(object_type, str):
378 object_type = _str2type(object_type)
379 return mujoco.mj_id2name(self.ptr, object_type, object_id) or ""
380
381 @contextlib.contextmanager
382 def disable(self, *flags):

Callers 13

_get_sensor_namesMethod · 0.80
egocentric_stateMethod · 0.80
action_specMethod · 0.80
nameMethod · 0.80
get_action_specMethod · 0.80
createFunction · 0.80
exclude_contactsFunction · 0.80
mainFunction · 0.80
testNamesIdsMethod · 0.80

Calls 1

_str2typeFunction · 0.85

Tested by 4

testNamesIdsMethod · 0.64
testNamelessObjectMethod · 0.64