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 Mujoco MJX Collision Types

From Leeroopedia
Knowledge Sources
Domains Physics_Simulation, JAX, Collision_Detection
Last Updated 2026-02-15 04:00 GMT

Overview

Base type definitions for the MJX collision system, defining the Collision result tuple and PyTreeNode dataclasses for GeomInfo, ConvexInfo, HFieldInfo, and FunctionKey.

Description

This module provides the foundational data types shared across all collision sub-modules. The Collision type alias is a tuple of (distance, position, frame) jax.Arrays returned by all collision functions. GeomInfo holds position, rotation matrix, and size for primitive shapes. ConvexInfo extends this with vertex, face, normal, and edge data for convex meshes. HFieldInfo stores height field grid data. FunctionKey is a frozen dataclass that determines how geom pairs are grouped in the collision function table, keyed on geom types, mesh data IDs, condim, and optional subgrid size.

Usage

Imported by collision_primitive.py, collision_convex.py, collision_sdf.py, and collision_driver.py as the shared type vocabulary for the entire collision pipeline.

Code Reference

Source Location

Key Classes

# Type alias
Collision = Tuple[jax.Array, jax.Array, jax.Array]

class GeomInfo(PyTreeNode):
    pos: jax.Array
    mat: jax.Array
    size: jax.Array

class ConvexInfo(PyTreeNode):
    pos: jax.Array
    mat: jax.Array
    size: jax.Array
    vert: jax.Array
    face: jax.Array
    face_normal: jax.Array
    edge: jax.Array
    edge_face_normal: jax.Array

class HFieldInfo(PyTreeNode):
    pos: jax.Array
    mat: jax.Array
    size: np.ndarray
    nrow: int
    ncol: int
    data: jax.Array

@dataclasses.dataclass(frozen=True)
class FunctionKey:
    types: Tuple[int, int]
    data_ids: Tuple[int, int]
    condim: int
    subgrid_size: Tuple[int, int] = (-1, -1)

Import

from mujoco.mjx._src.collision_types import Collision
from mujoco.mjx._src.collision_types import GeomInfo
from mujoco.mjx._src.collision_types import ConvexInfo
from mujoco.mjx._src.collision_types import FunctionKey

I/O Contract

Inputs

Name Type Required Description
(N/A - type definitions) -- -- This module defines types rather than processing inputs

Outputs

Name Type Description
GeomInfo PyTreeNode Geom shape data for primitive collision functions
ConvexInfo PyTreeNode Extended geom data for convex mesh collision
HFieldInfo PyTreeNode Height field grid data for terrain collision
FunctionKey dataclass Key for grouping geom pairs in the collision function table

Related Pages

Page Connections

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