Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:Google deepmind Mujoco mj printModel

From Leeroopedia
Knowledge Sources
Domains Debugging, Model_IO
Last Updated 2026-02-15 06:00 GMT

Overview

Concrete tool for printing a human-readable text dump of all compiled model data provided by the MuJoCo C API.

Description

The mj_printModel function writes a formatted text representation of every field in the compiled mjModel to a file or stdout. It is a convenience wrapper around mj_printFormattedModel with default formatting. The output includes all model sizes, options, and data arrays.

Usage

Call to inspect model contents for debugging. Pass NULL filename to print to stdout.

Code Reference

Source Location

  • Repository: mujoco
  • File: src/engine/engine_print.c
  • Lines: 1209-1211 (wrapper), 539-1205 (implementation)

Signature

void mj_printModel(const mjModel* m, const char* filename);

Import

#include <mujoco/mujoco.h>

I/O Contract

Inputs

Name Type Required Description
m const mjModel* Yes Compiled model to dump
filename const char* No Output file path (NULL for stdout)

Outputs

Name Type Description
file/stdout text Formatted text dump of all model data

Usage Examples

#include <mujoco/mujoco.h>

mjModel* m = mj_loadXML("robot.xml", NULL, error, 1000);
if (m) {
    // Dump model to text file for inspection
    mj_printModel(m, "robot_dump.txt");

    // Or print to stdout
    mj_printModel(m, NULL);

    mj_deleteModel(m);
}

Related Pages

Implements Principle

Page Connections

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