Commit Graph

1781 Commits

Author SHA1 Message Date
Sam Haves 2f2f9a30ba When loading models use mj_parse instead of mj_parseXML, and allow non-xml file types.
PiperOrigin-RevId: 853730923
Change-Id: I1c107daafd558bedb99338779c8174ee3e4d07e2
2026-01-08 07:22:51 -08:00
Yuval Tassa 1f4bb39b53 Fix typo in comment.
PiperOrigin-RevId: 853703158
Change-Id: Ic123f9273b99eeede1d76d3da20b5b5e9f898dcd
2026-01-08 05:56:29 -08:00
Haroon Qureshi 765bd54c7c Move GlobalModel class and functionality into its own file.
We'll need some of this functionality for tests.

PiperOrigin-RevId: 853652149
Change-Id: Ib924d886b73784a0f370285e0b82b2ed833e3e77
2026-01-08 03:08:12 -08:00
Yuval Tassa 8f5eb1e4f4 Improve bounds checking in engine_util_solve.c.
Add checks to ensure `snprintf` does not write beyond the allocated log buffer size, preventing buffer overflows.

Fixes #2661, #2673

PiperOrigin-RevId: 853643867
Change-Id: Ibdc47810158466dc961767284ac297df98916dac
2026-01-08 02:44:38 -08:00
Yuval Tassa 608115ab95 Add output attribute to camera elements.
This attribute allows specifying the intended output types (e.g., RGB, depth, normal) for each camera in the XML. The output types are stored as bit flags in `mjModel`.

PiperOrigin-RevId: 853316261
Change-Id: I1ad2e94102593cf402756f8f4c80509371ca86d2
2026-01-07 10:22:27 -08:00
Sam Haves 3c93d6b979 Move cache creation into lambda initializer to avoid data race.
PiperOrigin-RevId: 853295269
Change-Id: Ic1c8f3d2fec876070da432f8b709b341f3c6cc0a
2026-01-07 09:29:54 -08:00
Matija Kecman e1261ba5f1 Fix perturbation rendering in webdemo
PiperOrigin-RevId: 853290958
Change-Id: Ifcea1091633597171c5268d5ee091bea3ddee45b
2026-01-07 09:18:45 -08:00
Haroon Qureshi 9743c2d385 Use mjResourceProvider instead of custom LoadAsset callbacks.
PiperOrigin-RevId: 853172824
Change-Id: I60ef1207611c4da119cc3f0a7819088cffca6e4f
2026-01-07 03:03:23 -08:00
Yuval Tassa fa044fe0e5 Use the word "primal" for things that relate to both Newton and CG.
PiperOrigin-RevId: 852634373
Change-Id: I2c7641bb92d9c01252f861b9c36e72ef6ddc6e98
2026-01-05 23:56:57 -08:00
Haroon Qureshi e3ddb126f5 Fix target name; should be PLATFORM not STUDIO.
(This was caused by a bad merge on my end.)

PiperOrigin-RevId: 851315742
Change-Id: Ifd5afa7f6cbd566ef2c15603e91a7360ea65c86a
2026-01-02 06:03:13 -08:00
Haroon Qureshi b9fa8ee6e9 Move all specialized rendering logic into Renderer class.
(We may consider splitting this class up into specialized subclasses at a later date.)

PiperOrigin-RevId: 851290789
Change-Id: Iee00b8e906eeb911de5799f784475ac6916ab55b
2026-01-02 04:25:07 -08:00
Matija Kecman 9f674b04a9 Fix ground plane rendering when using filament backend
PiperOrigin-RevId: 848473849
Change-Id: I096b20c6a5538ff95396bdf09f84ed5f2d3015ed
2025-12-24 01:25:51 -08:00
Yuval Tassa 70bc7be4bc Add additional data fields that can be reported by rangefinder sensors.
PiperOrigin-RevId: 848316991
Change-Id: Idbf7ba81b4da711a22c23302c8782ab2b0b98d82
2025-12-23 15:33:00 -08:00
Yuval Tassa f2e9097ed6 Change mjsCamera.resolution type from float to int.
Resolution is inherently an integer quantity (pixels).

