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)
| 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): |