Git Product home page Git Product logo

dm_control2gym's Introduction

dm_control2gym

dm_control2gym is a small wrapper to make DeepMind Control Suite environments available for OpenAI Gym.

Installation

$ git clone https://github.com/martinseilair/dm_control2gym/
$ cd dm_control2gym
$ pip install .

Tested with Python 3.5.2 and Ubuntu 16.04.

Quick start

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()

Short documentation

Spaces and Specs

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.

Rendering

Three rendering modes are available by default:

  • human: Render scene and show it
  • rgb_array: Render scene and return it as rgb array
  • human_rgb_array: Render scene, show and return it

You can create your own rendering modes before making the environment by:

dm_control2gym.create_render_mode(name, show=True, return_pixel=False, height=240, width=320, camera_id=-1, overlays=(),
             depth=False, scene_option=None)
  • name: name of rendering mode
  • show: rendered image is shown
  • return_pixel: return the rendered image

It is possible to render in different render modes subsequently. Output of several render modes can be visualized at the same time.

Procedurally generated environments

  • swimmer: swimmer_n
    • k: number of links
  • stacker: stack_k
    • k: number of boxes (max. 4)
  • lqr: lqr_n_m
    • n: number of masses
    • m: number of actuated masses
  • cartpole: k_poles
    • k: number of poles
    • swing_up: balance or swing_up task (default=TRUE)
    • sparse: use sparse reward variant (default=FALSE)

Example

env = dm_control2gym.make(domain_name="cartpole", task_name="k_poles",task_kwargs={'k':10})

What's new

2018-01-25: Optimized registering process (thanks to rejuvyesh), added access to procedurally generated environments, added render mode functionality

dm_control2gym's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.