Commit Graph

126 Commits

Author SHA1 Message Date
Alessio Quaglino e310c23267 Fix return value of mj_saveXML and mj_saveXMLString, fixes #2247
PiperOrigin-RevId: 700269761
Change-Id: Ifb7e9c66c70eac7d681cfcf106712d47291cf9e2
2024-11-26 02:32:50 -08:00
Kyle Bayes 867e8b8adb Fix ARM issues with tests with nativeccd.
Note: frameless_contact_hfield.xml doesn't work with libccd nor nativeccd on ARM as expected.
PiperOrigin-RevId: 698317464
Change-Id: I4c57e04639b9870b416c67d79a16a313c5276cf6
2024-11-20 02:30:15 -08:00
Alessio Quaglino 831d9881d3 Remove box, cylinder and ellipsoid composite types.
Also, fix a bug with Flex textures that was causing an incorrect allocation of the textures in mjModel. Fixes #2013.

PiperOrigin-RevId: 692510858
Change-Id: If781716216974e085244da27bc3aa57d91c3458c
2024-11-02 11:14:13 -07:00
Yuval Tassa a4a6248a06 Move AsVector utility to fixture.h
PiperOrigin-RevId: 690577546
Change-Id: I2cebcffa1f2e3b0789f43e772e364c4762719ab3
2024-10-28 05:52:25 -07:00
Yuval Tassa 61cb552f8a Refactor PBR texture layers from separate sub-elements to a single layer sub-element.
Add new element to PyMJCF schema.

PiperOrigin-RevId: 690115286
Change-Id: I7bb3f184cb321ca96037b2ca0ee160efef37469d
2024-10-26 07:41:38 -07:00
Alessio Quaglino 4a3f77dd1f Add missing default namespaces.
Fixes #2162.

PiperOrigin-RevId: 688575676
Change-Id: I6c43e33ebead68dece0f779e6f031e90a5e19096
2024-10-22 09:16:31 -07:00
Alessio Quaglino bfa78614c8 Require prefix for the attach tag.
For `mjs_attachFrame` and `mjs_attachBody`, require either a prefix or suffix.

It is tempting for users to not use a prefix (see #2162), but this causes issues. For example, it creates a duplicate "main" default class in the parent as a child of the already existing "main" default.

PiperOrigin-RevId: 688535755
Change-Id: I653181ca35943f1e4eb89c70fca8b5289818324e
2024-10-22 07:08:33 -07:00
Alessio Quaglino c84f35b425 Do not delete pending keyframes during body detachment.
PiperOrigin-RevId: 685670895
Change-Id: Iadd0ba8ca7e74a280559168ac0ac855405a1cfd9
2024-10-14 05:23:46 -07:00
Alessio Quaglino 52a0149cd1 Resizes keyframes before storing them during attach/detach.
Improve keyframe tests.

PiperOrigin-RevId: 685450257
Change-Id: I97aa129c4d7a66f613290605b85657e8081700b6
2024-10-13 10:02:35 -07:00
Yuval Tassa 2dd518734f Stop over-allocating memory in Newton solver.
PiperOrigin-RevId: 684797464
Change-Id: I3389416cb69a8564b5119f6e3944b579893ea511
2024-10-11 05:09:33 -07:00
Alessio Quaglino 8256546432 Fix bug in xml_native_writer that was causing frames to be skipped.
PiperOrigin-RevId: 683721505
Change-Id: I8622f4ea42ecda934fbc805c429de40e7717fdef
2024-10-08 12:23:17 -07:00
Yuval Tassa 50f43b8745 Fix various issues with body inertial parsing and compiling.
- Add errors in body compiler for incorrect mixing of specifiers.
- Correctly process inertia orientation specifiers.

PiperOrigin-RevId: 676843326
Change-Id: I7e7eb22e25a6769754794f98fad5e0dcc0e5946f
2024-09-20 07:53:42 -07:00
Alessio Quaglino 015bdeb756 Disallow repeated nameless assets that use the same file, except for URDFs.
PiperOrigin-RevId: 675114055
Change-Id: I142811ac2d8ef9e12bb8a06d5f3a2fdac02946da
2024-09-16 05:50:50 -07:00
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