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

Ignore sporadic warnings that make the env crash and jobs terminate #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
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
11 changes: 6 additions & 5 deletions mjrl/envs/mujoco_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

try:
import mujoco_py
from mujoco_py import load_model_from_path, MjSim, MjViewer
from mujoco_py import load_model_from_path, MjSim, MjViewer, ignore_mujoco_warnings
except ImportError as e:
raise error.DependencyNotInstalled("{}. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.)".format(e))

Expand Down Expand Up @@ -113,10 +113,11 @@ def dt(self):
def do_simulation(self, ctrl, n_frames):
for i in range(self.model.nu):
self.sim.data.ctrl[i] = ctrl[i]
for _ in range(n_frames):
self.sim.step()
if self.mujoco_render_frames is True:
self.mj_render()
with ignore_mujoco_warnings():
for _ in range(n_frames):
self.sim.step()
if self.mujoco_render_frames is True:
self.mj_render()

def mj_render(self):
try:
Expand Down