Commit Graph

1225 Commits

Author SHA1 Message Date
Kyle Bayes 9e72874801 Remove EPA tolerance in the discrete case in nativeccd.
PiperOrigin-RevId: 750649926
Change-Id: I8ab317cd6b227c9486a2916ae9c6445906c23401
2025-04-23 10:52:14 -07:00
Yuval Tassa 8f768be2da Remove solver_nisland field from mjData.
PiperOrigin-RevId: 750527660
Change-Id: I6b34944c92483ea2abc774df75efd868255a2bac
2025-04-23 03:27:41 -07:00
Yuval Tassa c2ac0d724e Add mju_gather and mju_scatter, private engine functions.
PiperOrigin-RevId: 750245294
Change-Id: I3a14ccdd55a324d3fe206e388fb2a513772f5f5e
2025-04-22 10:33:33 -07:00
Alessio Quaglino 99490163df Prevent NaN in cylinder SDF.
Fixes #2573.

The correction matches the one used in MJX (see _cylinder_grad in collision_sdf.py).

PiperOrigin-RevId: 747887406
Change-Id: I1a4f1ac769adb96c98665eace7ce54fb09a7d3a2
2025-04-15 08:34:05 -07:00
Google DeepMind 8e7457d7c6 Initial support for writing UsdPhysics data starting with UsdPhysicsRigidbodyAPI support.
The SDF_FORMAT_ARGS `usdMjcfToggleUsdPhysics` is introduced to toggle writing UsdPhysics or not when converting. Off by default

PiperOrigin-RevId: 746467942
Change-Id: I26cb9a4c4ae2eef96163dab967a74f14940a2a6d
2025-04-11 08:19:11 -07:00
Sam Haves 446a8f1742 Add basic site support to Mjcf SdfFileFormat plugin.
We will still need to tag these with a custom API schema to ease round-tripping but that will follow creation of such a schema.

PiperOrigin-RevId: 746421793
Change-Id: I2df2209b4bc90d763718fb4bea8158b8598755c6
2025-04-11 05:28:03 -07:00
Gabe Oppenheimer 440ce5eb7a Update the version number to 3.3.2 following the 3.3.1 release.
PiperOrigin-RevId: 746147577
Change-Id: Idb7b4e7e06a4730b4f2eea8f6600b898e998f8db
2025-04-10 13:17:20 -07:00
Kyle Bayes b1f8d444f2 Fix bug in replaceSimplex3 in nativeccd.
PiperOrigin-RevId: 746014344
Change-Id: I93b32ab5f67ee48ab72238de53f7cda07638cb79
2025-04-10 07:04:27 -07:00
Yuval Tassa 25126e88c7 Move mju_cholFactorCount to engine_util_solve.
PiperOrigin-RevId: 746011856
Change-Id: If9812251420053644f4eca81adb5116d370ee524
2025-04-10 06:56:31 -07:00
Yuval Tassa d3664b5d01 Avoid square root in mju_makeFrame
PiperOrigin-RevId: 745974380
Change-Id: I90879fac05e62daf60acd2223f814e833634b242
2025-04-10 04:41:23 -07:00
Mohammad Hamid 3429a4881a Detect mismatch between maxNodes and Nodes in a gmsh block. Fixes #2342
PiperOrigin-RevId: 745967745
Change-Id: If1b5fcd71079a0e6a6def9b442758678e31a5828
2025-04-10 04:15:21 -07:00
Kyle Bayes 85b323c7fb Remove square roots when possible in EPA improving numerical precision.
PiperOrigin-RevId: 745559836
Change-Id: I3f8b23406e93ccfc4bc3499bfbed829b35462a74
2025-04-09 06:18:51 -07:00
Taylor Howell 96dda6ea75 Add tendon actuator force limits and tendon actuator force sensor.
PiperOrigin-RevId: 745096883
Change-Id: Ib9acb727fbbfc6b0b0323ee6a889053a7a878056
2025-04-08 05:16:35 -07:00
Kyle Bayes 606f00f802 Remove contact pruning with box-box collisions in nativeccd and add benchmarks.
PiperOrigin-RevId: 744732382
Change-Id: I2e20b646c541ee99888f1e964302d1b4363b2dc4
2025-04-07 08:34:04 -07:00
Alessio Quaglino d7027fb1c0 Do not skip mjSpec's with repeated model names when attaching a new mjSpec.
PiperOrigin-RevId: 744705838
Change-Id: Ie47a3c029f443910629619b7f9ff43ab07646725
2025-04-07 06:52:12 -07:00
Kyle Bayes 58234b2217 Replace mjMAXVAL with numerical max limit where necessary in nativeccd.
PiperOrigin-RevId: 744693156
Change-Id: I72c3122701be281d468291dfc2ad1e4bb1da5a1c
2025-04-07 05:59:02 -07:00
Alessio Quaglino cc2f57d820 Change mjSpec and mjModel signature mechanism.
The signature now contains the necessary information to safely perform `bind`. The private UIDs are now removed.

