Commit Graph

1523 Commits

Author SHA1 Message Date
Haroon Qureshi bb0878417e Automated g4 rollback of changelist 810355812.
*** Reason for rollback ***

mjv_makeScene does not call mjv_defaultScene directly.  Instead, it calls mjv_freeScene which calls mjv_defaultScene.  However, mjv_freeScene attempts to free pointers if they are not NULL and if you don't call mjv_defaultScene then you'll have garbage data in those pointers.

*** Original change description ***

Remove redundant mjv_defaultScene call since its called by mjv_makeScene

***

PiperOrigin-RevId: 810442645
Change-Id: Ica50493d6769a0afb086f9ead99d731cdf0d75d9
2025-09-23 08:05:40 -07:00
Yuval Tassa 33b09e0822 Stop using stack allocation for catenary drawing
PiperOrigin-RevId: 810434095
Change-Id: Iee8c01ff721c2af216c5725fc9eaf6267b2e5284
2025-09-23 07:37:34 -07:00
Haroon Qureshi 09e6723dab Remove unnecessary stack mark/free in engine_vis_visualize.c
PiperOrigin-RevId: 810391913
Change-Id: Id02f4dadba7ef08f60bb7726470082f45c5761c5
2025-09-23 04:53:50 -07:00
Matija Kecman bf918ccf40 Remove redundant mjv_defaultScene call since its called by mjv_makeScene
PiperOrigin-RevId: 810355812
Change-Id: I2bc112e24c3adaca616604ebc5c1e3e3c494eb59
2025-09-23 02:35:05 -07:00
Taylor Howell d616f11508 Remove references to deprecated nconmax and njmax.
PiperOrigin-RevId: 809987304
Change-Id: I4109497fe108234dd77011d61eb3ef833e6ae111
2025-09-22 06:28:41 -07:00
Taylor Howell 4bbe4e5ebc Zero actuator_velocity if actuation is disabled.
PiperOrigin-RevId: 809986353
Change-Id: Ie9fecda80864fef3377074042fd7829af8d03d64
2025-09-22 06:24:43 -07:00
Haroon Qureshi 6eea3d8ec0 Initial implementation of toolbox-based "Studio" app.
PiperOrigin-RevId: 809966748
Change-Id: Ic6333259ca1d112a2e42d47ccc44326bfcea3bdd
2025-09-22 05:02:31 -07:00
Haroon Qureshi 7fc6b29afd Replace PREPARE_NEXT_GEOM and FINISH_GEOM macros with functions.
PiperOrigin-RevId: 809940866
Change-Id: I1d45eede9ddf8606e7fd2a8caa2ed0224b0e24a7
2025-09-22 03:21:13 -07:00
Haroon Qureshi d9da8e2570 Replace RETURN_IF_GEOMS_EXHAUSTED macro with inlined code.
PiperOrigin-RevId: 809919921
Change-Id: Icf2afbd4168ebb18577b5915afa9d457001259d6
2025-09-22 02:03:19 -07:00
Yuval Tassa d55da23235 Simplify mj_comPos, avoid stack allocation
PiperOrigin-RevId: 809762290
Change-Id: I87824279ff5f7049b1f06b900d4d3e33f5fafe0f
2025-09-21 14:06:22 -07:00
Google DeepMind 0e1104768a No public description
PiperOrigin-RevId: 809083979
Change-Id: I5c6641b73c76153c15f5cdf858b788e1433acc81
2025-09-19 10:10:45 -07:00
Google DeepMind 26ea20a21f No public description
PiperOrigin-RevId: 809074980
Change-Id: Ib3e3522addceddba6a057cfef80fcbd30a420b3d
2025-09-19 09:49:07 -07:00
Alessio Quaglino 77e025ea98 Move meshdir and texturedir to mjsCompiler.
For backwards compatibility in the Python bindings, both `spec.compiler.meshdir` and `spec.meshdir` are now allowed.

