Commit Graph

82 Commits

Author SHA1 Message Date
Tom Erez f3c966796f Allow models without numerical suffixes.
This is important for MJPC, where some element special names (e.g., a site called "trace0", or different custom numeric fields) are used.

PiperOrigin-RevId: 502338391
Change-Id: I632b5d633c92b82b60160daeeb169693225640a3
2023-01-16 02:59:11 -08:00
Saran Tunyasuvunakool 1215067f5c Add an option in mjrContext for mjr_readPixels output format.
PiperOrigin-RevId: 500342924
Change-Id: I43e8c6208db341e2bdbef10382b7293c35bdca65
2023-01-07 00:11:01 -08:00
Saran Tunyasuvunakool e40775fab3 Abstract out GLFW calls from Simulate.
PiperOrigin-RevId: 500129478
Change-Id: I7ba998e20439575ad9a3fe1a866c3db4c36b9328
2023-01-06 02:45:56 -08:00
Saran Tunyasuvunakool 6824cd50e2 Update MJBindings.cs to correctly reflect pointer-to-pointer types.
PiperOrigin-RevId: 499881915
Change-Id: Ibd25d8e38258c7d1372a066dadbffcf4c1dd2d6b
2023-01-05 08:10:54 -08:00
Tom Erez ba9229cad5 Remove test for MjVfs read.
The c# library never reads from MjVfs files, so this test is superfluous (and flaky).

PiperOrigin-RevId: 499490518
Change-Id: I417959b5374c5ede29544ee3f463928513e28d07
2023-01-04 08:22:54 -08:00
Kyle Bayes f1007df013 Implement hash map for mj_name2id using djb2 and linear probing.
PiperOrigin-RevId: 499485127
Change-Id: I5aed6549db18b92d7c8a3b7590e50a00ce13a439
2023-01-04 07:57:55 -08:00
Tom Erez 69739426f1 Use scalar Angle to compare quaternions.
The Vector4 comparator couldn't know that q==-q.

PiperOrigin-RevId: 498947861
Change-Id: Ife9efeb369c794eedbef80829e40057794a334ee
2023-01-01 20:01:48 -08:00
Tom Erez eb8389fead Find MjScene at OnEnable: ensure MuJoCo compilation happens only once at startup.
PiperOrigin-RevId: 498655077
Change-Id: Ibed8f36a880426063b7729fc66b15c67adcc9a65
2022-12-30 18:37:59 -08:00
Tom Erez f78ebeab96 Add post-compile and pre-destroy events to MjScene.
PiperOrigin-RevId: 498516529
Change-Id: I52dbf135e3260ca2999069bcb9f9b9ad648595d2
2022-12-29 22:43:11 -08:00
Tom Erez 6a58fd1522 Clean-up test files.
Also, don't add a Global Settings component at import if the xml doesn't have any global settings (option/size/custom).

PiperOrigin-RevId: 495950899
Change-Id: I6599e8ea3f3a82729fc5c974fd7ced8eb93b277e
2022-12-16 13:39:28 -08:00
Copybara-Service 4d91866e98 Merge pull request #652 from Balint-H:fix/unity-scene-tranisition
PiperOrigin-RevId: 495876985
Change-Id: I9880aa6bd2fc696509e518449a35a69457d92ba4
2022-12-16 08:13:03 -08:00
Tom Erez 189349f421 Don't add an empty "user" attribute to user sensors.
This fixes the broken TAP tests.

PiperOrigin-RevId: 495867491
Change-Id: I740651ed0dd8d1c84053a48f3fca577b6024bf95
2022-12-16 07:17:42 -08:00
Tom Erez f70403d00a Add support for global custom numeric fields.
PiperOrigin-RevId: 495865065
Change-Id: I59ed65e84a0bcaa90220b938ed34fdc26165aa09
2022-12-16 07:03:31 -08:00
Bálint Hodossy a0ab1940bf Fix ignored units of springref 2022-12-15 15:36:14 +00:00
Tom Erez e95b0c0eaf Add anchor support for connect constraint components.
Fixes #647

PiperOrigin-RevId: 495587232
Change-Id: I528a69dabbc1ac9a12f9ab7c16716e3d69c635e2
2022-12-15 07:25:59 -08:00
Bálint Hodossy aec125fb4e Check whether MjScene exists in components' OnDisable() 2022-12-14 13:38:36 +00:00
Tom Erez 21f10ce1b6 Add user sensor bindings.
Stop force-setting nusersensor, instead allow MuJoCo to infer the size.

