Commit Graph

87 Commits

Author SHA1 Message Date
Saran Tunyasuvunakool ace5b74f83 Rename inteval attribute in mjLROpt to interval.
PiperOrigin-RevId: 509275105
Change-Id: I0ffb9cf485a504843ed255f0b4f24e9285a1c273
2023-02-13 10:54:25 -08:00
Saran Tunyasuvunakool db28c31f05 Rename <required> tag to <plugin>.
PiperOrigin-RevId: 509237786
Change-Id: I35e812830b479004ac5025cbd9477888f51fb43e
2023-02-13 08:41:52 -08:00
Saran Tunyasuvunakool 5e989d18c3 Enable compiler errors for implicit switch case fallthroughs.
Also unify warning options across Clang and GCC and fix minor issues that was surfaced by this.

PiperOrigin-RevId: 508619655
Change-Id: I59b777bf2dfea4422485670e2427c7d3f5cf6405
2023-02-10 03:49:00 -08:00
Saran Tunyasuvunakool 71c5f1794d Remove efc_ fields from joint indexers.
Since the introduction of arena memory, these fields now have dynamic sizes that change between time steps depending on the number of active constraints. This breaks strict correspondence between joints and `efc_` rows.

Note that these fields can still be accessed directly as attributes on the `MjData` object.

PiperOrigin-RevId: 508342388
Change-Id: I610ae6ca462f6bb5cf8bc199a3436bed3d1a5371
2023-02-09 05:02:11 -08:00
Saran Tunyasuvunakool 7d8e810ab1 Fix IPython history corruption when using launch_repl.
PiperOrigin-RevId: 508064761
Change-Id: I58fa2e4f35b57a1ab68c3172ba5c0d4495e40ced
2023-02-08 06:37:42 -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
Saran Tunyasuvunakool f1af86cf82 Fix msan failure in __repr__ when upgraded to NumPy 1.24.
PiperOrigin-RevId: 505661236
Change-Id: I37ea339679870d23886e3c95f51451349fa1de2c
2023-01-30 05:11:25 -08:00
Peter Hawkins cd99fbd59d Fix test failures under NumPy 1.24.
The use of `np.empty` triggers an msan use-of-uninitialized-value error when upgraded.

PiperOrigin-RevId: 503975799
Change-Id: I337c8227c8c1e3bd415d7a798fc5e764c88c0875
2023-01-23 07:04:33 -08:00
Nimrod Gileadi d7844aa5be Fix links to documentation.
1. Links to the programming chapter were broken after 69c74f850e. They're now fixed with a redirect in readthedocs.io, but this commit updates them to the latest URL.

2. Most docs links should point to "stable" instead of "latest", since most users will want the docs for the released version, not the upcoming version. The exceptions are the programming chapter, and instructions for building the Python bindings from source.

PiperOrigin-RevId: 502821526
Change-Id: If0a55ab2be4751ba0165bf644030464234083133
2023-01-18 02:55:41 -08:00
Saran Tunyasuvunakool d022cd1a31 Fix broken launch_repl in the Python viewer.
The REPL functionality was broken in 9fcf3b0c2e.

PiperOrigin-RevId: 501818153
Change-Id: I3fe2f14d78839e63deb43c1017527e7a1cf79e3c
2023-01-13 04:59:22 -08:00
Saran Tunyasuvunakool e40775fab3 Abstract out GLFW calls from Simulate.
PiperOrigin-RevId: 500129478
Change-Id: I7ba998e20439575ad9a3fe1a866c3db4c36b9328
2023-01-06 02:45:56 -08:00
Kevin Zakka a173e01f42 Prevent division by zero in Ornstein–Uhlenbeck control noise.
PiperOrigin-RevId: 498753494
Change-Id: Ib43e165a4da524c12fab4ea05848b084b2e7713c
2022-12-31 10:29:03 -08:00
Saran Tunyasuvunakool 725b45b577 Internal Python bindings cleanup.
PiperOrigin-RevId: 495868304
Change-Id: Ib9cfe5f7a1d49126659176207bd6b4a314f8516a
2022-12-16 07:22:48 -08:00
Copybara-Service 3a00e025ce Merge pull request #619 from traversaro:fixpypytests
PiperOrigin-RevId: 494129535
Change-Id: I301cb505a224eaa26df4896924d36c623b1a4a26
2022-12-09 03:39:22 -08:00
Nimrod Gileadi 91455b3e1e Add a naive test of mujoco.viewer.
It just tries to import mujoco.viewer and sees that nothing crashes.

