Alessio Quaglino
f75772587a
Add functions for setting an mjsActuator to a specific shortcut type.
...
PiperOrigin-RevId: 769049331
Change-Id: If5bb04966bd29a57569a2c17d712b9ae3d33324d
2025-06-09 02:17:02 -07:00
Alessio Quaglino
1fbbfd8079
Correct frame property in MjsBody from method to read-only attribute.
...
PiperOrigin-RevId: 764188923
Change-Id: I7c753f7f431b79aa320681c45b7614f68b63852c
2025-05-28 03:48:07 -07:00
Alessio Quaglino
7a5b55f57e
Expose mjs_resolveOrientation to the Python API.
...
PiperOrigin-RevId: 762571376
Change-Id: I08d8394b24670c7f102356da4234b17f1ba4e05f
2025-05-23 14:36:47 -07:00
Alessio Quaglino
e389872c7d
Add frame property to python bindings.
...
PiperOrigin-RevId: 762452877
Change-Id: I555cec650d04700f6718b4d77a866c821b90685c
2025-05-23 09:24:24 -07:00
Alessio Quaglino
3e9d130092
Add mjs_getPluginAttributes.
...
PiperOrigin-RevId: 752691116
Change-Id: Ib503a99f8d10661b8bf92410ccf471420f924986
2025-04-29 05:19:09 -07:00
Alessio Quaglino
ec186430ef
Add setting plugin config properties via Python bindings.
...
PiperOrigin-RevId: 747421357
Change-Id: Ie80f1a889f2f6ec457c1e16193fa0694e07d3fe9
2025-04-14 08:07:14 -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
Sam Haves
5c12ea871f
Split MjSpec out into header to allow use by other pybind modules.
...
This should enable other pybind modules to accept arguments of type MjSpec.
PiperOrigin-RevId: 745580987
Change-Id: I435a8d264149369e3fbee14c5d2c628ef74b2541
2025-04-09 07:31:23 -07:00
Alessio Quaglino
b839fe79e1
Allow to attach an entire mjSpec in mjs_attach.
...
PiperOrigin-RevId: 742737713
Change-Id: Ie172568b8c35232e1f13d75aebee20346e76e95b
2025-04-01 09:51:52 -07:00
Alessio Quaglino
a02a27d4a4
Combine all mjs_attach functions into one.
...
PiperOrigin-RevId: 742702092
Change-Id: I89e35c59ada017cd061e2031584eeea71776743d
2025-04-01 08:05:58 -07:00
Yuval Tassa
305b68ecbf
Add tests for body.find_all() of joints and geoms, fix error message.
...
Fixes #2525
PiperOrigin-RevId: 742685596
Change-Id: I5f0969967f2490d32e5691983e8d0c363d48a6bd
2025-04-01 07:14:59 -07:00
Alessio Quaglino
86c970bc23
Add error checking in mjs_setFrame.
...
Also raise error if the frame is not found in the mjCBody copy constructor.
Fixes #2543 .
PiperOrigin-RevId: 742624013
Change-Id: I4999b3165c97f8d079412214d027ca7a8dae8cb3
2025-04-01 03:34:48 -07:00
Tom Power
be64747166
add mjs_detachDefault to delete a default class from mjSpec
...
PiperOrigin-RevId: 738452369
Change-Id: I5a53a6dc8f89e1e8136aeefc09d7d9b7b7204e1f
2025-03-19 10:31:04 -07:00
Alessio Quaglino
1bf24e9f67
Do not overwrite existing parent frames for worldbody elements when attaching an mjSpec to a frame or a site.
...
PiperOrigin-RevId: 737662046
Change-Id: I7028c21c803c01845ae1d53cb476f7b3df172313
2025-03-17 10:21:38 -07:00
Alessio Quaglino
da04688071
Automatically compile mjSpec in to_xml().
...
Also, move mj_compile from MjModelWrapper to MjSpec.
PiperOrigin-RevId: 737640210
Change-Id: I93d2a31c33eb359452b0d966a29939183b4c5198
2025-03-17 09:21:10 -07:00
Yuxuan Jiang
2039629457
Expose MjSpec raw pointer via _address
2025-02-26 10:25:55 +08:00
Alessio Quaglino
d1d61925da
Do not delete the world child when doing spec.attach.
...
PiperOrigin-RevId: 730976077
Change-Id: I9aa8133241b45883e605ec80d64ae28af2962680
2025-02-25 12:02:13 -08:00
Alessio Quaglino
441b5c6082
Change MjSpec.default from method to attribute.
...
PiperOrigin-RevId: 730912407
Change-Id: I0147acbd257ecc8b72752a2992a7d4ea6e1b4c07
2025-02-25 09:17:45 -08:00
Alessio Quaglino
1b4258d274
Change set_default and default to classname in the bindings.
...
Having defaults in the names of the attribute or function names is confusing for the users since the defaults are not re-applied but are only used for writing to XML. The alternative would be to change mjs_setDefault to re-apply them, but this would overwrite any other attribute set by the user so far.
PiperOrigin-RevId: 726431090
Change-Id: I41f4a23e1722e278b0ecc0a00b07db9b384fe994
2025-02-13 04:52:02 -08: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
e54f3c222d
Autogenerate mjSpec find_* methods.
...
PiperOrigin-RevId: 725255440
Change-Id: Ia9112f6c582ea9bb0af38aa97a917e72a98a84f5
2025-02-10 10:03:44 -08:00
Alessio Quaglino
4156350708
Add to_file function to save the Spec to a file.
...
Fixes #2415 .
PiperOrigin-RevId: 725161617
Change-Id: I6c374cc7f7cb3f1da1cc0da531dd7e5be5d62b6a
2025-02-10 04:33:14 -08:00
Alessio Quaglino
6bd88711a8
Add parent to MjSpec wrapper in Python bindings.
...
This keeps track of specs attached with the full attach function `attach`. It does not track fine-grained attach via `attach_body` and `attach_frame`.
PiperOrigin-RevId: 722597081
Change-Id: I56188f1718592128b7033538acc9a40553cbbed2
2025-02-03 04:04:11 -08:00
Alessio Quaglino
86ace5e562
Remove body.spec() function from the Python API
...
We can only use the MjSpec wrapper, not the raw::MjSpec struct in the API.
PiperOrigin-RevId: 722589064
Change-Id: I007150f92738487f27211d7435e328cab86214f7
2025-02-03 03:31:35 -08:00
Alessio Quaglino
0643017346
Add asset argument to MjSpec constructors.
...
PiperOrigin-RevId: 720628689
Change-Id: I189aa34973e58b9fb87951e34cb923d94e081a55
2025-01-28 10:39:27 -08:00
Alessio Quaglino
5b330ca19c
Change keyword argument asset to include in spec.from_file and spec.from_string.
...
PiperOrigin-RevId: 720611881
Change-Id: I92f5e72cece8d3223bc552ea4f2ef742c47cb8c9
2025-01-28 09:55:48 -08:00
Alessio Quaglino
6a7a7a5f80
Add the override_assets attribute to MjSpec.
...
When specified, child asset with repeated names will override parent's, rather than throw an error. Default behavior is to override.
PiperOrigin-RevId: 717979621
Change-Id: I18022dc266619b4ba1a8636d1c60f85b0eb5f862
2025-01-21 10:39:02 -08:00
Alessio Quaglino
1412a29dac
Merge child asset dictionary into parent spec during attach().
...
PiperOrigin-RevId: 717939728
Change-Id: I54f8ac87062cf19f55a16af37b777701545ed865
2025-01-21 08:57:09 -08:00
Alessio Quaglino
4bb6aeb19f
Change site and frame attach API.
...
Old API:
```
site.attach(child_spec)
frame.attach(child_spec)
```
New API:
```
parent_spec.attach(child_spec, frame=frame_name_or_object)
parent_spec.attach(site_spec, site=site_name_or_object)
```
This enables accessing the parent object during attach, which will be used in a follow-up CL to automatically append the child assets to the parent.
PiperOrigin-RevId: 717908589
Change-Id: I0fb27e99694c954cb8ba8a8c98484ffd53a4d6db
2025-01-21 07:29:27 -08:00
Alessio Quaglino
699a6765e3
Add find functions for joints, lights, and cameras to mjSpec bindings.
...
PiperOrigin-RevId: 717578768
Change-Id: I2087ccbb9cf8b3b8ec03e9eb2edb0707d4a4cac1
2025-01-20 11:02:34 -08:00
Silvia Cruciani
4903d5321c
add find_geom property to mjSpec
...
PiperOrigin-RevId: 716225290
Change-Id: Ie6e229b0e802e7df06148f994d598334592e8ad1
2025-01-16 07:20:19 -08:00
Alessio Quaglino
c2138c3fb0
Do not copy the spec during attach.
...
Use a reference count for managing the memory.
PiperOrigin-RevId: 716169486
Change-Id: Id270c4858c17b9250115e9544d5ea143584e2d5f
2025-01-16 03:53:17 -08:00
Alessio Quaglino
05d4c3d670
Add mjs_getParent to retrieve the parent body of an object.
...
PiperOrigin-RevId: 715794859
Change-Id: Ib9792787cdb966f579938dde3f94ebabca8ef1fc
2025-01-15 07:42:43 -08:00
Alessio Quaglino
10c7207cea
Process asset path before adding VFS buffer.
...
Also, handle VFS errors.
PiperOrigin-RevId: 715755127
Change-Id: Iaf455d448f16e37ab89ceaa5797319135acd73c9
2025-01-15 05:10:00 -08:00
Alessio Quaglino
ba183adb67
Add assets to MjSpec wrapper.
...
This enables associating assets with a spec object.
Also, remove `spec.compile(assets)` and replace it with the `spec.assets` attribute, which must be be set before compile if assets are present.
PiperOrigin-RevId: 714981385
Change-Id: Ic3a33c3b75d3a7e14868622aadb57b2a8461a649
2025-01-13 08:41:51 -08:00
AaronYoung5
3ef5ebcf01
removed trailing spaces
2024-12-17 12:57:48 -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
41968f1527
Support body.find_all("joint") in bindings.
...
PiperOrigin-RevId: 703071822
Change-Id: I6457ca0561c794447cc06aab29dcd0aac82c49a0
2024-12-05 04:54:42 -08:00
Alessio Quaglino
a729acb4fa
Add spec find_sensor, find_actuator functions.
...
PiperOrigin-RevId: 703054696
Change-Id: Ie384f1a31de3ecd9b22b7f4be43234d452e7bb88
2024-12-05 03:42:26 -08:00
Alessio Quaglino
503e5e1815
Change site.attach to accept a spec instead of a body.
...
Add site.attach_body for attaching a body to a site.
PiperOrigin-RevId: 703047770
Change-Id: Ibc1f916f8741872135220461cda7cebc4b418913
2024-12-05 03:10:17 -08:00
Alessio Quaglino
a3b9f986c0
Add spec.find_site().
...
PiperOrigin-RevId: 702733068
Change-Id: I4cc7fd2b9b59185a4458fdac8537f8287af1f295
2024-12-04 08:20:57 -08:00
Alessio Quaglino
d1b02556ef
Allow keyword arguments in attach.
...
PiperOrigin-RevId: 702718597
Change-Id: I1f1a5e9c88c8e102d5cbe5984511e7923ec7be3e
2024-12-04 07:32:31 -08:00
Alessio Quaglino
f909d63cdf
Enable to attach a spec to a frame.
...
PiperOrigin-RevId: 699703988
Change-Id: Idbddcbce1e68286248458eb0bd24d5080451a58a
2024-11-24 07:35:14 -08:00
Alessio Quaglino
3a12db9ad2
Remove id attribute from mjSpec objects in Python bindings.
...
Using ids is error prone in scenarios of repeated attachment and detachment. Python users are encouraged to use names for unique identification of model elements.
PiperOrigin-RevId: 699227286
Change-Id: Ifd83e6d85d36ff72ea43caf8b82eab9e4d552440
2024-11-22 11:05:14 -08:00
Alessio Quaglino
ebe60b9ad5
Add const to mjsDefault when used as function argument.
...
Fixes #2197 .
PiperOrigin-RevId: 692346264
Change-Id: Iddb9be1377a7d59c86911802d8c5563f6bf6b043
2024-11-01 18:18:42 -07:00
Alessio Quaglino
e835f139c8
Add sibling traversal for tree elements.
...
PiperOrigin-RevId: 691057957
Change-Id: I3f30cf175b5ad0842f3fbbf7fdb42ba7a2212682
2024-10-29 09:55:08 -07:00
Joss Moore
ca45041049
MjSpecs.copy should return an MjSpec rather than a raw::MjSpec*
...
raw::MjSpec* is not a good python object.
PiperOrigin-RevId: 690564198
Change-Id: I3a5dd525a3a9acc67bb0e598dd508572dc4c687f
2024-10-28 04:55:38 -07:00
Alessio Quaglino
bebec52869
Add find_all with string input.
...
PiperOrigin-RevId: 689487165
Change-Id: I48511aec1610b2112f9456e8f410d077c57c7a95
2024-10-24 13:01:49 -07: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
dcf2816543
Remove copy_back from Python bindings and mj_copyBack from the C API.
...
PiperOrigin-RevId: 687377331
Change-Id: I355493d92857418b08b5aa90ea38cebe5c475314
2024-10-18 11:55:04 -07:00