Fix render issue in server render mode (e.g., docker)

px is an 1D array, and cause a runtime error when trying to strip the color channels into RGB. I fixed this by first reshape the px array into am image compatible format first.
This commit is contained in:
YungKC
2019-04-12 17:42:26 -07:00
committed by GitHub
parent c6a43e0a5b
commit 8f9ff5e674

View File

@@ -96,6 +96,7 @@ class MJCFBaseBulletEnv(gym.Env):
renderer=pybullet.ER_BULLET_HARDWARE_OPENGL
)
rgb_array = np.array(px)
rgb_array = np.reshape(np.array(px), (self._render_height, self._render_width, -1))
rgb_array = rgb_array[:, :, :3]
return rgb_array