Commit Graph

163 Commits

Author SHA1 Message Date
Alessio Quaglino 8dd9971409 Raise error if mesh has flipped faces.
PiperOrigin-RevId: 461860424
Change-Id: Ib23c50cf7f64de1173404d2f65ad87177fab45b3
2022-07-19 05:47:46 -07:00
Yuval Tassa e6480c76a9 Remove unused imports.
PiperOrigin-RevId: 461829404
Change-Id: I9ae44085af211013ed2b677b7d3a545ccec34605
2022-07-19 02:11:56 -07:00
Tom Erez 151449c47a binary retriever is only relevant for the Editor.
PiperOrigin-RevId: 461629986
Change-Id: Ib2e27bdf30c1fb696773b8d05b3e42a6adc3e0fe
2022-07-18 08:47:03 -07:00
Tom Erez e8a9db82b8 Retrieve the binary only when the MuJoCo package is installed.
PiperOrigin-RevId: 461524833
Change-Id: Ie8ca9dda71b35262f99688d02f71be77c251ea3e
2022-07-17 20:48:06 -07:00
Tom Erez 0180d839a9 Change assembly definition to target only the Editor.
PiperOrigin-RevId: 461522513
Change-Id: I3eb146eff71f0293c6f63d835d776b66b07c52ff
2022-07-17 20:21:42 -07:00
Tom Erez 26a0441e7c add a script that converts MJCF models to PhysX.
PiperOrigin-RevId: 461520759
Change-Id: I177195af60645169294180da8b99740426d23d8f
2022-07-17 20:08:31 -07:00
Saran Tunyasuvunakool 69e3fe1730 Add CI builds on Ubuntu 20 with GCC 9, GCC 10, Clang 10, and Clang 11.
PiperOrigin-RevId: 461500095
Change-Id: I812d1ac2a864e404c3052b3aa65443c5eb975ccf
2022-07-17 16:00:40 -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
Nimrod Gileadi 1392843aed Fix the use of __has_builtin for GCC < 10.
The breakage was introduced in af12322e9d.

__has_builtin was introduced to GCC in version 10, and the arithmetic overflow builtins were available since version 5.

Fixes deepmind/mujoco#386.

Tested with GCC 9.

PiperOrigin-RevId: 461463027
Change-Id: I76627539a5c0e7f5617b56a2c9ada9251bceb0f6
2022-07-17 07:51:40 -07:00
Copybara-Service 5ef1e59f06 Merge pull request #385 from wpumacay:fix-build-without-tests
PiperOrigin-RevId: 461352099
Change-Id: I27ad117a5a0055af32abc70f0cc3aea8dff8fdca
2022-07-16 08:02:47 -07:00
gregor 0223773a54 Fix typo on CMake script 2022-07-16 06:51:59 -05:00
gregor 06305c0ae1 Merge remote-tracking branch 'upstream/main' into fix-build-without-tests 2022-07-16 06:45:52 -05:00
gregor 7ee01ddcac Fixes #382 (compile with unittests disabled) 2022-07-16 05:56:32 -05:00
Saran Tunyasuvunakool c9ec2654a2 Fix binary rpath for Linux releases.
PiperOrigin-RevId: 461262210
Change-Id: If2d97176abef15bc250841ad518fd1f5915f698a
2022-07-15 16:24:11 -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
Nimrod Gileadi af12322e9d Avoid integer overflows when computing buffer sizes.
If any field size would cause an overflow, fail to create the model.

PiperOrigin-RevId: 460466485
Change-Id: Ic8b84f3b56f2617c04ba04604729f0f76c6d62ee
2022-07-12 08:20:40 -07:00
Yuval Tassa d5059f484d Add license badge to README.
PiperOrigin-RevId: 460437521
Change-Id: I25514343a6b0f507c661261a20d1ad07465491fc
2022-07-12 05:40:28 -07:00
Yuval Tassa 138a01625e Fix typo.
PiperOrigin-RevId: 460312313
Change-Id: I4ff1f82afb28d1286e33aaee8b008f76f81935ac
2022-07-11 15:20:38 -07:00
Yuval Tassa 50a72d7227 Don't use var[restrict n] syntax.
This notation is unsupported by MSVC.

