Commit Graph

59 Commits

Author SHA1 Message Date
Saran Tunyasuvunakool 985b3f1c9e Remove custom code path when run under type checking.
PiperOrigin-RevId: 487584485
Change-Id: I1b1c773240bb033e50205648f4611f4702c0e6e8
2022-11-10 10:56:32 -08:00
Kyle Bayes 601963beb2 Automated rollback of 39d20f20ea.
*** Reason for rollback ***

Breakage at https://github.com/deepmind/mujoco/actions/runs/3427459759

*** Original change description ***

Add test to catch missing Python function bindings.

***

PiperOrigin-RevId: 487505205
Change-Id: Iec3b588380b4b6fc7a3249ccdef08e48b42a7892
2022-11-10 05:07:24 -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
Kyle Bayes 39d20f20ea Add test to catch missing Python function bindings.
PiperOrigin-RevId: 487187845
Change-Id: Iddf8afd16abb9a22bba6a53a0ecc0423208f41e6
2022-11-09 02:45:11 -08:00
Alessio Quaglino fd4d47e4a5 Format memory warning in human-friendly way.
PiperOrigin-RevId: 486610408
Change-Id: I6beecb12059e69f4407e921d20efc54ce6b3f491
2022-11-07 02:56:07 -08:00
Yuval Tassa 36b30e4500 Allow more than 1 activation state per actuator, but only for dyntype user.
Fixes #305.

PiperOrigin-RevId: 486597273
Change-Id: I3eb806f60949e68ebe6cbe35a6e66218a167ed45
2022-11-07 01:43:02 -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
Yuval Tassa c83be2bc05 Add mju_clip, mju_fill, mju_eye and mju_symmetrize to python bindings.
- Also change signatures of `mju_fill` and `mju_symmetrize` to conform to standard.

PiperOrigin-RevId: 485613824
Change-Id: I8dd618bac92ef40aa6c76380fa73302e81968687
2022-11-02 09:22:28 -07:00
Yuval Tassa 0eb7f871b9 Remove requirement that stateless actuators come before stateful actuators.
PiperOrigin-RevId: 484332415
Change-Id: I1dae92c0f8e027e4ca71c20ea3f68b2926526f53
2022-10-27 13:18:57 -07:00
Saran Tunyasuvunakool 573d331b69 Bump pybind11 and Eigen versions.
PiperOrigin-RevId: 481831731
Change-Id: I29082287c7b716bfb29b25545599f6eca8106c49
2022-10-17 23:37:59 -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 3aaf94f42c Fix Python GIL-not-held issues in python/callbacks.cc.
The GIL bug was introduced in ec6ea6a69e and is resolved by decrementing the refcount before returning from MjWrapperLookup.

PiperOrigin-RevId: 481558798
Change-Id: I2744287d48635a55ae6d2ec46c9e43fe881019d8
2022-10-17 00:05:56 -07:00
Saran Tunyasuvunakool ec6ea6a69e Fix a memory leak when using Python callbacks.
Fixes #527.

PiperOrigin-RevId: 481173711
Change-Id: Ie176a8bda09727b6be8b6641d3be9a75c675d566
2022-10-14 10:12:11 -07:00
Alessio Quaglino 95fe2fbc40 Add plugin support to Python bindings.
PiperOrigin-RevId: 480675078
Change-Id: I2967654b6662efced8ae62cae9b03c6c8e65c67c
2022-10-12 11:30:15 -07:00
Alessio Quaglino e250ff0d5a - Added passive forces plugins
- Added new `cable` composite type:
  * The `initial` parameter specifies the joint at the starting boundary: `free`, `ball`, or `none`.
  * The boundary bodies are exposed with the names:`B_left` and `B_right`.
  * The vertex initial positions can be specified directly in the XML with the parameter `vertex`.
  * The orientation of the body frame **is** the orientation of the material frame of the curve.

- Added new `cable` passive force plugin:
  * Twist and bending stiffness can be set separately with the parameters `twist` and `bend`.
  * The stress-free configuration can be set to be the initial one or flat with the flag `flat`.
  * New cable example showing the formation of plectoneme.
  * New coil example.
  * New belt example showing interaction between twist and anisotropy.
  * Added test using cantilever exact solution.

