-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
oliverweissl
committed
Apr 30, 2024
1 parent
51b2d28
commit dd9050b
Showing
11 changed files
with
301 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
from abc import ABC, abstractmethod | ||
from typing import Any | ||
|
||
|
||
class Viewer(ABC): | ||
"""An abstract viewer class, enabling the rendering of simulations.""" | ||
|
||
@abstractmethod | ||
def close(self) -> None: | ||
"""Close the viewer.""" | ||
|
||
@abstractmethod | ||
def render(self) -> Any | None: | ||
""" | ||
Render the scene on the viewer. | ||
:returns: Nothing or feedback. | ||
""" | ||
|
||
@abstractmethod | ||
def current_viewport_size(self) -> tuple[int, int]: | ||
""" | ||
Get the current viewport size. | ||
:returns: The size as a tuple. | ||
""" | ||
|
||
@property | ||
@abstractmethod | ||
def view_port(self) -> Any: | ||
""" | ||
Get the viewport. | ||
:returns: The viewport object. | ||
""" | ||
|
||
@property | ||
@abstractmethod | ||
def context(self) -> Any: | ||
""" | ||
Return the viewer context. | ||
:returns: The context object. | ||
""" | ||
|
||
@property | ||
@abstractmethod | ||
def can_record(self) -> bool: | ||
""" | ||
Check if this viewer can record. | ||
:returns: The truth. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
simulators/mujoco_simulator/revolve2/simulators/mujoco_simulator/viewers/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"""Different viewer implementations for mujoco.""" | ||
|
||
from ._custom_mujoco_viewer import CustomMujocoViewer, CustomMujocoViewerMode | ||
from ._native_mujoco_viewer import NativeMujocoViewer | ||
from ._viewer_type import ViewerType | ||
|
||
__all__ = [ | ||
"CustomMujocoViewer", | ||
"CustomMujocoViewerMode", | ||
"NativeMujocoViewer", | ||
"ViewerType", | ||
] |
Oops, something went wrong.