Commit Graph

490 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
Alessio Quaglino 50843cad30 Add defaults to SDF plugin attributes.
Expose diameter and number of teeth for the gear SDF.

PiperOrigin-RevId: 577779297
Change-Id: Iec5890ab7f39080b395cf06a76f9c2216f4f39ed
2023-10-30 03:09:25 -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
Nimrod Gileadi f8c5ad2ba8 Check for errors when calling std::stod in XML loading.
PiperOrigin-RevId: 576608985
Change-Id: I148ca67d8960d73c281df2d6f2440d47940a6369
2023-10-25 12:26:43 -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
Nimrod Gileadi 97d99c84ce Delete the temporary mjData if model reference validation fails.
PiperOrigin-RevId: 575852845
Change-Id: I2146dbc510b48c310ac338adcd5d53cb9f38b383
2023-10-23 10:07:55 -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 317d6d9ebe Move edge creation after element reordering in mjCFlex.
PiperOrigin-RevId: 574193046
Change-Id: If2fb01b3494d637d4b220d03e7d7d84e4a9f7a2d
2023-10-17 10:28:43 -07:00
Alessio Quaglino d67b8c6251 Add membrane plugin (2D Flex elastic stiffness).
PiperOrigin-RevId: 574109411
Change-Id: I4a701d8189cecf540cd200bd30cb4582f3c7dd43
2023-10-17 04:55:33 -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
Yuval Tassa d88675a034 Change the default of <compiler autolimits> from "false" to "true".
PiperOrigin-RevId: 573184793
Change-Id: I24075a8d953d0a3c3ddf65c67e1e18075cd029b6
2023-10-13 05:05:24 -07:00
Alessio Quaglino 389e13938e Fix typos in docs.
PiperOrigin-RevId: 573172715
Change-Id: I0073d0872597b01d84151b9eea578cc0ae0a5013
2023-10-13 04:05:30 -07:00
Copybara-Service 59164702ab Merge pull request #978 from aftersomemath:depth-precision-in-place
PiperOrigin-RevId: 572961667
Change-Id: I69011ddf835ae286e30e7f84cca67867cfe94fa4
2023-10-12 11:18:36 -07:00
Saran Tunyasuvunakool 86859ad382 Restore shadows when flex is present.
PiperOrigin-RevId: 572936749
Change-Id: I57f8d486810767422bc2874433497eb5073bf63b
2023-10-12 09:58:59 -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
Levi Burner c6961b77d7 Fallback for if GL_ARB_clip_control not available
If GL_ARB_clip_control not available then [znear, zfar] -> [1, -1] instead of [1, 0] in normalized device coordinates

Thus, Z is still reversed, but not shifted, clipping should still work properly, and conversion to window coordinates does not cause accuracy regression compared to non-reversed Z rendering.
2023-10-02 18:30:57 -04:00
Yuval Tassa 177aec68dc Add overlay positions in the center of viewport edges, move PAUSE and LOADING... overlays to the top center.
PiperOrigin-RevId: 570054949
Change-Id: If0046df382e67ad3a48e7138a75e9e200c0626b9
2023-10-02 07:05:50 -07:00
Levi Burner 9e51f20ce2 More fixups to mjtDepthMap names 2023-09-29 19:53:58 -04:00
Levi Burner 56403b4dce Fixups to comments and flags for reversed Z rendering 2023-09-29 19:53:58 -04:00
Levi Burner 2e52bf807b Add flag to mjrContext to support legacy depth mapping by default 2023-09-29 19:53:57 -04:00
Levi Burner d32eb6bd12 In place change to reverse Z rendering and 32 bit float offscreen depth buffer 2023-09-29 19:53:47 -04:00
Levi Burner fc7b212369 Support reversed Z rendering and float32 offscreen depth buffer
Combined, both options greatly improve camera depth accuracy compared to
OpenGL default Z mapping and int24 depth buffer.

Requires GL_ARB_clip_control and ARB_depth_buffer_float extensions
2023-09-29 19:52:09 -04: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