Commit Graph

18 Commits

Author SHA1 Message Date
Yuval Tassa 51d80564fa Don't initialize plugins during model compilation.
PiperOrigin-RevId: 585701389
Change-Id: I4e5e34276f404abadf6f5d4d9764ca717304ee34
2023-11-27 11:01:08 -08:00
Matthew Bennice 0dfeedb320 fix open source build failure by switching C's _Alignof for C++'s alignof
PiperOrigin-RevId: 568400917
Change-Id: I90eff5e149d491f181370d72e43fdee9d4a3a20e
2023-09-25 20:43:59 -07:00
Matthew Bennice ff4158efff Modify memory allocation in MuJoCo to be thread safe:
1) protect mj_arenaAllocBytes with mutexes
2) create shards for each thread in the stack and update mj_stackAllocBytes to allocate memory within each shard for a given thread

PiperOrigin-RevId: 568315726
Change-Id: I0dee6694f2a5200fa4df22ade0e68dfaebf637fc
2023-09-25 13:53:28 -07:00
Yuval Tassa 9902b73502 Rename mj_stackAlloc to mj_stackAllocByte.
PiperOrigin-RevId: 566351365
Change-Id: I91541168e83b05a730113661cc9f07985ac9ff0c
2023-09-18 10:53:35 -07:00
Saran Tunyasuvunakool a07e172770 Make MuJoCo work with -fsanitize=alignment.
PiperOrigin-RevId: 563702045
Change-Id: Ieca69595b7e2fc1e35ca69754d7cc7971825f48b
2023-09-08 03:29:34 -07:00
Saran Tunyasuvunakool 94a8705ad0 Add mj_markStack and mj_freeStack as public API functions.
Also add asan instrumentation to detect stack frame leakages (i.e. `mj_markStack` without a corresponding `mj_freeStack` in the same caller function).

PiperOrigin-RevId: 562625645
Change-Id: I4e3ff66ca0b9d08ed0a95cef45393db8e3053e22
2023-09-04 17:04:11 -07:00
Kristian Hartikainen f91b760799 Clean model in VerifySizeModel test 2023-04-05 11:56:07 +01:00
Kristian Hartikainen 98c9718aaf Add (currently-failing) mj_sizeModel test 2023-04-05 11:09:23 +01:00
Nimrod Gileadi 8a402631a3 Add another test for sizes of arena pointers in mjData.
PiperOrigin-RevId: 518224754
Change-Id: I034f6778dedeeef49d2bb4a06337044469450f40
2023-03-21 03:39:19 -07:00
Kyle Bayes dfd463cdb5 Reset nnzJ in resetData.
PiperOrigin-RevId: 517976421
Change-Id: I329c0096d368062f150c6dbeec181f5b0eeefcbf
2023-03-20 08:33:36 -07:00
Yuval Tassa 8c7f6ce5a0 New implicitfast integrator and sparse RNE derivatives for implicit.
PiperOrigin-RevId: 516910733
Change-Id: I29a0465c0f0b1749a73e3d7e01925200d025ddd0
2023-03-15 13:17:41 -07:00
Nimrod Gileadi 7076da6909 Correctly validate the size of user sensors in mj_validateReference.
PiperOrigin-RevId: 494877162
Change-Id: I0a070d7813efea6216d15270f62b6009c55e1a54
2022-12-12 17:49:06 -08:00
Yuval Tassa c8ff7b3d34 Remove distance constraints.
- `distance` constraints were not very useful and increased the contact buffer within the constraint solver, violating a core design principle. Therefore they have been removed.
- The enum value `mjEQ_DISTANCE` is retained, but errors will be thrown in the parser and engine if these constraints are selected.

PiperOrigin-RevId: 467050101
Change-Id: Ie72a07e4fe338eea5107004a9fc0f5e47eb0c3b7
2022-08-11 14:31:11 -07:00
Nimrod Gileadi 01c297cddd Validate that fields like mjModel.body_jntnum don't contain negative values.
PiperOrigin-RevId: 466733848
Change-Id: I0b1f41fa8841c678307f2185aac4c46a2fd40396
2022-08-10 10:57:36 -07:00
Nimrod Gileadi fae896c51b Use a negative size instead of overflow in EngineIoTest.
The MSVC build on GH Actions doesn't detect overflows in mjData or mjModel sizes, so use a negative size instead to trigger an intentional failure in the test.

PiperOrigin-RevId: 465529615
Change-Id: Ic7f15eed782cdda11b29984b136ed4f625418cc8
2022-08-05 03:54:35 -07:00
Nimrod Gileadi 4268d81b55 Null out mjData.buffer and mjData.stack before possibly calling mj_deleteData.
While creating an mjData, any error triggers mj_deleteData. If buffer or stack is not NULL at that point, an uninitialized pointer will be freed.

PiperOrigin-RevId: 465378329
Change-Id: I9be0eef0648e05e3e5f1361da346a5046485cde7
2022-08-04 12:36:42 -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 1913a02b40 Initial open sourcing of MuJoCo.
PiperOrigin-RevId: 450374687
Change-Id: Ie3225a46ce095fc28ae8e63c326a640261f562bb
2022-05-23 01:08:49 -07:00