Make constraint island discovery on by default.

Also fix latent bug in mjData serialization.

PiperOrigin-RevId: 799505349
Change-Id: I299e7cc8133fa2ec0b339a7ff3d02543e06778b1
This commit is contained in:
Yuval Tassa
2025-08-26 04:26:30 -07:00
committed by Copybara-Service
parent 4cf5c37211
commit ec94bb49aa
27 changed files with 147 additions and 81 deletions
+1 -1
View File
@@ -723,7 +723,7 @@ void mj_fwdConstraint(const mjModel* m, mjData* d) {
mju_zeroInt(d->solver_niter, mjNISLAND);
// check if islands are supported
int islands_supported = mjENABLED(mjENBL_ISLAND) &&
int islands_supported = !mjDISABLED(mjDSBL_ISLAND) &&
nisland > 0 &&
m->opt.noslip_iterations == 0 &&
(m->opt.solver == mjSOL_CG || m->opt.solver == mjSOL_NEWTON);
+2 -2
View File
@@ -411,7 +411,7 @@ void mj_island(const mjModel* m, mjData* d) {
int nv = m->nv, nefc = d->nefc, ntree=m->ntree;
// no constraints: quick return
if (!mjENABLED(mjENBL_ISLAND) || !nefc) {
if (mjDISABLED(mjDSBL_ISLAND) || !nefc) {
d->nisland = d->nidof = 0;
return;
}
@@ -454,7 +454,7 @@ void mj_island(const mjModel* m, mjData* d) {
return;
}
// count ni: total number of dofs in islands
// count nidof: total number of dofs in islands
int nidof = 0;
for (int i=0; i < nv; i++) {
nidof += (tree_island[m->dof_treeid[i]] >= 0);
+3 -3
View File
@@ -62,7 +62,8 @@ const char* mjDISABLESTRING[mjNDISABLE] = {
"Midphase",
"Eulerdamp",
"AutoReset",
"NativeCCD"
"NativeCCD",
"Island"
};
@@ -72,8 +73,7 @@ const char* mjENABLESTRING[mjNENABLE] = {
"Energy",
"Fwdinv",
"InvDiscrete",
"MultiCCD",
"Island"
"MultiCCD"
};