Fixes an issue of changing signature when compiling a copy of an mjSpec.

PiperOrigin-RevId: 744670626
Change-Id: Id3c66419cf2afbe78e91bc4b37d2299f5ec00ab1
2025-04-07 04:21:27 -07:00
Yuval Tassa d05251af2a Add tendon armature
PiperOrigin-RevId: 743939992
Change-Id: I587214f5d6fabbc0cc273c33d82decbe9ad8f919
2025-04-04 07:44:04 -07:00
Yuval Tassa e1f5ceb65a Add mjModel.tendon_armature (in preparation, not yet implemented)
PiperOrigin-RevId: 743649968
Change-Id: I1d893e3e06afc48b652575bc7837750ab3573670
2025-04-03 12:06:27 -07:00
Yuval Tassa f96f3e1c22 Add XML compiler/saveinertial flag. Fixes #2405
PiperOrigin-RevId: 743607654
Change-Id: I1f2e61be89b79c1995e079f36aa285096f9fb441
2025-04-03 10:12:42 -07:00
Alessio Quaglino 8941f56e86 Copy UIDs during mj_copySpec.
This will produce the same mjSpec signature after a deep copy.

PiperOrigin-RevId: 743538018
Change-Id: Ic0f5b06a00e8883cb92dc98159db3bea02cb7a36
2025-04-03 06:29:07 -07:00
Google DeepMind 40393f460a Fix shadow flickering artefacts on platforms that do not support ARB_clip_control.
PiperOrigin-RevId: 743112447
Change-Id: Ibb727685605c0a257547162703f61e5232ff544c
2025-04-02 06:34:27 -07:00
Alessio Quaglino b839fe79e1 Allow to attach an entire mjSpec in mjs_attach.
PiperOrigin-RevId: 742737713
Change-Id: Ie172568b8c35232e1f13d75aebee20346e76e95b
2025-04-01 09:51:52 -07:00
Alessio Quaglino a02a27d4a4 Combine all mjs_attach functions into one.
PiperOrigin-RevId: 742702092
Change-Id: I89e35c59ada017cd061e2031584eeea71776743d
2025-04-01 08:05:58 -07:00
Kyle Bayes 08d22baea1 Fix bug in horizon code in nativeccd where parallel faces are included in horizon.
PiperOrigin-RevId: 742687622
Change-Id: I4a180cb9c7451e0a2c22ffd77b7b6f6fd68836a4
2025-04-01 07:21:14 -07:00
Alessio Quaglino c0a7ea1edb Added the element type mjOBJ_SPEC for mjSpec.
PiperOrigin-RevId: 742678572
Change-Id: I95a382ac58b5bc88c2aa5c07210549a1d5e2f538
2025-04-01 06:51:49 -07:00
Kyle Bayes 9ecec6f238 Fix bad contact from passing through polytope2 in nativeccd.
PiperOrigin-RevId: 742666700
Change-Id: I76034579b4e663f9abfa265ec3e2bc608f631f59
2025-04-01 06:11:20 -07:00
Alessio Quaglino 648a03c2cf Override inertia of body with visual geoms if discardvisual is true.
Fixes #2546.

