Commit Graph

236 Commits

Author SHA1 Message Date
Yuval Tassa 0bcaa85650 Fixed a bug wherein, for models that have both muscles and stateless actuators and used one of the implicit integrators, wrong derivatives would be computed.
PiperOrigin-RevId: 663680592
Change-Id: I5d72888cab19dd5e51f552f63fe0968db93f5dcd
2024-08-16 04:07:23 -07:00
Kyle Bayes 64575f399b Add heightfield collision support for GJK + EPA implementation.
PiperOrigin-RevId: 663321119
Change-Id: I01a85ae15386c997bff4e9c6d71555a4380dfffe
2024-08-15 08:50:09 -07:00
Kyle Bayes 7f09a7d8c6 Fix bug in S2D and improve readability of GJK + EPA code.
PiperOrigin-RevId: 663261102
Change-Id: Ibb1d801078cc02bc7ccec246be6dc50fa4f2be18
2024-08-15 04:35:15 -07:00
Kyle Bayes ebd8615554 Internal change.
PiperOrigin-RevId: 661267364
Change-Id: If2249eb1658c5b877a43a4d3c29ebf88d2a42d5a
2024-08-09 08:16:41 -07:00
Kyle Bayes 1c9d609b5b Make mj_gjkPenetration have the same signature as LibCCD penetration functions.
PiperOrigin-RevId: 661256774
Change-Id: If0ae95e27900a9d7b9c63f189837f1315fbbb987
2024-08-09 07:40:17 -07:00
Erik Frey 35a834f0ba Fix engine_sort_test compile error.
PiperOrigin-RevId: 660975517
Change-Id: I6e3d1b041fe60b1ec202391903eff340f787b46d
2024-08-08 14:11:35 -07:00
Taylor Howell 82c27165f2 mjQUICKSORT uses std::sort with C++.
fixes #1638

PiperOrigin-RevId: 660887790
Change-Id: Ia3b493feda98b246d963aa749bc81b96c42fddaa
2024-08-08 10:24:34 -07:00
Kyle Bayes a1d9b47e2f Initial (unoptimized) implementation of EPA.
PiperOrigin-RevId: 659938320
Change-Id: I72c6c6bd7504bce36e4788d90b06b2cb3849b4db
2024-08-06 06:53:55 -07:00
Google DeepMind 881b777ffd Fix a build error in engine_util_solve_test.cc.
PiperOrigin-RevId: 659668840
Change-Id: I56b0604628d54e149092201ff19c3318b75429a6
2024-08-05 13:47:28 -07:00
Yuval Tassa a29f67c850 Add test models for tendon wrapping.
PiperOrigin-RevId: 657208035
Change-Id: Ib82bd2b31a15d1386f8096b280def9e7325c8e46
2024-07-29 08:24:37 -07:00
Yuval Tassa a4bd2bec0a Skip disabled actuators in mjd_actuator_vel.
Fixes a bug where the derivative of the actuator force with respect to the generalized velocities (used in implicit and implicitfast integrators) was failing to take into account disabled actuators.

Fixes #1838

PiperOrigin-RevId: 657193960
Change-Id: Id8c0ab863a39e2a01cd2703774f460e9731b4807
2024-07-29 07:31:58 -07:00
Nimrod Gileadi 393895bb29 Explicitly specify actdim on PID plugin actuators, to allow them to be used with keyframes.
Support actdim attribute on plugin actuators.

Remove the actuator_actdim callback. This callback leads to crashes when loading keyframes for models that have a stateful plugin.

