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 Suite Finger

From Leeroopedia
Metadata Value
Implementation Suite Finger
Domain Reinforcement_Learning, Control
Source Google_deepmind_Dm_control
Last Updated 2026-02-15 04:00 GMT

Overview

Concrete tool for spinning and turning a hinged body with a two-segment finger provided by the dm_control Control Suite.

Description

The Finger domain models a planar two-segment finger that interacts with a freely rotating body (the "spinner") mounted on a hinge joint. The finger must push against the spinner to either spin it continuously or rotate it to a target angle. The Physics subclass provides methods for reading touch sensor signals (logarithmically scaled), hinge velocity, tip and target positions relative to the hinge, the distance from the tip to the target surface, and bounded joint positions.

Three benchmarking tasks are registered: spin, turn_easy, and turn_hard. The Spin task hides the target and tip visual markers, sets a low hinge damping of 0.03, and gives a sparse reward of 1 when the hinge velocity exceeds 15 rad/s in the negative direction. The Turn task places a spherical target at a random angle around the spinner and rewards the agent when the tip enters the target sphere. The easy variant uses a target radius of 0.07 m while the hard variant uses 0.03 m.

All tasks share a default time limit of 20 seconds and a control timestep of 0.02 seconds. Episode initialization randomizes limited and rotational joints to a collision-free configuration using up to 1000 attempts.

Usage

Use this implementation for dexterous manipulation benchmarks involving contact-rich interactions. Load via suite.load(domain_name='finger', task_name='spin') or the turn_easy/turn_hard variants.

Code Reference

Source Location

Signature

# Task factory functions
def spin(time_limit=20, random=None, environment_kwargs=None)
def turn_easy(time_limit=20, random=None, environment_kwargs=None)
def turn_hard(time_limit=20, random=None, environment_kwargs=None)

# Physics subclass
class Physics(mujoco.Physics):
    def touch(self)             # log-scaled touch sensor signals
    def hinge_velocity(self)    # velocity of the spinner hinge
    def tip_position(self)      # (x, z) position of tip relative to hinge
    def bounded_position(self)  # joint positions with tip replacing hinge angle
    def velocity(self)          # joint and hinge velocities from sensors
    def target_position(self)   # (x, z) position of target relative to hinge
    def to_target(self)         # vector from tip to target
    def dist_to_target(self)    # signed distance to target surface

# Task classes
class Spin(base.Task):
    def initialize_episode(self, physics)
    def get_observation(self, physics)
    def get_reward(self, physics)

class Turn(base.Task):
    def __init__(self, target_radius, random=None)
    def initialize_episode(self, physics)
    def get_observation(self, physics)
    def get_reward(self, physics)

Import

from dm_control import suite

env = suite.load(domain_name='finger', task_name='spin')

I/O Contract

Inputs

Name Type Required Description
time_limit float No Maximum episode duration in seconds (default 20).
random int, numpy.random.RandomState, or None No Random seed or RNG instance for reproducibility.
environment_kwargs dict or None No Additional keyword arguments forwarded to the Environment constructor.

Outputs

Name Type Description
environment dm_control.rl.control.Environment A fully initialised environment conforming to the dm_env.Environment interface.

Observations

Key Type Description
position numpy array Joint positions with hinge angle replaced by tip (x, z) position.
velocity numpy array Proximal, distal, and hinge velocities from sensors.
touch numpy array Logarithmically scaled touch sensor readings.
target_position numpy array (2,) Target (x, z) position relative to hinge (Turn task only).
dist_to_target float Signed distance to target surface (Turn task only).

Usage Examples

from dm_control import suite

# Load the spin task
env = suite.load(domain_name='finger', task_name='spin')

# Run an episode
time_step = env.reset()
while not time_step.last():
    action = env.action_spec().generate_value()
    time_step = env.step(action)

# Load the easy turn task
env_turn = suite.load(domain_name='finger', task_name='turn_easy')

# Load the hard turn task
env_hard = suite.load(domain_name='finger', task_name='turn_hard')

Related Pages

Page Connections

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