PiperOrigin-RevId: 742650702
Change-Id: I753c1e1c89da732ece100676644bbecf9d6373bb
2025-04-01 05:21:48 -07:00
Alessio Quaglino 86c970bc23 Add error checking in mjs_setFrame.
Also raise error if the frame is not found in the mjCBody copy constructor.

Fixes #2543.

PiperOrigin-RevId: 742624013
Change-Id: I4999b3165c97f8d079412214d027ca7a8dae8cb3
2025-04-01 03:34:48 -07:00
Yuval Tassa 8bcfe07e14 Fix potential division by zero in mj_tendonDot.
PiperOrigin-RevId: 742246626
Change-Id: I1f897bd0ca28e0efdffc5a93fadca35221eaeb38
2025-03-31 06:41:26 -07:00
Alessio Quaglino 01d4c46753 Store the mjsCompiler -> appended mjSpec map when appending an mjSpec.
Previously, we stored the source `mjSpec` during a copy as a hack for having access to the compiler options, but this is not robust since we cannot guarantee that 1) the source `mjSpec` is not destroyed before we need to look up the compiler options nor 2) that the `mjSpec` was appended without a copy.

While 2) could be solved by simply handling an additional case in `mjCModel::FindSpec`, using a map also solves 1) and it is easier to understand.

PiperOrigin-RevId: 741504264
Change-Id: Iab1bfd9e61299a94fa8caf3a244c067b09d54384
2025-03-28 06:27:22 -07:00
Alessio Quaglino e8c67ca586 Allow orientation for user composite.
PiperOrigin-RevId: 740909723
Change-Id: Id38a55114d4257a461bbced57d35d6bb42a2597d
2025-03-26 14:44:51 -07:00
Google DeepMind 644b42bee3 Add mujoco/experimental and move USD work there.
PiperOrigin-RevId: 740730698
Change-Id: If9c68798cda502d6d7632906a034437e2557802e
2025-03-26 05:37:45 -07:00
Alessio Quaglino 5c955b8fe2 Add frame support to the cable composite.
Also cleanup user_composite.cc includes.

PiperOrigin-RevId: 740730596
Change-Id: I05df59926d8e61de45fd6b2a3a63121b7a390448
2025-03-26 05:36:36 -07:00
Kyle Bayes d6943731b2 Fix bug in nativeccd multiccd.
PiperOrigin-RevId: 740495321
Change-Id: I7eaa0da8514e27c233d49567c276d1d238808d1f
2025-03-25 14:56:21 -07:00
Alessio Quaglino 69f8349203 Add signature error checking at the end of compilation.
Fixed some edge cases that caused the new error to be triggered.

PiperOrigin-RevId: 740483759
Change-Id: I6ced3ba55476d5c18103e205151ecace94f2b29b
2025-03-25 14:22:58 -07:00
Alessio Quaglino 157b074116 Add signature to mjSpec and mjModel and use it to perform safe bind to mjModel and mjData.
PiperOrigin-RevId: 740378879
Change-Id: If14b326942529494f172e7aedcae30195798b458
2025-03-25 09:37:49 -07:00
Yuval Tassa c931565fdc Add internal functionmj_tendonDot: time derivative of tendon Jacobian for one tendon.
Notes:
- Currently always uses dense math, even for sparse models. This should be easy to change in the future.
- Does not support geom wrapping. This is possible but harder, requires derivatives of mju_wrap.
PiperOrigin-RevId: 740378741
Change-Id: Id39ef2c4bfbb7ee11ec33c97d7d83140441cdab2
2025-03-25 09:36:30 -07:00
Alessio Quaglino 4e206c29c1 Keep tree lists updated at all times.
This simplifies the compiler logic since an updated tree list was necessary at many stages (e.g. attach and keyframes resizing) and it will be anyway required when computing the mjSpec signature.

