How to test/run OpenGL visualization?
See original GitHub issueHi,
I installed dm_control yesterday on an Ubuntu 16.04LTS system with NVIDIA graphics card. I have already installed --and work with-- mjpro150 and 131 (both mujoco-py and custom C++ interface) so I know those work fine.
I created the following “quickstart” script, using the provided one in the README:
import numpy as np
from dm_control import suite
# Load one task:
env = suite.load(domain_name="humanoid", task_name="stand", visualize_reward=True)
# Iterate over a task set:
for domain_name, task_name in suite.BENCHMARKING:
env = suite.load(domain_name, task_name)
# Reset data
action_spec = env.action_spec()
time_step = env.reset()
# Step through an episode and print out reward, discount and observation.
while not time_step.last():
action = np.random.uniform(action_spec.minimum,
action_spec.maximum,
size=action_spec.shape)
time_step = env.step(action)
pixels = env.physics.render()
print(time_step.reward, time_step.discount, time_step.observation)
It “seems” to run since the print() call in the loop does indeed output such as:
0.9902381173079999 1.0 OrderedDict([('orientations', array([ 0.92190494, -0.38741616, 0.75086908, -0.66045108, 0.34782824,
0.93755827, 0.01050299, 0.99994484, -0.34440243, -0.93882211,
-0.02782136, -0.99961291, 0.52972116, -0.84817185])), ('height', 1.2930647420729058), ('velocity', array([ -0.49068857, 0.54707421, 2.52160751, 4.02860209,
-1.37774209, -4.43418408, 9.91898924, -14.24762728,
0.23987449]))])
However, the MuJoCo OpenGL visualization never starts.
To get set-up, I created a virtualenv environment from scratch with python 3.5.2 as default (via PyCharm).
Also, I have to report that there is no Ubuntu package for libglew2.0 via apt-get on 16.04LTS. I had to download it from here and I not sure if this was the proper solution. I would appreciate it if someone who got it to work on Ubuntu 16.04 can report their steps.
Cheers,
Vassilios
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:17 (2 by maintainers)
Apparently
libglew2.0
doesn’t exist until zesty (i.e. Ubuntu 17). For xenial (i.e. 16.04LTS) you can uselibglew1.13
instead, see https://packages.ubuntu.com/search?keywords=libglewThe
libglfw3
package should work in all recent versions of Ubuntu. Alternatively, as @efagerho suggested you can also install the-dev
packages which will also pull in headers too, but this shouldn’t be necessary.import matplotlib.pyplot as plt … plt.imshow(env.physics.render(height, width, camera_id=0)) plt.show(block=False) plt.pause(.01)
any news?