From 2b45b39ce5783e75ecc556c4cd3e265ce155dace Mon Sep 17 00:00:00 2001 From: Yuval Tassa Date: Sun, 24 Aug 2025 23:44:25 -0700 Subject: [PATCH] Move `mjtConstraint` from `mjmodel.h` to `mjdata.h`. PiperOrigin-RevId: 798987338 Change-Id: I3117742de7eb3c16366f266fe0c0651262717cb4 --- doc/APIreference/APItypes.rst | 22 ++++++++++---------- doc/includes/references.h | 20 +++++++++---------- include/mujoco/mjdata.h | 12 +++++++++++ include/mujoco/mjmodel.h | 12 ----------- python/mujoco/introspect/enums.py | 30 ++++++++++++++-------------- unity/Runtime/Bindings/MjBindings.cs | 20 +++++++++---------- 6 files changed, 58 insertions(+), 58 deletions(-) diff --git a/doc/APIreference/APItypes.rst b/doc/APIreference/APItypes.rst index 59523a4c..783ff2d0 100644 --- a/doc/APIreference/APItypes.rst +++ b/doc/APIreference/APItypes.rst @@ -328,17 +328,6 @@ MuJoCo object types. These are used, for example, in the support functions :ref: .. mujoco-include:: mjtObj -.. _mjtConstraint: - -mjtConstraint -~~~~~~~~~~~~~ - -Constraint types. These values are not used in mjModel, but are used in the mjData field ``d->efc_type`` when the list -of active constraints is constructed at each simulation time step. - -.. mujoco-include:: mjtConstraint - - .. _mjtSensor: mjtSensor @@ -431,6 +420,17 @@ State component elements as integer bitflags and several convenient combinations .. mujoco-include:: mjtState +.. _mjtConstraint: + +mjtConstraint +~~~~~~~~~~~~~ + +Constraint types. These values are not used in mjModel, but are used in the mjData field ``d->efc_type`` when the list +of active constraints is constructed at each simulation time step. + +.. mujoco-include:: mjtConstraint + + .. _mjtConstraintState: mjtConstraintState diff --git a/doc/includes/references.h b/doc/includes/references.h index a0c9d7c3..04dce769 100644 --- a/doc/includes/references.h +++ b/doc/includes/references.h @@ -41,6 +41,16 @@ typedef enum mjtState_ { // state elements mjSTATE_USERDATA, mjSTATE_INTEGRATION = mjSTATE_FULLPHYSICS | mjSTATE_USER | mjSTATE_WARMSTART } mjtState; +typedef enum mjtConstraint_ { // type of constraint + mjCNSTR_EQUALITY = 0, // equality constraint + mjCNSTR_FRICTION_DOF, // dof friction + mjCNSTR_FRICTION_TENDON, // tendon friction + mjCNSTR_LIMIT_JOINT, // joint limit + mjCNSTR_LIMIT_TENDON, // tendon limit + mjCNSTR_CONTACT_FRICTIONLESS, // frictionless contact + mjCNSTR_CONTACT_PYRAMIDAL, // frictional contact, pyramidal friction cone + mjCNSTR_CONTACT_ELLIPTIC // frictional contact, elliptic friction cone +} mjtConstraint; typedef enum mjtConstraintState_ { // constraint state mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact) mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact) @@ -639,16 +649,6 @@ typedef enum mjtObj_ { // type of MujoCo object mjOBJ_MODEL // entire model } mjtObj; -typedef enum mjtConstraint_ { // type of constraint - mjCNSTR_EQUALITY = 0, // equality constraint - mjCNSTR_FRICTION_DOF, // dof friction - mjCNSTR_FRICTION_TENDON, // tendon friction - mjCNSTR_LIMIT_JOINT, // joint limit - mjCNSTR_LIMIT_TENDON, // tendon limit - mjCNSTR_CONTACT_FRICTIONLESS, // frictionless contact - mjCNSTR_CONTACT_PYRAMIDAL, // frictional contact, pyramidal friction cone - mjCNSTR_CONTACT_ELLIPTIC // frictional contact, elliptic friction cone -} mjtConstraint; typedef enum mjtSensor_ { // type of sensor // common robotic sensors, attached to a site mjSENS_TOUCH = 0, // scalar contact normal forces summed over sensor zone diff --git a/include/mujoco/mjdata.h b/include/mujoco/mjdata.h index 8b2e085f..60e8a11b 100644 --- a/include/mujoco/mjdata.h +++ b/include/mujoco/mjdata.h @@ -51,6 +51,18 @@ typedef enum mjtState_ { // state elements } mjtState; +typedef enum mjtConstraint_ { // type of constraint + mjCNSTR_EQUALITY = 0, // equality constraint + mjCNSTR_FRICTION_DOF, // dof friction + mjCNSTR_FRICTION_TENDON, // tendon friction + mjCNSTR_LIMIT_JOINT, // joint limit + mjCNSTR_LIMIT_TENDON, // tendon limit + mjCNSTR_CONTACT_FRICTIONLESS, // frictionless contact + mjCNSTR_CONTACT_PYRAMIDAL, // frictional contact, pyramidal friction cone + mjCNSTR_CONTACT_ELLIPTIC // frictional contact, elliptic friction cone +} mjtConstraint; + + typedef enum mjtConstraintState_ { // constraint state mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact) mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact) diff --git a/include/mujoco/mjmodel.h b/include/mujoco/mjmodel.h index 18915b6f..85849b96 100644 --- a/include/mujoco/mjmodel.h +++ b/include/mujoco/mjmodel.h @@ -291,18 +291,6 @@ typedef enum mjtObj_ { // type of MujoCo object } mjtObj; -typedef enum mjtConstraint_ { // type of constraint - mjCNSTR_EQUALITY = 0, // equality constraint - mjCNSTR_FRICTION_DOF, // dof friction - mjCNSTR_FRICTION_TENDON, // tendon friction - mjCNSTR_LIMIT_JOINT, // joint limit - mjCNSTR_LIMIT_TENDON, // tendon limit - mjCNSTR_CONTACT_FRICTIONLESS, // frictionless contact - mjCNSTR_CONTACT_PYRAMIDAL, // frictional contact, pyramidal friction cone - mjCNSTR_CONTACT_ELLIPTIC // frictional contact, elliptic friction cone -} mjtConstraint; - - typedef enum mjtSensor_ { // type of sensor // common robotic sensors, attached to a site mjSENS_TOUCH = 0, // scalar contact normal forces summed over sensor zone diff --git a/python/mujoco/introspect/enums.py b/python/mujoco/introspect/enums.py index 3508fe30..c867525c 100644 --- a/python/mujoco/introspect/enums.py +++ b/python/mujoco/introspect/enums.py @@ -312,21 +312,6 @@ ENUMS: Mapping[str, EnumDecl] = dict([ ('mjOBJ_MODEL', 102), ]), )), - ('mjtConstraint', - EnumDecl( - name='mjtConstraint', - declname='enum mjtConstraint_', - values=dict([ - ('mjCNSTR_EQUALITY', 0), - ('mjCNSTR_FRICTION_DOF', 1), - ('mjCNSTR_FRICTION_TENDON', 2), - ('mjCNSTR_LIMIT_JOINT', 3), - ('mjCNSTR_LIMIT_TENDON', 4), - ('mjCNSTR_CONTACT_FRICTIONLESS', 5), - ('mjCNSTR_CONTACT_PYRAMIDAL', 6), - ('mjCNSTR_CONTACT_ELLIPTIC', 7), - ]), - )), ('mjtSensor', EnumDecl( name='mjtSensor', @@ -501,6 +486,21 @@ ENUMS: Mapping[str, EnumDecl] = dict([ ('mjSTATE_INTEGRATION', 8191), ]), )), + ('mjtConstraint', + EnumDecl( + name='mjtConstraint', + declname='enum mjtConstraint_', + values=dict([ + ('mjCNSTR_EQUALITY', 0), + ('mjCNSTR_FRICTION_DOF', 1), + ('mjCNSTR_FRICTION_TENDON', 2), + ('mjCNSTR_LIMIT_JOINT', 3), + ('mjCNSTR_LIMIT_TENDON', 4), + ('mjCNSTR_CONTACT_FRICTIONLESS', 5), + ('mjCNSTR_CONTACT_PYRAMIDAL', 6), + ('mjCNSTR_CONTACT_ELLIPTIC', 7), + ]), + )), ('mjtConstraintState', EnumDecl( name='mjtConstraintState', diff --git a/unity/Runtime/Bindings/MjBindings.cs b/unity/Runtime/Bindings/MjBindings.cs index bb872565..634adb40 100644 --- a/unity/Runtime/Bindings/MjBindings.cs +++ b/unity/Runtime/Bindings/MjBindings.cs @@ -115,6 +115,16 @@ public const int mjVERSION_HEADER = 336; // ------------------------------------Enums------------------------------------ +public enum mjtConstraint : int{ + mjCNSTR_EQUALITY = 0, + mjCNSTR_FRICTION_DOF = 1, + mjCNSTR_FRICTION_TENDON = 2, + mjCNSTR_LIMIT_JOINT = 3, + mjCNSTR_LIMIT_TENDON = 4, + mjCNSTR_CONTACT_FRICTIONLESS = 5, + mjCNSTR_CONTACT_PYRAMIDAL = 6, + mjCNSTR_CONTACT_ELLIPTIC = 7, +} public enum mjtConstraintState : int{ mjCNSTRSTATE_SATISFIED = 0, mjCNSTRSTATE_QUADRATIC = 1, @@ -341,16 +351,6 @@ public enum mjtObj : int{ mjOBJ_DEFAULT = 101, mjOBJ_MODEL = 102, } -public enum mjtConstraint : int{ - mjCNSTR_EQUALITY = 0, - mjCNSTR_FRICTION_DOF = 1, - mjCNSTR_FRICTION_TENDON = 2, - mjCNSTR_LIMIT_JOINT = 3, - mjCNSTR_LIMIT_TENDON = 4, - mjCNSTR_CONTACT_FRICTIONLESS = 5, - mjCNSTR_CONTACT_PYRAMIDAL = 6, - mjCNSTR_CONTACT_ELLIPTIC = 7, -} public enum mjtSensor : int{ mjSENS_TOUCH = 0, mjSENS_ACCELEROMETER = 1,