vikashplus / robohive

A unified framework for robot learning
https://sites.google.com/view/robohive
Apache License 2.0
489 stars 82 forks source link

Headless Run #146

Closed maytusp closed 3 months ago

maytusp commented 3 months ago

Hello,

I've installed RoboHive on the remote server. I wonder how to run this script headless:

python -m robohive.utils.examine_env -e FrankaReachRandom-v0

Thank you

vikashplus commented 3 months ago

Check Wiki/Tutorials for the following section -

How to explore an environment offscreen?

maytusp commented 3 months ago

Thank you for your help.

python -m robohive.utils.examine_env -e FrankaReachRandom-v0 --render offscreen

Here are some tips I want to share.

The command above returns some errors on my server.

File "/mnt/iusers01/fatpou01/compsci01/n70579mp/robot/robohive/robohive/renderer/mj_renderer.py", line 107, in render_offscreen self.setup_renderer(self._sim.model.ptr, width=width, height=height) File "/mnt/iusers01/fatpou01/compsci01/n70579mp/robot/robohive/robohive/renderer/mj_renderer.py", line 48, in setup_renderer self._renderer = mujoco.Renderer(model, height=height, width=width) File "/mnt/iusers01/fatpou01/compsci01/n70579mp/.conda/envs/habitat/lib/python3.9/site-packages/mujoco/renderer.py", line 83, in init self._mjr_context = _render.MjrContext( mujoco.FatalError: an OpenGL platform library has not been loaded into this process, this most likely means that a valid OpenGL context has not been created before mjr_makeContext was called Exception ignored in: <function Renderer.del at 0x2b3117f76940> Traceback (most recent call last): File "/mnt/iusers01/fatpou01/compsci01/n70579mp/.conda/envs/habitat/lib/python3.9/site-packages/mujoco/renderer.py", line 330, in del self.close() File "/mnt/iusers01/fatpou01/compsci01/n70579mp/.conda/envs/habitat/lib/python3.9/site-packages/mujoco/renderer.py", line 318, in close if self._mjr_context: AttributeError: 'Renderer' object has no attribute '_mjr_context'

I've solved it with the following commands before running python.

# Create the display:
Xvfb :100 -ac &
PID1=$!
export DISPLAY=:100.0

Now, it works perfectly.

vikashplus commented 3 months ago

Seems like its failing to initialize the mujoco renderer on your servers by default. Thanks for sharing your fix.