Implementation:Google deepmind Mujoco User Objects
| Knowledge Sources | |
|---|---|
| Domains | Physics Simulation, Model Objects |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
Implements the C++ classes for all MuJoCo model objects including bodies, joints, geoms, textures, materials, sensors, and actuators.
Description
user_objects.cc is the largest file in the user module (8206 lines) and implements the concrete behavior of all MuJoCo specification object types. It includes PNGImage loading via lodepng, and provides the implementation for classes such as mjCBody, mjCJoint, mjCGeom, mjCSite, mjCCamera, mjCLight, mjCTexture, mjCMaterial, mjCSensor, mjCActuator, and many more. Each class handles its own compilation, validation, and conversion to the runtime format.
Usage
Used throughout the model compilation pipeline as the implementations of all model object types, from initial creation through parsing to final compilation into an mjModel.
Code Reference
Source Location
- Repository: Google_deepmind_Mujoco
- File: src/user/user_objects.cc
- Lines: 1-8206
Key Functions
class PNGImage {
public:
static PNGImage Load(const mjCBase* obj, mjResource* resource,
LodePNGColorType color_type);
int Width() const;
int Height() const;
bool IsSRGB() const;
mjByteVec&& MoveData() &&;
};
Import
#include "user/user_objects.h"
#include "lodepng.h"
#include <mujoco/mujoco.h>
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| obj | const mjCBase* | Yes | Base object providing context for resource loading |
| resource | mjResource* | Yes | Resource handle for file data |
| color_type | LodePNGColorType | Yes | PNG color type for texture loading |
Outputs
| Name | Type | Description |
|---|---|---|
| PNGImage | PNGImage | Loaded PNG image with width, height, sRGB flag, and pixel data |
| compiled objects | various | Compiled model objects ready for runtime use |