dm-control (single agent)#

Installation#

pip install shimmy[dm-control]

Usage (Single agent)#

import gymnasium as gym

env = gym.make("dm_control/acrobot_swingup_sparse-v0")

Class Description#

class shimmy.dm_control_multiagent_compatibility.DmControlMultiAgentCompatibilityV0(env: dm_control.composer.Environment, render_mode: str | None = None)#

This compatibility wrapper converts multi-agent dm-control environments, primarily soccer, into a Pettingzoo environment.

Dm-control is DeepMind’s software stack for physics-based simulation and Reinforcement Learning environments, using MuJoCo physics. This compatibility wrapper converts a dm-control environment into a gymnasium environment.

metadata: Dict[str, Any] = {'render_modes': ['human']}#
possible_agents: List[AgentID]#
observation_space(agent)#

The observation space for agent.

action_space(agent)#

The action space for agent.

render()#

Renders the environment.

close()#

Closes the environment.

reset(seed=None, return_info=False, options=None)#

Resets the dm-control environment.

step(actions)#

Steps through all agents with the actions.

agents: List[AgentID]#
observation_spaces: Dict[AgentID, gymnasium.spaces.Space]#
action_spaces: Dict[AgentID, gymnasium.spaces.Space]#
class shimmy.dm_control_compatibility.DmControlCompatibilityV0(env: composer.Environment | control.Environment | dm_env.Environment, render_mode: str | None = None, render_height: int = 84, render_width: int = 84, camera_id: int = 0)#

This compatibility wrapper converts a dm-control environment into a gymnasium environment.

Dm-control is DeepMind’s software stack for physics-based simulation and Reinforcement Learning environments, using MuJoCo physics.

Dm-control actually has two Environments classes, dm_control.composer.Environment and dm_control.rl.control.Environment that while both inherit from dm_env.Environment, they differ in implementation.

For environment in dm_control.suite are dm-control.rl.control.Environment while dm-control locomotion and manipulation environments use dm-control.composer.Environment.

This wrapper supports both Environment class through determining the base environment type.

Note

dm-control uses np.random.RandomState, a legacy random number generator while gymnasium uses np.random.Generator, therefore the return type of np_random is different from expected.

metadata: dict[str, Any] = {'render_fps': 10, 'render_modes': ['human', 'rgb_array']}#
observation_space: spaces.Space[ObsType]#
action_space: spaces.Space[ActType]#
reset(*, seed: int | None = None, options: dict[str, Any] | None = None) tuple[ObsType, dict[str, Any]]#

Resets the dm-control environment.

step(action: np.ndarray) tuple[ObsType, float, bool, bool, dict[str, Any]]#

Steps through the dm-control environment.

render() np.ndarray | None#

Renders the dm-control env.

close()#

Closes the environment.

property np_random: RandomState#

This should be np.random.Generator but dm-control uses np.random.RandomState.