Commit Graph

1011 Commits

Author SHA1 Message Date
Alessio Quaglino 6ca8a7bdf7 Make SdfLib dependency on args and stb_image optional.
PiperOrigin-RevId: 566309916
Change-Id: I74880781848b7e5235cdf5d723b0c8805827a4c8
2023-09-18 08:31:53 -07:00
Yuval Tassa ee8da5babe Fix indentation bugs in docs, improve attribute order in schema.
PiperOrigin-RevId: 566230568
Change-Id: I0f536a2048d3e35d8ee510d86b6eba7a74c4e80a
2023-09-18 01:48:14 -07:00
Yuval Tassa 63fd23a934 Remove mjTIMER_ACCELERATION, add mjTIMER_ADVANCE.
- mjTIMER_ACCELERATION is not very useful, it's usually very tiny (0.5% for humanoid, 1% for 22humanoids). It basically times a single call to `mj_solveM`.

- Added `mjTIMER_ADVANCE` to time `mj_Euler` and `mj_implicit` (which can be significant).

- Moved `mj_transmission` to `mjTIMER_KINEMATICS` where it belongs (and used to be).

PiperOrigin-RevId: 565936880
Change-Id: I26b8a067133594e5500ca1c809beb3518b4a8d9c
2023-09-16 08:03:45 -07:00
Alessio Quaglino e76e1c72f9 Fix SdfLib relative path.
PiperOrigin-RevId: 565884473
Change-Id: I77e25b55a5062ec089bbb643bd722ec2fbc7b211
2023-09-16 00:41:28 -07:00
Alessio Quaglino 0b700ce1e2 Add libsdf to github actions.
PiperOrigin-RevId: 565691982
Change-Id: Ia1bfa4242c0af4d37f6cd660c3404605439d9ffd
2023-09-15 08:59:36 -07:00
Yuval Tassa 2cc1205498 Add island support to CG solver.
BEGIN_PUBLIC

Add island support to CG solver.

END_PUBLIC

PiperOrigin-RevId: 565653886
Change-Id: Ib971ae37dd011b8f2cbe1f88d8875e0ed657c7af
2023-09-15 05:47:24 -07:00
Alessio Quaglino 492b6a72ec Prevent patches to be applied to an already patched dependency.
See https://gitlab.kitware.com/cmake/cmake/-/issues/21146

BEGIN_PUBLIC
Prevent patches to be applied to an already patched dependency.
END_PUBLIC

