Implementation:Google deepmind Dm control Walker Info
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Motion Capture |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
The WalkerInfo class encapsulates routines for modifying a walker's MJCF model to match the proportions and marker layout of a motion capture subject.
Description
WalkerInfo wraps a mocap_pb2.Walker protobuf and provides methods to adapt a walker model so that it physically matches the motion capture data. The class bridges the morphological differences between a generic walker model and a specific motion capture subject.
The rescale_walker method adjusts body subtree proportions by iterating over the protobuf's SubtreeScaling data. For each subtree, it computes a position factor either from parent_length (dividing by the current body position norm) or directly from size_factor, then delegates to rescale.rescale_subtree to recursively scale positions and sizes. If the protobuf specifies a target mass, the method compiles a temporary physics instance to read the current subtree mass, computes a mass factor, and scales all body inertial masses, geom masses, or geom densities accordingly.
The add_marker_sites method creates small sphere sites on walker bodies at positions specified by the protobuf's marker data. These sites are used for motion capture marker tracking and are styled using a dedicated mocap default class for consistent visualization. A compatibility check method ensures the walker's model type matches the protobuf's model enum before any modifications.
Usage
Use WalkerInfo when you need to adapt a walker model to match specific motion capture subject proportions. It is typically invoked through Trajectory.configure_walkers() rather than used directly. This is essential for accurate motion tracking where the simulated walker must match the physical dimensions of the recorded subject.
Code Reference
Source Location
- Repository: Google_deepmind_Dm_control
- File: dm_control/locomotion/mocap/walkers.py
- Lines: 1-97
Signature
class WalkerInfo:
def __init__(self, proto):
def check_walker_is_compatible(self, walker):
def rescale_walker(self, walker):
def add_marker_sites(self, walker, size=0.01, rgba=(0., 0., 1., .3),
default_to_random_position=True, random_state=None):
Import
from dm_control.locomotion.mocap.walkers import WalkerInfo
I/O Contract
Inputs (WalkerInfo.__init__)
| Name | Type | Required | Description |
|---|---|---|---|
| proto | mocap_pb2.Walker | Yes | Protobuf message containing walker model type, scaling data, mass, and marker info |
Inputs (add_marker_sites)
| Name | Type | Required | Description |
|---|---|---|---|
| walker | Walker | Yes | The walker entity to add marker sites to |
| size | float | No | Radius of marker site spheres (default: 0.01) |
| rgba | tuple | No | Color of marker sites (default: blue, semi-transparent) |
| default_to_random_position | bool | No | If True, use random position when marker has no position data (default: True) |
| random_state | numpy.random.RandomState | No | Random state for generating default marker positions |
Outputs
| Name | Type | Description |
|---|---|---|
| rescale_walker() | None | Modifies the walker's MJCF model in-place to match mocap proportions |
| add_marker_sites() | list of mjcf sites | List of created site elements; also sets walker.list_of_site_names
|
Usage Examples
from dm_control.locomotion.mocap.walkers import WalkerInfo
# WalkerInfo is typically used through Trajectory.configure_walkers()
trajectory = loader.get_trajectory('clip_001')
trajectory.configure_walkers(walker)
# Direct usage (less common):
walker_info = WalkerInfo(walker_proto)
walker_info.check_walker_is_compatible(walker)
walker_info.rescale_walker(walker)
marker_sites = walker_info.add_marker_sites(walker)