Commit Graph

113 Commits

Author SHA1 Message Date
Alessio Quaglino da15aa6a0e Improve error message for fullinertia and orientation specifiers.
Fixes #1888.

PiperOrigin-RevId: 661359190
Change-Id: Ibe38e88024b4a43922352b42347abf1026f168a2
2024-08-09 12:20:27 -07:00
Nimrod Gileadi 6a8e28f0e9 Prevent integer overflow when computing texture sizes and allocating memory for them.
Correctly check for failed allocations when resizing std::vector

PiperOrigin-RevId: 659488680
Change-Id: I7bf4c0b416e96eda2baec32b21be78456604f4b0
2024-08-05 02:58:46 -07:00
Kyle Bayes 5ac5cfb618 Support directories in VFS via mj_addBufferVFS.
PiperOrigin-RevId: 655286683
Change-Id: I846376a0571d8df28d979beb5981a0cbccd7a04f
2024-07-23 13:39:18 -07:00
Kyle Bayes 2746cb8559 Support FilePaths instead of raw strings in XML code.
PiperOrigin-RevId: 655177026
Change-Id: I55b055551384b01ba7a4baa5d75fbe3329b7d25d
2024-07-23 08:36:53 -07:00
Tom Erez 33e5960653 Allow multiple textures per material in MJCF.
PiperOrigin-RevId: 654795013
Change-Id: I418b72533484d00accaf801a342aa183e602a2d0
2024-07-22 09:57:51 -07:00
Kyle Bayes 8a8a44a4db Refactor numerical parsing in XML.
PiperOrigin-RevId: 653979240
Change-Id: I4d39f4041b88396193eb35f0cc393141d64f6fc0
2024-07-19 05:42:02 -07:00
Alessio Quaglino 2f46dec669 Fix bug in frame saving. Fixes #1802
PiperOrigin-RevId: 651696068
Change-Id: Ie1e2e1de4e83c42f2b5ebcc3afd0540b9afe7bbd
2024-07-12 01:56:38 -07:00
Alessio Quaglino 27b9ddda5b Add attach tag to MJCF.
PiperOrigin-RevId: 651117953
Change-Id: I57b0e53ed44607d479b3785d908e0837c0804cf3
2024-07-10 12:41:43 -07:00
Alessio Quaglino 7f9f8b5429 Catch errors in attach during replicate.
PiperOrigin-RevId: 651041336
Change-Id: I59986e157b4e22c74f8b8493899cdd4a3d5df839
2024-07-10 09:04:37 -07:00
Kyle Bayes 2a4410e4e5 Fix bug with absolute meshdirs in included XML files. Fixes #1772.
PiperOrigin-RevId: 649150979
Change-Id: I5df08c689afc4f5bc625e989a8c0b9733fcfa3c2
2024-07-03 11:49:17 -07:00
Yuval Tassa 8c380e7ba4 Don't print the fixed name ("main") of the top-level default class when saving XMLs.
Also insert newlines between top level sections in saved XML.

PiperOrigin-RevId: 646802227
Change-Id: If16b93409bda88aee8ef75f4a78d7ba0419fcfae
2024-06-26 03:22:22 -07:00
Yuval Tassa d8b85245a7 Informative error if mis-naming the top-level default class.
Also:
- Move the the top-level default class name into the mjCModel constructor.
- Fix bug in default class propagation in frame elements.
PiperOrigin-RevId: 646384669
Change-Id: Icc6154124361a234b84a07e2b5ecaa7c8b18ebf7
2024-06-25 01:46:18 -07:00
Yuval Tassa 8e2f830fd2 Fix type errors in compiler and tests.
In preparation for a float32 build of MuJoCo.

PiperOrigin-RevId: 644407674
Change-Id: I60069f0f865ef89fbf613f5a2ca0c336cc63461e
2024-06-18 09:12:44 -07:00
Yuval Tassa 86ef1746b0 Add convex collision test models.
PiperOrigin-RevId: 643567019
Change-Id: I233553f04ea7d67216a2440f834362965d9e8c58
2024-06-15 01:38:13 -07:00
Baruch Tabanpour 5ed464b489 Support spherical joint in URDF.
PiperOrigin-RevId: 642326650
Change-Id: Iec766800bc9ab7e022bd586fc5881df576d01331
2024-06-11 11:08:00 -07:00
Yuval Tassa 07fc95ca9a Add orthographic cameras.
Orthographic cameras are specified by setting the `orthographic` attribute of the `<camera>` element. The `fovy` attribute is still used to specify the field-of-view, but its semantic is different for orthographic cameras. For orthographic cameras, the field-of-view is expressed in units of length, rather than degrees.