PiperOrigin-RevId: 565624168
Change-Id: I29b36d2cd02f58d5d9e84f9cae5e5bbf8be1b404
2023-09-15 02:58:54 -07:00
Yuval Tassa 2aea61942c Replace Humanoids with Bipeds in docs.
PiperOrigin-RevId: 565474154
Change-Id: If8fe4220e7e86fe251d8d83e9d5dc1023f6452bc
2023-09-14 14:13:59 -07:00
Alessio Quaglino 4751f70026 Export SdfLib patch to GitHub.
PiperOrigin-RevId: 565354963
Change-Id: I10089d8abf85617d8e34da35c4bf4bfcb0a3684b
2023-09-14 06:56:12 -07:00
Alessio Quaglino 1afd98ec4b Add [SdfLib](https://github.com/UPC-ViRVIG/SdfLib) plugin to first-party SDFs.
The following dependencies are disabled with a cmake patch file.
- Enoki
- OpenMP
- Assimp
- FCPW

PiperOrigin-RevId: 565352386
Change-Id: Icff9de68408e0afa2032bb83b24491fc4e41d181
2023-09-14 06:42:42 -07:00
Kevin Zakka de5c3b1a09 PUBLIC: Update model gallery with new Menagerie models.
PiperOrigin-RevId: 565329315
Change-Id: I819ba429aacf5cd68d2b101047879319fba259be
2023-09-14 04:28:58 -07:00
Yuval Tassa 976a6df78d Fix typo in docs.
PiperOrigin-RevId: 565097458
Change-Id: I7a4440d72665d5db2853c18f72e83b130dde8d1a
2023-09-13 10:48:16 -07:00
Yuval Tassa 86d8b912f4 Rejigged solver statistics in preparation for islanding.
- See public description below.
- Stopped incrementing the iteration count in saveStats().
- `sizeof(mjSolverStat) == 40`, so this ends up costing 160KB, up from 40KB.

BEGIN_PUBLIC

Changed the size of `mjData.solver`, the structure used to collect solver diagnostic information. The array is now of length `mjNISLAND * mjNSOLVER`, where each row of length `mjNSOLVER` contains separate solver statistics for each constraint island. Until solver islanding is implemented, only row 0 is used.

- The new constant `mjNISLAND` is set to 20.
- `mjNSOLVER` is reduced from 1000 to 200.
- Added `mjData.solver_nisland`, the number of islands for which the solver ran.
- `mjData.solver_niter` (renamed from mjData.solver_iter) and `mjData.solver_nnz` are now integer vectors of length `mjNISLAND`.

END_PUBLIC

PiperOrigin-RevId: 565030093
Change-Id: I773e918805c6ced79f0dab5f19ea23956760c8c5
2023-09-13 06:18:37 -07:00
Kevin Zakka 8faf47dd16 BEGIN_PUBLIC
Add missing `ctrl` attribute to keyframe indexer.
END_PUBLIC

Context: Making an LQR notebook for the Skydio drone and wanted to read the ctrl attribute in the keyframe stored in the XML.
PiperOrigin-RevId: 564806350
Change-Id: I5af3189cc8be87915f9d320d95f0fab551ef87fa
2023-09-12 12:54:48 -07:00
Alessio Quaglino b0abafe3bb Set camera origin at top-left of the first pixel.
PiperOrigin-RevId: 564768176
Change-Id: Ieef632f0f6888390acca91b6de01c8951c747fe4
2023-09-12 10:44:51 -07:00
Alessio Quaglino 8064ad59c8 Add camera projection sensor.
BEGIN_PUBLIC
Add camera projection sensor.
END_PUBLIC

PiperOrigin-RevId: 564726114
Change-Id: I33b8e5562eff29c21538bf8f38ce3116c7dfc5a9
2023-09-12 08:16:20 -07:00
Alessio Quaglino ccda87aafa Use mesh_pos and mesh_quat in SDF transformation.
The SDF is defined in the `geom` frame. Using a mesh changes this frame so the inverse transformation is needed. So far the full `geom_pos` and `geom_quat` were used, which possibly contained user transformation. This CL uses the new structures which only contain transformations due to mesh processing.

PiperOrigin-RevId: 564721461
Change-Id: I6fb28001b38eaa50663427bce452cb1f05a56ac0
2023-09-12 07:58:04 -07:00
Nimrod Gileadi 71faea0e62 BEGIN_PUBLIC
Don't update actuator state when actuation is disabled.
END_PUBLIC

PiperOrigin-RevId: 564712814
Change-Id: I3cb656e81c9018a48d46348960cc07b14ae15b4a
2023-09-12 07:17:57 -07:00
Nimrod Gileadi fbcd96d03f BEGIN_PUBLIC
Zero all of act_dot when there are custom actuator dynamics, but no callback.
END_PUBLIC

PiperOrigin-RevId: 564712105
Change-Id: I107481727a42eb2577d62e29ac4e1496c56bb634
2023-09-12 07:14:15 -07:00
Yuval Tassa 48eb75ae92 In simulate, by default, keep updating profiler and sensor figures in Pause mode. Add UI option to disable.
PiperOrigin-RevId: 564710460
Change-Id: I893535e258ec2485d2ec997ecadfbdafba05bb99
2023-09-12 07:06:09 -07:00
Saran Tunyasuvunakool 2f14a7c102 Make asan instrumentation in mj_(mark|free)Stack cheaper.
Symbolization and string comparison results are now cached.

PiperOrigin-RevId: 564697198
Change-Id: I0447f283a90143e2f67ecd90d895a36a078b3981
2023-09-12 06:06:04 -07:00
Yuval Tassa 2b192cebb6 PUBLIC: In mju_normalize4, don't normalize if norm is less than mjMINVAL away from 1.
This makes mj_forward calls idempotent if warmstart is disabled and quats in qpos are normalized.

PiperOrigin-RevId: 564442666
Change-Id: I9c43add82bcfb4101c19fbfbfc8c30091b8906d5
2023-09-11 11:09:53 -07:00
Saran Tunyasuvunakool 860f7b376a Fix GCC and MSVC build.
PiperOrigin-RevId: 564390190
Change-Id: Icba3eefb394b8d17798679dd9876f127fba5a599
2023-09-11 08:17:08 -07:00
Saran Tunyasuvunakool 78183e60e1 Refactor thread pool implementation.
- Make mjTask non-opaque and remove C++ Task class.
- Make C++ thread pool a subclass of a skeletal mjThreadPool C struct.
- Make the mjTask status enum more consistent with the rest of MuJoCo.
- Change mju_threadPoolEnqueue to take just the mjTask. Users must now prepare the mjTask by assigning the function pointer and argument into the struct.
- Rename files in thread/ to be more consistent with the rest of MuJoCo.
- Run threading tests in CMake.
- Allow use of C++20 designated initializers.

Otherwise the functionality remains identical.

PiperOrigin-RevId: 564374675
Change-Id: I37c9894566bc39faf217e5aa97a4e2713a70e467
2023-09-11 07:20:34 -07:00
Matthew Bennice 0ba10cc4f0 Save normalising transform applied to mesh assets in mjModel.mesh_{pos,quat}
Fixes #409

PiperOrigin-RevId: 564217402
Change-Id: I53ddeef4e343905021cd7852d548f6769c876474
2023-09-10 15:25:59 -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 7e5a7b76fc Change GitHub org name to google-deepmind.
PiperOrigin-RevId: 563512242
Change-Id: Ife98501e95bb3459d96c7c73e5fb53be5513dd4b
2023-09-07 12:34:20 -07:00
Kevin Zakka 1a3215e329 Fix typo in changelog.
PiperOrigin-RevId: 563399339
Change-Id: I59b6e70bbde64d06a581b45ed529de09603ef8f8
2023-09-07 05:23:23 -07:00
Google DeepMind 040d3efce2 Add options for controlling early termination criteria of CG/Newton linesearch.
Useful for performance tuning models.

PiperOrigin-RevId: 563175078
Change-Id: Id64a510d6080038ea8d5876dabbf0b2b311435bb
2023-09-06 12:02:58 -07:00
Saran Tunyasuvunakool 48d0bfde44 Replace glfw.get_time with time.time in the Python viewer timing logic.
PiperOrigin-RevId: 563134207
Change-Id: Ic548701fc78336d8d87e94ea48833f94ee6395b8
2023-09-06 09:52:12 -07:00
Yuval Tassa ba66bd4f8b Fixes to documentation:
1. Cleaned up changelog, fixed some typos, removed nested admonitions.
2. Added missing documentation for `mjfResourceModified` function type.

PiperOrigin-RevId: 562859015
Change-Id: I34dc4f3131561cbe95be3127e6e318cc4b803a24
2023-09-05 12:36:28 -07:00
Saran Tunyasuvunakool 4929077211 Remove mjMARKSTACK and mjFREESTACK macros.
PiperOrigin-RevId: 562844184
Change-Id: Id2f57f5d132c47094dad75c6dab7297d7aa73458
2023-09-05 11:41:43 -07:00
Saran Tunyasuvunakool 329ed193ac Disallow variable-length arrays and turn on -Wpedantic in Clang and GCC.
PiperOrigin-RevId: 562832747
Change-Id: I0532624cee31e089a47426305d885687eb0fc5c5
2023-09-05 11:05:04 -07:00
Matthew Bennice 8ffdee355a Add new header to correct warning for placement new
PiperOrigin-RevId: 562800238
Change-Id: I94c883488391f7e95347eb2fe8dc291125233fff
2023-09-05 09:20:40 -07:00
Yuval Tassa d5292976de Add internal utility for zeroing int vectors.
Remove unnecessary branches in related functions.

PiperOrigin-RevId: 562768873
Change-Id: I3964a7a953d95bcd4e29137a7b590be5ffa6e311
2023-09-05 07:15:14 -07:00
Nimrod Gileadi f976d6d228 Use a raw function pointer instead of std::function objects in thread pool.
std::function can have an allocation cost when it's created, and also adds overhead to function calls. Since this API must be used from C, using a raw function pointer is good enough.
PiperOrigin-RevId: 562760324
Change-Id: I2b714a13e07a2b71566d013f21f76c506e817a52
2023-09-05 06:31:05 -07:00
Matthew Bennice edbe9ce86f Correct use of number_of_threads_ in an array length definition. It should be max_number_of_threads to allow Windows to compile it, GCC tolerates the variable length array.
PiperOrigin-RevId: 562743538
Change-Id: I5dc6dfb54002a996fe129b91e599cccfc9420e9c
2023-09-05 05:06:29 -07:00
Matthew Bennice 6225186964 Add threading primitives.
PiperOrigin-RevId: 562649644
Change-Id: I9c35b270e4b3b50cc7eb5a152f24d71def8e2fcd
2023-09-04 20:09:19 -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
Yuval Tassa 9308e1d383 Add internal utility for zeroing int vectors.
PiperOrigin-RevId: 562608956
Change-Id: I25ff1bbf9abf8fe2a636ed1d728d10ae862e04c9
2023-09-04 14:27:11 -07:00
Yuval Tassa 1aa375ef9a Allow RHS vector in mj_mulM_island to use uncompressed memory.
PiperOrigin-RevId: 562605681
Change-Id: If34bceed9eade59957ac9fd9b6a41fb736b58024
2023-09-04 13:56:54 -07:00
Yuval Tassa 600c12533d Add mj_constraintUpdate_island.
PiperOrigin-RevId: 562581620
Change-Id: If156a02873168127e2c5f2f377532fd45f7eec1c
2023-09-04 10:33:34 -07:00
Yuval Tassa b7686440d1 Indent a couple of #ifdef bodies.
PiperOrigin-RevId: 562572883
Change-Id: I44e2d6dc486ed7a181ca4614b1bf3f2f762f52f9
2023-09-04 09:32:35 -07:00
Yuval Tassa 5cef4708f2 Allow mj_mulJac(T)Vec_island to read and write from uncompressed vectors (length nv or nefc).
PiperOrigin-RevId: 562547310
Change-Id: Id517c1842e711639f4113d23cc364945839a3759
2023-09-04 06:51:51 -07:00
Saran Tunyasuvunakool 0e36f00857 Fix more mjData stack leakages.
PiperOrigin-RevId: 562545230
Change-Id: I2facf25b00878669dc12d5865767a44229d2ca48
2023-09-04 06:38:50 -07:00
Saran Tunyasuvunakool 5a21e202ed Eliminate mjContact copying during collision detection.
This results in approximately 4-5% speedup in collision detection for particle.xml.

PiperOrigin-RevId: 562526634
Change-Id: Ia6487b1908618064d858bac484fe6861ed37a402
2023-09-04 04:46:26 -07:00
Yuval Tassa feb8aa2fbb Fix bugs in engine_island.c
PiperOrigin-RevId: 562519702
Change-Id: I3075e539ccc1cef92485152721a9344f180aa4b1
2023-09-04 04:06:39 -07:00
Saran Tunyasuvunakool 89f47c33e4 Fix mjData stack frame leakages.
PiperOrigin-RevId: 562091591
Change-Id: Ia7bb8a70ccba6bd40edc06ad8ebfac16e4286836
2023-09-01 17:57:39 -07:00
Saran Tunyasuvunakool 33f51856c1 Check that alignment is power of 2 in mj_stackAlloc.
PiperOrigin-RevId: 562024496
Change-Id: I9230c6dc05ebb78e935f9b2f606aa77c921d67e5
2023-09-01 12:45:35 -07:00
Yuval Tassa 29aa5e4a41 Allow dot products with sparse vectors to specify that one vector uses uncompressed memory.
PiperOrigin-RevId: 561951337
Change-Id: I1310d7c09d9a85ad9b43877155844a9d0ce6edab
2023-09-01 07:40:16 -07:00