﻿# MuJoCo weld activation: enabling a constraint does not capture the current pose

Inspect body-based relpose and site-based weld targets before enabling a MuJoCo constraint after moving bodies to a new configuration.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/simulation-mujoco-weld-activation-reference-not-capture/
Language: en

## A simulated latch needs a defined target

A twin moves an object near a fixture and enables a previously inactive weld to represent latching. The bodies unexpectedly move toward an earlier relative configuration. The application assumed activation would freeze whatever pose happened to exist at that instant. Inspect the constraint target separately from its active flag. Enabling a relation and defining that relation are different operations; a valid active constraint can be faithfully enforcing a target the application did not intend.

## Read the body-based reference semantics

The [weld specification](https://mujoco.readthedocs.io/en/3.3.7/XMLreference.html) defines a body-based relative pose. Its special default, with an all-zero quaternion part, means using the model reference relation rather than an identity rotation literal. An explicitly authored relative pose has its own meaning. Neither case says that changing eq_active samples the current bodies and rewrites the target. Retain the compiled reference and understand how it was obtained before treating activation as a physically instantaneous attachment operation.

## Distinguish site alignment from body data

The specification also provides a site-based weld that aligns the selected site frames. In that mode, changing site pose can change the constraint target; ordinary body-based equality data is not the same target source. The inspected [constraint source](https://raw.githubusercontent.com/google-deepmind/mujoco/3.3.7/src/engine/engine_core_constraint.c) branches between body-derived anchors and site positions, then constructs orientation residuals accordingly. A utility that edits body-based relative-pose data should not be assumed to retarget a site-based weld. Record which semantic variant the model actually compiled.

## Propose a residual-before-activation fixture

A proposed nonactuating fixture should inspect the configured target and current relative transform before activation. Compare a state satisfying the target with a deliberately displaced state, then inspect the resulting weld residual at a declared forward-computation boundary. Repeat separately for body and site definitions if both are supported by the application. This reveals what would be enforced without interpreting a sudden corrective motion as measured latch physics. No activation experiment was run here.

## Accept the intended relation and its transition policy

Retain constraint identity, semantic variant, reference data, active-state transition and current relative pose. If the application retargets before activation, document that explicit operation and verify the resulting residual rather than assuming it occurred. Constraint softness and integration settings affect subsequent correction, while activation alone does not model impact, attachment strength or breakaway behavior. Decide how a mismatch is rejected or handled before allowing the twin to continue under a misleading attachment label.

## Keep equality modeling separate from physical attachment

The [PartNet articulation guide](/journal/fg2-partnet-mobility-urdf-load-missing-mesh-cross-engine/) addresses another model-completeness boundary; [software reproducibility](/journal/software-stack-reproducibility/) supports retaining compiled constraint definitions. Here acceptance means that the activated weld enforces the intended configured relation. It does not establish a real grasp, latch force or collision-safe connection. Those physical interpretations require additional models and observations rather than borrowing authority from the active flag of a soft equality constraint.
