Commit Graph

124 Commits

Author SHA1 Message Date
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
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
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 03d6d27f64 Use mesh BVH for speeding up ray mesh intersection.
PiperOrigin-RevId: 534141245
Change-Id: I9f5a71ea059a1a232fd2910d1efc0506ab6dbef3
2023-05-22 12:05:20 -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
Alessio Quaglino fcc825c5e6 Add cutoff argument to mj_multiRay.
PiperOrigin-RevId: 532158635
Change-Id: I70f98be9f781c8281e21aa5c17bd85f3654e9383
2023-05-15 10:44:37 -07:00
Yuval Tassa 770b4b363a Added optional smoothing to muscle dynamics:
- `muscle` actuators take a new `tausmooth` attribute (defaults to 0) which when positive, smooths the transition between activation and deactivation timescales.
- `mju_muscleDynamics` takes 3 parameters, adding width of smoothing sigmoid.

PiperOrigin-RevId: 531473354
Change-Id: I8ab6c0289ff04437e798c3ca6edda132a30fcc31
2023-05-12 04:58:53 -07:00
Alessio Quaglino 4c487e07ed Add mesh BVH.
PiperOrigin-RevId: 530559807
Change-Id: Ibdafae22c7c74d15d707f205be73e4a571a6ae10
2023-05-09 03:31:06 -07:00
Yuval Tassa 49efa9cc15 Change finite-support mju_sigmoid from a two-quadratic construction to a single quintic with zero 1st and 2nd derivatives at 0 and 1, the boundary of the smooth-support segment.
Note: this function is currently unused in the MuJoCo codebase.
PiperOrigin-RevId: 529969804
Change-Id: I2bddc72916eff67625b806510935bc7f3ce5c770
2023-05-06 09:22:37 -07:00
Kyle Bayes 67f0f5154f Add various improvements for resource providers.
PiperOrigin-RevId: 529706437
Change-Id: I20385e031446674584349c301982dbe13b812477
2023-05-05 07:03:49 -07:00
Nimrod Gileadi 3d82d2a40f Increase maximum number of UI elements per section in Simulate.
PiperOrigin-RevId: 529079121
Change-Id: Ia81418e45c855649e1d9654bbc522f7dffd7dfdc
2023-05-03 07:06:06 -07:00
Yuval Tassa 42a16f65c2 Fix typo in mjd_inverseFD documentation.
PiperOrigin-RevId: 529022023
Change-Id: I2f9e014e271910989f96cd9bfd28c6adaf2e62e5
2023-05-03 01:30:44 -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
Yuval Tassa e3cdc410d6 Rename centered argument of mjd_transitionFD to flg_centered, to conform with the rest of the API.
PiperOrigin-RevId: 527258079
Change-Id: I77817be8ee007a572c79e9cd41f7c5728a091fb3
2023-04-26 07:18:52 -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
Yuval Tassa 0295d972cb Improve comments in mjplugin.h, align to header standard (column 35).
PiperOrigin-RevId: 525868504
Change-Id: I8edfcea737e6e94458015a0e4fa6522cf89a1230
2023-04-20 15:39:09 -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
Kyle Bayes fe3dccfd1d Add a new plugin / extension mechanism called a resource provider along with retrofitting VFS on top of it.
A resource provider provides a mechanism for MuJoCo to read from filesystems other than the OS filesystem or the Virtual File System (VFS).

PiperOrigin-RevId: 525394983
Change-Id: I077ff5a7e2e76806b48b6defb531280aadc8b169
2023-04-19 03:02:22 -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
Yuval Tassa 01b84089dd Document engine plugins.
Rename `mjPLUGIN_DYNAMIC_LIBRARY_INIT` -> `mjPLUGIN_LIB_INIT`.

PiperOrigin-RevId: 521458377
Change-Id: I42aaec923e4f392899dfe53ab6ce1dddc75a83b3
2023-04-03 07:55:21 -07:00
Yuval Tassa 64229c089a Cosmetic improvements to public headers.
PiperOrigin-RevId: 521415262
Change-Id: Iee5d6baec78242f5a033c8b5cdd285af4a0895fa
2023-04-03 03:49:24 -07: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
Kevin Zakka 3f14d97f6b Add equivalent inertia ellipsoid visualization.
PiperOrigin-RevId: 519154067
Change-Id: I35f1993c1493df9be752b7163385004649498070
2023-03-24 08:47:43 -07:00
Yuval Tassa 2a471d1e11 Standardize docstrings in mjmodel.h
PiperOrigin-RevId: 519139821
Change-Id: I5a28c7415870012de1e219d2d00ea4ea9a495ec7
2023-03-24 07:38:39 -07:00
Kevin Zakka 5bc497cdf7 Fix a typo in mjvisualize.h.
PiperOrigin-RevId: 518940577
Change-Id: Iedb0c54cfde3ee01a99a4a706f9ff6833ad3333c
2023-03-23 13:00:26 -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
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 448ab1a299 More consistent formatting of mjdata.h
PiperOrigin-RevId: 517142236
Change-Id: I3ee93e10b843cb3f3a73a6a19e6b96f23be05cc3
2023-03-16 09:23:53 -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
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 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 2f03da740a Fix typos.
PiperOrigin-RevId: 516135725
Change-Id: I094f6af5d3ef8dd6a93430c09c61f29c23f55e02
2023-03-13 01:01:45 -07: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
Kyle Bayes 49dd6b4193 Clean up mj_id2name and mj_name2id.
PiperOrigin-RevId: 514340647
Change-Id: Idf895b2d7a4a8833725afbe5c71c777081b42d9e
2023-03-06 06:36:48 -08:00
Yuval Tassa fd1070cf03 Delete remaining code related to now-removed distance equality constraint.
PiperOrigin-RevId: 513391064
Change-Id: I47fc344708a580c1e99bd2753113aaa408812966
2023-03-01 17:57:54 -08:00
Kyle Bayes 50bebcb4ee Precount number of non-zeros for constraint Jacobian sparse matrix.
PiperOrigin-RevId: 512947632
Change-Id: I9605e81b4e51fbc90854c13153e4fee38ad48fb9
2023-02-28 08:57:56 -08:00
Yuval Tassa 7542c90cd2 Improved behaviour of mouse-spring interactions.
Also:

- Renamed recently introduced `mjvPerturb` member `reflocalpos` -> `refselpos` and corrected docstring.
- Added `mjvPerturb.localmass`: body spatial inertia at selection point.
- Removed `const` qualifier to `mjData` argument of `mjv_initPerturb()`, to facilitate spatial inertia computation.
- Improved `mj_Object{Velocity, Acceleration}` docstrings, clarifying that rotational velocities precede linear velocities.
- Removed redundant const qualifiers from non pointer arguments to `mju_dot` and `mju_writeNumBytes`.

PiperOrigin-RevId: 511002168
Change-Id: I27400f497947f330072d4abb7c9bf7e71e6c5d49
2023-02-20 08:40:33 -08:00
Alessio Quaglino 9756ed0d80 Read normals and textures from OBJ, do not duplicate vertices.
PiperOrigin-RevId: 510461549
Change-Id: I19245d691e722a8371e61153383f275f599353d6
2023-02-17 10:15:25 -08: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 ace5b74f83 Rename inteval attribute in mjLROpt to interval.
PiperOrigin-RevId: 509275105
Change-Id: I0ffb9cf485a504843ed255f0b4f24e9285a1c273
2023-02-13 10:54:25 -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