Commit Graph

636 Commits

Author SHA1 Message Date
Kyle Bayes dfd463cdb5 Reset nnzJ in resetData.
PiperOrigin-RevId: 517976421
Change-Id: I329c0096d368062f150c6dbeec181f5b0eeefcbf
2023-03-20 08:33:36 -07:00
Nimrod Gileadi e58d53e747 Update changelog.rst for version 2.3.3
PiperOrigin-RevId: 517932202
Change-Id: I55063e9bc5da2d424b1ad303834d8f11cb0a0fa9
2023-03-20 04:40:15 -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
Kyle Bayes 8696247f9d Add mj_stackAllocInt to get correct size for allocating ints on mjData stack. Reducing stack memory usage by 10% - 15%.
PiperOrigin-RevId: 517672195
Change-Id: Ie14e6c9c99e8b9e1c5d3686b77631f2df0651c67
2023-03-18 13:04:14 -07:00
Yuval Tassa fae5e822c0 Add links to default attributes.
PiperOrigin-RevId: 517639045
Change-Id: I45f766bda8ce5bd182ba2669c4121c21896d40c1
2023-03-18 07:07:01 -07:00
DeepMind c34826ef1a mujoco.renderer.render to output copy of pixel array.
Previously, it returned a view into the internal rgb array, which can be confusing to the user.

PiperOrigin-RevId: 517630186
Change-Id: Ibc1e86b6b6345269523bb4c82c37dd325961a8ec
2023-03-18 05:30:46 -07:00
Yuval Tassa d97ff39e86 Improvements to schema table.
- Schema table now has attribute links and is open by default.
- Attributes are in 4 columns.
- Fixed various documentation bugs made visible by this change.
- Removed distance equality constraint from xml_native_reader.cc

PiperOrigin-RevId: 517558035
Change-Id: Ibc7715587dd4e72253231bfd55bd037f0193b3fd
2023-03-17 18:57:34 -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
Saran Tunyasuvunakool 7a0def9791 Add viewer.launch_passive and mjpython to the changelog.
PiperOrigin-RevId: 517458183
Change-Id: Idaa39fed2ab9d4a82b92b7a1a1cefb80b5b36fcf
2023-03-17 11:09:27 -07:00
Yuval Tassa 7bff68dac8 Fix syntax of permalinks.
PiperOrigin-RevId: 517428359
Change-Id: I1409f91ca3b82116464b264c1b798807636506f0
2023-03-17 09:12:54 -07:00
Saran Tunyasuvunakool 7b91567585 Exit mjpython if any pthread function call fails.
PiperOrigin-RevId: 517401871
Change-Id: I2050769085690d50d331f2955ed1e09ca4c8414c
2023-03-17 06:58:26 -07:00
Yuval Tassa 62d200db33 Improve mid-phase images in changelog.
PiperOrigin-RevId: 517390561
Change-Id: Ib2775a5590bc5d03cf7cec1112659829d0dc8ce8
2023-03-17 05:38:39 -07:00
Saran Tunyasuvunakool 0c4e191dd6 Compatibility fixes for mjpython.
- Find Python functions in the interpreter binary itself rather than trying to find libpython.dylib, because this doesn't exist when using Conda. (https://github.com/conda-forge/python-feedstock/issues/595#issuecomment-1311275470)