Other related changes:

* Fix bug in the ordering of `cam_xxx` elements in `mjModel`.
* Make camera visualization translucent only when the frustum is visualized.
* Added a button to `simulate` to toggle between perspective and orthographic free cameras.

https://youtu.be/ZXBTEIDWHhs

PiperOrigin-RevId: 642293435
Change-Id: Id090a421ad88ab404b5b27ddbbd6bfc81ad49bc5
2024-06-11 09:23:18 -07:00
Alessio Quaglino 7a06bcfdaf Make model editing API public, fixes #364
Still missing:

- Detailed documentation.
- Python bindings.

PiperOrigin-RevId: 641445626
Change-Id: I20e67b707cf1bebae7e0cc94d17f7b76a89171f0
2024-06-07 22:28:01 -07:00
Alessio Quaglino b35ae973e1 Add mj_parseXML and mj_saveXML to xml_api.
PiperOrigin-RevId: 640099466
Change-Id: I75f763523c5bc8f6f7c2f2de6806d82ba37ebd4e
2024-06-04 15:28:14 +01:00
Kyle Bayes ba93a9b5d6 Remove mj_makeEmptyFileVFS in favor of mj_addBufferVFS from MuJoCo codebases.
build / windows-2022 (push) Has been cancelled
build / macos-12 (push) Has been cancelled
build / ubuntu-20.04-clang-10 (push) Has been cancelled
build / ubuntu-20.04-clang-11 (push) Has been cancelled
build / ubuntu-20.04-clang-12 (push) Has been cancelled
build / ubuntu-22.04-clang-13 (push) Has been cancelled
build / ubuntu-22.04-clang-14 (push) Has been cancelled
build / ubuntu-22.04-gcc-10 (push) Has been cancelled
build / ubuntu-22.04-gcc-11 (push) Has been cancelled
build / ubuntu-22.04-gcc-12 (push) Has been cancelled
build / ubuntu-22.04-gcc-9 (push) Has been cancelled
PiperOrigin-RevId: 639824744
Change-Id: I7746c71b0be88a61e76c4622d605356701881563
2024-06-03 10:08:36 -07:00
Yuval Tassa 8fa0fea02d Allow partial specification of polycoef attribute of equality constraints.
- Usually the user only wants to tweak `polycoef[1]`, after this change `"0 2"` is equivalent to `"0 2 0 0 0"`.
- Also improve documentation of this attribute.
- Tighten margins of documentation display equations.

PiperOrigin-RevId: 639720742
Change-Id: Ibafa0e093cebe1c1c75bf2e47ff3bd2ad7619414
2024-06-03 03:43:13 -07:00
Tom Erez 727893f0f2 Add timeconst attribute to position actuator.
PiperOrigin-RevId: 635018979
Change-Id: I919573f4241ecb4a4c61c3b8b6641b31aa79eca4
2024-05-18 03:38:20 -07:00
Yuval Tassa 39601b0f52 Fix bug in compiler error string construction.
PiperOrigin-RevId: 632404023
Change-Id: I79e24e44fc4eec67b76fbf62b053b169ba3070a3
2024-05-10 00:40:07 -07:00
Kyle Bayes dc68bc6c13 Add another unit test for caching PNG decoded images verifying that when a PNG file is updated the stale cached asset is not used.
PiperOrigin-RevId: 629748520
Change-Id: I6935a3d172ac1459602d3d82ac548adeb08a7b11
2024-05-01 09:39:40 -07:00
Alessio Quaglino 26f23066d1 Add replicate element to MJCF. Fixes #553
PiperOrigin-RevId: 629393578
Change-Id: Ia1db1b9e47eba8868117b0f7b85edcd0cc1b6d79
2024-04-30 06:29:18 -07:00
Yuval Tassa 027c26a153 Improve error reporting of sensorized objects.
Also remove duplication of element name and id from most error messages.

