diff --git a/doc/XMLreference.rst b/doc/XMLreference.rst index ba447d4b..ec0fea5c 100644 --- a/doc/XMLreference.rst +++ b/doc/XMLreference.rst @@ -1751,7 +1751,7 @@ properties are grouped together. .. _material-rgb: :el-prefix:`material/` |-| **rgb** (?) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This element references a texture asset used to specify base color / albedo values. @@ -1763,7 +1763,7 @@ This element references a texture asset used to specify base color / albedo valu .. _material-normal: :el-prefix:`material/` |-| **normal** (?) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This element references a texture asset used to specify the bump map (surface normals). @@ -1775,7 +1775,7 @@ This element references a texture asset used to specify the bump map (surface no .. _material-occlusion: :el-prefix:`material/` |-| **occlusion** (?) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This element references a texture asset used to specify ambient occlusion. @@ -1787,7 +1787,7 @@ This element references a texture asset used to specify ambient occlusion. .. _material-roughness: :el-prefix:`material/` |-| **roughness** (?) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This element references a texture asset used to specify the roughness map. @@ -1799,7 +1799,7 @@ This element references a texture asset used to specify the roughness map. .. _material-metallic: :el-prefix:`material/` |-| **metallic** (?) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This element references a texture asset used to specify the metallic map. @@ -1811,7 +1811,7 @@ This element references a texture asset used to specify the metallic map. .. _material-opacity: :el-prefix:`material/` |-| **opacity** (?) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This element references a texture asset used to specify the opacity map (alpha channel, transparency). @@ -1823,7 +1823,7 @@ This element references a texture asset used to specify the opacity map (alpha c .. _material-emissive: :el-prefix:`material/` |-| **emissive** (?) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This element references a texture asset used to specify light emission. @@ -1835,7 +1835,7 @@ This element references a texture asset used to specify light emission. .. _material-orm: :el-prefix:`material/` |-| **orm** (?) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This element references a texture asset used to specify a packed ORM map, where occlusion, roughness, and metallic are joined into the corresponding RGB values of a single texture. @@ -1848,7 +1848,7 @@ are joined into the corresponding RGB values of a single texture. .. _material-rgba: :el-prefix:`material/` |-| **rgba** (?) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This element references a texture asset used to specify a packed map where albedo and opacity are joined into the same 4-channel texture. diff --git a/doc/changelog.rst b/doc/changelog.rst index b19bcc28..d22ccc3b 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -7,16 +7,14 @@ Upcoming version (not yet released) General ^^^^^^^ - 1. Renamed ``mjModel.tex_rbg`` to ``mjModel.tex_data``. 2. Added a new disable flag ``mjDSBL_AUTORESETNAN`` to disable automatic reset when NaNs or infinities are produced. 3. Added sub-elements to the MJCF :ref:`material` element, to allow specification of multiple textures -for rendering (e.g., :ref:`occlusion-roughness-metallic`). Note that the MuJoCo renderer doesn't support -these new features, and they are made available for use with external renderers. + for rendering (e.g., :ref:`occlusion-roughness-metallic`). Note that the MuJoCo renderer doesn't + support these new features, and they are made available for use with external renderers. MJX ^^^ - 4. Added more fields to ``mjx.Model`` and ``mjx.Data`` for further compatibility with the corresponding MuJoCo structs. 5. Added support for :ref:`fixed tendons `. 6. Added support for tendon length limits (``mjCNSTR_LIMIT_TENDON`` in :ref:`mjtConstraint`). @@ -28,6 +26,10 @@ Python bindings 9. Added support for asset dictionary argument in ``mujoco.spec.from_file``, ``mujoco.spec.from_string`` and ``mujoco.spec.compile``. +Bug fixes +^^^^^^^^^ +10. Fixed a bug where implicit integrators did not take into account disabled actuators (:github:issue:`1838`). + Version 3.2.0 (Jul 15, 2024) ---------------------------- diff --git a/src/engine/engine_derivative.c b/src/engine/engine_derivative.c index 73c64b0f..dec37eb8 100644 --- a/src/engine/engine_derivative.c +++ b/src/engine/engine_derivative.c @@ -834,6 +834,11 @@ void mjd_actuator_vel(const mjModel* m, mjData* d) { // process actuators for (int i=0; i < m->nu; i++) { + // skip if disabled + if (mj_actuatorDisabled(m, i)) { + continue; + } + mjtNum bias_vel = 0, gain_vel = 0; // affine bias diff --git a/test/engine/engine_derivative_test.cc b/test/engine/engine_derivative_test.cc index 85ecf60a..9a7a776e 100644 --- a/test/engine/engine_derivative_test.cc +++ b/test/engine/engine_derivative_test.cc @@ -159,6 +159,70 @@ TEST_F(DerivativeTest, SmoothDvel) { } } +// disabled actuators do not contribute to d_qfrc_actuator/d_qvel +TEST_F(DerivativeTest, DisabledActuators) { + // model with only a position actuator + static constexpr char xml1[] = R"( + + + )"; + + mjModel* m1 = LoadModelFromString(xml1); + mjData* d1 = mj_makeData(m1); + + d1->ctrl[0] = 6; + while (d1->time < 1) + mj_step(m1, d1); + + // model with a position actuator and an intvelocity actuator + static constexpr char xml2[] = R"( + + + )"; + + mjModel* m2 = LoadModelFromString(xml2); + mjData* d2 = mj_makeData(m2); + + d2->ctrl[0] = 6; + d2->ctrl[1] = 6; + + while (d2->time < 1) + mj_step(m2, d2); + + // expect same qvel in both models + EXPECT_EQ(d1->qvel[0], d2->qvel[0]); + + mj_deleteData(d2); + mj_deleteModel(m2); + mj_deleteData(d1); + mj_deleteModel(m1); +} + // compare analytic and fin-diff d_qfrc_passive/d_qvel TEST_F(DerivativeTest, PassiveDvel) { for (const char* local_path : {kTumblingThinObjectPath,