Commit Graph

29 Commits

Author SHA1 Message Date
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
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
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
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
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 db28c31f05 Rename <required> tag to <plugin>.
PiperOrigin-RevId: 509237786
Change-Id: I35e812830b479004ac5025cbd9477888f51fb43e
2023-02-13 08:41:52 -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
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
Copybara-Service 3a00e025ce Merge pull request #619 from traversaro:fixpypytests
PiperOrigin-RevId: 494129535
Change-Id: I301cb505a224eaa26df4896924d36c623b1a4a26
2022-12-09 03:39:22 -08:00
Silvio Traversaro bfe1017fc8 Skip tests that cannot run on PyPy 2022-12-07 19:19:21 +01: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
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
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
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 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 3a3ca37615 Fix msan bugs in bindings_test.py.
PiperOrigin-RevId: 465321721
Change-Id: Ie5bfbf5fb0cd3f2b3db3adc86bff3cb1c4df3da0
2022-08-04 08:36:05 -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
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 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
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
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
Saran Tunyasuvunakool 3577e2cf8b Version 2.1.2: Python bindings, OBJ assets support, bugfixes.
PiperOrigin-RevId: 434731612
Change-Id: I0cfda3e7a3d1c72036764986efc252ffa1b8c6b0
2022-03-15 14:04:44 +00:00