Commit Graph

105 Commits

Author SHA1 Message Date
Saran Tunyasuvunakool 860f7b376a Fix GCC and MSVC build.
PiperOrigin-RevId: 564390190
Change-Id: Icba3eefb394b8d17798679dd9876f127fba5a599
2023-09-11 08:17:08 -07:00
Saran Tunyasuvunakool 78183e60e1 Refactor thread pool implementation.
- Make mjTask non-opaque and remove C++ Task class.
- Make C++ thread pool a subclass of a skeletal mjThreadPool C struct.
- Make the mjTask status enum more consistent with the rest of MuJoCo.
- Change mju_threadPoolEnqueue to take just the mjTask. Users must now prepare the mjTask by assigning the function pointer and argument into the struct.
- Rename files in thread/ to be more consistent with the rest of MuJoCo.
- Run threading tests in CMake.
- Allow use of C++20 designated initializers.

Otherwise the functionality remains identical.

PiperOrigin-RevId: 564374675
Change-Id: I37c9894566bc39faf217e5aa97a4e2713a70e467
2023-09-11 07:20:34 -07:00
Saran Tunyasuvunakool 7e5a7b76fc Change GitHub org name to google-deepmind.
PiperOrigin-RevId: 563512242
Change-Id: Ife98501e95bb3459d96c7c73e5fb53be5513dd4b
2023-09-07 12:34:20 -07:00
Google DeepMind 040d3efce2 Add options for controlling early termination criteria of CG/Newton linesearch.
Useful for performance tuning models.

PiperOrigin-RevId: 563175078
Change-Id: Id64a510d6080038ea8d5876dabbf0b2b311435bb
2023-09-06 12:02:58 -07:00
Saran Tunyasuvunakool 329ed193ac Disallow variable-length arrays and turn on -Wpedantic in Clang and GCC.
PiperOrigin-RevId: 562832747
Change-Id: I0532624cee31e089a47426305d885687eb0fc5c5
2023-09-05 11:05:04 -07:00
Nimrod Gileadi 5279ce6f6f Fix comment typo in simulate.cc
PiperOrigin-RevId: 561921946
Change-Id: I423378df566be7a6ad88fb3526769d298ac32a3b
2023-09-01 04:56:34 -07:00
Saran Tunyasuvunakool daa2ac7f8b Rename nstack to narena, change it and pstack to count bytes.
PiperOrigin-RevId: 561066311
Change-Id: I4d0e645e6c254dd906bfc42159e0e99149a7c6c8
2023-08-29 10:13:33 -07:00
Alessio Quaglino fdb041580c Add Signed Distance Field to collision geometries.
PiperOrigin-RevId: 557507088
Change-Id: I358a642407aee1ba8dfc9d405eb9a4f609435fe9
2023-08-16 09:15:23 -07:00
Yuval Tassa ac3ac0d28f Fix timing plots issue in simulate.
Before this change timing plots would report zeros if the render thread was faster than the physics thread, making them unreadable when slowdown was used.

PiperOrigin-RevId: 557432042
Change-Id: Ie9a18fb84cab788d11dfbede4e3052f24441b4c4
2023-08-16 04:03:50 -07:00
Yuval Tassa 3e034e38b2 Add constraint island discovery
PiperOrigin-RevId: 557067599
Change-Id: Ic41e1d0efef02b7a79142518afe49cf9d4e74725
2023-08-15 02:30:05 -07:00
Yuval Tassa 6d7b49ccf5 Remove collision pruning statistics from simulate info panel.
PiperOrigin-RevId: 554452244
Change-Id: I4f9f1d5e38d4b4bc37b5a2f0980b352db04a73c6
2023-08-07 06:05:13 -07:00
Saran Tunyasuvunakool eaf78b798b Bump dev version number to 2.3.8.
PiperOrigin-RevId: 549580971
Change-Id: If8be1910f0196754ce8abb8d91fe604e789ecec8
2023-07-20 03:27:50 -07:00
Saran Tunyasuvunakool c9246e1f50 Release version 2.3.7.
PiperOrigin-RevId: 549565890
Change-Id: I56db138998e43637bdde86de6490a567f0f255ec
2023-07-20 02:13:55 -07:00
Saran Tunyasuvunakool 06b70832ce Add keyboard event callback for Python passive viewer.
Fixes #766
Fixes #846