Fixes #2834.

PiperOrigin-RevId: 809060113
Change-Id: Ie23f1c5dd57de43568312a8e062906f4013bb474
2025-09-19 09:05:44 -07:00
Yuval Tassa 681f5767b2 Remove -Wno-extra-semi, add workaround for mjSORT confusing some IDEs
PiperOrigin-RevId: 808689636
Change-Id: Ia091fb597c171a33842e62690d06f32614fbe4eb
2025-09-18 12:28:09 -07:00
Kyle Bayes eb96dd556c Reduce ccd_iterations from 50 to 35.
PiperOrigin-RevId: 808610578
Change-Id: I8755f9ba2902bf0805b7ded07ee6e048e404a31f
2025-09-18 09:16:52 -07:00
Yuval Tassa 4b8454b79c Add semicolons after mjSORT macro calls.
PiperOrigin-RevId: 808587320
Change-Id: I9fd290b9a2b615647135f1250e87af8ea9bb81f6
2025-09-18 08:13:46 -07:00
Matija Kecman f9f3dd3c1d Fix ImGui input processing
PiperOrigin-RevId: 808555760
Change-Id: Ie443143d9c058058b99786e44f27715b05c9f8ed
2025-09-18 06:42:16 -07:00
Haroon Qureshi d7500e0dec Split START macro into two parts: one for control flow and one for assignment.
PiperOrigin-RevId: 808497167
Change-Id: I4d78426af69d98f57600cb7fd76edaf5b20b0039
2025-09-18 03:23:12 -07:00
Haroon Qureshi 6f5a7576f9 Move simlib into experimental folder and rename it toolbox.
Also:
- update the namespace to `toolbox` (instead of `filament`)
- Add copyright notices to all files
PiperOrigin-RevId: 808474353
Change-Id: Id1fe86c5d183c8e91bec8509b6c0830b5fe84c1c
2025-09-18 02:15:23 -07:00
Rishi Krishnan 8e9eb2fa38 Update MuJoCo's version number following the 3.3.6 release.
PiperOrigin-RevId: 808180152
Change-Id: I23de64cb0968b94c489b29622e4308d16513793a
2025-09-17 09:13:04 -07:00
Yuval Tassa 7eab0117f7 Don't smooth tracking camera motion
PiperOrigin-RevId: 808110613
Change-Id: Ib8631e5ace6db7c7bb780f26b79a72e26e72f451
2025-09-17 05:25:17 -07:00
Yuval Tassa 52da7586dc Clean up includes in src/engine
PiperOrigin-RevId: 807726978
Change-Id: I02800deb79bfb3c328d941861ded9d817e8f6e32
2025-09-16 09:36:44 -07:00
Alessio Quaglino 5bbda2186d Make the Octree interpolation continuous.
This is done by detecting the hanging nodes and compute the function at those location by interpolating the corresponding coarse vertices.

PiperOrigin-RevId: 807700228
Change-Id: I27dcb85361ca445c2099dd07b280cae5c92d3131
2025-09-16 08:15:26 -07:00
Kyle Bayes ac4874226c Support NULL in dir parameter in mj_addFileVFS.
Fixes #2839.

PiperOrigin-RevId: 807208005
Change-Id: I8def3b1e388dc19fa2fa8a92d53abef30dee5b88
2025-09-15 06:00:13 -07:00
Alessio Quaglino 4fc69fa64d Ensure that the Octree is balanced.
This means that two adjacent nodes can only have at most one level of refinement difference.

Note: This is a small breaking change for mjWarp since the order of the children was flipped.
PiperOrigin-RevId: 806299445
Change-Id: Ia326a31c7a8162ae02d70c868d87779198e805be
2025-09-12 08:34:15 -07:00
Alessio Quaglino 7e048b7535 Refactor: Convert mjCOctree::MakeOctree from recursive to iterative.
The octree construction is now performed using a breadth-first search with a `std::deque` to manage tasks. A new `OctreeTask` struct encapsulates the state for each node to be processed, and a helper function `Subdivide` is introduced for subdividing the Octree nodes.