PiperOrigin-RevId: 493998120
Change-Id: I56ee696283a3c28f6c8b72de45c8fdbedb41b05f
2022-12-08 14:35:20 -08:00
Silvio Traversaro bfe1017fc8 Skip tests that cannot run on PyPy 2022-12-07 19:19:21 +01:00
Saran Tunyasuvunakool 0d608282dd Fix viewer.py for Python 3.7 and 3.8.
PiperOrigin-RevId: 493301329
Change-Id: I44ffe5b33595d2dec7cd1aefbdd77d535901d894
2022-12-06 07:36:25 -08:00
Yuval Tassa 687bd15e05 Make comment more precise
PiperOrigin-RevId: 493165357
Change-Id: Ibdd86de67caf0e528e20ff6829e8ed4a8b967d4c
2022-12-05 18:15:14 -08:00
Kyle Bayes 73fb61e3e2 Bump version number to 2.3.1.
PiperOrigin-RevId: 493076656
Change-Id: I48c7a45b503c4a7363ea1455a4a3788262d007f7
2022-12-05 12:13:55 -08:00
Kyle Bayes ef695bb8a8 Add Renderer class to Python native bindings.
PiperOrigin-RevId: 492994751
Change-Id: Iebbe5980668a15b1cd62c0076cc131255462b2eb
2022-12-05 06:54:33 -08:00
Kyle Bayes 341578450f Update dependency versions for Benchmark and Pybind11.
PiperOrigin-RevId: 492978119
Change-Id: Id48037950a6beac2f04f5e08448bd2fb3cb88678
2022-12-05 05:20:08 -08:00
Saran Tunyasuvunakool 0846f38c82 Rename Python mujoco.simulate to mujoco.viewer.
PiperOrigin-RevId: 492701386
Change-Id: I059c572e2a63bd5529e863a9404720973df8ea46
2022-12-03 10:09:42 -08:00
Saran Tunyasuvunakool 9fcf3b0c2e Modify Python simulate so that the Reload button works.
Also allow a `Callable[[], [MjModel, MjData]]` to be provided as an argument to `launch` instead of a fixed MjModel/MjData instance. This allows users to customise the behaviour of the Reload button.

Context: https://github.com/deepmind/mujoco/discussions/576#discussioncomment-4161429
PiperOrigin-RevId: 492296268
Change-Id: Ic4b797d2ea8a6967f7e3e7316f2184ea94a86d8b
2022-12-01 14:12:35 -08:00
Saran Tunyasuvunakool df25d7d602 Raise an informative error when running on macOS under Rosetta 2.
Current users only get a cryptic "Illegal instruction" crash.

Context: https://github.com/deepmind/mujoco/issues/611
PiperOrigin-RevId: 491705647
Change-Id: I1285897a36e858300ee3d125957e90754be9a7f7
2022-11-29 12:19:06 -08:00
Kyle Bayes fdb81f3388 Fix location of MuJoCo tutorial Colab notebook.
PiperOrigin-RevId: 491436998
Change-Id: I93c1ea3ae142d69dc8a8fe893f014e539cb33746
2022-11-28 14:00:57 -08:00
Kyle Bayes 5a8e861152 Add MuJoCo tutorial Colab using the native Python bindings.
PiperOrigin-RevId: 491424124
Change-Id: I5bdeb68fd1bd1b4bc92fb40e0b876d9dcfc568cb
2022-11-28 13:09:51 -08:00
Saran Tunyasuvunakool fa0f6399d5 Make Python bindings buildable with older versions of CMake.
Context: https://discourse.cmake.org/t/alias-and-not-globally-visible-targets/6305
PiperOrigin-RevId: 489051335
Change-Id: I1bbe189413d6f8abe97d3d8ceccf6541de69e2ae
2022-11-16 15:12:01 -08:00
Saran Tunyasuvunakool 9ecade0707 Move plugin loading and scanning logic from Simulate to MuJoCo library.
PiperOrigin-RevId: 489020177
Change-Id: I1c29d931b47d5252e57e1d797cc7c17645859ffc
2022-11-16 13:15:51 -08:00
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