PiperOrigin-RevId: 628065116
Change-Id: Idd962fbab7aeba09e3a70c6c9d044b23db94cf23
2024-04-25 07:13:54 -07:00
Yuval Tassa caf215e342 Add metallic and roughness scalar attributes to materials.
Rename `light_radius` -> `light_bulbradius`, make the default value 0.02.

PiperOrigin-RevId: 627032170
Change-Id: I1e01e2eca028c0aefc2e7dc384e8b34abac184aa
2024-04-22 07:39:06 -07:00
Yuval Tassa 4b7b40d329 Add test for saving and loading binary models.
PiperOrigin-RevId: 626019520
Change-Id: I1e349921b3408bee288c52d9e52b29006ff3fda4
2024-04-18 06:55:07 -07:00
Alessio Quaglino 4b6c07cd7d Prevent bodies from overwriting the frame names in xml_native_writer.
PiperOrigin-RevId: 625632369
Change-Id: If3bd048ac40e116fcb97beb3dca3d99826fe4ad0
2024-04-17 04:07:50 -07:00
Yuval Tassa 0cd28d2423 Add light radius attribute.
Also fix bug: light defaults were not being saved.

PiperOrigin-RevId: 625142278
Change-Id: I8ec3a5a06e9f314e98b7c34346db3c24b34d7e0b
2024-04-15 17:55:15 -07:00
Google DeepMind 4f0293c6cb Added support for msh2.2
Now we can load flex with format 2.2 binary and ASCII.
There are two different parsing strategies. One for gmsh app and the other is for ftetwild.

Used the shark model from Scanned Objects by Google Research:
https://app.gazebosim.org/GoogleResearch/fuel/models/Weisshai_Great_White_Shark

PiperOrigin-RevId: 619229499
Change-Id: I6eb876afcbc8a00631914b093c45bde10c0caaf6
2024-03-26 10:12:13 -07:00
Alessio Quaglino bda03af49a Add childclass support to frames.
PiperOrigin-RevId: 615487831
Change-Id: I0e4d2efd52211701b4286a0b0de84424470a3a47
2024-03-13 11:31:22 -07:00
Alexis Fraudita a2a770453e Copybara import of the project:
--
1fcff13dfdc70519c4d33e17ade4be6afb2960a2 by Alexis <cuatroalejandro@gmail.com>:

add multipleBodies test for mj_loadXML

--
34270fa57946e68a82fa55313b64a5a56e5aa080 by Alexis <cuatroalejandro@gmail.com>:

add some space

--
3594020eb9be57cb6a2eef0baeca97cee8f25aab by Alexis <cuatroalejandro@gmail.com>:

remove TODO comment in xml_api_test

COPYBARA_INTEGRATE_REVIEW=https://github.com/google-deepmind/mujoco/pull/1487 from alefram:alexis-test 3594020eb9be57cb6a2eef0baeca97cee8f25aab
PiperOrigin-RevId: 615033458
Change-Id: I05fe5659b07b3226b82d2562e31bcd73f150b089
2024-03-12 07:31:11 -07:00
Kyle Bayes 31384bdfeb Speed up String2Vector.
PiperOrigin-RevId: 612767185
Change-Id: I4a4de5e03bbd6653be7ccb3e730ad64a335e17b0
2024-03-05 02:50:26 -08:00
Alessio Quaglino 9efa4ebe0b Move CompareModel to fixture.
PiperOrigin-RevId: 612759913
Change-Id: Ia5741a858003211c58c47a20d447dcbc041c8b5d
2024-03-05 02:24:32 -08:00
Yuval Tassa 8679c9fc59 Fix null pointer deref for unknown class names.
PiperOrigin-RevId: 610391077
Change-Id: I5abd62ff46e31e788f06fe111adb3c25287d4fdc
2024-02-26 06:38:52 -08:00
Kyle Bayes 24eb4c9f09 Improve include meta-element to load included resourced from the directory relative to the included XML file, fully backwards compatible.
PiperOrigin-RevId: 608312069
Change-Id: I80eadb32d7d78fb35bd24975f2e514021c2aa009
2024-02-19 05:40:31 -08:00
Yuval Tassa 05150546e3 Add inheritrange attribute to position and intvelocity actuators.
PiperOrigin-RevId: 607650147
Change-Id: Ibc1846f89179786d4f93435c3924687b4c5d1432
2024-02-16 04:42:44 -08:00
Yuval Tassa f9f7827a64 Trim trailing default values in saved xmls.
For attributes which accept variable-length inputs. Currently used for `gainprm, biasprm, friction, solref, solimp` Example:

