Commit Graph

70 Commits

Author SHA1 Message Date
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
Yuval Tassa bc0184d67e Increase precision of simulate sensor plot y-axis by 1 digit.
- Before this change, the y-axis scale had only one digit, leading to user confusion. Small changes in senor values could appear as if the values remained at the nearest integer value, while in fact the y-axis itself was changing, but this was not evident in the GUI due to the reduced precision.
- Fixes #719.

PiperOrigin-RevId: 506841881
Change-Id: I583036bba389cef8d9ecf1c1bbcfb573ef2285e6
2023-02-03 01:48:18 -08:00
Saran Tunyasuvunakool 4b4ee27f64 Turn off reflection and shadow in simulate when a GPU is not present.
Note that The GLFW adapter currently assumes that a GPU is always present, so this new code path is never reached at the moment.

PiperOrigin-RevId: 504617048
Change-Id: I04a323c33d9cff73686d39e4a6676ca6a4484c98
2023-01-25 11:33:20 -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
Kevin Zakka a173e01f42 Prevent division by zero in Ornstein–Uhlenbeck control noise.
PiperOrigin-RevId: 498753494
Change-Id: Ib43e165a4da524c12fab4ea05848b084b2e7713c
2022-12-31 10:29:03 -08:00
Gianfranco Costamagna 0b33fd9eaa sed s/atomic_bool/atomic_int/g -i simulate/simulate.h
Change atomic_bool to atomic_int to make sure that the compiler will try the best to
generate machine code, instead of relying on an external atomic library
2022-12-08 21:24:00 +01:00
Silvio Traversaro ca70d8bfaf Pass glfw3 as PACKAGE_NAME in glfw's findorfetch invocations 2022-12-07 19:25:18 +01: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
Saran Tunyasuvunakool df25d7d602 Raise an informative error when running on macOS under Rosetta 2.
Current users only get a cryptic "Illegal instruction" crash.

Context: https://github.com/deepmind/mujoco/issues/611
PiperOrigin-RevId: 491705647
Change-Id: I1285897a36e858300ee3d125957e90754be9a7f7
2022-11-29 12:19:06 -08:00
Saran Tunyasuvunakool ecac5758e2 Replace NULL with nullptr.
PiperOrigin-RevId: 491385488
Change-Id: Iec34af99edb7ccd64834130a8cc6280a02b166c2
2022-11-28 10:44:30 -08:00
Yuval Tassa 062cb53a4a In simulate, move "pause" label to the top left rather than the top right.
PiperOrigin-RevId: 491035420
Change-Id: I94ad7ca2764716f9821df6009e5c4b50675a04be
2022-11-26 05:40:52 -08: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
Saran Tunyasuvunakool 2ebc5f097b Change simulate plugin directory name to mujoco_plugin.
This helps distro packagers avoid having to create a directory with the generic `plugin` name in system locations.