PiperOrigin-RevId: 650649505
Change-Id: I40d1994d02ae4e20ce631b2702a984766cf2628e
2024-07-09 09:08:48 -07:00
Kyle Bayes c6fd002f87 Move engine/engine_resource.{c,h} to user/user_resource.{c,h}.
PiperOrigin-RevId: 649628768
Change-Id: Id90c983cf70c0f92c3b033ac1b1654c53696955d
2024-07-05 05:41:55 -07:00
Kyle Bayes 57e6760ec9 Re-implement VFS internals in C++, removing the constraints of the previous implementation.
PiperOrigin-RevId: 649433087
Change-Id: Icaa3e6b7f2ef14f56b04fef2f4360b46d8b5f022
2024-07-04 09:22:23 -07:00
Yuval Tassa 19d505d847 Remove unused texture attribute in some models.
PiperOrigin-RevId: 648497401
Change-Id: I9f9a843abfb710afaf25798fa659efd92bcd7007
2024-07-01 15:05:02 -07:00
Yuval Tassa c1ade85490 Add tests for mju_normalize4.
PiperOrigin-RevId: 648422309
Change-Id: Ie363b396cd854588dc59994ae76059f42f2a54b0
2024-07-01 10:58:35 -07:00
Yuval Tassa 0c3698f278 Don't normalize mocap quaternions in-place.
PiperOrigin-RevId: 648394295
Change-Id: I348a0a045c1697f6ef782280d92c90a30759eb33
2024-07-01 09:29:50 -07:00
Yuval Tassa 4d4b0bb2c3 Don't normalize mjData->qpos quaternions in-place.
PiperOrigin-RevId: 647927542
Change-Id: I13b0be55498d1da3af2cdc414cfed4c3908a6fe1
2024-06-29 03:07:10 -07:00
Kyle Bayes 5e39fc0564 Improvements to GJK implementation:
- Fix various bugs
- Improve readability
- Add support for recovering witness points.

PiperOrigin-RevId: 646515019
Change-Id: I295cf90d885e32013e595ea7aad07ed6c1869239
2024-06-25 10:00:58 -07:00
Kyle Bayes 1e8454820d Implement initial GJK algorithm.
PiperOrigin-RevId: 645368315
Change-Id: I40a1e1023fd9f14a59e11a9dcc6ac22df241b6ae
2024-06-21 06:17:43 -07:00
Nimrod Gileadi 73cd15344e Fix a couple of mjtNum build errors.
PiperOrigin-RevId: 645024056
Change-Id: Id283f550a4e2d927c214a86e77d42b90fb02824e
2024-06-20 07:31:28 -07:00
Yuval Tassa 6067048537 Deprecate mju_rotVecMat and mju_rotVecMatT in favor of mju_mulMatVec3 and mju_mulMatTVec3.
These functions names and argument ordering are more consistent with the rest of the API.

PiperOrigin-RevId: 643788290
Change-Id: I783eda8021b80b82098e23ed95669b102bb82508
2024-06-16 10:02:36 -07:00
Yuval Tassa 86ef1746b0 Add convex collision test models.
PiperOrigin-RevId: 643567019
Change-Id: I233553f04ea7d67216a2440f834362965d9e8c58
2024-06-15 01:38:13 -07:00
Yuval Tassa c9bcf8371e Add mj_setKeyframe function to save current state in k-th model keyframe.
Fixes #1719.

Also improve documentation of `mju_sigmoid`, was previously only documented in changelog.

PiperOrigin-RevId: 642637458
Change-Id: I811a0bf8f881c8b76c9a62d2faec8fdec4e7585b
2024-06-12 09:22:52 -07:00
Yuval Tassa 07fc95ca9a Add orthographic cameras.
Orthographic cameras are specified by setting the `orthographic` attribute of the `<camera>` element. The `fovy` attribute is still used to specify the field-of-view, but its semantic is different for orthographic cameras. For orthographic cameras, the field-of-view is expressed in units of length, rather than degrees.

Other related changes:

* Fix bug in the ordering of `cam_xxx` elements in `mjModel`.
* Make camera visualization translucent only when the frustum is visualized.
* Added a button to `simulate` to toggle between perspective and orthographic free cameras.

https://youtu.be/ZXBTEIDWHhs

PiperOrigin-RevId: 642293435
Change-Id: Id090a421ad88ab404b5b27ddbbd6bfc81ad49bc5
2024-06-11 09:23:18 -07:00
Saran Tunyasuvunakool 40755e165d Reduce VeryLargeMemory test memory allocation in engine_io_test.cc
An upcoming LLVM update is due to make this test fail under msan, since msan touches most of the memory allocated for the mjData arena. This causes an OOM failure on memory-limited testing infrastructure.

An 8G allocation is sufficient to catch errors that arise from the use of 32-bit integers to handle sizes.

