Commit Graph

343 Commits

Author SHA1 Message Date
Yuval Tassa 893c404230 Runtime disabling of actuators according to group.
Added `option-actuatorgroupdisable` attribute and associated `mjOption.disableactuator` integer bitfield, used to disable sets of actuators at runtime according to their group.

- The first 6 actuator groups are toggleable in the `simulate` viewer.
- Minor refactor and cleanup of actuator documentation.

https://youtu.be/H9qG9Zf2W44

Fixes #1092.

PiperOrigin-RevId: 578335600
Change-Id: I4cf663b90ea768e4380acfa2fe3b8c15c7cbb568
2023-10-31 16:24:38 -07:00
Nimrod Gileadi 64a59bb2dc Use the correct free function to free plugin data.
The array was created with `mju_malloc` (which does an aligned alloc) and released with `free` (which doesn't care about alignment), which led to errors on Windows.

PiperOrigin-RevId: 578186714
Change-Id: I193987bed061e945c49d7268a9a9af3f17af362a
2023-10-31 08:07:22 -07:00
Yuval Tassa c921c3956e Change keyboard shortcut key to visualize equality constraints from N to E. Delete the keyboard shortcut of the Selection Point.
PiperOrigin-RevId: 577770608
Change-Id: I5428a58dff93c95bcb71c27d0e65d2303a23b129
2023-10-30 02:42:26 -07:00
Yuval Tassa 86d9c84e59 Fix bug in implementation of torquescale
PiperOrigin-RevId: 577466789
Change-Id: I3c8e5dd9b4af9a629e777f7ccad8417075b0046c
2023-10-28 08:25:25 -07:00
Alessio Quaglino 1a47a97040 Disable shadows for geoms of category mjCAT_DECOR. Fixes #1114.
Added `frustum` to `rgba` and `scale` in the `visual` section.

PiperOrigin-RevId: 576547599
Change-Id: I69bf528680e3d4a59d6e04f6db99a6d345001d1d
2023-10-25 09:08:20 -07:00
Yuval Tassa a89412bb4a Add components of qfrc_passive to mjData: qfrc_{spring, damper, gravcomp, fluid}.
PiperOrigin-RevId: 576493532
Change-Id: If8eda1a2bb728fe8ab91b8004f97fc729d999ad9
2023-10-25 05:01:45 -07:00
Alessio Quaglino 643c1248b8 Skip flex edge Jacobian if not needed.
When equality constraints and built-in passive forces are not present, edge Jacobians are unused. This gives a 3x speedup in `mj_kinematics` in `floppy_flex` (from 0.2ms/step to 0.06ms/step).

Changed the default options of `floppy_flex` to match those of `floppy` for a fair comparison.

PiperOrigin-RevId: 575850622
Change-Id: I4c618536fd17ef930153bbd1f1da7d9e0e44abbe
2023-10-23 10:02:00 -07:00
Alessio Quaglino c6ef4f71c3 Add flex fields to mj_validateReferences.
PiperOrigin-RevId: 575779915
Change-Id: I14d22092e7d712dcc3d474cf0c2a85ef4d6a4aee
2023-10-23 04:44:32 -07:00
Alessio Quaglino 01a932e052 Fix flex constraint Jacobian for edges belonging to a single body.
PiperOrigin-RevId: 575161094
Change-Id: If4153bcb751cdd6dbdddeb08672f7107c7c5bbc2
2023-10-20 02:49:34 -07:00
Saran Tunyasuvunakool 269d88ad92 Bump dev version number to 3.0.1.
PiperOrigin-RevId: 574451745
Change-Id: Iedbbb3304b88876f31a6196d690a1f05c6428e2f
2023-10-18 15:01:21 +01:00
Alessio Quaglino d0294b7cc0 Initialize contact frame in planeVertex contact.
PiperOrigin-RevId: 574416404
Change-Id: I305f7113364ad9198947c5aa7346bb832fc43146
2023-10-18 02:56:14 -07:00
Erik Frey 8f9c690c85 Add MJX and bump version number to 3.0.0.
Co-authored-by: Baruch Tabanpour <btaba@google.com>
PiperOrigin-RevId: 574327508
Change-Id: Ia9b62fbc929c6869dfcec87636b2e10d405a1060
2023-10-18 10:33:29 +01:00
Alessio Quaglino 3f3d5a3b49 Fix contactcompare swapping condition.
PiperOrigin-RevId: 574276137
Change-Id: Iafbb6a99c1fb57907d3cb1d0796b6ad718e549d2
2023-10-17 15:05:20 -07:00
Yuval Tassa d0bdb78207 Disable island discovery for models with flexes.
PiperOrigin-RevId: 574244981
Change-Id: I7c08b23cf5f29338a04ec684ad7a0d4d8a0397df
2023-10-17 13:17:24 -07:00
Alessio Quaglino 110ade1435 Update Solid and Shell plugins to use FlexComp.
PiperOrigin-RevId: 573755821
Change-Id: I3b8d7fb27f0e940038fa9fd2b26ecc746df4f7ac
2023-10-16 03:03:06 -07:00
Yuval Tassa a9ee497e33 Add spaces around comparison operators.
PiperOrigin-RevId: 573620198
Change-Id: Icf295cc0dd381a4a7f0e2c94f2e12b499193e862
2023-10-15 07:40:10 -07:00
Yuval Tassa a1b6026b8c Delete derivative code sample.
PiperOrigin-RevId: 573477509
Change-Id: I0e619e36dd3fe677a27bbbdac87a15f04670cc13
2023-10-14 08:38:37 -07:00
Nimrod Gileadi eb41c720d4 Restore full state in mjd_stepFD.
Make sure that plugin state is also restored after finite-difference calculations.

PiperOrigin-RevId: 573272654
Change-Id: Ie276ecc391c463ae5c47cafa5b8de873b9345a7d
2023-10-13 11:23:52 -07:00
Nimrod Gileadi 60fd6a3298 Check if there's enough data in the buffer before reading fields while loading MJB.
Before this change, loading a truncated MJB file would crash with mjERROR. After this change it will just return NULL.

PiperOrigin-RevId: 572928724
Change-Id: I9611eaffcc2e5ef1b957f48162ce2ef29619e087
2023-10-12 09:30:00 -07:00
Alessio Quaglino 386b65086b Reduce contact label length.
PiperOrigin-RevId: 572868387
Change-Id: Icedec0792516b05d083068b9a3dad7e47e4ccc41
2023-10-12 05:10:03 -07:00
Alessio Quaglino 3addd490a4 Increase contact label length.
PiperOrigin-RevId: 572856066
Change-Id: I9d68481644b5a67720c055461607c95de8ec16ac
2023-10-12 04:10:25 -07:00
Alessio Quaglino 5a70ad08ab Add Flex component.
PiperOrigin-RevId: 572830650
Change-Id: I6908228087b7b9683be3506c8d9cdc725ed5dcd5
2023-10-12 10:49:35 +01:00
Matthew Bennice 2842245ca9 Multithread parallelizable operations in mj_fwdPosition
PiperOrigin-RevId: 572576240
Change-Id: I70eb518385366a0027c5dad44ac15e3904d1b4a3
2023-10-11 08:01:53 -07:00
Saran Tunyasuvunakool 2e15574b58 Allow user-defined visualization geoms to be added to the passive viewer.
Fixes #1023, #1082

PiperOrigin-RevId: 572303635
Change-Id: Ia8399f816f311b38a7b137f5bd4f359f77a1da1c
2023-10-10 10:52:21 -07:00
Google DeepMind 1bd6c94e6d Fix setting wrong value in efc_diagApprox for rotational components of weld constraints.
PiperOrigin-RevId: 572276016
Change-Id: Ic985a342777aca976f5c4bc781133fb4a8976e3f
2023-10-10 09:34:34 -07:00
Alessio Quaglino 8af09eb70d Add timing of collision phases.
PiperOrigin-RevId: 572273621
Change-Id: Ib9440a996a05e42e00dcf4f1ce487a12f65e999b
2023-10-10 09:27:45 -07:00
Yuval Tassa 18d9f1abb0 Improvements to timing.
- Fixed bug in timing of kinematics, was under-reported.
- Moved timing of inertia and collision into respective functions, in preparation for multi-threading.
- Detailed profiling in `testspeed` is always on, removed command-line flag.
- Improved `testspeed` self-documentation.

PiperOrigin-RevId: 571989548
Change-Id: If0e3cc17f6f3511b98fc36339f406a19968a9361
2023-10-09 11:14:44 -07:00
Alessio Quaglino f0608648cb Stricter swapping condition in mju_eig3.
This solves the texture rendering issue with the Rubik's cube. The texture were specified with respect to the incorrect frame, so a default rotation of (0, 0, pi/2) is now applied to the model file.

PiperOrigin-RevId: 571715153
Change-Id: I3efae3b1fc8f64e6c9e4db90a7609506e3cbed86
2023-10-08 04:04:34 -07:00
Alessio Quaglino 77d0400733 Accelerate inertia computation for simple bodies.
PiperOrigin-RevId: 571411319
Change-Id: I82732e95795cc0f0645f8273a1b084f2a9187a75
2023-10-06 12:51:14 -07:00
Yuval Tassa d61d0349b8 Fix mju_eig3 declarations.
PiperOrigin-RevId: 571296456
Change-Id: Ic05f44c8c0883fe96e5671d71fe9b447c2e91162
2023-10-06 04:10:44 -07:00
Matthew Bennice 071af3b015 Implement threading for island constraint solving.
Humanoids22 No threads:
 Benchmark Execution Time: 9.475905812s

Humanoids22 with 10 Threads:
 Benchmark Execution Time: 4.871352s

PiperOrigin-RevId: 571214307
Change-Id: I1f4f2c761b4ae6bc8fac1f28c6c695f6c499f339
2023-10-05 21:05:19 -07:00
Yuval Tassa ee78b8f76b Added mjData.eq_active user input variable, for enabling/disabling the state of equality constraints.
Renamed `mjModel.eq_active` to `mjModel.eq_active0`, which now has the semantic of "initial value of `mjData.eq_active`".

Fixes #876.

PiperOrigin-RevId: 570410643
Change-Id: Id03171e751377c7cc453f143abee64239ee2e2ed
2023-10-03 09:32:24 -07:00
Yuval Tassa e1549376f6 Use body AABB for torque perturbation visualisation, if available.
PiperOrigin-RevId: 569579715
Change-Id: I62c1083fb868520832746ca1f28fab2bf1d679cc
2023-09-29 13:50:02 -07:00
Alessio Quaglino 36d2ffe4f2 Specify camera parameters using standard robotics conventions.
PiperOrigin-RevId: 569147555
Change-Id: I3443f95e5de56a17024f5e5c03f33888dd583edb
2023-09-28 05:19:19 -07:00
Saran Tunyasuvunakool ca60de79c8 Change sz to 64-bit integer in mj_setPtrData.
PiperOrigin-RevId: 569123159
Change-Id: If16777f06a2b0ea08083261d1b77c95fc14f2751
2023-09-28 03:20:18 -07:00
Yuval Tassa 772326e9eb Fix potential out-of-range write in solver statistics saving.
PiperOrigin-RevId: 569094007
Change-Id: I2e596a7c03d76523359cae7ae7f4501b06256a38
2023-09-28 00:58:13 -07:00
Saran Tunyasuvunakool 8ed321d469 Rename mesh_assetpathadr to mesh_pathadr and move it to the end of the mesh section.
PiperOrigin-RevId: 568911603
Change-Id: I8f21c3d1cc9c73b6a95292a50f262b1a199d0898
2023-09-27 11:32:10 -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
Matthew Bennice 7f8018a3f3 Update XML parsing to store asset path so that assets can be recovered and sent to external renderers
PiperOrigin-RevId: 567347908
Change-Id: I4d8e1abe35be3a67643ff925af709921280856f8
2023-09-21 10:27:52 -07:00
Matthew Bennice 4f34cacf35 Add maxuse_threadstack to mjData
PiperOrigin-RevId: 567334177
Change-Id: Ifd772350042e548a63ab269fd68fb5e5fef55831
2023-09-21 09:41:00 -07:00
Yuval Tassa dfd48dd821 Replace mjMIN and mjMAX with mju_min and mju_max, where possible.
PiperOrigin-RevId: 566602924
Change-Id: I2d24183d0d9df3e647bb2d7d7544473582f38128
2023-09-19 05:40:41 -07:00
Yuval Tassa 9cf1f6eba4 Remove mjOption.collision and associated option/collision attribute.
PiperOrigin-RevId: 566427090
Change-Id: I6e5873b8db707586820b17b53c7ab4bbff0f0b2b
2023-09-18 15:15:54 -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
Yuval Tassa 812e617fe9 Clear mjData.actuator_moment more selectively.
PiperOrigin-RevId: 566324919
Change-Id: Ie453f8de059d39fa1ebd5248f33a18758ee748af
2023-09-18 09:27:03 -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
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 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
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
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