Skip to content

Commit

Permalink
Update "rgb_array" rendering mode warning and add render_fps metadata (
Browse files Browse the repository at this point in the history
…#52)

* Update rendering

* update version

* Update core.py
  • Loading branch information
qgallouedec authored Jan 2, 2023
1 parent 933b582 commit 175149a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
author = "Quentin Gallouédec"

# The full version, including alpha/beta/rc tags
release = "v3.0.2"
release = "v3.0.3"


# -- General configuration ---------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions panda_gym/envs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ class RobotTaskEnv(gym.Env):
def __init__(self, robot: PyBulletRobot, task: Task) -> None:
assert robot.sim == task.sim, "The robot and the task must belong to the same simulation."
self.sim = robot.sim
self.metadata["render_fps"] = 1 / self.sim.dt
self.robot = robot
self.task = task
observation, _ = self.reset() # required for init; seed can be changed later
Expand Down
10 changes: 6 additions & 4 deletions panda_gym/pybullet.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ def render(
if self.render_mode == "rgb_array":
if self.connection_mode == p.DIRECT:
warnings.warn(
"The use of the render method is not recommended when the environment "
"has not been created with render_mode='human'. The rendering will probably be weird. "
"Prefer making the environment with option `render_mode='rgb_array'. For example: "
"`env = gym.make('PandaReach-v3', render_mode='rgb_array')`.",
"You have set 'render_mode' to be 'rgb_array'. This is correct if you want to render the "
"environment without an OpenGL engine. However, this option does not support transparency "
"or background rendering and may result in lower quality rendering. To improve the rendering "
"quality, we recommend that you use render_mode='human' instead. The render() method will "
"return a more qualitative rendering of the environment. "
"For example: env = gym.make('PandaReach-v3', render_mode='human').",
UserWarning,
)
view_matrix = self.physics_client.computeViewMatrixFromYawPitchRoll(
Expand Down
2 changes: 1 addition & 1 deletion panda_gym/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.2
3.0.3

0 comments on commit 175149a

Please sign in to comment.