PiperOrigin-RevId: 640504620
Change-Id: Ia1949b04a1428f01e1075e26b421facb3babedb6
2024-06-05 06:27:01 -07:00
Yuval Tassa 2830a4071f Add dampratio attribute to position and intvelocity actuators.
PiperOrigin-RevId: 639745135
Change-Id: I94ba4c346d2750c6c454a60a568f2e6f6bce19d4
2024-06-03 05:28:35 -07:00
Kyle Bayes 50aab2dd48 Move engine/engine_vfs.{c,h} to user/user_vfs.{c,h}.
PiperOrigin-RevId: 636219666
Change-Id: I820de511948e82256784edb0893f209a73b221e6
2024-05-22 10:44:53 -07:00
Yuval Tassa 02d015458c Add mj_geomDistance API function and sensors for geometric distance, normal direction and segment between between two geoms. Fixes #51
PiperOrigin-RevId: 632458301
Change-Id: I65b7e5bb0df59008028114cf4a07e0d6365ff3d3
2024-05-10 04:52:43 -07:00
Alessio Quaglino 26f23066d1 Add replicate element to MJCF. Fixes #553
PiperOrigin-RevId: 629393578
Change-Id: Ia1db1b9e47eba8868117b0f7b85edcd0cc1b6d79
2024-04-30 06:29:18 -07:00
Yuval Tassa 546a27ca72 Fix memory allocation error when memory size is larger than 2G. Fixes #1606
PiperOrigin-RevId: 627058355
Change-Id: Iebef647a0107d1f112a876d705f5b3ea888b4a41
2024-04-22 09:15:46 -07:00
Yuval Tassa 5a365603f8 Add mju_euler2Quat.
PiperOrigin-RevId: 623469398
Change-Id: Ia86b29a764018cd4c3bc57d23616bed7393081f5
2024-04-10 06:02:50 -07:00
Yuval Tassa 47ba72ea59 Add actuatorgravcomp joint attribute, to treat gravity compensation forces as applied by actuators, rather than passive buoyancy.
PiperOrigin-RevId: 620049593
Change-Id: I2c8a9dc152c087b408e4f904838034271a7dd910
2024-03-28 14:01:52 -07:00
Yuval Tassa dd2580e546 Add internal functions for 3x3 matmul.
PiperOrigin-RevId: 616749614
Change-Id: I7f3ac2ffc826076b6c97424324f03ecd9ccd4655
2024-03-18 01:44:10 -07:00
Kyle Bayes c7a8b104f9 Add modified callback for VFS resource provider.
PiperOrigin-RevId: 616152275
Change-Id: I417f9b204eaa1eb9fc68a15927f86031dcd20575
2024-03-15 09:23:29 -07:00
Kyle Bayes c42868a91b Update logic for OS filesystem timestamps for caching.
PiperOrigin-RevId: 616138153
Change-Id: I0ce966546bc4af04e57b983e27bbd75a94377237
2024-03-15 08:31:56 -07:00
Copybara-Service 6b7d714291 Merge pull request #1450 from v-r-a:angmomMat
PiperOrigin-RevId: 612835207
Change-Id: I8e7b01cc433563556a3ae4bbdd0c53612cc15e97
2024-03-05 07:35:15 -08:00
Vyankatesh 3fd0fe7884 corrections 2024-02-26 20:15:22 +05:30
Vyankatesh ebf9d63702 changed the model, using central differences in CompareAngMomMats test 2024-02-26 14:48:47 +05:30
Vyankatesh Ashtekar 41e41b538d added two tests for the mj_subtreeAngMomMat() function 2024-02-26 01:23:55 +05:30
Kyle Bayes a4a621f6e3 Add checksums (used as a timestamp) to VFS.
Deprecate mj_makeEmptyFileVFS in favor of mj_addBufferVFS.

PiperOrigin-RevId: 608915388
Change-Id: Id9e9b042799bc1bf547f0795ae6f386447d53cdd
2024-02-21 02:25:36 -08:00
Kyle Bayes 266161ee4c Convert mju_openResource to write warnings to a given error string.
PiperOrigin-RevId: 606907392
Change-Id: Ic70e980aa9ba2bdbe1787773f51749b34f74afed
2024-02-14 02:17:40 -08:00
Alessio Quaglino a3e49d582e Add mjmBody and mjmPlugin and their compiler C APIs.
PiperOrigin-RevId: 604937231
Change-Id: Ib8a2105ce6c0500d6a610258b46f192d9e73169d
2024-02-07 04:17:30 -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
Yuval Tassa 7ce05f4957 Improve documentation of solver parameters.
PiperOrigin-RevId: 595723619
Change-Id: I00b67eaec02d2e85ce60fb44eb3e582ce036be3a
2024-01-04 09:17:31 -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
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
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 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