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 Jumping Ball

From Leeroopedia
Knowledge Sources
Domains Robotics, Reinforcement Learning
Last Updated 2026-02-15 04:00 GMT

Overview

The JumpingBallWithHead and RollingBallWithHead classes implement simple ball-based walkers with a directional head marker, providing lightweight locomotion agents for testing and multi-agent settings.

Description

JumpingBallWithHead extends legacy_base.Walker and loads its MJCF model from the jumping_ball_with_head.xml asset file. Unlike humanoid walkers that use a freejoint, this walker uses three slide joints (x, y, z) for root movement and a steer hinge joint for z-axis rotation. A kick actuator enables the ball to jump. The head geom serves as a directional marker, and optional colored ear sites (red and blue spheres) can be added for agent identification in multi-agent settings with egocentric vision.

The walker supports optional camera control, which exposes two additional actuated degrees of freedom for adjusting the egocentric camera height and tilt. When camera control is enabled, gravity compensation is applied to the camera body during episode initialization to keep it stable. The set_pose method handles the non-standard root joint setup by setting slide joint qpos directly and extracting only the z-angle component from quaternions via arctan2.

RollingBallWithHead extends the jumping ball by removing the kick actuator and joint, creating a simpler rolling-only agent that cannot jump. Both walkers expose a minimal set of observable joints and use the head body as both the root body and sole end effector.

Usage

Use JumpingBallWithHead for simple locomotion tasks that require a jumping capability, or RollingBallWithHead for tasks where only rolling is needed. These walkers are particularly useful for rapid prototyping, testing task implementations without complex body dynamics, and multi-agent settings where lightweight agents are preferred.

Code Reference

Source Location

Signature

class JumpingBallWithHead(legacy_base.Walker):
    def _build(self, name='walker', marker_rgba=None,
               camera_control=False, initializer=None,
               add_ears=False, camera_height=None):
    def _xml_path(self):  # property
    def marker_geoms(self):  # property
    def create_root_joints(self, attachment_frame):
    def set_pose(self, physics, position=None, quaternion=None):
    def initialize_episode(self, physics, unused_random_state):
    def mjcf_model(self):  # property
    def actuators(self):  # cached_property
    def root_body(self):  # cached_property
    def end_effectors(self):  # cached_property
    def observable_joints(self):  # cached_property
    def egocentric_camera(self):  # cached_property
    def ground_contact_geoms(self):  # cached_property

class RollingBallWithHead(JumpingBallWithHead):
    def _build(self, **kwargs):
    def observable_joints(self):  # cached_property

Import

from dm_control.locomotion.walkers.jumping_ball import JumpingBallWithHead
from dm_control.locomotion.walkers.jumping_ball import RollingBallWithHead

I/O Contract

Inputs

Name Type Required Description
name str No Name of the walker (default: 'walker')
marker_rgba array-like No RGBA color for the marker geoms, used to distinguish walkers in multi-agent settings
camera_control bool No If True, exposes actuated camera height and tilt degrees of freedom (default: False)
initializer WalkerInitializer No Optional initializer object for episode pose initialization
add_ears bool No If True, adds colored ear sites for agent identification in egocentric vision (default: False)
camera_height float No Override for the egocentric camera height; None uses the XML default

Outputs

Name Type Description
mjcf_model mjcf.RootElement The walker's MJCF model
actuators list All actuator elements in the model
root_body mjcf element The head_body element serving as root
end_effectors list List containing the head_body as the sole end effector
observable_joints list List containing the kick joint (empty for RollingBallWithHead)
ground_contact_geoms tuple Tuple containing the shell geom for ground contact detection

Usage Examples

from dm_control.locomotion.walkers.jumping_ball import JumpingBallWithHead
from dm_control.locomotion.walkers.jumping_ball import RollingBallWithHead

# Create a jumping ball walker
jumping_walker = JumpingBallWithHead(
    name='player_1',
    marker_rgba=[1, 0, 0, 1],  # red marker
    add_ears=True,               # for egocentric vision
)

# Create a rolling-only ball walker
rolling_walker = RollingBallWithHead(
    name='player_2',
    marker_rgba=[0, 0, 1, 1],  # blue marker
)

# With camera control enabled
camera_walker = JumpingBallWithHead(
    camera_control=True,
    camera_height=0.5,
)

# Attach to arena and create root joints
frame = arena.attach(jumping_walker)
jumping_walker.create_root_joints(frame)

Related Pages

Page Connections

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