PiperOrigin-RevId: 494783883
Change-Id: Ia2a1b1803b2904f2dded7b790d01eb6f1920dbaf
2022-12-12 11:43:00 -08:00
Tom Erez 7a248a8bde Rename bindings file for consistency.
PiperOrigin-RevId: 494779230
Change-Id: I693a0e389febc51276bde565bbbfc87c241f15e0
2022-12-12 11:24:12 -08:00
Bálint Hodossy ae2a8a4247 Add .meta file to Bindings folder 2022-12-07 11:44:44 +00:00
Copybara-Service bebfcad685 Merge pull request #628 from Balint-H:feature/unity-mesh-import
PiperOrigin-RevId: 493556582
Change-Id: I26bac07a8fc996043ec478d0ec0c5b56fe447e50
2022-12-07 03:18:38 -08:00
Saran Tunyasuvunakool e4f1d584ad Add control plugin API.
PiperOrigin-RevId: 493311715
Change-Id: Iccd99fb26004f39832818e378f01f9149a0e3e3b
2022-12-06 08:23:49 -08:00
Bálint Hodossy 8312f37e7e Reuse existing mesh assets in MjMeshFilter 2022-12-06 16:11:03 +00:00
Kyle Bayes 73fb61e3e2 Bump version number to 2.3.1.
PiperOrigin-RevId: 493076656
Change-Id: I48c7a45b503c4a7363ea1455a4a3788262d007f7
2022-12-05 12:13:55 -08:00
Copybara-Service 170a060a50 Merge pull request #601 from Balint-H:fix/mesh-filter-disappear
PiperOrigin-RevId: 490719489
Change-Id: I04bdd2f302197a06acaf922e9d10a0bbf00ee89a
2022-11-24 05:46:49 -08:00
Bálint Hodossy dc927b367d Remove unnecessary unit conversion 2022-11-23 16:26:42 +00:00
Bálint Hodossy 12d3e0ae09 Create separate mesh when MjMeshfilter is first instantiated, to support duplicating in Editor 2022-11-23 15:02:35 +00:00
Copybara-Service 6f2092bef2 Merge pull request #593 from Balint-H:feature/unity-ccd
PiperOrigin-RevId: 489551476
Change-Id: I751d2faa95d82f201614e8a3f08a9629492bfbe7
2022-11-18 13:38:51 -08:00
Bálint Hodossy 5c79a9a8fe Add multiccd option in Unity MJCF parser and writer 2022-11-18 13:10:06 +00:00
Bálint Hodossy 1fdbfa7061 Add MjScene property to check if scene has initialized 2022-11-18 11:25:08 +00:00
Bálint Hodossy 2328316d7d Add synchronisation events to MjScene 2022-11-18 11:23:41 +00:00
Saran Tunyasuvunakool 9ecade0707 Move plugin loading and scanning logic from Simulate to MuJoCo library.
PiperOrigin-RevId: 489020177
Change-Id: I1c29d931b47d5252e57e1d797cc7c17645859ffc
2022-11-16 13:15:51 -08:00
Copybara-Service f2bae1ffe3 Merge pull request #556 from Balint-H:fix/uv
PiperOrigin-RevId: 487203617
Change-Id: I6eade6f871b80f78f2ed13e1b5e4672ef857b9ef
2022-11-09 04:14:27 -08:00
Alessio Quaglino fd4d47e4a5 Format memory warning in human-friendly way.
PiperOrigin-RevId: 486610408
Change-Id: I6beecb12059e69f4407e921d20efc54ce6b3f491
2022-11-07 02:56:07 -08:00
Yuval Tassa 36b30e4500 Allow more than 1 activation state per actuator, but only for dyntype user.
Fixes #305.

PiperOrigin-RevId: 486597273
Change-Id: I3eb806f60949e68ebe6cbe35a6e66218a167ed45
2022-11-07 01:43:02 -08:00
Yuval Tassa c83be2bc05 Add mju_clip, mju_fill, mju_eye and mju_symmetrize to python bindings.
- Also change signatures of `mju_fill` and `mju_symmetrize` to conform to standard.

PiperOrigin-RevId: 485613824
Change-Id: I8dd618bac92ef40aa6c76380fa73302e81968687
2022-11-02 09:22:28 -07:00
Bálint Hodossy f6fd7efeb3 Add UVs to newly created geom meshes 2022-11-01 22:21:30 +00:00
Kyle Bayes 23092a11d7 Add per-body gravity compensation (buoyancy) passive force.
PiperOrigin-RevId: 485342531
Change-Id: Icb3e6bb5080b6ef17a3d3b1cc67e0503cfeaeffb
2022-11-01 09:48:06 -07:00
Saran Tunyasuvunakool c7960385be Declare DllMain as extern "C".
Fixes #550.

