Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Google deepmind Dm control Viewer Launch For Manipulation

From Leeroopedia
Metadata
Knowledge Sources dm_control
Domains Reinforcement Learning, Robotics Simulation, Visualization
Last Updated 2026-02-15 00:00 GMT

Overview

Concrete tool for visualizing manipulation tasks using the dm_control interactive viewer, launched via the viewer.launch() function or the manipulation/explore.py script.

Description

dm_control provides two complementary components for visualization of manipulation environments:

viewer.launch() (dm_control/viewer/__init__.py):

  • Creates an application.Application window with the specified title and dimensions (default 1024x768).
  • Calls app.launch(environment_loader, policy) to begin the interactive render loop.
  • The environment_loader parameter accepts either a callable that returns a dm_env-compatible environment, or a pre-built environment instance.
  • The optional policy parameter accepts a callable that takes a TimeStep and returns an action conforming to env.action_spec().
  • When no policy is provided, the viewer runs in manual exploration mode.

manipulation/explore.py:

  • A standalone abseil application for interactively exploring manipulation tasks.
  • Defines a --environment_name flag whose choices are constrained to manipulation.ALL.
  • If no environment name is provided on the command line, it prints all available environment names and prompts the user to select one interactively.
  • Wraps manipulation.load in a functools.partial to create a zero-argument environment loader, then passes it to viewer.launch().

The viewer provides real-time MuJoCo rendering with interactive camera control, pause/resume, single-stepping, episode reset, and optional overlays for contact forces, joint axes, and other debug visualizations.

Usage

Developers use explore.py from the command line for quick visual inspection of any manipulation task. Programmatic users call viewer.launch() directly when they want to visualize a custom loader or attach a trained policy for visual evaluation.

Code Reference

Attribute Value
Source Locations dm_control/viewer/__init__.py, lines 22--40
dm_control/manipulation/explore.py, lines 26--61
Signatures viewer.launch(environment_loader, policy=None, title='Explorer', width=1024, height=768)
Import from dm_control import viewer

I/O Contract

Inputs

Parameter Type Required Description
environment_loader Callable[[], dm_env.Environment] or dm_env.Environment Yes A callable that returns an environment, or a pre-built environment instance.
policy Callable[[dm_env.TimeStep], np.ndarray] or None No A policy function that maps timesteps to actions. None enables manual exploration.
title str No Window title. Default: 'Explorer'.
width int No Window width in pixels. Default: 1024.
height int No Window height in pixels. Default: 768.

Outputs

Return Type Description
None The function blocks until the viewer window is closed. It does not return a value.

Usage Examples

# Launch the explore script from the command line.
# This opens an interactive viewer for the specified task.
# $ python -m dm_control.manipulation.explore --environment_name reach_site_features
import functools
from dm_control import manipulation
from dm_control import viewer

# Programmatically launch the viewer for a specific task.
loader = functools.partial(manipulation.load, environment_name='reach_duplo_features')
viewer.launch(loader)
import functools
import numpy as np
from dm_control import manipulation
from dm_control import viewer

# Launch the viewer with a random policy.
env_name = 'lift_brick_features'
loader = functools.partial(manipulation.load, environment_name=env_name)

def random_policy(timestep):
    spec = manipulation.load(env_name).action_spec()
    return np.random.uniform(spec.minimum, spec.maximum, size=spec.shape)

viewer.launch(loader, policy=random_policy)
from dm_control import manipulation
from dm_control import viewer

# Launch with a pre-built environment instance (no loader callable needed).
env = manipulation.load('reach_site_features', seed=42)
viewer.launch(env)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment