Skip to content

Reject negative sigma1 in LuGre bristle model - #3486

Closed
giusenso wants to merge 6 commits into
google-deepmind:mainfrom
giusenso:fix/lugre-neg-sigma1
Closed

Reject negative sigma1 in LuGre bristle model#3486
giusenso wants to merge 6 commits into
google-deepmind:mainfrom
giusenso:fix/lugre-neg-sigma1

Conversation

@giusenso

@giusenso giusenso commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Reject non-finite or negative LuGre sigma1 (see #3487). Negative values correspond to anti-damping, which causes the friction model to inject mechanical energy rather than dissipate it.
Validation covers both <dcmotor> and raw dyntype="dcmotor" configurations, including inherited defaults. Documentation is updated accordingly.

Testing

Added C API and MJCF compilation tests for negative, non-finite, inherited, and raw dynprm values.

yuvaltassa and others added 6 commits August 16, 2026 00:05
Three diagnostics that clang does not emit, so they were missed until the
gcc-14 CI jobs, which build with -Werror:

- mji_scl3 takes a restrict-qualified destination, so passing the same array
  as source and destination is undefined. Two calls did: negating the edge
  separating axis, and halving the witness midpoint. The first now negates in
  place, the second forms the midpoint directly.
- Adding const to a pointer to array is not a valid implicit conversion before
  C23. The pointer it qualified was a redundant alias of the clip buffer, and
  is removed.

No functional change: the box-box fuzzer's output hash over 60k configurations
is identical before and after.
- The 25-line comment describing the collider's two stages, the reference and
  incident face convention, and why the manifold is not reduced below the
  clipped polygon. The last paragraph is load-bearing: reducing the patch to
  four points is what an earlier draft did, and it costs two to three orders of
  magnitude of residual motion on stacks of plates.

- contact_net.xml's b1 orientation, from euler="5 4 3" back to "5 5 5". The
  re-posed model does not converge under mjUSESINGLE: SensorTest.ContactNet
  spends minutes in mj_solPrimal instead of hundredths of a second, so the
  single-precision suite never finishes. The original orientation passes in
  both precisions with the current collider, in 0.02s and 0.01s.

No functional change to the collider: the box-box fuzzer's output hash over 60k
configurations is unchanged.
On mjWARN_BADQACC the warning handler resets mjData, which rewinds data->time
to one timestep. A loop conditioned on data->time then cannot terminate: the
model diverges, resets, falls, diverges again, indefinitely. Every step is
sub-millisecond, so it presents as a compute hang rather than a failure, and a
CI job sits in it until the runner is killed. This test hit that under
mjUSESINGLE: 100k steps without data->time reaching 0.2.

Bounding by step count turns the same event into a prompt failure. 80 further
occurrences of the idiom remain across the test suite; they are only latent as
long as their models do not diverge.
@giusenso giusenso changed the title Handle negative sigma1 in LuGre bristle model Reject negative sigma1 in LuGre bristle model Aug 16, 2026
@yuvaltassa

Copy link
Copy Markdown
Collaborator

Thanks, but I closed #3487 as WAI: MuJoCo is liberal with parameter values throughout and I don't think LuGre should be special. The line we do enforce is structural: a configuration that's meaningless (a gain with no input to act on, or a τ→V map with K=0) is rejected; a value that's merely unphysical is yours to choose.

Separately, this branch has picked up unrelated changes (engine_collision_box.c, the sensor test and contact_net.xml), so it isn't mergeable as-is. Closing.

@yuvaltassa yuvaltassa closed this Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants