Commit Graph

86 Commits

Author SHA1 Message Date
Yuval Tassa 652bab3eec Improve documentation of <freejoint> element.
PiperOrigin-RevId: 453192974
Change-Id: I14b02c8c37f6208a67b35efc17887668f6555aef
2022-06-06 07:15:41 -07:00
Yuval Tassa 8e38a8a020 Add "Asking Questions" section to README.md
PiperOrigin-RevId: 453178202
Change-Id: I0cb3a52983930fb3665cc40e26d5d19b44ac99f1
2022-06-06 05:23:55 -07:00
Yuval Tassa 880304abba Update the asset/mesh section of the XML reference to mention OBJ files.
Also clean up some formatting.

PiperOrigin-RevId: 453173729
Change-Id: I069b9433542dda0e3effe71d162cb51a46ce2f4e
2022-06-06 05:02:41 -07:00
Kevin Zakka d7ae7f5433 Improve error message when loading textures that are not PNGs.
PiperOrigin-RevId: 452052514
Change-Id: Ic2f0e8717e43d1a17b2d07ac0e07efe96c5ae1bd
2022-05-31 08:27:05 -07:00
Alessio Quaglino 8902c2089a Add dyntype to IncompleteActlimited test.
The test is meant to illustrate a failure of an incomplete actrange when the rest of the line is correct.

PiperOrigin-RevId: 451895379
Change-Id: I9782fae7055c9bed87ccbc0fda18495aacb2ae8a
2022-05-30 10:37:10 -07:00
Tom Erez 02f300c762 Refactor: separate buffer indexing and swizzling.
This also fixes a sensor data reading bug: previously, _sensorIndex was multiplied by 3 by MjEngineTool.

PiperOrigin-RevId: 451699887
Change-Id: I864bcbf8159857764854b25311a26ec5672125d9
2022-05-29 00:24:30 -07:00
Saran Tunyasuvunakool 5cc73c30bf Align all arrays in mjData's buffer to 64 byte boundaries.
The introduction of additional mjData arrays for the implicit integrator caused in a shift in data alignment in memory. In certain combinations of machines and models, this change resulted in ~5% performance regression that appears to be attributable to L2 cache misses.

This change aligns all arrays in mjData to the boundary of a typical L2 cache line size. Benchmarking shows that this resolves the performance regression on a Broadwell machine.

PiperOrigin-RevId: 451652783
Change-Id: I4ed2c2d03453a83a0b4a9b8e224e2fd7c0dadea9
2022-05-28 13:03:38 -07:00
Yuval Tassa 981fa22302 Don't enforce minimum inertia at mesh loading.
Inertias of moving bodies are enforced to be greater mjMINVAL at model compilation, there is no need to enforce inertias at mesh load time. Tiny meshes could be static or part of a larger geom assembly, in which case their tiny inertia is not a problem.

Also, make error message for small masses/inertias more precise.

PiperOrigin-RevId: 451625216
Change-Id: I4b48d7a881e620d6fbb591ec77fbdacc7c03496c
2022-05-28 06:43:24 -07:00
Yuval Tassa e94a46c20f Indent #ifdef blocks, improve comment for MSVC pragma.
PiperOrigin-RevId: 451614625
Change-Id: I5b46572521955b51da48f183d2195817df6ea28d
2022-05-28 04:49:58 -07:00
Saran Tunyasuvunakool 79082ea1ae Fix an out-of-bound read bug in mj_collision exclusion handling.
PiperOrigin-RevId: 451609651
Change-Id: Ifc10753ee65d176e609a9b742414d2c2f13d8bd0
2022-05-28 04:02:02 -07:00
Saran Tunyasuvunakool 1da4e1c784 Fix ASAN_(UN)POISON_MEMORY_REGION macros for MSVC.
Closes #306.

PiperOrigin-RevId: 451609183
Change-Id: Iadc2db7c5550261050340e38b7f7eb8a806013a1
2022-05-28 03:56:32 -07:00
Saran Tunyasuvunakool b5a6a725e5 Asan-poison padding regions in mjModel and mjData buffers.
This allows us to detect reads and writes that are logically out of bounds.

PiperOrigin-RevId: 451520772
Change-Id: I614a8062c404d97148166bcd37db399420956d8b
2022-05-27 17:34:29 -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
Tom Erez ef9fa9dfe4 Get rid of the opaque "entryIndex" argument.
Use pointer arithmetic instead.

PiperOrigin-RevId: 451493057
Change-Id: Ic89ad8ff1d3191180031a1011c1b100eaea12f6f
2022-05-27 15:24:22 -07:00
Saran Tunyasuvunakool 6faf1d93de Use explicit template instantiation for mjXUtil::ReadAttr.
PiperOrigin-RevId: 451481936
Change-Id: Ib26e41823606e612f017db0f606983262713066e
2022-05-27 14:35:05 -07:00
Alessio Quaglino f3453cf87f Stricter parsing of XML array attributes.
PiperOrigin-RevId: 451456510
Change-Id: I2556d4365762378261c04d3c9f1942166fbd156e
2022-05-27 12:51:02 -07:00
Nimrod Gileadi 0741273c86 Typo in README.md.
PiperOrigin-RevId: 451172762
Change-Id: I0254cef6d279a13008f7dcdd358636f30d6d3107
2022-05-26 08:56:56 -07:00
Copybara-Service dee54ede2a Merge pull request #275 from jespersmith:feature/UnityFixes
PiperOrigin-RevId: 450975561
Change-Id: I06deabfa19dd7649cf465bfb529206266371d5cc
2022-05-25 11:39:29 -07:00
Nimrod Gileadi f713e81297 Explicitly reset xipos for worldbody.
Before this change, xipos[0,1,2] was only set to 0 by mj_resetData zeroing the entire buffer.

When using mj_resetDataDebug, the value would be wrong.

PiperOrigin-RevId: 450939814
Change-Id: I887dd977161c7d132a80b766db7be23350ffb50b
2022-05-25 09:22:06 -07:00
Alessio Quaglino 4973f0d7f8 Loop over all XML files in model/ and test/ subfolders when running xml load-save-load-compare test. XMLs referencing file assets are currently skipped.
PiperOrigin-RevId: 450923388
Change-Id: I79c594fb4c4e065d67736f06d515abaa0dd763a4
2022-05-25 07:56:37 -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
Alessio Quaglino 223874c4ca Correctly handle the case of explicit zero mass in xml_native_writer.
PiperOrigin-RevId: 450901455
Change-Id: I77aaf2a214ac05ed1ed1e6ffe473bf98f2fea8ef
2022-05-25 05:29:25 -07:00
Saran Tunyasuvunakool 3034e8537c Add a Linux Clang build and MUJOCO_HARDEN to build.yml.
PiperOrigin-RevId: 450709606
Change-Id: I63525e4670d0d05ca478c0a3f8c39f15d0b2aaf3
2022-05-24 10:08:11 -07:00
Alessio Quaglino 43e3b3a3f9 If <composite flatinertia="true">, set mjCBody.explicit_inertial so that an <inertial> element is added in mj_saveLastXML. Bug found by the WriteReadCompare test.
PiperOrigin-RevId: 450702639
Change-Id: I978dfb6713d68ce8327f2e8eea1fc31f43a38b5e
2022-05-24 09:38:53 -07:00
Saran Tunyasuvunakool dbf6c74f8f Add a comment to build.yml to clarify that it's not "official".
PiperOrigin-RevId: 450679854
Change-Id: I0a71c02c61b6ee8969b47590ad87f1dc5fdf145b
2022-05-24 07:47:09 -07:00
Alessio Quaglino 20cc535ba6 xml_native_writer saves geom mass or density, if specified.
Fixes a bug introduced in CL/432455486, which stopped saving explicit inertias if they were inferred from geoms. But if we don't save inertias then we need to save mass/density specifiers.

BEGIN_PUBLIC

xml_native_writer saves geom mass or density, if specified.

END_PUBLIC

