Commit Graph

2110 Commits

Author SHA1 Message Date
Yuval Tassa 4aab00fa2d Minor cleanups to body and joint compilers.
PiperOrigin-RevId: 664824939
Change-Id: I6014ff10683849e2926f1b1c8df8b6862192cd00
2024-08-19 08:43:10 -07:00
Yuval Tassa 0fa39164f7 Speed up mesh support function with warmstarts.
PiperOrigin-RevId: 664807396
Change-Id: I9124e65efd9140a8e858b7b6be0867c26961477b
2024-08-19 07:54:50 -07:00
Taylor Howell 6241814ad7 Add velocity-dependent sensors to MJX. Includes: joint velocity, actuator velocity, and ball joint angular velocity.
PiperOrigin-RevId: 664461284
Change-Id: I5063f662d707fbe342493f9cd7993f009fac9c76
2024-08-18 08:47:35 -07:00
Taylor Howell 6a12787a32 Add camera projection sensor to MJX.
PiperOrigin-RevId: 664426007
Change-Id: I0f2681c156b12ab62503d45beb2cd8752e7202d6
2024-08-18 05:57:33 -07:00
Taylor Howell 51733c2a8a Add rangefinder sensor to MJX.
PiperOrigin-RevId: 664417458
Change-Id: I1ad7720e48541349f155984584314b2b49ccbf36
2024-08-18 05:15:58 -07:00
Taylor Howell 6acf40613d Add support for disabling MJX sensors.
PiperOrigin-RevId: 664410169
Change-Id: Icb278e9d7a9a493d5a61ab04c1300d8e412d0e83
2024-08-18 04:41:24 -07:00
Kyle Bayes 0bffd744f9 Add nativeccd flag. When this flag is enabled, general convex collision detection is handled natively, as opposed to using libccd.
PiperOrigin-RevId: 663859009
Change-Id: Ife18bb1de62f2154e4725fdf764484a18586b836
2024-08-16 14:08:35 -07:00
Erik Frey 390bce2352 Avoid placing arrays on device for unused MJX fields. Add `device` parameter to mjx.make_data.
PiperOrigin-RevId: 663808411
Change-Id: Ic55875f87f5c36b9dfe21e5ed5891d64c7003cab
2024-08-16 12:02:21 -07:00
Taylor Howell ce9c0ea351 Modify MJX sensor_pos to handle unsupported sensors.
PiperOrigin-RevId: 663768186
Change-Id: I2e7600e77855a96a47f012fb64b6cc43abbf6f64
2024-08-16 10:10:37 -07:00
Yuval Tassa 4d9305fbb9 Fix typo.
PiperOrigin-RevId: 663728400
Change-Id: Ifaf266a515bacb7b1598d14eb435561cb2375224
2024-08-16 07:45:38 -07:00
Yuval Tassa f864108c23 using for std::{string, string_view}, where helpful for readibility.
PiperOrigin-RevId: 663707900
Change-Id: Icbea374d5f99c7d267140d83f541f0ee872de8c1
2024-08-16 06:14:54 -07:00
Yuval Tassa e0e08aa597 Rename xml_native_writer variables to be consistent with xml_native_reader.
PiperOrigin-RevId: 663699130
Change-Id: If11ed48d3b30d3c6d09ca77e3d8048c2a3d9f054
2024-08-16 05:34:30 -07:00
Alessio Quaglino cfc7dc9848 Clarify that keyframes are not replicated in nested attachments.
PiperOrigin-RevId: 663683684
Change-Id: Id180b3a6afad6809d8189a7a525c474bd3a91fc1
2024-08-16 04:22:21 -07:00
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
Taylor Howell 6db96e07e4 Add position-dependent sensors to MJX: magnetometer, ballquat, subtreecom, framepos, framexaxis, frameyaxis, framezaxis, and clock.
PiperOrigin-RevId: 663668212
Change-Id: Ifc9adc6bff4544172ab22572da04a093aebfdbd4
2024-08-16 03:10:24 -07:00
Copybara-Service 6c76678167 Merge pull request #1906 from michael-ahn:fix-face-circumradius
PiperOrigin-RevId: 663667230
Change-Id: I61774565c2e453f9a25f1c81e3e898f2f22fd554
2024-08-16 03:06:24 -07:00
Michael Ahn 9924d9ca89 Fixed incorrect mesh face circumradius calculation
- In 8e2f830, this was changed from `mju_norm3` to `mjuu_normvec`, but the
  latter will mutate its input to be normalized instead of just
