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 User Flexcomp

From Leeroopedia
Knowledge Sources
Domains Physics Simulation, Deformable Bodies
Last Updated 2026-02-15 04:00 GMT

Overview

Implements the mjCFlexcomp class for generating flexible (deformable) composite objects from grids, meshes, and GMSH files.

Description

user_flexcomp.cc provides the logic for creating flexible deformable objects in MuJoCo, supporting multiple generation types including grid, box, cylinder, ellipsoid, square, disc, circle, mesh, GMSH, and direct specification. It reads vertex and element data from external resources (including GMSH v2.2 and v4.1 formats), handles binary and ASCII data, and generates the underlying flex elements with configurable spacing, scaling, and degrees of freedom (full, radial, trilinear, quadratic).

Usage

Used during model parsing when a flexcomp element is encountered in MJCF XML, generating the deformable body structure with vertices, elements, and connectivity.

Code Reference

Source Location

Key Functions

mjCFlexcomp::mjCFlexcomp(void);
bool mjCFlexcomp::Make(mjsBody* body, char* error, int error_sz);
bool mjCFlexcomp::MakeGrid(char* error, int error_sz);
bool mjCFlexcomp::MakeMesh(mjCModel* model, mjsCompiler* compiler, char* error, int error_sz);
bool mjCFlexcomp::MakeGMSH(mjCModel* model, mjsCompiler* compiler, char* error, int error_sz);
void mjCFlexcomp::LoadGMSH(mjCModel* model, mjResource* resource);

Import

#include "user/user_flexcomp.h"

I/O Contract

Inputs

Name Type Required Description
body mjsBody* Yes Parent body for the flexcomp
model mjCModel* Yes (for mesh/GMSH) Model for resource loading
compiler mjsCompiler* Yes (for mesh/GMSH) Compiler settings for file paths
error char* No Buffer for error messages
error_sz int No Size of error buffer

Outputs

Name Type Description
bool bool True on success, false on failure with error message

Related Pages

Page Connections

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