Commit Graph

775 Commits

Author SHA1 Message Date
Alessio Quaglino 462cfa5ceb Attach the tree of defaults recursively and with namespacing.
PiperOrigin-RevId: 650664018
Change-Id: I17751a02a406dcb2a2ca218c316b5eb0370071b8
2024-07-09 09:54:09 -07:00
Nimrod Gileadi 393895bb29 Explicitly specify actdim on PID plugin actuators, to allow them to be used with keyframes.
Support actdim attribute on plugin actuators.

Remove the actuator_actdim callback. This callback leads to crashes when loading keyframes for models that have a stateful plugin.

PiperOrigin-RevId: 650649505
Change-Id: I40d1994d02ae4e20ce631b2702a984766cf2628e
2024-07-09 09:08:48 -07:00
Alessio Quaglino e0d33eb1d0 Remove mjCBase::def and use mjCBase::classname instead.
PiperOrigin-RevId: 650629741
Change-Id: I10a9955b99e4a5ff0b5a742e22635ccad1455f1a
2024-07-09 08:02:32 -07:00
Nimrod Gileadi c5f958bdff When reporting compilation errors, include warning strings.
This allows plugins to call mju_warning, and have the string propagate to users.

PiperOrigin-RevId: 650621601
Change-Id: I608e7a3a1ad126ab8da2ff0634fa708458fb9ccc
2024-07-09 07:33:11 -07:00
Kyle Bayes 450e7ff777 Move user_resource.c to C++.
PiperOrigin-RevId: 650592110
Change-Id: I5e043970e3aa722e3961e478334cad4f3f1c191e
2024-07-09 05:33:38 -07:00
Alessio Quaglino f57dc90669 Refactor Default class to use pointers instead of indices.
This in order to make it easier to append the default tree to another tree.

PiperOrigin-RevId: 649812975
Change-Id: I2915ac7e37957e45eadc24d6caaf7beea236bf29
2024-07-06 03:51:30 -07:00
Kyle Bayes c6fd002f87 Move engine/engine_resource.{c,h} to user/user_resource.{c,h}.
PiperOrigin-RevId: 649628768
Change-Id: Id90c983cf70c0f92c3b033ac1b1654c53696955d
2024-07-05 05:41:55 -07:00
Kyle Bayes 57e6760ec9 Re-implement VFS internals in C++, removing the constraints of the previous implementation.
PiperOrigin-RevId: 649433087
Change-Id: Icaa3e6b7f2ef14f56b04fef2f4360b46d8b5f022
2024-07-04 09:22:23 -07:00
Kyle Bayes f8b944bf7f Fix missing fclose when resource is closed without being read. Fixes #1685.
PiperOrigin-RevId: 649416747
Change-Id: I05eeb1071868116b6e5be76e26b465788e4d35b1
2024-07-04 08:07:34 -07:00
Alessio Quaglino a5a3c9efc7 Discard all keyframes when attaching models.
PiperOrigin-RevId: 649415647
Change-Id: Ie2defe248df7078684d987351985cb66bd754e5b
2024-07-04 08:04:40 -07:00
Alessio Quaglino a0945e4b5a Add non-tree element lists to python bindings.
Fixes #1752.

PiperOrigin-RevId: 649405039
Change-Id: Ie0b575a3ec912b773141694397ac2f394bff1227
2024-07-04 07:24:02 -07:00
Kyle Bayes d831153401 Reorganize GJK support logic.
PiperOrigin-RevId: 649361144
Change-Id: I9868377cf36cccdcf66de3bc27afb872a164da8d
2024-07-04 03:48:52 -07:00
Kyle Bayes 5cce67439b Clean up user_util.
PiperOrigin-RevId: 649166858
Change-Id: I79423dda628fb4bf3ceae438dd8dc5b96d69d2a9
2024-07-03 12:38:36 -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
Alessio Quaglino 9107d3b507 Add mjs_findKeyframe.
PiperOrigin-RevId: 649036650
Change-Id: If514d5c333dd6084af9509324fd658c72576d7b5
2024-07-03 05:17:41 -07:00
Yuval Tassa 8f16b72f44 Rename mjSpec.euler to eulerseq to match MJCF.
PiperOrigin-RevId: 649007737
Change-Id: Iedb53c1d8a6e6a082a6ba30a1fb2bb4516839fa1
2024-07-03 03:10:02 -07:00
Tom Erez df7ea3ed33 Add support for multiple textures in one material (mjModel).
PiperOrigin-RevId: 648732764
Change-Id: I29b60dd62a069789a32017ff0d55e36b57e0052b
2024-07-02 08:50:23 -07:00
Tom Erez 3b73dfe33b Add textured materials to render context, and refactor mjvGeom to refer to those textures.
PiperOrigin-RevId: 648719103
Change-Id: Idb4425bdeea3cbc1133cda3e4366574ed3bb5ccc
2024-07-02 08:01:40 -07:00
Yuval Tassa af3233f98d Delete unused code.
PiperOrigin-RevId: 648658198
Change-Id: I1bec6b07becd7cec22af4c67e9cc1a9bcda669b0
2024-07-02 03:32:55 -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
Yuval Tassa f2c3be470f Make seed fixed for random number generator when using <texture mark="random"/>
Also improve documentation regarding texture height and width attributes.

