Commit Graph

1541 Commits

Author SHA1 Message Date
Yuval Tassa edbdb5195c Change MuJoCo engine source code function-spacing convention from 3 blank lines to 2
PiperOrigin-RevId: 813754244
Change-Id: I6836e41c3b021cb727e922c25c60f629b9814c93
2025-10-01 07:58:17 -07:00
Sam Haves c439628f82 When parsing USD, infer gravity from stage metadata if UsdPhysicsScene missing or undefined.
PiperOrigin-RevId: 813705210
Change-Id: I13741af6dc87ecd9efb83219e978f5f06c72d021
2025-10-01 05:19:31 -07:00
Haroon Qureshi b1ae44d10f Refactor duplicated frame drawing logic into a utility function.
PiperOrigin-RevId: 813675737
Change-Id: I7f9094852f26b2ddc08534bf87cf2f71476d99ec
2025-10-01 03:36:14 -07:00
Haroon Qureshi f9d0bedb44 Minor cleanup: Move geom-related functions together.
PiperOrigin-RevId: 813661319
Change-Id: I6cdf74ff57f39f932ddd39268f15f1128ddf1df4
2025-10-01 02:46:45 -07:00
Haroon Qureshi 328a4ab293 Merge geomsExhausted into acquireGeom.
PiperOrigin-RevId: 813347956
Change-Id: I07bd566388383cc5c49e675f5b85fffb379ef6d1
2025-09-30 11:19:53 -07:00
Sam Haves 4d590afdad Instead of caching PNGImage results, cache mjCTexture and mjCHField assets.
PiperOrigin-RevId: 813307632
Change-Id: I9de8b46423f57240d22811571d0533b010ee1e2b
2025-09-30 09:44:45 -07:00
Haroon Qureshi 59d0676dcc Remove redundant checks for exhausted geoms.
PiperOrigin-RevId: 813284297
Change-Id: I565c517bef782ba07ff323e206b75f6f905e5809
2025-09-30 08:44:17 -07:00
Sam Haves 2dc533b63b Allow flipping textures with any number of channels and user provided pixel data.
PiperOrigin-RevId: 813256285
Change-Id: I0d49885dc483ab8f093b2566ec4bef355575505e
2025-09-30 07:28:13 -07:00
Haroon Qureshi 70d03adc71 Store the status of the scene in the scene itself.
PiperOrigin-RevId: 813119377
Change-Id: Iebff9e7796ca9809ea22902522982bfd96eeba06
2025-09-30 00:06:00 -07:00
Haroon Qureshi 6a7566872a Functions for printing the contents of mjvScene.
PiperOrigin-RevId: 812699642
Change-Id: Iafff53c952c952624129ff01a8c1b0aa5d38eec5
2025-09-29 02:47:17 -07:00
Haroon Qureshi e1c7e19780 Add rendering flags to the studio UI.
PiperOrigin-RevId: 812649785
Change-Id: I47c6f974b7336bdd63c088ccfd06b5835e77ebff
2025-09-28 23:58:33 -07:00
Kyle Bayes 8de86c9944 Remove margin name from geomdist sensors.
PiperOrigin-RevId: 811775910
Change-Id: I4d265d4ad0206ea2d92c6c4b659f509a17f12baa
2025-09-26 05:24:12 -07:00
Yuval Tassa e51459f949 Break out struct initialization functions into engine_init.c.
PiperOrigin-RevId: 811598048
Change-Id: Ia832a8268e2209a5a264bbf79aa00dda487206bc
2025-09-25 19:22:27 -07:00
Yuval Tassa fe8384b6c5 Visualize joint and tendon limits by re-coloring.
PiperOrigin-RevId: 811590674
Change-Id: I5b65f2294a4bcda3c321fb51ebf29501bd0d416d
2025-09-25 19:02:26 -07:00
Sam Haves 922aebbeed Provide explicit argument for asset cache ID.
This will allow assets to cache compiled results with different parameters. For example, we could cache both an RGB version of a texture and a Mono version.

PiperOrigin-RevId: 811341377
Change-Id: Ifd6a4ff88661a2b38be47c02d6a666de2c202885
2025-09-25 07:24:12 -07:00
Haroon Qureshi 0baac58999 Remove redundant ngeoms check.
PiperOrigin-RevId: 810787607
Change-Id: I5d04b1d7f5f8ad758960a46ff08cc47d2887e851
2025-09-24 02:21:35 -07:00
Yuval Tassa d9650b68b0 Remove unused private functions
PiperOrigin-RevId: 810776310
Change-Id: I1c67c5efe07c4ca23b04122548b674719be927f7
2025-09-24 01:48:54 -07:00
Yuval Tassa d71d42a374 Add private function mju_isZeroByte to check for byte-wise zero.
PiperOrigin-RevId: 810456282
Change-Id: I877d0f9225e7a783ed7ff12ce54f4ed0a7889793
2025-09-23 08:49:43 -07:00
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