Commit Graph

172 Commits

Author SHA1 Message Date
Saran Tunyasuvunakool 7e549495d9 Fix macOS mjpython launcher to suppoer show_{left,right}_ui.
PiperOrigin-RevId: 572377315
Change-Id: Iee734a6e49821b42e94dc19d9ed92a45ee605ea7
2023-10-10 15:04:02 -07:00
Saran Tunyasuvunakool a84499e904 Fix non-graceful exiting behaviour in launch_passive.
The viewer currently hard crashes when the user script loops on the passive viewer handle without paying attention to `is_running`. This is considered user error, however this change makes the user script hang on the loop rather than hard crashing.

Startblock:
   diffbase is submitted
PiperOrigin-RevId: 572336261
Change-Id: Id53126a158242b947584da1f946304ae8e792d4a
2023-10-10 12:39:37 -07:00
Saran Tunyasuvunakool a1d0cbd654 Add show_{left,right}_ui kwarg to viewer.launch(_passive).
Fixes #857

PiperOrigin-RevId: 572333909
Change-Id: I12247fe856afddf808eb8f386a594acac47c34b5
2023-10-10 12:31:11 -07:00
Saran Tunyasuvunakool 2e15574b58 Allow user-defined visualization geoms to be added to the passive viewer.
Fixes #1023, #1082

