Commit Graph

329 Commits

Author SHA1 Message Date
Yuval Tassa e143b3dbc0 Allow height-field elevation data to be specified in XML.
PiperOrigin-RevId: 602374498
Change-Id: I2d3364d68876a35799b24aca1051e2f5aebdda75
2024-01-29 06:59:28 -08:00
Alessio Quaglino fb8f77df74 Throw error if qhull is called with NaNs.
PiperOrigin-RevId: 601745538
Change-Id: I590673ca7975e4abc171f98704a6c8f8d08f8327
2024-01-26 06:13:27 -08:00
Alessio Quaglino 076db5d366 Copy face_ into facetexcoord_ if not specified and needed.
PiperOrigin-RevId: 601732448
Change-Id: Iffe01076db22201dba2611ea36174f808ae00c1e
2024-01-26 04:54:43 -08:00
Kyle Bayes 4f53d9a0d7 Add AddVector and GetVector to user cache.
PiperOrigin-RevId: 601485067
Change-Id: I1a31f15c2495de4f057316022dcddf4df39afd64
2024-01-25 10:13:13 -08:00
Kyle Bayes aede8cf5cf Rename user_asset_cache to user_cache.
PiperOrigin-RevId: 601097322
Change-Id: Iea3d6481cd214028ef63ed72868999ecb0b1eeb4
2024-01-24 06:05:56 -08:00
Kyle Bayes a1ddbdf7f8 Add an implementation of a cache for assets for compilation speedups.
PiperOrigin-RevId: 599850003
Change-Id: I83e299e127058a5657d7b262aa98d36451b530f6
2024-01-19 09:04:01 -08:00
Yuval Tassa fea7c10b95 Add bvhactive flag to visual/global. Fixes #1279.
PiperOrigin-RevId: 599778272
Change-Id: If5530629035cc68b198447503388f59a04041b13
2024-01-19 02:59:56 -08:00
Yuval Tassa a14a584f1d Fix bug in muscle length-gain curve. Fixes #1342
PiperOrigin-RevId: 599165049
Change-Id: Ic5ef77b4349a8a9c343eacfd781195bfebea9aca
2024-01-17 07:20:01 -08:00
Alessio Quaglino 1e2e0b3053 Remove all visual-only assets if discardvisual is selected, not only the geoms.
PiperOrigin-RevId: 598598250
Change-Id: I12e60ce41ad436d037b4877d197decf6bdce0fc8
2024-01-15 06:39:25 -08:00
Yuval Tassa 42515033a7 Fix linter issues in user_objects_test.
PiperOrigin-RevId: 597204770
Change-Id: I0b396d4c64684d845dc9baf205800e22c8fac314
2024-01-10 04:00:08 -08:00
Nimrod Gileadi c59a33dd81 Use std::string_view instead of absl::string_view in fixture.cc.
Clean up some lint warnings.

Fixes #1306.

PiperOrigin-RevId: 595988916
Change-Id: I0e8584ff8704ea7294cf649664ab447cb1d4ff46
2024-01-05 07:20:58 -08:00
Yuval Tassa 7ce05f4957 Improve documentation of solver parameters.
PiperOrigin-RevId: 595723619
Change-Id: I00b67eaec02d2e85ce60fb44eb3e582ce036be3a
2024-01-04 09:17:31 -08:00
Alessio Quaglino 63ec34f9f8 Add plugins to flex parent body if there are pinned vertices.
Fixes #1270.

PiperOrigin-RevId: 595429578
Change-Id: Ifc61d4bde4dd3c6b4d4a09106152de1d24e71ef0
2024-01-03 09:53:22 -08:00
Nimrod Gileadi 7cb7c87f70 Fix a few issues with the passive viewer.
1. Create an arena for the mjData instance used by the passive viewer visualization.

When using the passive viewer, stuff gets copied from the real mjData into a minimal struct.
That struct didn't have a stack, and now visualization for Flex does stack allocs.

2. Add missing a missing field in scene state for flex visualization.

3. Fix a memory leak where mjvScene wasn't released on exit in the passive viewer.

4. Add some locks in places where the render thread and Simulate::Sync collide.

This fixes #1280.

