Fix bug in engine_derivative.c

- The inner loop was reusing and modifying an outer loop variable.

PiperOrigin-RevId: 518843275
Change-Id: I922f8768c4e8ef74c2fb2b1fd897de8234336acf
This commit is contained in:
Yuval Tassa
2023-03-23 06:31:38 -07:00
committed by Copybara-Service
parent 0036f4e7ee
commit ce6c9053e2
2 changed files with 14 additions and 4 deletions
+10
View File
@@ -2,6 +2,16 @@
Changelog
=========
Upcoming version (not yet released)
-----------------------------------
Bug fixes
^^^^^^^^^
- Fixed bug in the handling of ellipsoid-based fluid model forces in the new implicitfast integrator. If using the
(as-yet undocumented) ellipsoid-based fluid model, please use a different integrator until the next release.
Version 2.3.3 (March 20, 2023)
------------------------------
+4 -4
View File
@@ -1210,10 +1210,10 @@ void mjd_ellipsoidFluid(const mjModel* m, mjData* d, int bodyid) {
// make B symmetric if integrator is IMPLICITFAST
if (m->opt.integrator == mjINT_IMPLICITFAST) {
for (int i=0; i<5; i++) {
for (j=i+1; j<6; j++) {
mjtNum tmp = 0.5 * (B[6 * i + j] + B[6 * j + i]);
B[6 * i + j] = tmp;
B[6 * j + i] = tmp;
for (int k=i+1; k<6; k++) {
mjtNum tmp = 0.5 * (B[6 * i + k] + B[6 * k + i]);
B[6 * i + k] = tmp;
B[6 * k + i] = tmp;
}
}
}