PiperOrigin-RevId: 648427167
Change-Id: I59a0fe75d3526f8563a5252584ed60ef7fb8fd70
2024-07-01 11:11:17 -07:00
Yuval Tassa 0c3698f278 Don't normalize mocap quaternions in-place.
PiperOrigin-RevId: 648394295
Change-Id: I348a0a045c1697f6ef782280d92c90a30759eb33
2024-07-01 09:29:50 -07:00
Yuval Tassa 4d4b0bb2c3 Don't normalize mjData->qpos quaternions in-place.
PiperOrigin-RevId: 647927542
Change-Id: I13b0be55498d1da3af2cdc414cfed4c3908a6fe1
2024-06-29 03:07:10 -07:00
Saran Tunyasuvunakool 0e19722c61 Split name2id and id2name into a separate source file.
PiperOrigin-RevId: 647373431
Change-Id: I3bab0ea7157750b79826739e3d739e4114fa0af7
2024-06-27 10:50:21 -07:00
Alessio Quaglino f6cc3f4091 Remove classname from mjs* structs.
PiperOrigin-RevId: 647277317
Change-Id: Ic3cb0d3bf890d6be2712c0538e21910a8f12ab44
2024-06-27 05:13:02 -07:00
Yuval Tassa 62e2842116 Skip deprecated mju_rotVecMat and mju_rotVecMatT in Python bindings.
PiperOrigin-RevId: 647275284
Change-Id: I371236182b22eb399041959901085bb82af3f670
2024-06-27 05:06:01 -07:00
Yuval Tassa 13fce3e5b0 Use std::array instead of std::vector for a constant array of strings.
PiperOrigin-RevId: 646826439
Change-Id: I7d9462109027ebb64cb52e3265dde87ca23f906f
2024-06-26 04:53:08 -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
Alessio Quaglino 6be4e0697e Simplify mjs_addDefault.
PiperOrigin-RevId: 646534046
Change-Id: I658224e4800849231e68ed02d8fad07b8d796231
2024-06-25 10:51:57 -07:00
Kyle Bayes 5e39fc0564 Improvements to GJK implementation:
- Fix various bugs
- Improve readability
- Add support for recovering witness points.

PiperOrigin-RevId: 646515019
Change-Id: I295cf90d885e32013e595ea7aad07ed6c1869239
2024-06-25 10:00:58 -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
Emo Todorov ee6a1dba28 UI improvements. Fixes #1274.
Copybara import of the project:

--
a1297d997d0b3cc624bbd1e704ffb7fbb2c5db9d by Emo Todorov <etodorov@gmail.com>:

UI imrovements

When OpenGL buffer size is too small to hold entire UI with all sections open, older sections (as determined by latest mouse click) are automatically closed as needed.

To test this new functionality, uncomment the test near the top of mjui_resize().

UI items now have userid, which can be used for event handling.  It is set through the (new) last field of mjuiDef, called otherint.

Sections titles can now have a checkmark - in which case they are rendered differently. Set via mjuiDef.otherint: 0- none (as before), 1- rendering changed but box not shown, 2- box shown.  This can be used to label sections of special interest to the application.

--
b0405bfb3005586ef1d2656ea9cc43c608225927 by Emo Todorov <etodorov@gmail.com>:

more ui improvements

Implemented mjPRESERVE state for adding sections and separators, so you don't have to keep track of old states.

simulate.cc is now modified to use this new functionality.  I also made the separators in the Physics section collapsible. If you don't like it, change them back to state 1.

Also added functionality for handling section checkboxes.

--
10f4c49be62a6605a38b7c0c7bfae1629024ba31 by Emo Todorov <etodorov@gmail.com>:

even more ui improvements

Selection boxes that extend below the current UI height are finally rendered in full.

Sections and collapsible separators now have rounded corners. The radius can be controlled from theme spacing.

More theme color settings were added. In particular, color gradients can now be disabled (the two end colors are set independently).

--
96c2dc601a25d31c93b21f8e089d349e729e829e by Emo Todorov <etodorov@gmail.com>:

final ui improvements

Cleaned up the code a bit.

Added more control for color gradients.