PiperOrigin-RevId: 549449372
Change-Id: I37d17f1162c66d0e8482d402aae22d9a16b59deb
2023-07-19 15:54:44 -07:00
Saran Tunyasuvunakool f7847ba73e Fix GLFW crash when Python exits while the passive viewer is running.
Fixes #790

PiperOrigin-RevId: 549440435
Change-Id: I808f6aaab6662225e5fe1131e0da72eca6011ba9
2023-07-19 15:20:46 -07:00
Saran Tunyasuvunakool 0ccfef7314 Add update_{hfield,mesh,texture} methods to the passive viewer.
Fixes #812.
Fixes #958.
Fixes #965.

PiperOrigin-RevId: 548181282
Change-Id: I6eb0cd2ce52c66083e83dd08d69e0cfb4178dbba
2023-07-14 11:43:36 -07:00
Kyle Bayes 242aea93c6 Bump oldest supported MacOS to version 11.
PiperOrigin-RevId: 547479684
Change-Id: Idb6a432af0e7872ca087a0c571aafa72e9528818
2023-07-12 06:38:26 -07:00
Yuval Tassa 906a8e8b27 Correct shortening of camera name in simulate.cc (for UI menu item)
Fixes #963

PiperOrigin-RevId: 545187656
Change-Id: Ib213d693569d884915fba99f150df4fd5f53984c
2023-07-03 04:32:27 -07:00
Yuval Tassa d40c395917 Add Visualization tab to simulate.
Also:
- Increased label width in mjUI tight theme spacing.
- Added `mjITEM_EDITFLOAT` for editing float values.
- Move mjUI numpad key codes to header file.
PiperOrigin-RevId: 535839953
Change-Id: Ibdc0a9a20be514caa5b487211212ed6f5b8a6ba9
2023-05-27 05:08:15 -07:00
Yuval Tassa bb8044e5f3 Set minimum tree slider depth to 0.
PiperOrigin-RevId: 534003561
Change-Id: I42ccd0eab15b5a3c9852f8944c6b191f7999c113
2023-05-22 02:39:58 -07:00
Yuval Tassa 20e06ba353 Add missing braces.
PiperOrigin-RevId: 533419351
Change-Id: Iad54f6cb6d63c05e6a2f81526b22a914e2a23ba2
2023-05-19 04:35:12 -07:00
Nimrod Gileadi 39723891ce Use the correct string length argument to mj_loadXML.
PiperOrigin-RevId: 531941053
Change-Id: Ia85b779b603a673b8e1d6f22d4bc183311204c4b
2023-05-14 14:40:36 -07:00
Saran Tunyasuvunakool 90e14ac8d0 Bump version number to 2.3.6.
Going forward, the version number at head will be kept one ahead of the latest released version. The rationale behind this change is so that it is clear that the source code at head is more recent.

PiperOrigin-RevId: 527687981
Change-Id: I7982ecd0b99ad70dccec6a8ffe86629754558bda
2023-04-27 14:40:32 -07:00
Saran Tunyasuvunakool c2115a1f51 Fix a mjvSceneState leak in the passive viewer.
PiperOrigin-RevId: 526957248
Change-Id: I4f30faf097da64189607a4b98c6dff04fec773fa
2023-04-25 07:11:42 -07:00
Saran Tunyasuvunakool db3b49b60f Bump version number to 2.3.5.
PiperOrigin-RevId: 526918869
Change-Id: I9f19600b0c1b855ef0834e5c026b204bf1dc06c4
2023-04-25 03:52:12 -07:00
Yuval Tassa a2a1ac9fc2 Pass mjvOption to plugin visualize callback.
PiperOrigin-RevId: 526047180
Change-Id: Ia63f02184f5c6a7e3b588298639fa0ab4a6da649
2023-04-21 08:44:20 -07:00
Saran Tunyasuvunakool 94779a722a Rename Differ to IsDifferent and tidy up its implementation.
Startblock:
   diffbase is submitted