PiperOrigin-RevId: 450667775
Change-Id: Ibb5b269b58f1143013091729642bb501243ed943
2022-05-24 06:33:24 -07:00
Copybara-Service 18921c83ca Merge pull request #288 from liuliu:main
PiperOrigin-RevId: 450658596
Change-Id: I0eecda3625d9b0857c2ac06a2cf31a4e52af16c9
2022-05-24 05:28:49 -07:00
Copybara-Service 11ec067321 Merge pull request #295 from aftersomemath:lower-cmake
PiperOrigin-RevId: 450658474
Change-Id: Ia25fd5cdbb8c7108cd04c1409d360cea0a1cf6c0
2022-05-24 05:27:33 -07:00
Levi Burner b9534c4e76 Lower cmake version to 3.16 to support Ubuntu 20.04 2022-05-24 00:23:02 -04:00
Kevin Zakka 70b19d5fd6 Typo fixes in programming.rst.
PiperOrigin-RevId: 450494768
Change-Id: I039430931c3357135724aaccff609bd8fd8a2553
2022-05-23 12:05:00 -07:00
Saran Tunyasuvunakool 98cea58c5e Add a build shield to README.md.
PiperOrigin-RevId: 450490553
Change-Id: I9be149134966f9a744bbbc5810ed22da43f0a586
2022-05-23 11:48:13 -07:00
Saran Tunyasuvunakool 01e232446d Add build.yml for GitHub Actions.
PiperOrigin-RevId: 450475783
Change-Id: I2384b64459c327b94ac98aa0bdd8a5258c5cda0f
2022-05-23 10:47:11 -07:00
Liu Liu f0bb7467a3 Add annotations for length of a given array in mj* structs
This PR added necessary annotations, following what we did for mjData
and mjModel for length of the given array.

This is useful because my parser used to generate Swift interface:
https://github.com/liuliu/swift-mujoco/blob/main/Sources/codegen/main.swift#L297
such that the access to underlying array is bound-checked.

Please let me know if this makes sense. After this change, I can
successfully generate all mj* struct interfaces in Swift without problem
(with notable exception of mjui): https://github.com/liuliu/swift-mujoco/tree/main/Sources
2022-05-23 13:09:41 -04:00
Kevin Zakka 89d95ad3c7 Nit fixes in README.
PiperOrigin-RevId: 450435777
Change-Id: I8d9c969cce1d16560ca50fbda3704ac808c20477
2022-05-23 07:40:45 -07:00
Nimrod Gileadi 098b125d02 Install mujoco headers under include/mujoco.
PiperOrigin-RevId: 450428761
Change-Id: I40dc43f1594b32b732775fe540d58645517933a5
2022-05-23 07:00:23 -07:00
Saran Tunyasuvunakool a2ee3d8df0 Fix a typo in changelog.rst and update intro in overview.rst.
PiperOrigin-RevId: 450422495
Change-Id: Icc10fd6cfae38cb51a7499cba9b05e002e68e986
2022-05-23 06:21:58 -07:00
Saran Tunyasuvunakool 7eb4ab3a8f Fix documentation typos and CMake framework setup for macOS.
The previous commit missed out some recent changes in the internal repo. This commit brings the public GitHub repo in sync.

PiperOrigin-RevId: 450377010
Change-Id: I59a68ae4a39c5cd5ed5f7df77ba870273243d623
2022-05-23 14:06:12 +01:00
DeepMind 64bc6d27b2 Add implicit integrator.
Added analytic derivatives of smooth (unconstrained) dynamics forces, with respect to velocities:
  - Centripetal and Coriolis forces computed by the Recursive Newton-Euler algorithm.
  - Damping and fluid-drag passive forces.
  - Actuation forces.

A new implicit-in-velocity integrator is implemented using the analytic derivatives. This integrator lies between the Euler and Runge Kutta integrators in terms of both stability and computational cost.

PiperOrigin-RevId: 450377010
Change-Id: Ie192b441876c22e732fb749333926f296e0a09cc
2022-05-23 01:22:15 -07:00
Saran Tunyasuvunakool 1913a02b40 Initial open sourcing of MuJoCo.
PiperOrigin-RevId: 450374687
Change-Id: Ie3225a46ce095fc28ae8e63c326a640261f562bb
2022-05-23 01:08:49 -07:00
Jesper Smith a83a8f642f Add priority settings to geometry 2022-05-13 17:40:11 +02:00
Jesper Smith c62c68d744 Fixed reading offsets for Sensors. Added Advanced Settings property to MjGeomEditor 2022-05-13 13:32:40 +02: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 0d5d1f5ff2 Add -Wl,-no-as-needed to Linux Makefile.
GCC's linker drops dependency on libGL because neither MuJoCo, GLFW, nor the sample applications themselves explicitly depend on OpenGL symbols.

PiperOrigin-RevId: 439372170
Change-Id: I122d1d9658484e901f422d35395ad5929c7a9021
2022-04-04 19:43:58 +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