returning the norm (the former was likely mistaken as `mju_normalize3`
which does mutate its input).
2024-08-15 20:53:57 -07:00
Taylor Howell a74c184f9d Add efc_pos to MJX.
fixes #1388

PiperOrigin-RevId: 663358494
Change-Id: I63885f9208d12edbaa4b7d123ce4c6d16f40dcbe
2024-08-15 10:33:44 -07:00
Alessio Quaglino e0e134ca63 Add plugin tests for mjSpec.
Fixes #1903.

PiperOrigin-RevId: 663352920
Change-Id: I3a9e17aec5694e49c20b542f4b0a4402f88a2f17
2024-08-15 10:19:53 -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
Alessio Quaglino 4b88e9bebf Do not delete keyframes during mjs_detachBody.
PiperOrigin-RevId: 663281082
Change-Id: I6eedf8c5a3a422bcd78086f2fe30c2099f0b9d16
2024-08-15 06:10:43 -07:00
Yuval Tassa b2018ff506 Replace function with static array in engine_forward.c
PiperOrigin-RevId: 663268322
Change-Id: Ibd161a8eda55fc04cf37e465f0d0ac0adcfc7847
2024-08-15 05:11:38 -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
Yuval Tassa 1f5f9a8a67 Improve variable naming in xml_native_reader.cc
PiperOrigin-RevId: 663236609
Change-Id: I0a3af8432054172a3fe687867706eeef14a2529d
2024-08-15 02:42:30 -07:00
Yuval Tassa d932faa1d4 Flip order of cases in user_objects.cc (readability)
PiperOrigin-RevId: 663040865
Change-Id: I27d06a6a769d5bfc41189d270021b4fc1d4b5932
2024-08-14 13:49:11 -07:00
Alessio Quaglino 4c64e6f036 Add mocap state to SaveState/RestoreState and attached keyframes.
PiperOrigin-RevId: 662975257
Change-Id: I3edb44f34426525813033902caf31db16ad7b2ab
2024-08-14 10:42:49 -07:00
Alessio Quaglino 5927b3d4d9 Add time to attached keyframes.
PiperOrigin-RevId: 662886533
Change-Id: If9118a226250d2e806d184c9715c7e6a1390fd95
2024-08-14 05:47:43 -07:00
Alessio Quaglino 7be4df7e03 Add ctrl to attached keyframes.
PiperOrigin-RevId: 662878508
Change-Id: Ie273fae0220c8b257766cbbd90a880d44b901725
2024-08-14 05:14:49 -07:00
Alessio Quaglino afd7c73f44 Attach multiple keyframes.
Still missing: support for ctrl, mocap, and time.

PiperOrigin-RevId: 662871569
Change-Id: I8a418c4007663e3063d7146bd72db4eba78ddc5d
2024-08-14 04:42:54 -07:00
Yuval Tassa 2cb601c98d Improve documentation w.r.t smoothness, differentiability and finite-differencing.
PiperOrigin-RevId: 662848709
Change-Id: Icb7dc03a2c53d43d0d3a9e4ac95d963e5bc6853c
2024-08-14 03:11:38 -07:00
Yuval Tassa 7efd690471 Document where mesh transforms are saved, fixes #1894
PiperOrigin-RevId: 662836678
Change-Id: I060e3b1f29e82c6c3c188e730657cda7b99f63e9
2024-08-14 02:24:46 -07:00
Saran Tunyasuvunakool 1141b4abbc Force dtype of mjx.Contact.{geom1,geom2,geom} to int32.
This improves compatibility with MuJoCo.

PiperOrigin-RevId: 662655282
Change-Id: I2a336d9453f40cf0bfa85a7203b55709e23a07fe
2024-08-13 14:34:43 -07:00
Alessio Quaglino 19aa68c2b2 Add keyframe support to attach.
Limitations:
- Supports attaching a single keyframe. If multiple keyframes are present in the child, only the first one will be attached.
- Does not support time, ctrl, mpos, mquat.
- If mjs_detachBody is used, all keyframes are removed.
PiperOrigin-RevId: 662517666
Change-Id: If6e3839471e1884afc14e1a75e7ce1957c2f3581
2024-08-13 08:00:01 -07:00
Copybara-Service 98cd49d529 Merge pull request #1827 from abhihjoshi:open3d-removal
PiperOrigin-RevId: 662510404
Change-Id: I79b356eecddb3402c444cb16a305516bd724aef6
2024-08-13 07:33:23 -07:00
Kyle Bayes 39896f8064 Restructure mjCMesh for caching.
PiperOrigin-RevId: 662496475
Change-Id: I4c3a58a63ef2c3b1196b3e6b30eb556b5528ff7f
2024-08-13 06:40:36 -07:00
Copybara-Service 4ebf381b4d Merge pull request #1899 from saran-t:saran-t-patch-5
PiperOrigin-RevId: 662454010
Change-Id: Ie3d6c59dd787aefa3c95869a91451387783b6057
2024-08-13 03:51:18 -07:00
Saran Tunyasuvunakool 1132632627 Fix for benign UBsan signed-integer-overflow complaints.
When counting nl and nc, the nnz is optionally also counted when in sparse mode. However, the functions mj_nl and mj_nc unconditionally counts nnz into a temporary accumulator, then only afterwards check whether the output nnz pointer is NULL.

