dm_control2gym is a small wrapper to make DeepMind Control Suite environments available for OpenAI Gym.
$ git clone https://github.com/martinseilair/dm_control2gym/
$ cd dm_control2gym
$ pip install .
Tested with Python 3.5.2 and Ubuntu 16.04.
import gym
import dm_control2gym
# make the dm_control environment
env = dm_control2gym.make(domain_name="cartpole", task_name="balance")
# use same syntax as in gym
env.reset()
for t in range(1000):
observation, reward, done, info = env.step(env.action_space.sample()) # take a random action
env.render()
The dm_control specs are converted to spaces. If there is only one entity in the observation dict, the original shape is used for the corresponding space. Otherwise, the observations are vectorized and concatenated. Note, that the pixel observation is processed separately through the render routine.
The difference between the Discrete
and the corresponding ArraySpec
with type np.int
, is that the domain ArraySpec
is arbitrary and of that the domain of Discrete
always starts at 0. Therefore, the domain is shifted to obtain a valid Discrete
space.
Three rendering modes are available:
human
: Render scene and show itrgb_array
: Render scene and return it as rgb arrayhuman_rgb_array
: Render scene, show and return it
swimmer
:swimmer_n
k
: number of links
stacker
:stack_k
k
: number of boxes (max. 4)
lqr
:lqr_n_m
n
: number of massesm
: number of actuated masses
cartpole
:k_poles
k
: number of poles
Example
env = dm_control2gym.make(domain_name="cartpole", task_name="k_poles",task_kwargs={'k':10})
2018-01-25: Optimized registering process (thanks to rejuvyesh), added access to procedurally generated environments