Also reduce the number of (center, size) to (min, max) conversion for the bounding box representation in order to avoid duplicated vertices in the Octree due to floating point errors.

PiperOrigin-RevId: 806214441
Change-Id: Iff9015ebe4705522db743c478cef5acf1a7312b7
2025-09-12 03:22:17 -07:00
Haroon Qureshi ad5f07e060 Extract functions from mjv_updateCamera for calculating frames and frustums.
PiperOrigin-RevId: 805770746
Change-Id: Id2a6022a2ee2e8b1a783debf54b470a9df81051a
2025-09-11 04:10:59 -07:00
Haroon Qureshi 017e7d5a73 Add light ids.
PiperOrigin-RevId: 805755907
Change-Id: I92a1b1ea4ce1495c2746fd518f33ab2d1ad81399
2025-09-11 03:20:44 -07:00
Alessio Quaglino 9d5063799f Resize keyframes also at the start of compilation.
Previously, it was assumed that attaching was the last operation performed on the mjSpec, so keyframes resulted in the incorrect size. In order to prevent information loss, we now only allow the resize function to expand the keyframe array, since attach should never remove a degree of freedom.

PiperOrigin-RevId: 804917828
Change-Id: Icfacd207ced1c6aac600d514f8d9065ceff2d347
2025-09-09 08:16:32 -07:00
Kyle Bayes ea660f4c13 Expose minimal asset cache API.
PiperOrigin-RevId: 803126923
Change-Id: Iabf63802572f7cb86864b5ece85f44b3f15a4ec0
2025-09-04 12:18:36 -07:00
Alessio Quaglino 767996ab17 Transform inputs to global before calling rayMesh in SDF collisions.
PiperOrigin-RevId: 802523399
Change-Id: I889b020e4e721fbf471992f5c87446df601ba766
2025-09-03 06:12:34 -07:00
Yuval Tassa 7a93e22514 Refactor MJMODEL_POINTERS into category-specific macros.
PiperOrigin-RevId: 802089588
Change-Id: Id3443f88e8243c5167a23b6e42eb32a32f88e8d3
2025-09-02 04:41:50 -07:00
Haroon Qureshi 8d884585dd Add target relative mouse motion actions.
PiperOrigin-RevId: 802072880
Change-Id: I1ff204594a126f8e50df4c703709f70ec4dd458c
2025-09-02 03:39:49 -07:00
Alessio Quaglino 8acd83f317 Add passive collision mode for flexes.
PiperOrigin-RevId: 801754907
Change-Id: I4147af2ee2596519d42cb9a03cf8d5488f0bc3e8
2025-09-01 04:13:58 -07:00
Yuval Tassa b9900db00e Extract memory allocation functions and core utilities
PiperOrigin-RevId: 801745499
Change-Id: Iaf05c3430769d3115743d8ab020d13148cb2eb59
2025-09-01 03:38:25 -07:00
Yuval Tassa b092563cab Remove mjDSBL_PASSIVE, split it into mjDSBL_SPRING and mjDSBL_DAMPING.
PiperOrigin-RevId: 800870384
Change-Id: I273e0ceec090901e2620febb67e57914928e94bb
2025-08-29 06:06:28 -07:00
Yuval Tassa b1c94c3761 Add printing of block-diagonalized matrices
PiperOrigin-RevId: 800345520
Change-Id: I4996c5a7509cb451744d3e428a975cceee845ea5
2025-08-28 00:54:39 -07:00
Yuval Tassa 643dc5bf4f Update USD schema formatting
PiperOrigin-RevId: 800018484
Change-Id: I7677cd099415af1271c7475d80a660653199b984
2025-08-27 07:02:50 -07:00
Yuval Tassa 7443e685ac Allow contact sensor subtree1/subtree2 to be any body.
PiperOrigin-RevId: 799632590
Change-Id: If9cd6c5a3a5f83d89ae024a8f64232ab1f1d603a
2025-08-26 11:00:39 -07:00
Yuval Tassa ec94bb49aa Make constraint island discovery on by default.
Also fix latent bug in mjData serialization.

