Commit Graph

802 Commits

Author SHA1 Message Date
Taylor Howell 23c56ec4bb mjSpec python bindings for add functions: accept size with 1, 2, or 3 parameters
PiperOrigin-RevId: 858494291
Change-Id: I8a02dcac1d2419fbc728607907425b401cf66da4
2026-01-20 02:39:04 -08:00
Alessio Quaglino e56b31e98f Reduce flexedge_J size from nflexedge x nv to the effective sparse size.
PiperOrigin-RevId: 856290141
Change-Id: Ide297d1b6f0e3aa07e3e20bf9ab44b6501097695
2026-01-14 11:18:41 -08:00
Google DeepMind cbc1136502 Roll back VFS refactor due internal breakages
PiperOrigin-RevId: 856273160
Change-Id: I4097e05ed4e48ebee05b4347d0f227d4f39c1b09
2026-01-14 10:38:29 -08:00
Haroon Qureshi d387578783 Refactor mjVFS and resource management.
Resource operations (e.g. mju_openResource, mju_readResource, and
mju_closeResource, etc.) are now all handled by a VFS instance. It
is now up to the VFS to determine which provider to use in order to
handle those operations.

This allows us to dynamically add/remove (aka "mount") providers to
a VFS to handle special requests. mj_addFileVFS and mj_addBufferVFS
have been reimplemented as two such use-cases. Moreover, we expose
the mounting behaviour with two new functions: mj_mountVFS and
mj_unmountVFS.

PiperOrigin-RevId: 856166919
Change-Id: Id723d612ffc0bff020705cf19ef95fbf24676840
2026-01-14 05:19:57 -08:00
Yuval Tassa 218226fc95 Breaking change: Add surface normal output to MuJoCo raycast functions.
PiperOrigin-RevId: 855781592
Change-Id: Id96b1ca7eaf722e260cc69d7706c28dc51f52d92
2026-01-13 10:22:21 -08:00
Alessio Quaglino a49576e469 Move flexedge sparse Jacobian indices to mjModel.
PiperOrigin-RevId: 855718305
Change-Id: Ic136f4efa6735b934288f65c332d71ee8b0f6da5
2026-01-13 07:33:17 -08:00
Google DeepMind 09a6fb7d4d #mjspec Enforce that material textures array is always of length mjNTEXROLE.
PiperOrigin-RevId: 855684213
Change-Id: Id8a3734c75841dfb91bd2252114249f08461b7f2
2026-01-13 05:55:09 -08:00
Sam Haves 7e45bbb51c Add urdf file extension case to mj_parse.
fixes #3004

PiperOrigin-RevId: 855249634
Change-Id: I6c21d0ada4fe482059f64e96d413796f5c1c66ce
2026-01-12 08:59:00 -08:00
Yuval Tassa d7e4038be8 Expose mj_copyData in Python bindings.
This allows calling `mujoco.mj_copyData(dest, model, src)` to copy data between existing `mjData` instances.

PiperOrigin-RevId: 855150139
Change-Id: If122cb7acf590846e25ee15f9770c3c087147169
2026-01-12 03:21:15 -08:00
Yuval Tassa a26f09accf Standardize function docstring style in MuJoCo API.
Updates function comments to consistently use a semicolon (`;`) before describing the return value and to use the imperative form "return" instead of "returns".

Also fix error in docstring of `mjp_registerResourceProvider`

PiperOrigin-RevId: 854888532
Change-Id: I311239a2770ded5febece9958ae4e94c1e522600
2026-01-11 09:00:35 -08:00
Sam Haves e37c2268a6 Release gil when compiling spec.
When compiling with threading, we will block the main thread anyways waiting for all threads to complete.