PiperOrigin-RevId: 526024927
Change-Id: I718f3b98539f5c33a42f6254bc817a07459f694c
2023-04-21 07:14:26 -07:00
Saran Tunyasuvunakool da17fdfcfd Fix a macOS segfault in simulate.cc.
The segfault was caused by updating the UI outside the main thread.

PiperOrigin-RevId: 526019783
Change-Id: I3a211ce8a65f10716778bb3310bb568e00309a32
2023-04-21 06:46:09 -07:00
Nimrod Gileadi d4414a0353 Initialize real_time_index to zero.
In the passive viewer, this value wasn't initialized.

PiperOrigin-RevId: 525760119
Change-Id: I6635270a30556600a0c51ba1d2767da226ba0440
2023-04-20 08:55:32 -07:00
Saran Tunyasuvunakool 0630b7543d Bump version number to 2.3.4.
PiperOrigin-RevId: 525745444
Change-Id: I8a9994b72a0a2ba3f371bee2c2bea947ad8f4fd1
2023-04-20 07:52:46 -07:00
Saran Tunyasuvunakool b362cb4972 Expose a handle for the Python viewer.
This change also requires user scripts to explicitly synchronize changes to physics state to the viewer. The Simulate class was reconfigured so that certain UI events are handled during this sync operation, outside of the render loop on the main thread. These correspond to operations that require access to the full mjModel/mjData.

To support other, more interactive operations (e.g. camera movements), a new mjvSceneState struct is introduced which captures only the portion of the physics state required for scene re-rendering. The mjvSceneState is updated from mjModel/mjData during the viewer sync operation, and is significantly cheaper than a full mj_copyModel and mj_copyData.

Fixes https://github.com/deepmind/mujoco/issues/796

PiperOrigin-RevId: 525723636
Change-Id: Id08d0210a2c067d5afe85e2bf104f276aeddd75e
2023-04-20 05:59:19 -07:00
Saran Tunyasuvunakool 5646c905cd Rename a few functions and variables to be a bit more Googley.
PiperOrigin-RevId: 523963645
Change-Id: Ife7ed3f44aa83c64dfbdc3ca78ee6de2092b0d63
2023-04-13 04:24:31 -07:00
limymy dd32843e89 Disable the propagation of MUJOCO_SIMULATE_COMPILE_OPTIONS 2023-04-12 21:50:50 +08:00
Alessio Quaglino 5f132af625 Add midphase and broadphase statistics to mjData.
PiperOrigin-RevId: 521387641
Change-Id: Id50f2549d119e364216491a23b107e04d9ebb5b6
2023-04-03 00:59:59 -07:00
Nimrod Gileadi 0e7e299bf6 Declare loop variables inside for loop in C++ files.
PiperOrigin-RevId: 518852339
Change-Id: I0174d873d89e48f11b816d337728f213c2798248
2023-03-23 07:22:36 -07:00
Nimrod Gileadi 33a2ce73d4 Update MuJoCo version to 2.3.3.
PiperOrigin-RevId: 517931617
Change-Id: I7c9960290f1b6e5d5f68a54df617a580f23c57e9
2023-03-20 04:36:09 -07:00
Nimrod Gileadi c6ab23d6b4 Add a missing mjITEM_END when creating the UI for the collision tree.
This fixes #774.

PiperOrigin-RevId: 517469175
Change-Id: I24a127c59f4a8dd7a5b306558425b90a80ec44f3
2023-03-17 11:51:06 -07:00
Nimrod Gileadi 08027b4e43 Only use -Wgnu-empty-initializer on Clang and not GCC.
Broken by ee566eb880.

