Commit Graph

147 Commits

Author SHA1 Message Date
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
Tom Erez 819b5cb982 Add invdiscrete flag to enable discrete-time inverse dynamics with mj_inverse.
PiperOrigin-RevId: 560161140
Change-Id: If3e30be5e9af4982571dd310172f2fc0d8d1c551
2023-08-25 12:08:37 -07:00
Nimrod Gileadi b92a9d599c Fix type errors in mujoco Python library.
PiperOrigin-RevId: 559473920
Change-Id: I45056b4a86a062f223d39c60fbc849ef69a5866b
2023-08-23 10:38:50 -07:00
Saran Tunyasuvunakool a2de04f5be Sanitize function parameter names that are Python keywords.
PiperOrigin-RevId: 559436458
Change-Id: I56b8a595885f3f3d3ecb7a00db5f1bd70e5f95d9
2023-08-23 08:34:41 -07:00
Yuval Tassa 90f58ebe5d Rename mj_stackAllocBytes to mj_stackAllocByte
PiperOrigin-RevId: 559071711
Change-Id: I19072e07ac86ee0486703aa48b0dceb297f5f893
2023-08-22 04:43:53 -07:00
Matthew Bennice 59138af10b Refactor stack allocations to have a clean byte allocation interface.
PiperOrigin-RevId: 558881470
Change-Id: I08c45cb5fa25a1a9c39560e598e805cfa5141c3e
2023-08-21 13:18:29 -07:00
Kyle Bayes ed4bb2aab5 Change _Alignof to alignof in functions.cc
PiperOrigin-RevId: 558388811
Change-Id: I40f394d6dd05215a7499ede5903841a07cd1c9f0
2023-08-19 05:11:40 -07:00
Saran Tunyasuvunakool 488041d362 Add a private function for resizing contact and efc-sized arrays in Python.
This function is currently used for internal experimentation.