PiperOrigin-RevId: 854230560
Change-Id: Ief689d381afaa3aacc5d712a8df0cb4b6762251c
2026-01-09 09:50:15 -08:00
Sam Haves ce74475c39 Delete VFS created from assets dict before throwing error.
PiperOrigin-RevId: 853838173
Change-Id: Id0dd33b69657813275d1f42db54fae222c337791
2026-01-08 12:13:55 -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
Alessio Quaglino 5febca9eeb Remove gainprm trailing dimension in test_actuator_shortname.
PiperOrigin-RevId: 853243753
Change-Id: Ia46df64a2308ef0bbc94a396f0732e221e174ea0
2026-01-07 06:59:50 -08:00
Yuval Tassa 5be6f262b2 Fix legend call in MuJoCo tutorial notebook. Fixes #2447
PiperOrigin-RevId: 853220360
Change-Id: I1920af5fd01bcf654c7d9d11d8dd1c2f637ef748
2026-01-07 05:42:45 -08:00
Taylor Howell fa70f73691 fix generate_spec_bindings.py
PiperOrigin-RevId: 852414826
Change-Id: I50ddba2d238866ba313338040f020ff3a645e1e4
2026-01-05 12:42:26 -08:00
Taylor Howell 90449f7521 Update codegen for mjSpec add functions to add typed arguments and docstring.
PiperOrigin-RevId: 852351892
Change-Id: If785accdf8c9e48dd9924c54942856c1e00fd031
2026-01-05 10:14:49 -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 7fddeeaff6 Minor fixes to mj_multiRay
PiperOrigin-RevId: 847780959
Change-Id: I3588415f215bd5f1592bec6678a5bae45d5f0980
2025-12-22 08:52:36 -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
Haroon Qureshi 7190bd4912 Add flag for depth rendering.
PiperOrigin-RevId: 846203691
Change-Id: I5ec494446bcfc1f7c81536a87dd24f9967973563
2025-12-18 04:36:26 -08:00
Matija Kecman 3c19b63ed3 Refactor texture.data to be handled using py::bytes
PiperOrigin-RevId: 843226742
Change-Id: I7ab920da3c387467b1fced27f557c6edd1af4bce
2025-12-11 08:06:12 -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
Haroon Qureshi caec236b2f Make mj_loadModelBuffer a public API.
PiperOrigin-RevId: 843105390
Change-Id: I4058471b4cf64995dd5ab43e9c8c24e322004b62
2025-12-11 01:24:17 -08:00
Matija Kecman bf49fe3daa Enable reading textures from spec in Python
PiperOrigin-RevId: 842151742
Change-Id: I477d118cc7e2385d29b395b192fa89e9facb9c3e
2025-12-09 03:08:32 -08:00
Gabe Oppenheimer 96e376451c Update MuJoCo version from 3.4.0 to 3.4.1 following the 3.4.0 release
PiperOrigin-RevId: 840914696
Change-Id: Iffabc70dd174384ba1c535cafcd34982ff8e5712
2025-12-05 16:15:56 -08:00
Gabe Oppenheimer b663b7602b Final preparations for the v3.4.0 release
PiperOrigin-RevId: 838824676
Change-Id: Icb5a825cb41be4d0730f4a6729b63531d649066f
2025-12-01 10:06:33 -08:00
Yuval Tassa 19e2d0ae2f Add mj_fwdKinematics and a table improving documentation of the MuJoCo computation pipeline structure.
PiperOrigin-RevId: 838768130
Change-Id: I1a22d5cdca7db704ba4cea1667fcbecb16b87005
2025-12-01 07:39:00 -08:00
Gabe Oppenheimer b6e162d6fa Update MuJoCo version from 3.3.8 to 3.4.0
PiperOrigin-RevId: 836719207
Change-Id: I28cbc90cee42aebfb5a4201561289ef6747cdc83
2025-11-25 10:16:02 -08:00
Yuval Tassa 888d3a7b07 Add mj_copyState
PiperOrigin-RevId: 836588419
Change-Id: I7609e121dc0ac697d4d015d4244bdd5962650def
2025-11-25 03:10:30 -08:00
Yuval Tassa c2e9bfa3e8 Clarify semantic of body_rootid and body_weldid
PiperOrigin-RevId: 834827589
Change-Id: I562e0aa374ce59d8b769e8d003e4c63ee434a1fc
2025-11-20 10:54:59 -08:00
Alessio Quaglino 62872fecd1 Reduce size of mjsTexture.gridlayout (was 13, should be 12)
PiperOrigin-RevId: 833764817
Change-Id: I2655a729d38a8871be2024492ce2a971fc8a0372
2025-11-18 04:49:05 -08:00
Yuval Tassa a66cf303f8 Clean up ray functions
PiperOrigin-RevId: 833299985
Change-Id: I30aabe889ccc5900ff0e50a578e98e176d3effa4
2025-11-17 05:47:44 -08:00
Haroon Qureshi 6c15c711ee Make mjv_cameraFrame and mjv_cameraFrustum public.
PiperOrigin-RevId: 832187804
Change-Id: I74d05d7fe03bc81bd05a823c7c9791bca12e3079
2025-11-14 00:03:18 -08:00
Yuval Tassa 042c5223a6 Change mj_sizeModel return type to mjtSize.
PiperOrigin-RevId: 831768095
Change-Id: I079fbadc403b32a3ce8a73fe21b2cd66391401c3
2025-11-13 02:32:18 -08:00
Yuval Tassa 252a0d73df Add sleep related data structures
PiperOrigin-RevId: 829055431
Change-Id: I1ccbd77a57044a754ae7db611b4c2c0010fbda53
2025-11-06 12:10:55 -08:00
Yuval Tassa ad49733db2 Improve error message for insufficient arena memory in _realloc_con_efc.
PiperOrigin-RevId: 826845370
Change-Id: I09467dd44a6f9f01b89ff6c1d74cde493e84eb1c
2025-11-01 05:54:56 -07:00
Sam Haves 57f7145806 Create mjpDecoder, mj_parse, and mju_decodeResource
- plugin system similar to mjpResourceProvider, but instead of loading a resource it converts an existing mjResource into an mjSpec.
  - The returned spec is then composed into the referencing spec.
  - This enables different file types to generate arbitrary specs, and allows us to separate format parsing from compilation code.