PiperOrigin-RevId: 460030944
Change-Id: Ib86b76c8767d83ab49e4db9d3d0fd1437721df20
2022-07-10 02:31:21 -07:00
Yuval Tassa ea956dfe34 Derivatives of ellipsoid fluid model.
PiperOrigin-RevId: 459751881
Change-Id: I52db87d82e20e10698b13065df2e983b9841bd7a
2022-07-08 07:19:48 -07:00
Yuval Tassa 7034851d0a Add slider-crank example to model/
PiperOrigin-RevId: 459746610
Change-Id: I6ff609718adba7166cef6a105331d83cc3ee3097
2022-07-08 06:43:14 -07:00
Yuval Tassa c14a7ef4a7 Add clock sensor type.
PiperOrigin-RevId: 459720950
Change-Id: Ibda48ae7dc4aa7be451a947a1c53d10a7eaf176b
2022-07-08 03:50:08 -07:00
Yuval Tassa d3a86bb748 - Add floating changes to changelog.
- Add sections about the state and derivatives to the Computation chapter.

PiperOrigin-RevId: 459032736
Change-Id: I0b69401688f24c84d5747f1b49980e38e19a54a3
2022-07-05 02:18:01 -07:00
Yuval Tassa 6d01627c0b No longer modify control vector in-place, add mju_clip.
- Never modify `d->ctrl`:
  - `ctrl` values which are outside their respective `ctrlrange` are clamped internally, but `d->ctrl` itself is unmodified.
  - Similarly, if `mjWARN_BADCTRL` is raised (NaNs or huge values), `ctrl` is cleared internally, but `d->ctrl` itself is unmodified.
- `mjWARN_BADCTRL` is no longer raised for `d->ctrl` values that are larger in absolute value than `mjMAXVAL`, if clamping makes them smaller than that.
- Added `mju_clip()` utility function.
- Added missing warning string for `case mjWARN_BADCTRL`.

PiperOrigin-RevId: 459025950
Change-Id: Ifbf974f9c02c3d70afdaa3114018fc81dfd746d3
2022-07-05 01:38:32 -07:00
Yuval Tassa 09a5efc09e Add control values to keyframes.
- Add basic test for keyframes.
- Add missing documentation for keyframe mocap positions and quaternions.

PiperOrigin-RevId: 459021649
Change-Id: I91cf7ecbddc6262e8c72a868eeb82d627f389fb3
2022-07-05 01:07:37 -07:00
Yuval Tassa 5ba880506c Improve header and paragraph spacing.
PiperOrigin-RevId: 458935896
Change-Id: Ibbd084ddd18cf9c1a5fe59b3ca60b715595cf606
2022-07-04 11:05:16 -07:00
Tom Erez 3df3c95812 Update C# bindings.
PiperOrigin-RevId: 458919739
Change-Id: I7737d2736491dae8fce46bc36aa5135007a7a588
2022-07-04 08:47:29 -07:00
Nimrod Gileadi b1e185bb9e Fix ReadTheDocs config.
build.os is a required field, see docs: https://docs.readthedocs.io/en/stable/config-file/v2.html#build-os

PiperOrigin-RevId: 458465958
Change-Id: I24889d32996328290c2f470c4f2a593fa89a637d
2022-07-01 07:31:00 -07:00
Nimrod Gileadi 2b319c81bc Update sphinx and jq for documentation.
Old versions of Sphinx don't support Python 3.10.

sphinx-rtd-theme 1.0.0 supports Sphinx 4.x:
https://sphinx-rtd-theme.readthedocs.io/en/stable/changelog.html#features

PiperOrigin-RevId: 458455382
Change-Id: Ic34a7d350d5ecd1dfff53d88472a3b25a7245ec0
2022-07-01 06:27:14 -07:00
Nimrod Gileadi dbef8e6c2b Fix memory leaks when loading an invalid model from MJB.
PiperOrigin-RevId: 458445745
Change-Id: I99229a66fc86f7763cfe2b5382229b0304bdfa9c
2022-07-01 05:21:55 -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 040deb161f Run cmake-format on test/xml/CMakeLists.xml
PiperOrigin-RevId: 458226371
Change-Id: I34f43a890dee7511597b48b303d5674ab9435d64
2022-06-30 07:59:39 -07:00
Nimrod Gileadi d567263959 Fix null pointer dereference in mj_loadModel.
mj_makeModel returns NULL if any of the array sizes are negative. Callers of the function need to handle that case.

PiperOrigin-RevId: 457948558
Change-Id: I9a5c8c0d3293ed0a92c5791f00d3ed34c848e024
2022-06-29 05:09:54 -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
Nimrod Gileadi 263c92e301 Update lodepng to latest version.
This speeds up PNG loading significantly.

