Implementation:Google deepmind Dm control Build Neck
| Knowledge Sources | |
|---|---|
| Domains | Robotics Simulation, Biomechanical Modeling |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
The build_neck module constructs the cervical spine (neck), skull, jaw, and head region of the dog_v2 walker model, including vertebral joints, teeth collision geometry, eyes, and bite sensor sites.
Description
The module provides a single function, create_neck, that builds the neck as a chain of 7 cervical vertebrae (C_7 through C_1) attached sequentially to the torso. Each vertebra receives a bone mesh geom and a sphere collision primitive with progressively decreasing radius. Cervical joints are added with a configurable number of DOFs per vertebra (extend, bend, twist), where the joint axes are computed dynamically from inter-vertebral directions using cross products to derive anatomically correct bend and twist directions. Joint ranges are scaled inversely with the total number of joints per axis to maintain consistent range of motion regardless of the DOF count.
The skull is attached to C_1 with bone meshes for the cranium, ethmoid, vomer, eyes, and upper teeth, plus iris/pupil geoms for visual detail and multiple collision primitives (ellipsoid, capsule, boxes). An atlas joint connects the skull to the cervical spine. The jaw is attached to the skull with mandible and lower tooth meshes, four box collision primitives at positions along its length, a mandible joint, and upper/lower bite sensor sites. Finally, visible teeth bones are converted to ellipsoid collision geoms by recompiling physics and using bound geometry size data to scale the collision shapes.
This is a modular component of the dog_v2 build pipeline, called by build_dog.py. It encapsulates one of the most anatomically detailed regions of the dog model. The cervical joints returned by this function are later used by add_torque_actuators to create coupled tendon-based spinal actuators.
Usage
Use this module when constructing the dog_v2 walker model. It is called internally by the dog build pipeline (build_dog.py) and is not typically invoked directly by users. It should be called after the torso body and cervical default classes (cervical, cervical_extend, cervical_bend, cervical_twist, atlas, mandible) have been defined.
Code Reference
Source Location
- Repository: Google_deepmind_Dm_control
- File: dm_control/locomotion/walkers/assets/dog_v2/build_neck.py
- Lines: 1-328
Signature
def create_neck(
model,
bone_position,
cervical_dofs_per_vertebra,
bones,
side_sign,
bone_size,
parent,
):
"""Add neck and head in the dog model.
Args:
model: model in which we want to add the neck.
bone_position: a dictionary of bones positions.
cervical_dofs_per_vertebra: a number that determines how many dofs are
going to be used between each pair of cervical vertebrae.
bones: a list of strings with all the names of the bones.
side_sign: a dictionary with two axis representing the signs of
translations.
bone_size: dictionary containing the scale of the geometry.
parent: parent object on which we should start attaching new components.
Returns:
A list of cervical joints.
"""
Import
from dm_control.locomotion.walkers.assets.dog_v2.build_neck import create_neck
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| model | mjcf.RootElement | Yes | The MJCF model to which the neck and head will be added |
| bone_position | dict[str, np.ndarray] | Yes | Dictionary mapping bone names to their 3D positions |
| cervical_dofs_per_vertebra | int/float | Yes | Number of degrees of freedom per cervical vertebra (controls joint density) |
| bones | list[str] | Yes | List of all bone mesh names available in the model |
| side_sign | dict[str, np.ndarray] | Yes | Dictionary with keys '_L' and '_R' for left/right mirroring of translations |
| bone_size | dict[str, np.ndarray] | Yes | Dictionary containing the scale of bone geometry (used for atlas joint positioning) |
| parent | mjcf.Element | Yes | The parent body element on which to start attaching the cervical chain |
Outputs
| Name | Type | Description |
|---|---|---|
| cervical_joints | list[mjcf.Element] | A list of cervical joint elements, used for creating coupled tendon-based spinal actuators |
Usage Examples
Basic Usage
from dm_control.locomotion.walkers.assets.dog_v2.build_neck import create_neck
# Called internally by build_dog.py with model setup already complete:
cervical_joints = create_neck(
model=model,
bone_position=bone_position,
cervical_dofs_per_vertebra=3,
bones=bones,
side_sign=side_sign,
bone_size=bone_size,
parent=torso,
)
# cervical_joints can then be used for actuator creation