PiperOrigin-RevId: 799505349
Change-Id: I299e7cc8133fa2ec0b339a7ff3d02543e06778b1
2025-08-26 04:27:24 -07:00
Yuval Tassa a230aa60c5 Improve mj_addM and associated test
- Updated docs to clarify that only the lower triangle is touched
- The function was unnecessarily adding the upper triangle in the sparse case
- The test used an unnecessarily large model and stepping it leading to timeouts under ASAN

PiperOrigin-RevId: 798528736
Change-Id: I592cc17dfb62379bb0cd6b332a8eb7e8b0ef6355
2025-08-23 03:56:47 -07:00
Sam Haves 1fb1810b07 Add ability to specify a material assignment to a mesh asset.
This extends both the spec and the XML definition to allow specification of a material name on a mesh. This material acts as a fallback in the case that the referencing geom element does not specify a material of it's own.

PiperOrigin-RevId: 798232378
Change-Id: Iaf300c727732744ea1b613e64334ee505ac6e209
2025-08-22 09:11:31 -07:00
Haroon Qureshi debbd7c916 Fix cast; should be mjtGeom not mjtMouse.
PiperOrigin-RevId: 798177495
Change-Id: I5d95446dd7f7f84052b60cb378acdd856c1e4d50
2025-08-22 05:47:49 -07:00
Yuval Tassa 2f28473bc1 Remove transposed Jacobian fields from mjData
No longer computed unconditionally, only ad-hoc where required.

PiperOrigin-RevId: 797753297
Change-Id: I2030fc342c98ff33575b0526dd72e2110c4fcb74
2025-08-21 07:21:24 -07:00
Yuval Tassa 5fe4224ae7 Compute sparse Jacobian transpose inside solver.
PiperOrigin-RevId: 797745776
Change-Id: I2ec429120d0c6eb51bec340619ab178389482e69
2025-08-21 06:55:48 -07:00
Yuval Tassa 174a50442d Allow transposing of sparse sub-matrices whose first row is > 0
PiperOrigin-RevId: 797728559
Change-Id: I3c825118dae198333d357d2e4f248d00b0f5d8ce
2025-08-21 05:56:33 -07:00
Yuval Tassa c7a82c32dc Do not update qacc_warmstart at the end of the solver call; instead, update it at the same time as all other state variables. This change makes mj_forward idempotent.
See changelog herein for motivation and discussion.

PiperOrigin-RevId: 797392841
Change-Id: If50e9f09e1d07e8363169d3589c32097aeca2432
2025-08-20 11:30:13 -07:00
Sam Haves 4bad134ba2 Add proper handling of MJCF asset/mesh/texturedir compiler attributes to USD plugin.
This allows the MJCF SdfFileFormat plugin to load MJCF files that specify assetdir, meshdir, or texturedir attributes. This is specifically important for resolver implementations that fetch assets into a local cache.

PiperOrigin-RevId: 796509754
Change-Id: Ib2b0c9cf9d6a3351ceea49d90c882edf94d0b880
2025-08-18 11:38:32 -07:00
Yuval Tassa 424226b640 Refactor mj_mulM to use CSR structure
PiperOrigin-RevId: 796450207
Change-Id: I2a9d567732614674547c7ae02ff0d3d4bbf1b654
2025-08-18 09:09:29 -07:00
Alessio Quaglino c2ff60e630 Decrease time step in shell examples.
Also add bending damping.

PiperOrigin-RevId: 796446515
Change-Id: I4744003caf6146e5e00614a6016d1a6dfc42cca7
2025-08-18 09:00:10 -07:00