PiperOrigin-RevId: 848276456
Change-Id: I92ee1aa88fd552fd42cb3871442f020f26d6fa6a
2025-12-23 13:14:32 -08:00
Yuval Tassa 9d646e6548 Extend rangefinder sensor to support cameras.
PiperOrigin-RevId: 848255889
Change-Id: I6e1a9ed13d29d2242558625a47e24e47ad6e87db
2025-12-23 12:04:49 -08:00
Yuval Tassa 4a871990e9 Fix mismatched signature in engine_ray.c
PiperOrigin-RevId: 847834144
Change-Id: Ib42008880f495cf7f3b9e0fd2394a4df64c66ad4
2025-12-22 11:41:23 -08:00
Yuval Tassa b28b5db680 Add mj_multiRayNormal for multi-ray casting with normal computation (not exposed in public header)
PiperOrigin-RevId: 847821078
Change-Id: I616441d3460406a92a10731d1a086af6163e96ad
2025-12-22 11:02:58 -08:00
Yuval Tassa 7fddeeaff6 Minor fixes to mj_multiRay
PiperOrigin-RevId: 847780959
Change-Id: I3588415f215bd5f1592bec6678a5bae45d5f0980
2025-12-22 08:52:36 -08:00
Haroon Qureshi a3e66cd5df Combine performance charts; add fullscreen mode.
PiperOrigin-RevId: 847751915
Change-Id: I819eb8d36224ddba38ef8532a038a2ef350890c8
2025-12-22 07:08:20 -08:00
Yuval Tassa 223ba99ec2 Add mju_rayFlexNormal (not exposed in public header)
PiperOrigin-RevId: 847746174
Change-Id: Ia8f597d296bf6a3eed9bd48b1c39b2ff2b5fcf90
2025-12-22 06:49:22 -08:00
Yuval Tassa c7f5766345 Add frustum visualization for orthographic cameras.
PiperOrigin-RevId: 847698917
Change-Id: I13633e8ba2d4718b127a5838c404ab74c6180e3d
2025-12-22 03:43:54 -08:00
Yuval Tassa 158525269b Refactor camera intrinsic parameter handling.
Move logic from parser to compiler.

PiperOrigin-RevId: 847689906
Change-Id: I844746081973205e1b33a3845add842e8b8c3c07
2025-12-22 03:08:18 -08:00
Yuval Tassa b8a4ac5d48 Refactor camera orthographic attribute to projection enum.
PiperOrigin-RevId: 847069028
Change-Id: I7f686fe654e9b56519cab8bd2f37c9cc40091d3f
2025-12-20 03:28:29 -08:00
Sam Haves 44c8ef890d When building with USD enabled, add functionality that automatically registers the mujoco USD plugins.
PiperOrigin-RevId: 846767370
Change-Id: Ieedbe127353623c11150551c1409d340dbc57421
2025-12-19 09:39:03 -08:00
Sam Haves 3d9c195e3c Fix rpath for usd target shared libs.
PiperOrigin-RevId: 846759676
Change-Id: I5b2a73b3f997d4d0d447e051c43069ae7418a7ec
2025-12-19 09:14:45 -08:00
Yuval Tassa 849a650143 Refactor mju_cholUpdateSparse to use a dense accumulator, 1.5-2x function speedup.
PiperOrigin-RevId: 846754379
Change-Id: Ie599658db2907a26095072d97d07b99a693050dc
2025-12-19 08:57:45 -08:00
Sam Haves 9e150fe82c Add separate build step for OpenUSD to third_party_deps.
This will fetch and call the build_usd.py build helper for OpenUSD and build within the MuJoCo _deps folder. Simplifying the build process for MuJoCo with USD. Users can still provide their own USD build, but must now do so via pxr_DIR.

PiperOrigin-RevId: 846735578
Change-Id: I0da7eb2da6465e2d518084340e762bf370adb6d5
2025-12-19 08:00:15 -08:00
Yuval Tassa 76e0a78b32 Use two-step sparse Cholesky in Newton solver.
17% overall speedup for `100_humanoids.xml` as measured by `testspeed`

PiperOrigin-RevId: 846723342
Change-Id: Ibc41487bfc576c992f14853640d0b6000f5b47b2
2025-12-19 07:20:09 -08:00
Yuval Tassa 45b0153067 Refactor sparse Cholesky factorization into symbolic and numeric phases.
The new symbolic function is a generalization of the function it replaces. In this CL it takes two unused temp arrays. The actual change in behavior happens in the followup.

New benchmark test output below ("L" is 2 humanoids and 100 free objects, "XL" is 100 humanoids). Note that `symbolic` is only ever called once per Newton iteration, while `numeric` is sometimes called multiple times (when the rank-1 update fails), hence timing them separately is valuable.

```
Benchmark               Time(ns)        CPU(ns)     Iterations
--------------------------------------------------------------
BM_old_L_mean              84382          84703          19547  11.807k items/s
BM_symbolic_L_mean         16345          16381          88414  61.055k items/s
BM_numeric_L_mean          10986          10994         120000  90.999k items/s
BM_old_XL_mean           1241208        1244212           1200  803.924 items/s
BM_symbolic_XL_mean       130917         131042          12720  7.631k items/s
BM_numeric_XL_mean         77004          76767          21116  13.029k items/s
```

PiperOrigin-RevId: 846704054
Change-Id: Ib0c365724d63bf2b81606ca5353756a6496c3a26
2025-12-19 06:11:55 -08:00
Haroon Qureshi d1fd11bccd Refactor SaveScreenshot into a more useful RenderToTexture function.
Removes a few unused functions from helpers library.