PiperOrigin-RevId: 591891676
Change-Id: I592f286cab9719c8d9af84e42f9756ea1f9f1971
2023-12-18 07:33:19 -08:00
Nimrod Gileadi 8ecb16abfa Don't run particle.xml in testspeed_test under ASAN.
Reduce the number of steps for a couple of other slow tests.

PiperOrigin-RevId: 591844569
Change-Id: If722567b91163f1f3c451302f9543a43d05872a1
2023-12-18 03:33:59 -08:00
Yuval Tassa f2a967348c Fix bug introduced in 7942fe957e
That change removed some spurious contacts returned by mjc_BoxBox, but also removed some desirable contacts that occur during very deep penetration of two boxes (when one box is completely inside another box). This is now fixed.

PiperOrigin-RevId: 591036252
Change-Id: I84b51f2179fd6fe29618a4e908e86934c6fc6941
2023-12-14 13:30:38 -08:00
Kyle Bayes 9f6be3135e Modify mjListKeyMap to be a fixed-size array, and add internal object_lists variable to mjCModel to remove redundant code.
PiperOrigin-RevId: 590997348
Change-Id: I5f4d7de605f44d40a75eb1e9ceec208325fa3be5
2023-12-14 11:12:01 -08:00
Yuval Tassa 5b2c98f8f1 When saving XMLs, don't round floats that are bigger than INT_MAX. Fixes #1278
PiperOrigin-RevId: 590692020
Change-Id: Icd11d20f47bc4163eb4378f4cb031b8fd9d13612
2023-12-13 13:13:15 -08:00
Yuval Tassa b22919543d Fix bugs related to saving of <statistics> values.
Before this change:
- User-modified values of `mjModel.stat.{meanmass, meaninertia}` would not be saved to XML.
- Non-user-modified values of `mjModel.stat.{meansize, extent, center}` would always get saved to XML.

After this change values are saved to XML only if provided by the user, either in the XML or by changing values in `mjModel` before saving.

PiperOrigin-RevId: 589473351
Change-Id: I4dcf4892ef61c35edf424226e731232d861bad8d
2023-12-09 16:06:39 -08:00
Yuval Tassa 7942fe957e Circumvent bug in mjc_BoxBox.
The box-box collider sometimes outputs bad contact points which are far outside one of the two boxes. This happens at configurations which are very rare numerically, but rare configurations (e.g. perfect box alignment) are often induced by the designer and the physics, making them actually not-so-rare.

Since the box collision functions are very difficult to understand, we circumvent the issue by extending the post processing code to detect and remove such contacts.

PiperOrigin-RevId: 589178197
Change-Id: I82b8a888ef04f9196111c960757e3314d0ab6d8e
2023-12-08 10:39:27 -08:00
Yuval Tassa b1a912e9e2 Improve readability of test.
PiperOrigin-RevId: 589048504
Change-Id: I5087cfd67481df90103da2d7f5f06e421fc28e11
2023-12-08 01:18:59 -08:00
Alessio Quaglino 1db0a9946f Fix frame accumulation order for <frame> meta-element.
PiperOrigin-RevId: 588803425
Change-Id: Id0289c34d1a6cfb6007540a29cc1f32d879e43ed
2023-12-07 08:37:20 -08:00
Alessio Quaglino d12fe594d9 Add suffix to duplicated assets.
PiperOrigin-RevId: 588775467
Change-Id: I3a0d2a14601cf018b0c8c56728bd3ae22adb8ec2
2023-12-07 06:46:51 -08:00
Yuval Tassa 762371c3e4 Add kv damping attribute to position and intvelocity actuator shortcuts.
PiperOrigin-RevId: 588377097
Change-Id: I8ded2ff982e52ed8673019979e29b706ef65c743
2023-12-06 04:28:30 -08:00
Nimrod Gileadi c062a8db19 Allow multiple actuators to use the same PID plugin.
Maintain separate state for each actuator in the Plugin object.