PiperOrigin-RevId: 558238153
Change-Id: I32eec8f13ac2d995e90c5421f2a157412e2148f2
2023-08-18 13:53:04 -07:00
Yuval Tassa 3e034e38b2 Add constraint island discovery
PiperOrigin-RevId: 557067599
Change-Id: Ic41e1d0efef02b7a79142518afe49cf9d4e74725
2023-08-15 02:30:05 -07:00
Kyle Bayes 631b16e7ad Add better user error messages to Python renderer update_scene along with missing unit tests.
PiperOrigin-RevId: 554482720
Change-Id: Ief3ba496fb5720668f98fb9d44a5c82e6a14b9cc
2023-08-07 08:22:34 -07:00
Kevin Zakka 4a519b9dd8 Raise an error if invalid camera name is provided to renderer update_scene. Fixes #870.
PiperOrigin-RevId: 553211464
Change-Id: I00ab01a9929160dd40a2a789b104a8a6ed0d5a61
2023-08-02 11:46:37 -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 5f327b0c31 Add missing pybind definition for update_mesh.
PiperOrigin-RevId: 548395521
Change-Id: Id21a1ef6daa94a221062e7354db3e906611f0f36
2023-07-15 14:57:38 -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
Yuval Tassa 5cfbb6ac8b Add mjd_quatIntegrate, expose mjd_subQuat.
PiperOrigin-RevId: 546252926
Change-Id: I7d6b2bd6536e7e8afc368f3c46037c20f6a1cb5e
2023-07-07 05:33:24 -07:00
Saran Tunyasuvunakool 551a7bbc38 Drop support for Python 3.7.
Python 3.7 reaches end-of-life on 27 June 2023 (https://devguide.python.org/versions/), and future versions of MuJoCo (after 2.3.6) will no longer support it.

PiperOrigin-RevId: 543594006
Change-Id: I66a7db3dab5d08f2fc52912c43e1532080600fc8
2023-06-26 18:05:32 -07:00
Yuval Tassa c50c92ccc8 Add mjv_connector, identical to mjv_makeConnector but with a more convenient "from-to" parameterization.
PiperOrigin-RevId: 542343761
Change-Id: I75f5ff3c404a2a9f65dfed706e590efd7b951f6e
2023-06-21 13:19:36 -07:00
Saran Tunyasuvunakool f555261934 Bump MuJoCo dependency versions.
PiperOrigin-RevId: 541945332
Change-Id: I13e67a2ef55a4b61600563c510e8f22405a87943
2023-06-20 09:14:28 -07:00
Kyle Bayes ac1f41160d Add engine internal error macro mjERROR to prepend calling function to error function.
PiperOrigin-RevId: 541584847
Change-Id: I57447e64375413ee07aa96372a402e1ced59ff4a
2023-06-19 03:29:31 -07:00
taylor howell b81dfbbc48 fix python type_error mj_differentiatePos, mj_integratePos 2023-06-14 12:19:58 -06:00
Yuval Tassa f67e359532 Add mjtState enum and related mj_stateSize, mj_getState and mj_setState functions.
PiperOrigin-RevId: 539667943
Change-Id: I14c34be8ce4c287e529380257b5c5bffc3ab45ce
2023-06-12 08:56:48 -07:00
Yuval Tassa 466c9aca82 Remove mj_activate and mj_deactivate.
PiperOrigin-RevId: 538799120
Change-Id: I4d6729131e20ab9ae15c94c221ba83ae5732e942
2023-06-08 08:55:39 -07:00
Yuval Tassa d82f5ce5a4 Add mjContact.solreffriction, mjModel.pair_solreffriction and related implementation, allowing contact reference acceleration to be different for normal and frictional contact directions. This is required for e.g. elastic frictional collisions.
PiperOrigin-RevId: 538513357
Change-Id: Id9eb910fe791cf898c712030cb2c0fc481389c91
2023-06-07 09:40:20 -07:00
Saran Tunyasuvunakool f887c1e928 Add ASAN and MSAN instrumentation for arena and mjData stack.
PiperOrigin-RevId: 535635490
Change-Id: Ia1e58771bae25bf72c861f57452fb8faa2b918fb
2023-05-26 09:17:26 -07:00
Alessio Quaglino dab49d487c Use mesh BVH for speeding up ray mesh intersection.
PiperOrigin-RevId: 532516008
Change-Id: Ia9cac060279d030221c1a6b4fad457a857701370
2023-05-16 11:10:38 -07:00
Alessio Quaglino 9d1a21f99d Use mesh BVH for speeding up ray mesh intersection.
PiperOrigin-RevId: 532464595
Change-Id: If159c89b93c24e6a7be6310911364cfad7baae81
2023-05-16 08:17:50 -07:00
Yuval Tassa b0bc330b54 Add utility functions for banded-then-dense symmetric matrices.
PiperOrigin-RevId: 528757637
Change-Id: I916d843140322c28e857100a6b305a041f704d53
2023-05-02 05:58:08 -07:00
Alessio Quaglino 2ad82d5998 Add mj_multiRay function to perform multiple ray intersection with the same source.
PiperOrigin-RevId: 528684535
Change-Id: I6e1747a4a0910e6061d6154e19ad8723f56c22e3
2023-05-01 23:02:45 -07:00
Yuval Tassa c50177d301 Add mjd_inverseFD for finite-difference approximations of inverse dynamics Jacobians.
Fixes #703.

PiperOrigin-RevId: 527899700
Change-Id: I10e41a381dcecf62c53b3b9aa72a4ce666161366
2023-04-28 09:04:41 -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 db3b49b60f Bump version number to 2.3.5.
PiperOrigin-RevId: 526918869
Change-Id: I9f19600b0c1b855ef0834e5c026b204bf1dc06c4
2023-04-25 03:52:12 -07:00
Nimrod Gileadi 707fcdb44f Correct return type on viewer.launch_passive.
PiperOrigin-RevId: 525753923
Change-Id: Idfff26e89deaeb37dd8b179106640f05c0deabb2
2023-04-20 08:30:42 -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 c6e35d255c Update dependency versions.
PiperOrigin-RevId: 525487198
Change-Id: Ic352c0dc6aaa4120e1f2fa637a8c483c885ca4cd
2023-04-19 10:33:11 -07:00
Saran Tunyasuvunakool cefc290eac Reorder arguments of Simulate::Load in Python to match C++.
PiperOrigin-RevId: 523973129
Change-Id: I58760e3e392a208dd8257c340da146aa8f745fb7
2023-04-13 05:22:13 -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
Saran Tunyasuvunakool 2e23594fe8 Add an introspect module for structs.
Also missing struct fields to the Python bindings that were discovered as a result of the new `introspect` metadata.

PiperOrigin-RevId: 523947396
Change-Id: I367fd2dc8d5fd7e5712a45b70a5c50da51d152e4
2023-04-13 02:50:23 -07:00
Copybara-Service bcb19fd85c Merge pull request #802 from hartikainen:fix-typos
PiperOrigin-RevId: 523698082
Change-Id: Ib12bbf8b6a1e02f87a278a230dcb6e5d722d2a94
2023-04-12 07:49:14 -07:00
Saran Tunyasuvunakool 34226bf52d Fix a race condition in launch_passive and launch_repl.
Before this change, these functions can return before an internal call to `mj_forward`, which results in a race condition if the user script then tries to modify the physics state.

Fixes #783
Fixes #790

PiperOrigin-RevId: 523214378
Change-Id: I8a4c6cef0f5d3ec781fd2c5cae3c20dd4b8be67f
2023-04-10 14:35:53 -07:00
Saran Tunyasuvunakool 6d63e046fd Add low-level CGL context management for macOS.
This allows rendering from non-main threads as the context is not tied to a Cocoa window.

Fixes #742
Fixes #798

PiperOrigin-RevId: 523144359
Change-Id: I98432debdd034814c313eda94e38c248c3c1f76c
2023-04-10 10:09:49 -07:00
Kristian Hartikainen a611b7bf6d Fix typos 2023-04-04 19:58:43 +01:00
Kevin Zakka 3f14d97f6b Add equivalent inertia ellipsoid visualization.
PiperOrigin-RevId: 519154067
Change-Id: I35f1993c1493df9be752b7163385004649498070
2023-03-24 08:47:43 -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
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
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
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