Commit Graph

754 Commits

Author SHA1 Message Date
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
Nimrod Gileadi d3dbc554b9 LQR.ipynb: Don't refer to global model from Renderer.
PiperOrigin-RevId: 477444216
Change-Id: I1e71d823428b1c4f60751720fe5b85d5ae98c5c2
2022-09-28 07:11:50 -07:00
Saran Tunyasuvunakool 6acc111c48 Remove internal-only paths from Colab notebook.
PiperOrigin-RevId: 476416594
Change-Id: I54e7b27d30da76f7690341e70f182e7e5d0dec96
2022-09-23 11:15:39 -07: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
Levi Burner e0f6441a27 swap out cp call with shutil.copyfile closes #462 2022-09-01 16:50:46 -04: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 cb01022124 Uncomment pypi-versions-badge from README.md.
This badge now works correctly since version 2.2.1 has been uploaded to PyPI.

PiperOrigin-RevId: 461476606
Change-Id: I22b40d2fbf900a7cbd86b04f7af69c313bcc721d
2022-07-17 10:55:55 -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
Kevin Zakka 461f8ccbda Add PyPI classifiers and README badge.
PiperOrigin-RevId: 461197208
Change-Id: I2c82a83d5f8719d5bc7f3373fd39d45ed965f218
2022-07-15 08:17:06 -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
Copybara-Service 4616529f32 Merge pull request #209 from kevinzakka:install-instructions
PiperOrigin-RevId: 438270229
Change-Id: I6ea4b1a7f6763f06e5a931b2ab252195da6c287a
2022-03-30 04:45:59 -07:00
Kevin Zakka 0c9bbec26f Nit. 2022-03-29 15:32:04 -07:00
Kevin Zakka c047b9a530 Remove screenshot and assets dir. 2022-03-29 15:25:07 -07:00
Kevin Zakka 117a9cfcf2 Nits. 2022-03-29 10:56:07 -07:00
Kevin Zakka 647fc7770e Address Saran's comments. 2022-03-29 10:32:16 -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
Kevin Zakka 691ea00716 Add module level version dunder. 2022-03-26 20:38:57 -07:00
Kevin Zakka 95350ce482 Improve source installation of python bindings.
Add support for conda environments.
Add step by step instructions in the README.
2022-03-26 18:46:10 -07:00
Nimrod Gileadi df048e54c0 Update MuJoCo to version 2.1.3.
PiperOrigin-RevId: 436727767
Change-Id: I9b1b0084021e83f790efa46eab9a980cbde4953f
2022-03-23 16:57:26 +00:00
Nimrod Gileadi c6984b42af Add a free() method to mujoco.MjrContext.
Up the mujoco bindings version to 2.1.2.post2.

Keep the capsule deconstructor which calls mj_freeContext, because mjr_freeContext is idempotent.

PiperOrigin-RevId: 435714183
Change-Id: I9f8615f85f2b3e383f447f6684e61200039d57d4
2022-03-23 16:57:25 +00:00
Saran Tunyasuvunakool df202d23b1 Implement reversed arithmetic operators for enums and fix division behavior.
PiperOrigin-RevId: 435408435
Change-Id: Ifeeff679cff658d5aae96a9ba5fee19d499656a3
2022-03-23 16:57:25 +00:00
Saran Tunyasuvunakool 295602b3eb Implement binary operations between enums and numbers.
PiperOrigin-RevId: 435352475
Change-Id: I95ffab7d35898b8e04e00e2f37933b7959b90097
2022-03-23 16:57:25 +00:00