PiperOrigin-RevId: 587760569
Change-Id: I633a1b94f0dde9377120145066a26aef6a4033b8
2023-12-04 10:08:07 -08:00
Nimrod Gileadi 236dcb4ffd Fix a bug with PID actuators, when plugin definition order differs from actuator order.
PiperOrigin-RevId: 587729879
Change-Id: If71c7e374f36ef08c5147e7316066d6f5365925f
2023-12-04 08:31:45 -08:00
Matthew Bennice c0b7b9873d Store paths for hfields, textures, and skins similar to meshes.
PiperOrigin-RevId: 587283093
Change-Id: Ie6d8d2ecb185697a27d1b6f7fca1312df006af12
2023-12-02 03:51:25 -08:00
Yuval Tassa 51d80564fa Don't initialize plugins during model compilation.
PiperOrigin-RevId: 585701389
Change-Id: I4e5e34276f404abadf6f5d4d9764ca717304ee34
2023-11-27 11:01:08 -08:00
Alessio Quaglino eb9568a48b Add frame element to MJCF.
PiperOrigin-RevId: 585598244
Change-Id: I4c06be3dd586dab5a4458f05faaf1e7f2b615458
2023-11-27 03:32:18 -08:00
Nimrod Gileadi 002b427a32 PID Controller as an actuator plugin.
Implement a configurable PID controller.

PiperOrigin-RevId: 585282014
Change-Id: I2d884554629101a0a25b5e0979ffb1ff8ed9cab4
2023-11-25 08:41:01 -08:00
Nimrod Gileadi f2025c6abf Allow plugin actuators to have activation state.
Accept new attributes on the plugin/actuator tag:
  - dyntype
  - dynprm
  - actlimited
  - actrange
  - actearly

This addresses some of the requests in #1098.

PiperOrigin-RevId: 584866281
Change-Id: I4f7559e446888216093efba4ced9119cfc0528a4
2023-11-23 05:14:03 -08:00
Yuval Tassa cd56a41f83 Fix bug in Cartesian actuation with movable refsite.
PiperOrigin-RevId: 584035818
Change-Id: I005f6bbbe02f8b36d287ecada0406a6ae4d720ba
2023-11-20 08:37:29 -08:00
Alessio Quaglino 4014196c6c Add pin to flex golden data.
Also reduce slightly the resolution of the models to make comparing golden data more readable.

PiperOrigin-RevId: 582990641
Change-Id: I4f935a4ce316c70f4b1641e1c0f2fe49f801b32c
2023-11-16 04:14:58 -08:00
Nimrod Gileadi 97ad543051 Test-only change: Don't update actuator_force in Advance in TestActuator.
Actuators update actuator_force in compute and not in advance.

PiperOrigin-RevId: 581985081
Change-Id: I013d6c4f0888ee8e25df15a6f58c9e3412d33ceb
2023-11-13 09:11:42 -08:00
Alessio Quaglino 9ae40e718e Define mj_multiRay bindings explicitly.
Fixes #1184.

PiperOrigin-RevId: 581956413
Change-Id: I6c611ac7537442a65e6961430ec724326ee6095a
2023-11-13 07:31:22 -08:00
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
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 034bb62986 Add cam_intrinsic to mjvSceneState.
Add `frustum.xml` to engine_vis_state_test models.

Fixes #1115.

PiperOrigin-RevId: 576567292
Change-Id: I642c32a87427507580046d2d260263c689d50c99
2023-10-25 10:17:42 -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
Alessio Quaglino 83515446b6 Add missing models to all_models and all_test_models.
PiperOrigin-RevId: 574491634
Change-Id: I943043b21056d7f22dd1c50454deee3f49e7eac0
2023-10-18 08:59:54 -07:00
Yuval Tassa 3c6b573f78 Add flex model to test/testdata
PiperOrigin-RevId: 574431067
Change-Id: Ide06b145afeca5df80acfc05e290e7bc54786a8e
2023-10-18 04:11:46 -07:00
Nimrod Gileadi 393cfec1e8 Don't use PluginTest as the fixture name in xml_native_writer_test
PiperOrigin-RevId: 574129298
Change-Id: I8c3e10bf271d54cb414b8d2af3724d8c81b6fc80
2023-10-17 06:32:37 -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 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
Yuval Tassa 493ae95d69 Add stack leak test to WriteReadCompare
PiperOrigin-RevId: 572953669
Change-Id: Id6cad3fc86777d68f218119f67c9dc473bdcfcc8
2023-10-12 10:53:24 -07:00
Alessio Quaglino 6f8128dc6a Fix benchmark label for plugin flag test.
PiperOrigin-RevId: 572891541
Change-Id: I442e31f7e4164789759be0d2c71275fdb1398955
2023-10-12 06:53:38 -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