PiperOrigin-RevId: 457431911
Change-Id: I28da22a1fdbfc912d187a40cd731d9c04b83e07c
2022-06-27 03:06:55 -07:00
Kevin Zakka afc8395376 Make installation instructions more explicit in the README.
PiperOrigin-RevId: 456976659
Change-Id: I9bac31771eb62e069107b30122478437b67c2ebf
2022-06-24 03:48:26 -07:00
Yuval Tassa 228264c92b Add efficient finite-difference Jacobians of mj_step.
- Add `qH` and `qHDiagInv` to `mjData` to save factorized modified inertia.
- Add `mj_EulerSkip`, `mj_implicitSkip`, to `engine_forward.c`.
- Using the above functions, implement `mj_stepSkip` in `engine_derivative.c`.
- Add `mjd_stepFD` and `mjd_transitionFD` to `engine_derivative.c` to compute `mj_step` Jacobians.
  - Exploit "Skip" functionality for speed.
  - Correctly handle quaternion derivatives.
  - Handle warmstarts and control limits.

PiperOrigin-RevId: 456584811
Change-Id: Iee8541f11e7b66feb8f431cb102d9bbe65461f79
2022-06-22 12:48:48 -07:00
Yuval Tassa 2ea01bf2f6 Add Related Software section to README.md.
BEGIN PUBLIC

Add Related Software section to README.md.

Fixes #312.

END_PUBLIC

PiperOrigin-RevId: 456528399
Change-Id: Icf97a31a5ea16e93edf9856f70dec650c7b70791
2022-06-22 09:06:43 -07:00
Yuval Tassa 03c2011463 Enable activation clamping when using implicit integrator.
- Introduced private function `mj_advance()` as single point of state & time advancement.

PiperOrigin-RevId: 456525969
Change-Id: Iae17217e305c7baf07cb5ecd1e1b84b936421097
2022-06-22 08:55:48 -07:00
Nimrod Gileadi 2a26bf1ba5 Disable MSAN poisoning when printing using engine_print.
When using MSAN, mjData->buffer is marked as poisoned, despite being initialized with zeroes.
This is useful for catching computations that accidentally use uninitialized values.

However, when using engine_print, it's OK to assume the buffer is initialized to zeros.

PiperOrigin-RevId: 456085776
Change-Id: I9d85e37fa82958eb54ac413140543a6581aa46ad
2022-06-20 08:57:54 -07:00
Yuval Tassa 08b2db2f62 Allow in-place mju_rotVecMat and mju_rotVecMatT (res=vec)
PiperOrigin-RevId: 456021131
Change-Id: Id38ff5fabd15706d3087bc95d341b4f7a673449f
2022-06-20 01:57:45 -07:00
Nimrod Gileadi b1faec1dc2 Use _Generic instead of string comparisons for code that depends on field type.
This will allow us to add fields that can't be cast to int or double, without breaking print.

PiperOrigin-RevId: 456005913
Change-Id: I1fccfd11466f4745f69172af0ae61be07642927c
2022-06-20 00:03:17 -07:00
Saran Tunyasuvunakool 37fe45d41e Change macOS bundle structure.
This allows us to sign and notarize the bundle with mujoco.tbd in place, which is required for AppleClang to be able to build against the embedded framework.

PiperOrigin-RevId: 455952502
Change-Id: I366f1c17e7a6c06d956467ced6f16f3c37aebf6a
2022-06-19 14:13:23 -07:00
Saran Tunyasuvunakool 0e5ce18cff Manually parse inf and nan.
The C++ standard library `std::istringstream` is not guaranteed to parse "inf" and "nan" as valid floating point numbers. In our testing, libc++ does this, but libstdc++ and MSVCRT do not.

PiperOrigin-RevId: 455435431
Change-Id: I99c00303b08c2e4e62acfa3ca52a21a3008f4545
2022-06-16 11:57:52 -07:00
Alessio Quaglino 69a506e6ba Use C++ strcpy_arr in xml_native_reader_test.
PiperOrigin-RevId: 455375707
Change-Id: Ia3dbb11886ab29c4ad3192e4f78b4b60b94baad0
2022-06-16 07:15:14 -07:00
Alessio Quaglino 307cf692e5 Add <damper> actuator shortcut and related mjGAIN_AFFINE.
**Rationale**

A general `mjGAIN_AFFINE` actuator adds the term `force = (c + kp * length + kv * velocity) * ctrl`. The damper shortcut restricts it to `kv * velocity * ctrl` and sets the `ctrllimited` attribute to true.

**API**

```xml
<actuator>
  <damper ctrlrange="0 1" kv="1"/>
</actuator>
```

* Required attributes: `ctrlrange` (>=0)
* Optional attributes: `kv` (>=0)

PiperOrigin-RevId: 455366866
Change-Id: I88773abbeccabb6442f215c9fc05e205df63f692
2022-06-16 06:21:17 -07:00
Alessio Quaglino e0b6ba4a13 Raise warning if there are NaNs in the XML.
For Windows, throw an error if NaNs are present.

PiperOrigin-RevId: 455340787
Change-Id: Ibd95e2335ab15b706ee3328816983e5b57b2315e
2022-06-16 03:09:24 -07:00