PiperOrigin-RevId: 484540205
Change-Id: I3915f65f1ae6ab3a93118b9d747b5c09d9abe872
2022-10-28 08:41:46 -07:00
Yuval Tassa 0eb7f871b9 Remove requirement that stateless actuators come before stateful actuators.
PiperOrigin-RevId: 484332415
Change-Id: I1dae92c0f8e027e4ca71c20ea3f68b2926526f53
2022-10-27 13:18:57 -07:00
Yuval Tassa f905c7fb7f Add mju_fill, mju_symmetrize and mju_eye utility functions.
PiperOrigin-RevId: 484226916
Change-Id: I79593d54e903ddacab0f859bfc6d17eccad7d3a1
2022-10-27 05:28:26 -07:00
Saran Tunyasuvunakool 57b0b36699 Bump version number to 2.3.0.
PiperOrigin-RevId: 481823754
Change-Id: Ie8c2c65b11178952355830ef019fe2efdf774189
2022-10-17 22:36:59 -07:00
Alessio Quaglino e250ff0d5a - Added passive forces plugins
- Added new `cable` composite type:
  * The `initial` parameter specifies the joint at the starting boundary: `free`, `ball`, or `none`.
  * The boundary bodies are exposed with the names:`B_left` and `B_right`.
  * The vertex initial positions can be specified directly in the XML with the parameter `vertex`.
  * The orientation of the body frame **is** the orientation of the material frame of the curve.

- Added new `cable` passive force plugin:
  * Twist and bending stiffness can be set separately with the parameters `twist` and `bend`.
  * The stress-free configuration can be set to be the initial one or flat with the flag `flat`.
  * New cable example showing the formation of plectoneme.
  * New coil example.
  * New belt example showing interaction between twist and anisotropy.
  * Added test using cantilever exact solution.

PiperOrigin-RevId: 480033694
Change-Id: I491271bce8fccb185961477e903e5a72d172c8a3
2022-10-10 02:46:51 -07:00
Saran Tunyasuvunakool 1a393429ef Fix formatting of large unsigned numbers in mju_warningText.
PiperOrigin-RevId: 479902611
Change-Id: Ia7187478a246b8b068684e75d6f3851d749844c9
2022-10-09 04:55:26 -07:00
Copybara-Service 2a8acf77ed Merge pull request #491 from Balint-H:weld
PiperOrigin-RevId: 479802394
Change-Id: Ieefec4e1ca29fb137947d458837d8ff3c3ee97f3
2022-10-08 09:24:29 -07:00
Bálint Hodossy 0ae8b966e7 Remove stray space in MjEngineTool 2022-10-08 14:04:37 +01:00
Saran Tunyasuvunakool 58fd72f53d Dynamically allocate contact and efc_ arrays on a new memory arena.
- Add private function `mj_arenaAlloc`. This is used internally to allocate memory from the arena.

- Add private function `mj_nefc` to count constraints. This function returns a tight upper bound on `d->nefc`. The number of counted constraints can be slightly bigger than exact `d->nefc` in the case of constraints with empty Jacobian, as when placing a frictional tendon between two world sites.

- Add new `memory` attribute to the `size` XML element for specification of arena memory size. This attribute is mutually exclusive with `nstack` and `njmax` specifications, which are now deprecated (but left around for the time being for legacy compatibility).

- Move `d->stack` to the end of the new arena space. The stack now grows in reverse from the end.

PiperOrigin-RevId: 479341539
Change-Id: Ie019c202e0908577ffc6f833a37920858116f667
2022-10-06 10:03:05 -07:00
stonfute 401e5daf82 Update float parsing
Update float parsing using InvariantCulture to not depend on OS language to parse float value.
Usefull for French, German, ... users where comma is default notations for the decimal point parsing.
2022-10-06 12:14:18 +02:00
Alessio Quaglino bc1490b7a8 Add realtime parameter to visual global.
PiperOrigin-RevId: 478775714
Change-Id: Ic2d178a5c57d298d005215219ce8470392c4651b
2022-10-04 07:09:15 -07:00
Bálint Hodossy d0a628f464 Fix MjWeld using wrong address in Unity plugin 2022-09-17 17:35:09 +01:00
Saran Tunyasuvunakool 1e2a9a53bc Implement plugin mechanism for actuators and sensors.
PiperOrigin-RevId: 474874088
Change-Id: I65a8ffdf845f4fa0f8266c165883a747ab5812d8
2022-09-16 12:21:29 -07:00