- Increase the stack size of both the Python main thread and the OS main thread to 16MiB, to match what Python normally uses on macOS. (https://github.com/python/cpython/blob/3.11/configure#L11038)

- Check whether dlfcn and pthread function calls actually succeeds. Emit error messages and exit on failure rather than continuing the program (which generally leads to segfaults).

- Fix pixelated shadow in the icon.

PiperOrigin-RevId: 517390522
Change-Id: Ib91679b4baa63bac5f6b5893e634712d72161ea5
2023-03-17 05:37:35 -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
Yuval Tassa 47b58f5ccb Move memory-alignment static utility from engine_macro.h to engine_io.c
PiperOrigin-RevId: 517259347
Change-Id: Ic3f67e9018fe8903e709128674c0da10032e2162
2023-03-16 16:27:29 -07:00
Copybara-Service 7690965d73 Merge pull request #769 from milutter:plugin_loading
PiperOrigin-RevId: 517231543
Change-Id: Ia3f0929650da235589e9434db84500b3d9f17df1
2023-03-16 14:40:25 -07:00
Yuval Tassa d59a919ef6 Minor style fixes.
PiperOrigin-RevId: 517193740
Change-Id: I093e57efa1480e5d1d6053493b665e145f9b3f87
2023-03-16 12:24:06 -07:00
Saran Tunyasuvunakool e20ab6c96f Add a number of missing struct fields to Python bindings.
It is quite possible that there are a few other fields still missing since we currently do not yet have automated testing of struct field existence.

Fixes #747.

PiperOrigin-RevId: 517189048
Change-Id: I7c1d95e700eaea05aaa3cde1fd05e1a259553117
2023-03-16 12:05:50 -07:00
Copybara-Service a04c4314fd Merge pull request #770 from jonas-eschmann:patch-1
PiperOrigin-RevId: 517174871
Change-Id: I9a52f6bc79777fb7d987eaf057185d9c0e87e477
2023-03-16 11:15:11 -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
Saran Tunyasuvunakool 230e2780de Add viewer.launch_passive and a mjpython launcher for macOS.
The `launch_passive` function launches the GUI viewer in a non-blocking manner, allowing the Python script or REPL to continue execution. The viewer is automatically kept up to date with any subsequent modifications to mjModel and mjData.

Note that when run inside a REPL (including IPython), `launch_passive` is functionally identical to `launch_repl`.

On Linux and Windows, this is achieved by spawning a new thread and launching the GUI there.

On macOS, this is not possible as all Cocoa API calls must be made on the "macOS main thread", which is always the first thread launched in a process and carries the `com.apple.main-thread` dispatch queue. We also cannot simply trampoline from a Python script on the main thread into the user's script on a side thread because CPython's signal handler can only be installed on the "Python main thread". Putting the user's script in a side thread means that it cannot e.g. gracefully handle SIGINT by catching a KeyboardInterrupt exception. To work around this, we ship a custom Python launcher on macOS called `mjpython`. This launcher is a native binary that spawns a pthread and initialize the Python interpreter on that thread, thus allowing "Python main thread" and "macOS main thread" to represent two distinct threads. From Python's point of view, the "macOS main thread" is a secondary thread that runs a loop that continuously empties a Queue of (mjModel, mjData) and launches a viewer.

PiperOrigin-RevId: 517167868
Change-Id: Icac9d2126bbb4760d47e0b9300e0a979cffa4338
2023-03-16 10:53:11 -07:00
Yuval Tassa 9a97674e1e Break up engine_derivative.c into analytical and finite-differencing functions (moved to engine_derivative_fd.c)
PiperOrigin-RevId: 517165392
Change-Id: I649f5521364877d36d7564bb650a889298f0c8a1
2023-03-16 10:45:15 -07:00
Yuval Tassa 1731baa925 Add links to all attributes in XMLreference.rst
PiperOrigin-RevId: 517158584
Change-Id: Ia50a2840049e1c5c24eb2f571483d65537276296
2023-03-16 10:22:53 -07:00
Yuval Tassa 448ab1a299 More consistent formatting of mjdata.h
PiperOrigin-RevId: 517142236
Change-Id: I3ee93e10b843cb3f3a73a6a19e6b96f23be05cc3
2023-03-16 09:23:53 -07:00
mlutter 5215992d55 review comments 2023-03-15 20:51:47 -04: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
jonas-eschmann 1fa538a43b Fixing typo in the documentation 2023-03-15 16:10:50 -04:00
Kyle Bayes 056e849273 Provide improved mju_sqrMatTDSparse implementation that doesn't require dense memory allocation for sparse matrices.
PiperOrigin-RevId: 516812783
Change-Id: Ieb43337831d8d3b2c7f18a7facd8e0a0f2b0eff5
2023-03-15 06:56:16 -07:00
mlutter 3cb0121474 fix typo 2023-03-14 14:28:31 -04:00
milutter 53ab95c792 Ensure that loaded plugins are a shared library 2023-03-14 14:21:16 -04:00
Yuval Tassa fe18e58ad2 Rendering of mjGEOM_LINE respects size[0] (width argument of mjv_makeconnector), denominated in pixels.
- Before this change, line width was hardcoded to 3 pixels and the width argument of mjv_makeConnector was ignored.
- After this change, the width argument is respected and interpreted in units of pixel. The non-standard width unit is ok since lines can only be drawn programmatically.

PiperOrigin-RevId: 516529265
Change-Id: I27bffabba69cde415d2ada67263a887c9240efbf
2023-03-14 08:17:36 -07:00
Yuval Tassa 972770ba55 Improve order of sections in APIfunctions.rst
PiperOrigin-RevId: 516518339
Change-Id: I84e973e6f9034a5d24f20791c13b3880fedde46c
2023-03-14 07:26:29 -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 c16d4d0d25 Move mjtByte definition from mjmodel.h to mjtnum.h.
PiperOrigin-RevId: 516193927
Change-Id: Idbba21119ef2f7da3ab6f6f21611a757658aad23
2023-03-13 06:38:46 -07:00
Yuval Tassa b4d29abfc1 Add table of contents to API Functions documentation page.
PiperOrigin-RevId: 516191825
Change-Id: I792aa72e748443a3f422d0b6cf65a2803f3ec012
2023-03-13 06:26:52 -07:00
Alessio Quaglino ae2c530d8b Tighter axis-aligned bounding box for meshes.
PiperOrigin-RevId: 516166936
Change-Id: Ie99217f8894bdd4bb093900fc0df9d4a1e5030d3
2023-03-13 03:54:33 -07:00
Yuval Tassa 2f03da740a Fix typos.
PiperOrigin-RevId: 516135725
Change-Id: I094f6af5d3ef8dd6a93430c09c61f29c23f55e02
2023-03-13 01:01:45 -07:00
Yuval Tassa c57a588ab5 Re-organise API data structure documentation.
PiperOrigin-RevId: 515515875
Change-Id: I743a0409eb9b867249a90d5c1cb4d77bacade4dc
2023-03-09 20:24:32 -08:00
Kyle Bayes d3d789cf7d Convert mju_error and mju_warning to variadic functions, supporting printf-like arguments. The functions mju_error_i, mju_error_s, mju_warning_i, and mju_warning_s are now deprecated.
PiperOrigin-RevId: 515431052
Change-Id: I440de0cb417ce216b6d636a5d86dc9ef6cc1fc06
2023-03-09 13:51:27 -08:00
Yuval Tassa 2e6a37e8c5 Changelog: Move the image under the "Simulate" heading.
PiperOrigin-RevId: 514666433
Change-Id: Ief3f10260fb071412fdd0d4b481fb10ee99b71ff
2023-03-07 02:09:16 -08:00
Nimrod Gileadi ac78f8aee9 Update CMake dependencies to latest versions.
Upgrade abseil and pybind11.

PiperOrigin-RevId: 514397331
Change-Id: I4a35dc9f3b9dcc79bdd13016a5326f72cd3fc67f
2023-03-06 07:12:22 -08:00
Copybara-Service 93b4d4981d Merge pull request #758 from PeterMitrano:main
PiperOrigin-RevId: 514385239
Change-Id: Ie85f355f1bdcd0b81ff228b71685e37552f679ea
2023-03-06 06:38:00 -08:00
Kevin Zakka bddc4b88b2 Fix comment typos.
PiperOrigin-RevId: 514360878
Change-Id: If119beec09d7eae568d8f6d8e3fa150ec7de88b6
2023-03-06 06:37:42 -08:00
Kevin Zakka ed52b4084e Add missing affine gaintype to XMLreference.
PiperOrigin-RevId: 514359011
Change-Id: I96668ed20dbb20b4d2b60a08eb71286bdfe5fe37
2023-03-06 06:37:26 -08:00
Yuval Tassa 367c254f54 Remove .cc suffix from sample code titles.
PiperOrigin-RevId: 514342526
Change-Id: I4484b70e1c4da7dc98e362cfef16195224d0c65e
2023-03-06 06:37:10 -08:00
Kyle Bayes 49dd6b4193 Clean up mj_id2name and mj_name2id.
PiperOrigin-RevId: 514340647
Change-Id: Idf895b2d7a4a8833725afbe5c71c777081b42d9e
2023-03-06 06:36:48 -08:00