Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose glb file metadata. #1716

Merged
merged 3 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Copy and pasting the git commit messages is __NOT__ enough.

## [Unreleased]
### Added
- Exposed `.glb` file metadata through the scenario `Scenario.map_glb_metadata` attribute.
### Deprecated
### Changed
### Removed
Expand Down
15 changes: 15 additions & 0 deletions smarts/core/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,21 @@ def map_glb_filepath(self):
"""The map geometry filepath."""
return os.path.join(self._root, "map.glb")

@property
def map_glb_metadata(self):
"""The metadata for the current map glb file."""
metadata = self.map_glb_meta_for_file(self.map_glb_filepath)
return metadata

@staticmethod
@lru_cache(1)
def map_glb_meta_for_file(filepath):
"""The map metadata given a file."""
import trimesh

scene = trimesh.load(filepath)
return scene.metadata

def unique_sumo_log_file(self):
"""A unique logging file for SUMO logging."""
return os.path.join(self._log_dir, f"sumo-{str(uuid.uuid4())[:8]}")
Expand Down