PiperOrigin-RevId: 846661437
Change-Id: I815ffe1990098dedb71f694af088d85294f9c7de
2025-12-19 03:33:59 -08:00
Haroon Qureshi 522ff1cd80 Allow ImGui uploaded images to be resized or destroyed.
PiperOrigin-RevId: 846354598
Change-Id: I86882813ab607945fffc763122248e167be856a8
2025-12-18 11:42:19 -08:00
Sam Haves b5b654f00c Correctly handle segmentation and ID_COLOR flag in filament.
PiperOrigin-RevId: 846319715
Change-Id: I244ae52c34079b79d3179fafdf6aa506cc89e1ff
2025-12-18 10:14:13 -08:00
Sam Haves 05e1c452c7 Add VFS parameter to mjpDecoder decoding function.
PiperOrigin-RevId: 846242734
Change-Id: I317e11e6fcd965f66416abcf690a3a65d043e9ee
2025-12-18 06:38:40 -08:00
Haroon Qureshi bebdd62943 Allow studio to search for models in predetermined search paths.
A future CL will allow users to specify search paths in their settings.

PiperOrigin-RevId: 846240293
Change-Id: I1a1a4027d0fc85004a12fe01a406f50fd929f3e4
2025-12-18 06:32:24 -08:00
Haroon Qureshi 7190bd4912 Add flag for depth rendering.
PiperOrigin-RevId: 846203691
Change-Id: I5ec494446bcfc1f7c81536a87dd24f9967973563
2025-12-18 04:36:26 -08:00
Yuval Tassa 08b4b4144d Add tests for mju_cholUpdate and mju_cholUpdateSparse.
PiperOrigin-RevId: 845229292
Change-Id: Ide1406f85e49fe5a5b339bedff7ff6dd8099e5e8
2025-12-16 05:59:40 -08:00
Yuval Tassa 2b9940bc67 Add private function mju_fillInt
PiperOrigin-RevId: 845217293
Change-Id: I604372ab7ea7f4d47d9427d36dc8cd78e60d84ca
2025-12-16 05:16:50 -08:00
Sam Haves eef71832db Remove usage of usdImaging tokens to avoid needing to build imaging.
PiperOrigin-RevId: 844768270
Change-Id: Iba0a03646e56d9be5accf754f97ec37db8055425
2025-12-15 07:44:18 -08:00
Yuval Tassa ccbfc6c8bf Improve line search initialization logic and first Newton step acceptance.
PiperOrigin-RevId: 844316808
Change-Id: I0a7639a486c75f122db7f8b8c0df42ef810f060c
2025-12-14 01:50:52 -08:00
Yuval Tassa e3a860de69 Update function signatures in engine_util_spatial.h to appease fussy GCC
PiperOrigin-RevId: 843752024
Change-Id: I041efe6acc5a4a44488bb9ec09101681d47c37c5
2025-12-12 10:47:31 -08:00
Haroon Qureshi 43bcbb158c Load last saved GUI configuration on first load.
Also save theme to the configuration.

PiperOrigin-RevId: 843710929
Change-Id: I7ce9ce0f026d2cb5f79addf6c16c9b540bf11954
2025-12-12 08:56:53 -08:00
Yuval Tassa 499291e5c2 Fix aliasing issues in engine_core_smooth.c
PiperOrigin-RevId: 843699660
Change-Id: I21d4ed09284624ce80fcd5b1d572b9084e95e1f1
2025-12-12 08:25:06 -08:00
Haroon Qureshi 3da421afaa First-pass implementation of web-based studio app.
PiperOrigin-RevId: 843685213
Change-Id: I2642a21d5573ef548eece0eb9a2c634e4881eec5
2025-12-12 07:42:42 -08:00
Yuval Tassa 157d261701 Fix aliasing issues in engine_collision_primitive.c
PiperOrigin-RevId: 843665186
Change-Id: I76cd479991f6083495e7ad95c2f57a8ef8fde925
2025-12-12 06:36:34 -08:00
Yuval Tassa 9fc37a3be4 Fix aliasing violations in engine_collision_box.c
PiperOrigin-RevId: 843647612
Change-Id: If8ad12c058a30ec475b9eb47d315019edbb8a7bb
2025-12-12 05:35:42 -08:00
Yuval Tassa 600f0f20bc Introduce private header engine_inline.h exploiting restrict and avoiding loops and copies in some commonly used utility functions.
PiperOrigin-RevId: 843635464
Change-Id: I3b0553eea98424ccc7def77e3769e2994f3e9014
2025-12-12 04:49:29 -08:00
Haroon Qureshi a0a56065e0 Use hex values instead of u8 string literals.
PiperOrigin-RevId: 843583709
Change-Id: Ib55cfd472de2f83b0455ebf95f6826c887f6dd70
2025-12-12 01:45:13 -08:00
Haroon Qureshi e07adc387a Update themes to differentiate from default dear_imgui themes and add a classic theme that's similar to simulate.
PiperOrigin-RevId: 843313013
Change-Id: Id01841097f32a5b01acd8fcf59392a73acad8f27
2025-12-11 11:46:12 -08:00
Haroon Qureshi 87d333c64a Allow MJB and XML content to be loaded directly.
PiperOrigin-RevId: 843180720
Change-Id: Id4f2bf81507b971dfbbf250d775d7fdfc76517df
2025-12-11 05:41:43 -08:00
Yuval Tassa 1ff74ba810 Change the type of state signature arguments from unsigned int to int
PiperOrigin-RevId: 843162492
Change-Id: I51d3324f088e8055898e115bdd32267c5950a412
2025-12-11 04:34:36 -08:00