PiperOrigin-RevId: 572303635
Change-Id: Ia8399f816f311b38a7b137f5bd4f359f77a1da1c
2023-10-10 10:52:21 -07:00
Google DeepMind df48624d0d Place mjx tutorial correctly in copybara excludes.
PiperOrigin-RevId: 571390140
Change-Id: I8d0b9ac7b30391e4abaa1ba03fd941e028fd2991
2023-10-06 11:29:54 -07:00
Google DeepMind 06670155c4 Add MJX training colab.
PiperOrigin-RevId: 571066455
Change-Id: I8b0638181cdc751cf9fbacfb84c1ac551d7ce4bd
2023-10-05 10:45:36 -07:00
Yuval Tassa e9613f0cc9 Rename simulate.fully_managed_ to simulate.is_passive_ with flipped semantics.
PiperOrigin-RevId: 570815258
Change-Id: Iaffdb0e52bcdb31cff7bd29cb820913e3838f0ee
2023-10-04 14:49:52 -07:00
Yuval Tassa 3e12f0d50c Add history scrubbing mechanism to simulate.
[screen capture](https://www.youtube.com/watch?v=YSvWn_poqWs)

PiperOrigin-RevId: 570676968
Change-Id: Id9a1fccc9418b851e007ddcf3fa89acd4edff3e9
2023-10-04 06:36:34 -07:00
Yuval Tassa ee78b8f76b Added mjData.eq_active user input variable, for enabling/disabling the state of equality constraints.
Renamed `mjModel.eq_active` to `mjModel.eq_active0`, which now has the semantic of "initial value of `mjData.eq_active`".

Fixes #876.

PiperOrigin-RevId: 570410643
Change-Id: Id03171e751377c7cc453f143abee64239ee2e2ed
2023-10-03 09:32:24 -07:00
Yuval Tassa 639e77876d Improved unpause behavior in simulate.
PiperOrigin-RevId: 570030315
Change-Id: I5822f8686ba2fd7c5c59a9fa73fc29000a8406ec
2023-10-02 05:00:40 -07:00
Saran Tunyasuvunakool 8e00f8029e Disable -Wmaybe-uninitialized in GCC versions 12 and later.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109561

PiperOrigin-RevId: 569204628
Change-Id: I34ccb84a0afc60ccfcc47c820438d15dfa0a5f42
2023-09-28 09:25:27 -07:00
Alessio Quaglino 36d2ffe4f2 Specify camera parameters using standard robotics conventions.
PiperOrigin-RevId: 569147555
Change-Id: I3443f95e5de56a17024f5e5c03f33888dd583edb
2023-09-28 05:19:19 -07:00
Copybara-Service b8a91a00ce Merge pull request #1070 from aftersomemath:simulate-load-message
PiperOrigin-RevId: 568995214
Change-Id: Iac7644c4b35a916aa6a7d1bb158ba15a024b43ac
2023-09-27 16:36:40 -07:00
Yuval Tassa ac74c72657 Fix issue where unpausing the simulation (especially under slowdown) causes a jump in simulation time, in both native simulate and Python viewer.
PiperOrigin-RevId: 568948943
Change-Id: I2f401508555e272f348e97627aeb85cb3e9cf017
2023-09-27 13:46:19 -07:00
Levi Burner e7d1f2f110 simulate: fix display of loading message 2023-09-27 16:04:36 -04:00
Saran Tunyasuvunakool 81c5e61b1e Correct OpenGL library path on macOS.
Although the path doesn't exist on disk, dlopen seems to be previously redirecting to the correct file, but this stopped working in macOS 14.

PiperOrigin-RevId: 567684115
Change-Id: I21894302e87803d06bfd27ba123eacbdfec0ec56
2023-09-22 12:09:31 -07:00
Matthew Bennice 7f8018a3f3 Update XML parsing to store asset path so that assets can be recovered and sent to external renderers
PiperOrigin-RevId: 567347908
Change-Id: I4d8e1abe35be3a67643ff925af709921280856f8
2023-09-21 10:27:52 -07:00
Matthew Bennice 4f34cacf35 Add maxuse_threadstack to mjData
PiperOrigin-RevId: 567334177
Change-Id: Ifd772350042e548a63ab269fd68fb5e5fef55831
2023-09-21 09:41:00 -07:00
Saran Tunyasuvunakool be75dda8d1 Fix arena memory leak in _realloc_con_efc.
PiperOrigin-RevId: 567093603
Change-Id: I0a00da461b495cc13e54381862d740333a43f82b
2023-09-20 15:16:04 -07:00
Yuval Tassa 9902b73502 Rename mj_stackAlloc to mj_stackAllocByte.
PiperOrigin-RevId: 566351365
Change-Id: I91541168e83b05a730113661cc9f07985ac9ff0c
2023-09-18 10:53:35 -07:00
Yuval Tassa 86d8b912f4 Rejigged solver statistics in preparation for islanding.
- See public description below.
- Stopped incrementing the iteration count in saveStats().
- `sizeof(mjSolverStat) == 40`, so this ends up costing 160KB, up from 40KB.

BEGIN_PUBLIC

Changed the size of `mjData.solver`, the structure used to collect solver diagnostic information. The array is now of length `mjNISLAND * mjNSOLVER`, where each row of length `mjNSOLVER` contains separate solver statistics for each constraint island. Until solver islanding is implemented, only row 0 is used.

- The new constant `mjNISLAND` is set to 20.
- `mjNSOLVER` is reduced from 1000 to 200.
- Added `mjData.solver_nisland`, the number of islands for which the solver ran.
- `mjData.solver_niter` (renamed from mjData.solver_iter) and `mjData.solver_nnz` are now integer vectors of length `mjNISLAND`.

END_PUBLIC

PiperOrigin-RevId: 565030093
Change-Id: I773e918805c6ced79f0dab5f19ea23956760c8c5
2023-09-13 06:18:37 -07:00
Kevin Zakka 8faf47dd16 BEGIN_PUBLIC
Add missing `ctrl` attribute to keyframe indexer.
END_PUBLIC

Context: Making an LQR notebook for the Skydio drone and wanted to read the ctrl attribute in the keyframe stored in the XML.
PiperOrigin-RevId: 564806350
Change-Id: I5af3189cc8be87915f9d320d95f0fab551ef87fa
2023-09-12 12:54:48 -07:00
Saran Tunyasuvunakool 48d0bfde44 Replace glfw.get_time with time.time in the Python viewer timing logic.
PiperOrigin-RevId: 563134207
Change-Id: Ic548701fc78336d8d87e94ea48833f94ee6395b8
2023-09-06 09:52:12 -07:00
Saran Tunyasuvunakool 33f51856c1 Check that alignment is power of 2 in mj_stackAlloc.
PiperOrigin-RevId: 562024496
Change-Id: I9230c6dc05ebb78e935f9b2f606aa77c921d67e5
2023-09-01 12:45:35 -07:00
Saran Tunyasuvunakool 4c899b92cc Rename mj_stackAllocByte to mj_stackAlloc and make it public.
PiperOrigin-RevId: 561133040
Change-Id: I4f5ffe51c1287aa0c82af68bfe17ed6dd2ad09da
2023-08-29 14:07:54 -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
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