PiperOrigin-RevId: 480033694
Change-Id: I491271bce8fccb185961477e903e5a72d172c8a3
2022-10-10 02:46:51 -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 8cc983af5b Remove stray build option 2022-10-04 15:11:19 -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
Levi Burner 0b6bf42840 WIP Python bindings for Simulate tested on Linux only 2022-10-04 12:34:49 -04:00
Saran Tunyasuvunakool c13979cd17 Add id and name properties to MjModel and MjData indexers.
PiperOrigin-RevId: 476078133
Change-Id: I905cc8ec147ac595cd56f0a42e38013ae1ac6903
2022-09-22 06:19:03 -07:00
Yuval Tassa 6e256c03b7 Fix location of LQR colab notebook.
PiperOrigin-RevId: 475562228
Change-Id: Ifa51caee6c573a15814b57fb1237d0fdb859c4b8
2022-09-20 08:35:22 -07:00
Yuval Tassa f151e84a1d Add LQR tutorial colab notebook.
PiperOrigin-RevId: 475551810
Change-Id: Iac8ca4fff88331f325e34fef01b41307603a6416
2022-09-20 07:41:16 -07:00
Yuval Tassa f4e7fa97af Add mju_mulVecMatVec, mutiplies a square matrix M by a vector x on both sides. Returns x^T * M * x.
PiperOrigin-RevId: 474292806
Change-Id: I3432469dbe1f02ccf5a13241c7aa12d824cbe034
2022-09-14 08:05:28 -07:00
Yuval Tassa 8957976674 Add mju_boxQP solving box-constrained quadratic programs.
PiperOrigin-RevId: 474256629
Change-Id: I87d70fe6899608122fe0688b017420a3e81afae2
2022-09-14 04:31:34 -07:00
Saran Tunyasuvunakool 9b694103e6 Update dependencies in CMake.
PiperOrigin-RevId: 472698116
Change-Id: I0afc29468555339e0a2cac27977bd68246e483f3
2022-09-07 05:17:54 -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 e3a82247c2 Add sensor matrices to mjd_transitionFD.
- Also add missing `mj_jacSubtreeCom` to Python bindings.

PiperOrigin-RevId: 471610181
Change-Id: I31410d194527ce6a7bdbd01e176f3a41efa52d84
2022-09-01 13:00:36 -07:00
Yuval Tassa 7b7cf0c27a Add mjd_transitionFD to Python bindings.
PiperOrigin-RevId: 468731887
Change-Id: I2152e10bc0f50a6c6a6b6832b1e7ef7c413976f7
2022-08-19 10:27:40 -07:00
Yuval Tassa b966a37855 Add optional azimuth and elevation to initial free camera.
- Add `azimuth` and `elevation` to `visual.global`.
- Add `mjv_defaultFreeCamera`.
- Use `mjv_defaultFreeCamera` in `simulate`.

PiperOrigin-RevId: 465505244
Change-Id: I61e60f14a990d4e2d220958adb75c325001978ee
2022-08-05 01:04:02 -07:00
Saran Tunyasuvunakool 3a3ca37615 Fix msan bugs in bindings_test.py.
PiperOrigin-RevId: 465321721
Change-Id: Ie5bfbf5fb0cd3f2b3db3adc86bff3cb1c4df3da0
2022-08-04 08:36:05 -07:00
Yuval Tassa 3d77eb1ef4 Add adhesion actuators.
- Adhesion actuators using contact normals as force transmission mechanism.
- Related video: https://youtu.be/HdBue4MUZys

Closes #229

PiperOrigin-RevId: 464389367
Change-Id: I9f69b3cd152d957e8f65870d208788463c036a6d
2022-07-31 08:54:06 -07:00
Saran Tunyasuvunakool 373cc894a8 Bump version number to 2.2.1.
PiperOrigin-RevId: 461471944
Change-Id: Ia752d992fabdc57b822bc30b01030c19162917ac
2022-07-17 09:50:31 -07:00
Alessio Quaglino 2d0995b47c Add visualisation groups to skins.
PiperOrigin-RevId: 458441645
Change-Id: I14324e8efda5142b2718a5cc9215228c7556dbf7
2022-07-01 04:57:34 -07:00
Nimrod Gileadi 41bcf2d621 Python bindings: Add __repr__ implementations to grouped views.
PiperOrigin-RevId: 457704673
Change-Id: Idf0d2132ce0872e6ae3eef319b4c3119ab769cd0
2022-06-28 05:23:16 -07:00
Nimrod Gileadi e14cf7ddf1 Python bindings: Give a detailed error message when passing non-existent name.
List all valid names in the error message.