PiperOrigin-RevId: 740356447
Change-Id: I7f2ec25b27b8d4ca4364801c9a401c40c6d84569
2025-03-25 08:21:22 -07:00
Kyle Bayes 12b40b948e Remove MuJoCo stack calls in nativeccd.
1. There is now thread local static memory for use with a conservative max number of iterations needed for contact.
2. For possible needs of high precision contact recovery with large iteration numbers (i.e. ellipsoid-ellipsoid collisions), there are callbacks to allocate memory when needed.

PiperOrigin-RevId: 739187134
Change-Id: I3d210f75218922d969c78465da3fe50da4fe3080
2025-03-21 08:20:51 -07:00
Alessio Quaglino dc96ed6bdb Remove plugins that are not referenced after detaching a body.
Fixes #2497.

Also, use `Release()` instead of `delete` for removing elements when detaching a body in order to preserve correct reference count.

PiperOrigin-RevId: 739133888
Change-Id: I7ccfad84446fb15259bad30c4ba1e6f7fa601518
2025-03-21 04:34:05 -07:00
Tom Power 8d92a0fbe6 Clear body subtreedofs when compiling. Fixes issue when attaching previously compiled model.
PiperOrigin-RevId: 738906593
Change-Id: I74875b4d07c422e397358dff5daf6682ec1bd655
2025-03-20 12:52:36 -07:00
Tom Power be64747166 add mjs_detachDefault to delete a default class from mjSpec
PiperOrigin-RevId: 738452369
Change-Id: I5a53a6dc8f89e1e8136aeefc09d7d9b7b7204e1f
2025-03-19 10:31:04 -07:00
Kyle Bayes a1b9ffd124 Fix memory over-allocation in nativeccd.
PiperOrigin-RevId: 738383181
Change-Id: Ibf9e2b146da671e8d3a48339c8f4c6813f537456
2025-03-19 07:08:21 -07:00
Alessio Quaglino 209d2bd2c5 Added functionality for user payload data in mjSpec.
PiperOrigin-RevId: 738343134
Change-Id: I6217362ced9993afcd5a2914c78718ffe3bf753a
2025-03-19 04:36:00 -07:00
Kyle Bayes dc50fbbb9b Add safeguard if n is invalid in GJK.
PiperOrigin-RevId: 738340065
Change-Id: I2288eb731621e5b84dcc0f078d8dbd84dca94cd4
2025-03-19 04:21:11 -07:00
Yuval Tassa efe213a7b3 Cosmetic improvements to src/xml/ source files.
PiperOrigin-RevId: 738010419
Change-Id: Idb90a42a374682450737684e67388329c184c777
2025-03-18 08:12:29 -07:00
Yuval Tassa 205599ac1a Cosmetic improvements to src/user/ source files.
PiperOrigin-RevId: 737930914
Change-Id: I1cc254d420fcdf0c42ec3d2f601e5a02d925d958
2025-03-18 02:59:12 -07:00
Alessio Quaglino bae5175cf2 Accumulate rotation after updating pos and quat in replicate.
Fixes #2501.

PiperOrigin-RevId: 737929158
Change-Id: I0cad2de37190f1d30d427ae646acbde335b5be56
2025-03-18 02:51:05 -07:00
Alessio Quaglino 1bf24e9f67 Do not overwrite existing parent frames for worldbody elements when attaching an mjSpec to a frame or a site.
PiperOrigin-RevId: 737662046
Change-Id: I7028c21c803c01845ae1d53cb476f7b3df172313
2025-03-17 10:21:38 -07:00