Sam Haves
f5d3ce3451
Introduce mjpEncoder plugin architecture
...
Add a new mjpEncoder plugin type mirroring the existing mjpDecoder pattern.
Encoders serialize an mjSpec + mjModel to an mjResource for a given format.
New API functions:
- mjp_registerEncoder: globally register an encoder
- mjp_defaultEncoder: zero-initialize an encoder struct
- mjp_findEncoder: look up an encoder by filename extension or content type
The mjfEncode callback takes (mjSpec*, mjModel*, mjVFS*, mjResource*) and
returns 0 on success. Writing to mjResource keeps symmetry with the decoder
reading from mjResource and leaves the door open for writable resource providers.
PiperOrigin-RevId: 889187898
Change-Id: I180771b2255b91dea188ac5e2cdc3a8f0fb85364
2026-03-25 05:35:39 -07:00
Tom Erez
60be42e83c
Replace autowrap C# binding generator with introspect-based codegen.
...
This CL replaces the header-parsing autowrap system for generating
MuJoCo C# bindings (MjBindings.cs) with a new generator that uses
the mujoco.introspect module. The new generator reads pre-parsed
API data from introspect's enums, functions, and structs modules
instead of parsing C headers directly.
Changes:
- New: generate_cs_bindings.py in third_party/py/mujoco/codegen/
- Updated: genrule in unity/mujoco/BUILD to use codegen
- Updated: MjBindings.cs regenerated from codegen
- Removed: entire autowrap/ directory (9 files)
- Removed: transitional validate_codegen.py
The validate test continues to verify that the genrule output
matches the checked-in MjBindings.cs.
PiperOrigin-RevId: 885206129
Change-Id: Ib9fb883a2242dd2c039033eadee7a4a6ac91ed55
2026-03-17 14:19:49 -07:00
Yuval Tassa
efae9157a7
Polynomial stiffness and damping https://youtu.be/aKa3ZlEF9_Y
...
PiperOrigin-RevId: 884607673
Change-Id: If8088dbf37fed1055304778a7eb84dec52cba920
2026-03-16 13:25:25 -07:00
Sam Haves
6890e133c0
Add mjs_getCompiler C API and compiler property to Python spec elements.
...
PiperOrigin-RevId: 881488083
Change-Id: I3aa1c0562bf2fd27057b8056048e3156fc1b067c
2026-03-10 09:57:36 -07:00
Sam Haves
448e221690
Raise ValueError if adding a spec results in a duplicate name.
...
PiperOrigin-RevId: 871397807
Change-Id: I50742efe7ba194ed3b1fe916f05e35b7fb2d7ec0
2026-02-17 10:54:47 -08:00
Alessio Quaglino
54ace777c1
Add convenient plugin assignment in Python bindings.
...
PiperOrigin-RevId: 861168536
Change-Id: I274fbf3460d475434f837ab58bf5e2b0988369fd
2026-01-26 06:37:31 -08:00
Taylor Howell
5ae6b5fe31
Fix MjSpec.add_texture gridlayout argument to accept strings and character lists
...
PiperOrigin-RevId: 859599919
Change-Id: If785f36010a7437b354ec0ce7db30c2b7ec69fe6
2026-01-22 07:28:16 -08:00
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
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
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
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
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
Alessio Quaglino
fc13995dd4
Yield ownership of vector<double>, vector<float>, and vector<int> to mjSpec in Python bindings.
...
Fixes #2756
PiperOrigin-RevId: 785417251
Change-Id: Ib399c46ee59585258ace7d9583c68b7d06d0a9e4
2025-07-21 06:44:17 -07:00
Alessio Quaglino
564c51ddb9
Check for duplicated names when setting element names.
...
PiperOrigin-RevId: 778827590
Change-Id: I77a208c1571cf735cae80840ea830aa347681f71
2025-07-03 03:20:55 -07:00
Alessio Quaglino
594e17074a
Replace name attribute with setters and getters in the C API of mjSpec.
...
PiperOrigin-RevId: 778816015
Change-Id: Ieffb7a5bce37e887ff009f9a02d2434435e79ca1
2025-07-03 02:30:56 -07:00
Alessio Quaglino
a209134315
Enable procedural plugin activation in Python bindings.
...
PiperOrigin-RevId: 746055614
Change-Id: Idcc2f62fdfeccdca356e3d1acadf168b46a98881
2025-04-10 09:13:21 -07:00
Alessio Quaglino
ebd30493c8
Allow nameless bind in MJX.
...
PiperOrigin-RevId: 742592221
Change-Id: I9490aebd64e3a31219c552d5b6eb55236680f10d
2025-04-01 01:45:44 -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
Copybara-Service
d830691f53
Merge pull request #2291 from AaronYoung5:main
...
PiperOrigin-RevId: 725933976
Change-Id: I207cf272d30e28f00fb4d07bd237385ad4c26a84
2025-02-12 00:16:10 -08:00
Alessio Quaglino
cef5b31a3f
Drop find_ prefix in Python MjSpec methods accessing elements by name.
...
PiperOrigin-RevId: 725594833
Change-Id: Ibf8a9918e98b298751d0ef2e657714e28e5fa460
2025-02-11 05:50:49 -08:00
Alessio Quaglino
e54f3c222d
Autogenerate mjSpec find_* methods.
...
PiperOrigin-RevId: 725255440
Change-Id: Ia9112f6c582ea9bb0af38aa97a917e72a98a84f5
2025-02-10 10:03:44 -08:00
AaronYoung5
287256e63f
added struct function for spec bindings
2024-12-16 14:22:59 -05:00
AaronYoung5
0cf5500b6a
Fixed MjSpec introspection with visual.rgba and visual.headlight. Added access to MjSpec.visual.global_.
2024-12-16 14:20:18 -05:00
Alessio Quaglino
644dfc7fb5
Fix assigning bytes to texture data.
...
PiperOrigin-RevId: 706747323
Change-Id: I6b0ee67d4f35db3a149ba8d9979546d3c712bb8b
2024-12-16 10:05:23 -08:00
Alessio Quaglino
159f23e6b4
Remember compiler options during attach.
...
Note:
- Move compiler options into `mjsCompiler` struct.
- The compiler options from the attached model are not written by mj_SaveXML.
PiperOrigin-RevId: 689391440
Change-Id: I1d63c146a32f87c737b7a55b64a54b0ffe3aecc9
2024-10-24 08:31:15 -07:00
Alessio Quaglino
1f9dca8bc4
Do not expose plugin_slot.
...
PiperOrigin-RevId: 683215401
Change-Id: Ic64f7221ed83ca3b0c8cca16eb680ea67c67b564
2024-10-07 09:38:01 -07:00
Alessio Quaglino
66faba9aa5
Avoid changing semantics of mjsPlugin.name across XML sections.
...
The `extension` section used to discard the plugin name and write the instance name in `plugin.name`, while all of the other sections wrote the instance name in `plugin.instance_name` and optionally the plugin name in `plugin.name` (via the function `OnePlugin`). Now all plugin names are in `plugin.plugin_name` and the instance is written in `plugin.name`, so that it is possible to lookup a plugin via its unique instance name.
PiperOrigin-RevId: 683183804
Change-Id: I179ef5d221143b720db24d745b09e327bf1449ef
2024-10-07 07:57:03 -07:00
Alessio Quaglino
e973dc74dd
Yield ownership of char[], vector<string>, and vector<byte> to mjSpec in Python bindings.
...
PiperOrigin-RevId: 681522091
Change-Id: Icb3788d9ef6e914a307531e39ad8171c24f590af
2024-10-02 11:14:48 -07:00
Alessio Quaglino
8a825e6050
Add auto-generated tree element lists to Python bindings.
...
PiperOrigin-RevId: 680973047
Change-Id: I948151260cba330c6b7218cecf13aae2c7ae92c7
2024-10-01 05:23:03 -07:00
Alessio Quaglino
b5bcc91a03
Add bindings generation for mjOption, mjVisual, and mjStatistic.
...
Fixes #2076 .
PiperOrigin-RevId: 677789263
Change-Id: Ie1bda40af62c5ac9bbba541668a50adfc59d3f7c
2024-09-23 07:43:09 -07:00
Taylor Howell
6c7e1095c5
Add mjsPlugin and mjsOrientation related keyword argument support for mjSpec Python bindings.
...
PiperOrigin-RevId: 676412967
Change-Id: I8cc1bfcc443327fde33246981400b375f8d4ff3d
2024-09-19 07:55:31 -07:00
Taylor Howell
bfda9f4ace
Add optional kwarg inputs to mjSpec Python bindings for mjSpec add constructors.
...
PiperOrigin-RevId: 675929024
Change-Id: Idd8c584276d8f585b79585230f5167f79760eaef
2024-09-18 04:02:10 -07:00
Taylor Howell
b0c7101f1c
Add optional kwarg inputs to mjSpec Python bindings for mjsBody add constructors.
...
PiperOrigin-RevId: 675141078
Change-Id: I8d735ae7d0a018ce7cd1aca56c899d1455586015
2024-09-16 07:32:55 -07:00
Yuval Tassa
5d91231d31
Rename mjBuffer to mjByteVec.
...
PiperOrigin-RevId: 664872558
Change-Id: I7b003374c390958667635fb21089faf2ece54b14
2024-08-19 10:40:26 -07:00
Alessio Quaglino
e0e134ca63
Add plugin tests for mjSpec.
...
Fixes #1903 .
PiperOrigin-RevId: 663352920
Change-Id: I3a9e17aec5694e49c20b542f4b0a4402f88a2f17
2024-08-15 10:19:53 -07:00
Alessio Quaglino
851bb6eef4
Add option to mjspec for creating a texture directly from a buffer.
...
PiperOrigin-RevId: 662186527
Change-Id: I469c876681d52964ac971c0bb2ec3517224d3a3d
2024-08-12 12:29:08 -07:00
Saran Tunyasuvunakool
d029e4ff99
Get rid of unnecessary return value policy specification.
...
PiperOrigin-RevId: 649437250
Change-Id: I61f8db0af526ebf667244124fcd4984881c6ef13
2024-07-04 09:45:22 -07:00
Alessio Quaglino
9106f40e2b
Add mjSpec bindings.
...
Co-authored-by: Saran Tunyasuvunakool <stunya@google.com >
PiperOrigin-RevId: 648444641
Change-Id: I08ee1d3f4fae1efbc7934ba94702b1c06d8cb92a
2024-07-01 12:05:50 -07:00
Saran Tunyasuvunakool
a2de04f5be
Sanitize function parameter names that are Python keywords.
...
PiperOrigin-RevId: 559436458
Change-Id: I56b8a595885f3f3d3ecb7a00db5f1bd70e5f95d9
2023-08-23 08:34:41 -07:00
Kyle Bayes
d3d789cf7d
Convert mju_error and mju_warning to variadic functions, supporting printf-like arguments. The functions mju_error_i, mju_error_s, mju_warning_i, and mju_warning_s are now deprecated.
...
PiperOrigin-RevId: 515431052
Change-Id: I440de0cb417ce216b6d636a5d86dc9ef6cc1fc06
2023-03-09 13:51:27 -08:00
Saran Tunyasuvunakool
1913a02b40
Initial open sourcing of MuJoCo.
...
PiperOrigin-RevId: 450374687
Change-Id: Ie3225a46ce095fc28ae8e63c326a640261f562bb
2022-05-23 01:08:49 -07:00
Saran Tunyasuvunakool
3577e2cf8b
Version 2.1.2: Python bindings, OBJ assets support, bugfixes.
...
PiperOrigin-RevId: 434731612
Change-Id: I0cfda3e7a3d1c72036764986efc252ffa1b8c6b0
2022-03-15 14:04:44 +00:00