When not in sparse mode, ten_J_rownnz does not get initialized by mj_tendon, however mj_nl and mj_nc are accumulating potentially spurious data from ten_J_rownnz into the temporary accumulator. While the spurious result eventually gets discarded, UBsan nevertheless detects an integer overflow in the temporary accumulator.

PiperOrigin-RevId: 662443910
Change-Id: I78a9a088d4db7f16be779c7d669167d6fb3e4401
2024-08-13 03:08:41 -07:00
Alessio Quaglino e3814be8e6 Remove duplicated title from the changelog.
PiperOrigin-RevId: 662443493
Change-Id: Idf6d36aba168488f2752d7e167ed13c599acbd91
2024-08-13 03:06:31 -07:00
Saran Tunyasuvunakool acab66d799 Remove superfluous break statements. 2024-08-13 10:46:35 +01:00
Alessio Quaglino 851bb6eef4 Add option to mjspec for creating a texture directly from a buffer.
PiperOrigin-RevId: 662186527
Change-Id: I469c876681d52964ac971c0bb2ec3517224d3a3d
2024-08-12 12:29:08 -07:00
Kyle Bayes 20cae556ee Encapsulate BVH class members.
PiperOrigin-RevId: 662141171
Change-Id: Ica202d31dacc9cc500d0aeecded941b79002b9a1
2024-08-12 10:27:03 -07:00
Alessio Quaglino 648fd56ed1 Preserve time when recompiling a model.
Fixes #1890.

PiperOrigin-RevId: 662084324
Change-Id: I6aed40761cee5044e63426935d102123db295b25
2024-08-12 08:00:36 -07:00
Yuval Tassa d3a976e10d Fix indent.
PiperOrigin-RevId: 662035313
Change-Id: I30ec124e8144b8130623daa6b0802a46de124aec
2024-08-12 04:23:48 -07:00
Yuval Tassa d45d13e5ad Remove uses of mjtNum-typed functions from user_objects.cc
PiperOrigin-RevId: 662026275
Change-Id: Idfb2b6ced6eac4b4b60079e219aac63fc1d00b89
2024-08-12 03:45:43 -07:00
Yuval Tassa 02ffaa8248 Yet another GCC-related fix.
PiperOrigin-RevId: 661595661
Change-Id: Ib66a0d891533be50451adc850d7350532fc39d67
2024-08-10 05:32:28 -07:00
Yuval Tassa d72f01bad4 Add break statements in user_objects.cc to appease persnickety GCC
PiperOrigin-RevId: 661590599
Change-Id: I2d167ca92cc4d5230922d221c9267a2e8d018b40
2024-08-10 04:56:18 -07:00
Yuval Tassa e397fcb5a5 Add return values to private mjJCJoint methods.
PiperOrigin-RevId: 661438758
Change-Id: I08a77eb878703610ead526040d86f3f3fccb080b
2024-08-09 16:09:17 -07:00
Taylor Howell 466368efc6 Add shellinertia support for primitives: sphere, capsule, cylinder, ellipsoid, and box.
PiperOrigin-RevId: 661407997
Change-Id: Icddac58c540c71ea26ac7a3be874788443bd1122
2024-08-09 14:40:13 -07:00
Alessio Quaglino ec43ec7c30 Remove hard-coded nPOS and nVEL from mjCModel.
PiperOrigin-RevId: 661370196
Change-Id: Ib2c1876dfea55dbf496e2358000f24bbde29fc52
2024-08-09 12:53:55 -07:00
Alessio Quaglino da15aa6a0e Improve error message for fullinertia and orientation specifiers.
Fixes #1888.

PiperOrigin-RevId: 661359190
Change-Id: Ibe38e88024b4a43922352b42347abf1026f168a2
2024-08-09 12:20:27 -07:00