initial commit, add gello software code and instructions
This commit is contained in:
parent
e7d842ad35
commit
18cc23a38e
70 changed files with 5875 additions and 4 deletions
23
gello/dm_control_tasks/mjcf_utils.py
Normal file
23
gello/dm_control_tasks/mjcf_utils.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from pathlib import Path
|
||||
from typing import List
|
||||
|
||||
from dm_control import mjcf
|
||||
|
||||
# Path to the root of the project.
|
||||
_PROJECT_ROOT: Path = Path(__file__).parent.parent.parent
|
||||
|
||||
# Path to the Menagerie submodule.
|
||||
MENAGERIE_ROOT: Path = _PROJECT_ROOT / "third_party" / "mujoco_menagerie"
|
||||
|
||||
|
||||
def safe_find_all(
|
||||
root: mjcf.RootElement,
|
||||
feature_name: str,
|
||||
immediate_children_only: bool = False,
|
||||
exclude_attachments: bool = False,
|
||||
) -> List[mjcf.Element]:
|
||||
"""Find all given elements or throw an error if none are found."""
|
||||
features = root.find_all(feature_name, immediate_children_only, exclude_attachments)
|
||||
if not features:
|
||||
raise ValueError(f"No {feature_name} found in the MJCF model.")
|
||||
return features
|
Loading…
Add table
Add a link
Reference in a new issue