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 XML URDF

From Leeroopedia
Knowledge Sources
Domains Physics Simulation, XML Parsing, URDF Format
Last Updated 2026-02-15 04:00 GMT

Overview

Implements the URDF (Unified Robot Description Format) parser for importing robot models into MuJoCo.

Description

xml_urdf.cc provides the mjXURDF class that parses URDF XML documents and converts them into MuJoCo model specifications. It maps URDF joint types (revolute, continuous, prismatic, fixed, floating, planar, and the non-standard spherical) to MuJoCo equivalents, handles link-joint hierarchy construction with parent/child tracking via urName, urParent, and urChildren maps, and supports material (urMat), RGBA color (urRGBA), and geometry name (urGeomNames) mappings. The parser also supports an optional name prefix (urPrefix) for namespace isolation when loading multiple URDF models.

Usage

Called by the XML parser when a URDF document is detected (based on root element), enabling MuJoCo to load standard robot description files used across the robotics ecosystem.

Code Reference

Source Location

Key Functions

mjXURDF::mjXURDF();
mjXURDF::~mjXURDF();
void mjXURDF::Clear(void);
std::string mjXURDF::GetPrefixedName(const std::string& name);

static const mjMap urJoint_map[7];  // revolute, continuous, prismatic,
                                     // fixed, floating, planar, spherical

Import

#include "xml/xml_urdf.h"
#include "user/user_api.h"
#include "xml/xml_util.h"
#include "tinyxml2.h"

I/O Contract

Inputs

Name Type Required Description
XMLElement* tinyxml2::XMLElement* Yes Root URDF element to parse
spec mjSpec* Yes Model specification to populate from URDF data

Outputs

Name Type Description
mjSpec* mjSpec* Populated model specification with URDF-derived bodies, joints, and geoms

Related Pages

Page Connections

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