Follow up CLs will move some of the logic in src/engine for PNG, USD, KTX, OBJ loading into decoders.

The mj_parse function MjSpec from a given file, it's a more generic version of mj_parseXML.

In it's implementation, mj_parse as opposed to mj_parseXML will look for any registered decoder and
not assume we are striclty dealing with MJCF.

PiperOrigin-RevId: 826149497
Change-Id: I0ece26904280cb94bd5ded6dd5a565c539d60254
2025-10-30 12:54:40 -07:00
Google DeepMind d769440924 Store asset keys relative to the MJCF. This CL fixes cases when loading a spec with "from_zip" that fails on zipped folders that contain a root directory.
PiperOrigin-RevId: 825484553
Change-Id: I79c6f542edbd3ffd167d0b5cecc704c32c8d6824
2025-10-29 04:24:09 -07:00
Alessio Quaglino 010d919244 Add __setattr__ to _MjBindModel and _MjBindData.
This allows setting attributes with bind using a list of mjSpec objects as arguments.

PiperOrigin-RevId: 825456920
Change-Id: Ie6af956feab0a805175d7aaecf26e071401fbf05
2025-10-29 02:55:08 -07:00
Alessio Quaglino 2bdea1a0aa Use "/" as default prefix during attach if not specified.
The user can recover the old behavior by passing prefix="".

This enables to attach children with default and save a valid result to XML.

PiperOrigin-RevId: 825011185
Change-Id: Id20c2589da928bf92b77bdb01cfba73dfc1d2f52
2025-10-28 06:40:34 -07:00
Copybara-Service d971e5c2df Merge pull request #2908 from davidhozic:doc/fix-comments
PiperOrigin-RevId: 824546229
Change-Id: I9961e7f39d0549ff8b15a1007fb20832a0014bbd
2025-10-27 09:16:01 -07:00
Sam Haves ac2cd5dfd6 Add support for querying of MjsTendon path from Python.
Fixes #2670

PiperOrigin-RevId: 822215254
Change-Id: Ice5a264e54f963776093511c6e4ac830aae6d4f8
2025-10-21 11:51:24 -07:00
Saran Tunyasuvunakool 2f65e23779 Add mj_extractState as a public API function.
This function allows the caller to extract a subset of components of a state previously obtained via `mj_getState` without having to first write it back into `mjData`.

PiperOrigin-RevId: 822165077
Change-Id: I6433261f4f5ec2e8d024bb7dee8f7dbf1e62666c
2025-10-21 10:01:22 -07:00
Alessio Quaglino 056945df20 Enable frames to create the same children as bodies.
PiperOrigin-RevId: 822097998
Change-Id: I8477d8abe2d6f711421126825fd94d39af1a4e07
2025-10-21 06:57:01 -07:00
Sam Haves 59f14485e0 Move mjCWrap type to mjsWrap.
PiperOrigin-RevId: 821851540
Change-Id: I53382a8a21312a96aea46eec130f43e7cad70f92
2025-10-20 16:28:41 -07:00
David Hozic b19644bec9 Fix spelling errors 2025-10-21 01:21:47 +02:00
Gabe Oppenheimer 48f10bfcb6 Update MuJoCo to v3.3.8 following the 3.3.7 release.
PiperOrigin-RevId: 819919328
Change-Id: Ib34f959f6f8efd83362d49e784aa8e0594036899
2025-10-15 14:39:05 -07:00
Gabe Oppenheimer ae1febd83f Automated g4 rollback of changelist 818694877.
*** Reason for rollback ***

BEGIN_PUBLIC
Holding off on a minor version bump until the next release.

*** Original change description ***

#mujoco update the version to 3.4.0 ahead of the 3.4.0 release.

Bump the version to 3.4.0 ahead of the next release.

***

PiperOrigin-RevId: 818748143
Change-Id: I722e9beb80c61a48bd997da6a1840777a81d5036
2025-10-13 11:14:42 -07:00