Fix an off-by-one error when accessing elements by numeric index (rather than name).

PiperOrigin-RevId: 457702283
Change-Id: I6e4f1518b4ecd9ca91ac9b0bf6b0963fc0a9bd18
2022-06-28 05:06:28 -07:00
Nimrod Gileadi a077db1b91 Implement __repr__ and __eq__ on MjrRect in Python bindings.
PiperOrigin-RevId: 457457401
Change-Id: I0d395ff301fbcf775b4766ac81c830a625b3be63
2022-06-27 05:55:38 -07:00
Kevin Zakka 6048a55daf Add intvelocity actuator shortcut.
PiperOrigin-RevId: 454899823
Change-Id: I9b5494baacfab5a7d03bd680d0ded06a7790e75e
2022-06-14 10:36:58 -07:00
Saran Tunyasuvunakool 185b79f664 Make msan treat mjData buffer as uninitialized in mj_resetData.
Indiscriminate memset into d->buffer and m->buffer previously caused msan to not detect uninitialized reads.

Also fix tests with uninitialized read bugs that are detected by msan after this change.

PiperOrigin-RevId: 451508224
Change-Id: I1f4b080a8ef765c34ba7a0adc2c686419f6e5516
2022-05-27 16:34:33 -07:00
Saran Tunyasuvunakool aefab0e9dc Build Python bindings in build.yml.
We currently skip building the Python bindings on Windows since MSVC takes an hour+ on them. Internally, we use Clang for our Windows build, so are not affected by this issue.

PiperOrigin-RevId: 450914163
Change-Id: I329aab28f3a2aeb1896242a8712f89d8ecff2f92
2022-05-25 07:01:59 -07:00
Saran Tunyasuvunakool 1913a02b40 Initial open sourcing of MuJoCo.
PiperOrigin-RevId: 450374687
Change-Id: Ie3225a46ce095fc28ae8e63c326a640261f562bb
2022-05-23 01:08:49 -07:00
Saran Tunyasuvunakool 0e5d062302 Fix GIL-not-held bug in mjr_readPixels.
PiperOrigin-RevId: 441813459
Change-Id: I2f15cb77ca243b890fd0825ebbc9b910d3ece56f
2022-04-14 11:35:43 -07:00
Saran Tunyasuvunakool 87539dbd24 Version 2.1.5: Fix GLAD loading on Linux, experimental multi-CCD.
PiperOrigin-RevId: 441482552
Change-Id: I16b7ba81cd81ca2293a9a12bfa08a40ab24c70bb
2022-04-13 16:22:26 +01:00
Saran Tunyasuvunakool 55c1c91382 Don't return ndarray with empty shape through named indexers.
NumPy arrays with an empty shape cannot be assigned via the usual syntax.

Fixes: #238.
Related: #237.
PiperOrigin-RevId: 441265437
Change-Id: Ib0de22c83f9babe9a97682dc5a32660c198ad68c
2022-04-12 20:57:16 +01:00
Saran Tunyasuvunakool 90dea1bdfb Version 2.1.4: Switch to GLAD, minor improvements to simulate.
PiperOrigin-RevId: 439277749
Change-Id: I741d1c499ae88753338fcc6d141a65e92e13023e
2022-04-04 13:53:21 +01:00
Saran Tunyasuvunakool 3c71720d83 Revert commit d627374545.
This commit requires a new binary build, and therefore breaks compatibility with version 2.1.3.

Fixes #217.

Change-Id: I1e08b6fd2c468e3845e2166a1e4cc9d265de64de
2022-03-31 11:54:51 +01:00
Copybara-Service e1e0d5c435 Merge pull request #210 from kevinzakka:version-no
PiperOrigin-RevId: 438310559
Change-Id: I8b7409c513144805d3f5afc0f1c2a23b5d649630
2022-03-30 08:39:09 -07:00
Kevin Zakka 5639ee22fc Remove extraneous line. 2022-03-29 10:11:41 -07:00
Kevin Zakka 8dc08d3733 Use mujoco function instead. 2022-03-29 10:08:43 -07:00
Yuval Tassa d627374545 Add contact frame visualisation.
This is useful when writing or modifying collision functions, when the actual direction of the x and y axes of a contact can be important.

PiperOrigin-RevId: 437256700
Change-Id: I5eab737fc98018399e151552778c6109088bf614
2022-03-29 13:08:05 +01:00