PiperOrigin-RevId: 517390165
Change-Id: Ibd8ec46647873050899cffe435e3f5c293279aae
2023-03-17 05:35:16 -07:00
Alessio Quaglino ee566eb880 Remove empty initializers to ensure MSVC compatibility.
Add -Wgnu-empty-initializer to Clang builds to catch this issue in the future. Initialising arrays with empty braces is not part of the C standard and fails on MSVC. This commit should catch the issue earlier by detecting it in Clang.

PiperOrigin-RevId: 517373961
Change-Id: I518006e84151e8d5b45a7fe00ba7675dfb031ca0
2023-03-17 04:02:24 -07:00
Alessio Quaglino 70959c1a2c Added a collision midphase on geom pairs using rotated AABBs static trees.
PiperOrigin-RevId: 517357695
Change-Id: I068fee714d9638be2fb6d042d5d86f8ff970635b
2023-03-17 02:37:29 -07:00
Saran Tunyasuvunakool 81ba9ec54a Fix a rare crash when running simulate on macOS.
The bug was introduced in 2f0fb1e4ef. The glfwSwapBuffers call should occur on the main UI thread, not the CoreVideo DisplayLink thread.

PiperOrigin-RevId: 517172202
Change-Id: I2491f2194765019748198cd0cc61ca9263331b01
2023-03-16 11:06:25 -07:00
Yuval Tassa 8c7f6ce5a0 New implicitfast integrator and sparse RNE derivatives for implicit.
PiperOrigin-RevId: 516910733
Change-Id: I29a0465c0f0b1749a73e3d7e01925200d025ddd0
2023-03-15 13:17:41 -07:00
Saran Tunyasuvunakool b6080108c3 Ignore -Wdeprecated-declarations for NSOpenGLContext.
PiperOrigin-RevId: 516500366
Change-Id: I39d974626e51627c767c52a7f90135963fdeb1c2
2023-03-14 05:53:35 -07:00
Saran Tunyasuvunakool 2f0fb1e4ef Workaround for broken VSync in Simulate on macOS.
OpenGL VSync became broken again in macOS 13 (https://github.com/glfw/glfw/issues/2249). This workaround is similar to https://github.com/glfw/glfw/pull/2277 but is implemented entirely outside of GLFW.

PiperOrigin-RevId: 516320722
Change-Id: Ib8a651a942f592c74e00ad3c7b22f2dfd156be5f
2023-03-13 14:19:17 -07:00
Alessio Quaglino 3abf2ae2cd Increase maximum number of geoms in simulate from 5000 to 20,000.
PiperOrigin-RevId: 516246198
Change-Id: I8a07a075b370ad0c212db8ed68b3d61389eba197
2023-03-13 10:16:12 -07:00
Yuval Tassa 2607e67f8d Add contact labels showing which geom pairs are in contact.
PiperOrigin-RevId: 510422404
Change-Id: Ia73570098752e7c7175e4b5a5f2a0f8b08a6c006
2023-02-17 07:03:19 -08:00
Saran Tunyasuvunakool 5e989d18c3 Enable compiler errors for implicit switch case fallthroughs.
Also unify warning options across Clang and GCC and fix minor issues that was surfaced by this.

PiperOrigin-RevId: 508619655
Change-Id: I59b777bf2dfea4422485670e2427c7d3f5cf6405
2023-02-10 03:49:00 -08:00
Saran Tunyasuvunakool 95a07e85cc Fix Windows stack overflow problem in the simulate app.
PiperOrigin-RevId: 507763611
Change-Id: I199910142d9165710c48b41a842ab9aef01ff5c2
2023-02-07 06:34:10 -08:00
Alessio Quaglino dd632b7ccc Bump MuJoCo version to 2.3.2.
PiperOrigin-RevId: 507720557
Change-Id: I7a5b577094ac1a7f468a84c484f62f61dc6b409f
2023-02-07 02:35:17 -08:00
Copybara-Service 36836d8e42 Merge pull request #636 from traversaro:fixextglfw
PiperOrigin-RevId: 507618773
Change-Id: I74362535e9840c97b7c4c3fbff29e06bcdcaf41a
2023-02-06 16:50:54 -08:00