--
c9eddb679f36df3f0745d37e3fa90c4e66ee6b98 by Emo Todorov <etodorov@gmail.com>:

bug fix

Fixed some rendering bugs in the new functionality.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google-deepmind/mujoco/pull/1749 from emotodorov:ui_improve ddfc21dbcf0482b8f0d5eacab21847c302f71440
PiperOrigin-RevId: 646060325
Change-Id: Idb27aae7cd0311d00f26387bcadf5891175e867d
2024-06-24 05:33:51 -07:00
Kyle Bayes e66b9a36b2 Remove mj_makeEmptyFileVFS and mj_findFileVFS from MuJoCo API.
PiperOrigin-RevId: 645393666
Change-Id: Iabe939c88f60b80dce20f84c7ff9a6396717cc84
2024-06-21 08:12:51 -07:00
Kyle Bayes 14fe527ea2 Fix small typo/bug in gjk implementation.
PiperOrigin-RevId: 645378191
Change-Id: Icdba53b30c934ac3059bb6f7b6d1081d71823131
2024-06-21 07:04:22 -07:00
Kyle Bayes 1e8454820d Implement initial GJK algorithm.
PiperOrigin-RevId: 645368315
Change-Id: I40a1e1023fd9f14a59e11a9dcc6ac22df241b6ae
2024-06-21 06:17:43 -07:00
Kyle Bayes b0b934cb5f Separate CCD code from support/center logic.
PiperOrigin-RevId: 645355865
Change-Id: I71303ffd7bbee37c5e8ac7e770f810768780c2e6
2024-06-21 05:17:57 -07:00
Yuval Tassa 3f3b39bbb1 Fix type-related issues in dependent code. Remove hardcoded mjUSEDOUBLE. Add mjUSESINGLE compiler flag.
This CL does not change the default build behavior of MuJoCo. To use single-precision floating-point, build MuJoCo with `-DmjUSESINGLE`.

PiperOrigin-RevId: 644782648
Change-Id: Ie815df9916798ca8054306437b39a33f84ce9e08
2024-06-19 10:52:18 -07:00
Alessio Quaglino 7bd7065e0e Renamed mjs_fullInertia to mjuu_fullInertia and moved it to user_util.
PiperOrigin-RevId: 644769379
Change-Id: I83511eeb4c0972ce9f46f0e3443d438cccdd4d9f
2024-06-19 09:39:02 -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
Alessio Quaglino f15b6e5e21 Set orientation type in composite box. Fixes #1732.
PiperOrigin-RevId: 643937520
Change-Id: I9ba9d9a8feae6815df35c5d21b0314165713c9d6
2024-06-17 03:07:16 -07:00
Yuval Tassa 19388eee0c Fix type errors in engine and plugins.
- Preparation for a float32 build of MuJoCo.
- Fix use of `float`-typed `fabs` in `mju_eig3`.

PiperOrigin-RevId: 643804942
Change-Id: I89f64e8fd39f4e70e78d7607816283e217912383
2024-06-16 12:35:05 -07:00
Yuval Tassa 6067048537 Deprecate mju_rotVecMat and mju_rotVecMatT in favor of mju_mulMatVec3 and mju_mulMatTVec3.
These functions names and argument ordering are more consistent with the rest of the API.

PiperOrigin-RevId: 643788290
Change-Id: I783eda8021b80b82098e23ed95669b102bb82508
2024-06-16 10:02:36 -07:00
Tom Erez 739512a0e4 Fix comment typos.
PiperOrigin-RevId: 643762423
Change-Id: I98289ed4053e635b863b029f239b14a232e505e3
2024-06-16 05:54:33 -07:00
Yuval Tassa c9bcf8371e Add mj_setKeyframe function to save current state in k-th model keyframe.
Fixes #1719.

Also improve documentation of `mju_sigmoid`, was previously only documented in changelog.

PiperOrigin-RevId: 642637458
Change-Id: I811a0bf8f881c8b76c9a62d2faec8fdec4e7585b
2024-06-12 09:22:52 -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
Baruch Tabanpour ace0c8f0a3 Add maxhullvert.
PiperOrigin-RevId: 641092710
Change-Id: Ib4fa828a9c82531614f0a67de9990340dbb25406
2024-06-06 19:05:16 -07:00
Alessio Quaglino f6084b4328 Change user_api handle types.
PiperOrigin-RevId: 640978033
Change-Id: I53496671ac823b50e6f90ceee15bf3b314b06db8
2024-06-06 12:06:10 -07:00
Alessio Quaglino 9a140bad14 Use suffix instead of prefix underscore for private members in user_api.h.
PiperOrigin-RevId: 640866779
Change-Id: Ifab04d8cdfe7e4c416d1916eb66f7d3584259f30
2024-06-06 05:44:12 -07:00