Context: https://github.com/deepmind/mujoco/issues/552
PiperOrigin-RevId: 489011386
Change-Id: Ie9f1748cbb4f2b9dc8c328064caaeb50c88fdec3
2022-11-16 12:40:31 -08:00
Copybara-Service f7b256de91 Merge pull request #419 from aftersomemath:simulate-python
PiperOrigin-RevId: 487496285
Change-Id: I17d15bd2a3886e5ce1631f4eb78afa94830d08cc
2022-11-10 04:12:34 -08:00
Yuval Tassa 5004a4c8c5 Better memory setting and reporting, updated example models.
- Memory heuristic rounds up to the nearest MB.
- `simulate` reports total memory currently allocated in the info box.
- All example models use `<size memory/>` rather than legacy attributes.
- Regenerated `example_saved.xml` and reformatted original model in [overview chapter](https://mujoco.readthedocs.io/en/latest/overview.html?#examples).
- `<size>` top-level section does not get written if empty.

PiperOrigin-RevId: 486702670
Change-Id: I0306e335f32344c59562ba606664ec9d2101f8a8
2022-11-07 10:36:37 -08:00
Nimrod Gileadi 0514010928 Disable deprecated-builtins warnings in clang.
Since upgrading to Clang 15, abseil fails to build, because of abseil/abseil-cpp#1201.

PiperOrigin-RevId: 486190797
Change-Id: Ibaa1c03b8d21ae4a83c3825c8d56363aa2f89505
2022-11-04 11:35:49 -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
Saran Tunyasuvunakool c2f1381f31 Update dependency versions.
PiperOrigin-RevId: 479839325
Change-Id: I44f51ed9fd756cf8c3397489f045492cca0bf54a
2022-10-08 16:55:29 -07: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
Levi Burner e12343ae51 remove stray #include 2022-10-04 14:55:26 -04:00
Levi Burner 95a4b1c551 simulate python: fix cmake, glfw usage, update Python version of physics loop 2022-10-04 14:37:06 -04:00
Kevin Zakka af7f48d9e6 Fix video embedding in simulate README.
PiperOrigin-RevId: 478823401
Change-Id: Ie3c6b94621dcfdcf4a27b7d6ddb1c2be08353d0a
2022-10-04 10:24:17 -07:00
Levi Burner 0b6bf42840 WIP Python bindings for Simulate tested on Linux only 2022-10-04 12:34:49 -04:00
Alessio Quaglino bc1490b7a8 Add realtime parameter to visual global.
PiperOrigin-RevId: 478775714
Change-Id: Ic2d178a5c57d298d005215219ce8470392c4651b
2022-10-04 07:09:15 -07:00
Kevin Zakka f85cfb8ed2 Fix broken simulate links.
PiperOrigin-RevId: 478775551
Change-Id: I1c4f43c7cbe01f267948f5915a7511744eb0d158
2022-10-04 07:07:57 -07:00
Saran Tunyasuvunakool 7072b61cc5 Make Simulate app scan for plugin libraries on launch.
PiperOrigin-RevId: 478502151
Change-Id: I9057e74af4d207cfc551e701134820100bdeee78
2022-10-03 07:47:42 -07:00
Kevin Zakka 7e89d8dab0 In simulate UI, clear shortcut string for flags with no shortcuts.
PiperOrigin-RevId: 478467279
Change-Id: Icc4317d9e35b41871143572275d03adf7e13d956
2022-10-03 04:31:17 -07:00
Yuval Tassa 0a0acb3419 Display real-time percentage in paused mode, if different than 100%
PiperOrigin-RevId: 474519561
Change-Id: I54eea97f305dc9b57b9513d6ab5cd75368c2cd45
2022-09-15 03:26:12 -07:00
Saran Tunyasuvunakool 00576a3bf9 Update icons to match the new banner and add Windows version info.
Also update the README banner so that the background grid lines scale more reliably to different screen PPI.

PiperOrigin-RevId: 473598837
Change-Id: I43434b35333714922128f8fd625aa6eb62521a7f
2022-09-11 11:04:36 -07:00
Saran Tunyasuvunakool 94b6ae2b69 Bump version number to 2.2.2.
PiperOrigin-RevId: 472513958
Change-Id: I42f321c6681fdd42c5f80368f612534aa885af74
2022-09-06 11:32:55 -07:00
Yuval Tassa 834e8dd506 Improvements to time synchronisation in simulate.
- Improved time-sync logic readability in `PhysicsLoop`.
- Fixed unattainable condition for breaking from stepping loop if data was reset.
- Added measurement of actual real-time tracking.
- Moved slowdown overlay to top left.
- Report slowdown as % of real-time, rather than fraction.
- Report actual slowdown if different than requested (very small timestep, PhysicsLoop cannot keep up) by more than 10%.
- Replaced slowdown increments of 2 with decimal-rounded increments of 10^(1/10). This is a finer-grained scale (approximately 3x as fine) and well suited for decimal percentage representation.
- Maximum slowdown increased to 1000.
- Added `Simulate.refreshrate` with a default of 60Hz, in case videomode refreshrate is 0 (can occur e.g. when forwarding over X11).
- Remove realtime reporting from regular info overlay.
- Various cleanups.

PiperOrigin-RevId: 471547481
Change-Id: Idd2514a4defb1dc431617f3a515cc747c4fd8971
2022-09-01 09:09:48 -07:00
Yuval Tassa 7839c1c42a Annotate simulate/glfw_dispatch.cc
PiperOrigin-RevId: 471256296
Change-Id: I63594a478fc65bf27d8f04f6bb25352a719c5ccc
2022-08-31 07:59:23 -07:00
Saran Tunyasuvunakool 9d9493153c Fix GCC "declaration of ... changes meaning" errors.
PiperOrigin-RevId: 470175500
Change-Id: If13a81f308f803d3cc4731b3d4d0561cfe56d5c8
2022-08-26 00:13:57 -07:00
Saran Tunyasuvunakool 3240596c3a Call GLFW functions via a dynamic dispatch table.
This allows us to use GLFW without needing to introduce a link-time dependency on the library, which in turn enables us to get GLFW through Python.

PiperOrigin-RevId: 470100999
Change-Id: I27c84ad3310afdbebd582ab0033b6a963ba6307e
2022-08-25 15:41:53 -07:00
Kevin Zakka d466e390fc Add new simulate to CI.
PiperOrigin-RevId: 468670988
Change-Id: I2c6c7ac4763402f2a3e8df734746477e54a8ed8e
2022-08-19 04:17:10 -07:00
Copybara-Service 396fdf00c3 Merge pull request #425 from aftersomemath:cull-face-flag
PiperOrigin-RevId: 466904386
Change-Id: Icd5515c2bbb8f8f3417501ea43c8e5ae22b32f91
2022-08-11 02:44:37 -07:00