- Saved before: `biasprm="0 -3 -4 0 0 0 0 0 0 0"`.
- Saved after: `biasprm="0 -3 -4"`.

PiperOrigin-RevId: 607609550
Change-Id: I0501348280663867693175236872e2aabc703601
2024-02-16 01:36:06 -08:00
Alessio Quaglino 414a67640a Add mjmDef to C API.
PiperOrigin-RevId: 607310534
Change-Id: I530f32c8fd4340dc1006585259a5e05cb4aa62b8
2024-02-15 06:17:58 -08:00
Kyle Bayes eabd4c06f9 Move schema definition validation from runtime to a test.
PiperOrigin-RevId: 606280564
Change-Id: I9fec9eb3538f63f84e1982f21e1a93f16342d540
2024-02-12 09:49:48 -08:00
Kyle Bayes ff39d0b812 Keep include elements while parsing XML. No change in behavior.
PiperOrigin-RevId: 606203141
Change-Id: Ica06f7c121a90597cd29f74692230365edd4302f
2024-02-12 03:54:44 -08:00
Yuval Tassa 3601026b1d Refactor handling of auto-limits.
PiperOrigin-RevId: 605972151
Change-Id: If468af2081182787178d805124f2d2c90ee29951
2024-02-10 22:01:13 -08:00
Matthew Bennice b9c50ad79c Move fullinertia from mjCAlternative to mjCBody with correction to handle URDF with 0 inertias.
PiperOrigin-RevId: 604812870
Change-Id: I018254d1362a654a4f99bf5e621d5abc7129a0c6
2024-02-06 17:21:31 -08:00
Matthew Bennice 84f20ffb66 Automated g4 rollback of changelist 604607692.
*** Reason for rollback ***

breakage resulting in "inertia must have positive eigenvalues" when parsing URDF's

*** Original change description ***

Move fullinertia from mjCAlternative to mjCBody.

***

PiperOrigin-RevId: 604677400
Change-Id: Iab8263b5b0aee310bd75404e314f3b707ce3300e
2024-02-06 09:47:04 -08:00
Alessio Quaglino 737342bdfe Move fullinertia from mjCAlternative to mjCBody.
PiperOrigin-RevId: 604607692
Change-Id: Ic2fcc08b9073d01ab190e7acacc3d827dbdfbca4
2024-02-06 04:43:12 -08:00
Alessio Quaglino df76b55fe0 Add line error check to user_objects and xml_native_reader tests.
PiperOrigin-RevId: 603714614
Change-Id: Ic031f33a9a6eb45b3e61cb666e0d4890bfe08275
2024-02-02 09:57:49 -08:00
Yuval Tassa e143b3dbc0 Allow height-field elevation data to be specified in XML.
PiperOrigin-RevId: 602374498
Change-Id: I2d3364d68876a35799b24aca1051e2f5aebdda75
2024-01-29 06:59:28 -08:00
Yuval Tassa 5b2c98f8f1 When saving XMLs, don't round floats that are bigger than INT_MAX. Fixes #1278
PiperOrigin-RevId: 590692020
Change-Id: Icd11d20f47bc4163eb4378f4cb031b8fd9d13612
2023-12-13 13:13:15 -08:00
Yuval Tassa b22919543d Fix bugs related to saving of <statistics> values.
Before this change:
- User-modified values of `mjModel.stat.{meanmass, meaninertia}` would not be saved to XML.
- Non-user-modified values of `mjModel.stat.{meansize, extent, center}` would always get saved to XML.

After this change values are saved to XML only if provided by the user, either in the XML or by changing values in `mjModel` before saving.

PiperOrigin-RevId: 589473351
Change-Id: I4dcf4892ef61c35edf424226e731232d861bad8d
2023-12-09 16:06:39 -08:00
Yuval Tassa 762371c3e4 Add kv damping attribute to position and intvelocity actuator shortcuts.
PiperOrigin-RevId: 588377097
Change-Id: I8ded2ff982e52ed8673019979e29b706ef65c743
2023-12-06 04:28:30 -08:00