Commit Graph

2954 Commits

Author SHA1 Message Date
Sam Haves af088adaee Add mjPhysics schemas, starting with MjcPhysicsSceneAPI and MjcPhysicsSiteAPI
PiperOrigin-RevId: 757710745
Change-Id: Ia920abecdf8c6a05f61dd0fd3a8e6bc001ccc7d0
2025-05-12 04:57:52 -07:00
Yuval Tassa 85dd78d6f3 Add private function mj_makeM.
PiperOrigin-RevId: 757689756
Change-Id: Ie8bb49d9f18a95da2e3fd8622e30f9266a1ced98
2025-05-12 03:52:38 -07:00
Taylor Howell 9accc7ae51 Update mj_energyPos.
PiperOrigin-RevId: 757678945
Change-Id: If236b9e8f376a2673abc87e818326e9188f6c15a
2025-05-12 03:14:43 -07:00
Taylor Howell b0b2c48190 Update comment in mj_energyPos.
PiperOrigin-RevId: 757670899
Change-Id: I3827089f4298b3800c20ed64ca0ccfcf3ed83d92
2025-05-12 02:45:45 -07:00
Sam Haves 924ee3070a Modify user values in mujoco to allow users to provide cleanup functions to avoid memory leaks.
For the MJCF -> USD plugin, and I suspect other usecases for user values, it's necessary to give ownership of the object to Mujoco. However since they get type erased, we can't clean up the data automatically for the user. Instead this allows c++ clients to provide a cleanup function with their data.

PiperOrigin-RevId: 756832010
Change-Id: I80b8e7822e1a0e399a0d19dcaa57ee69b3ccc16a
2025-05-09 11:03:06 -07:00
Taylor Howell baf84265b8 Improve wrap_circle.
PiperOrigin-RevId: 756704385
Change-Id: Id44ba317c6072790763a958f4227a76278d3ab74
2025-05-09 04:13:14 -07:00
Alessio Quaglino ad80a4625b Always generate a BVH in flex.
The BVH is used also for computing normalized vertex coordinates in the trilinear interpolation, so we need to compute it also when the flex cannot collide.

PiperOrigin-RevId: 756349244
Change-Id: Ib397c472e31251df5a7ea85850d83a62f3b2c949
2025-05-08 09:46:47 -07:00
Kyle Bayes f4774a5449 Fix bug in cached meshes where convex hull was missing. Previously if a mesh was copied from the cache it would not have its convex hull if the original mesh that was cached didn't previously compute it.
Fixes #2609

PiperOrigin-RevId: 756223337
Change-Id: I54705456636c270607a17340b249047e0df75d0b
2025-05-08 02:42:15 -07:00
Baruch Tabanpour 6cfea71985 Allow for different MJX backend implementations.
PiperOrigin-RevId: 755935704
Change-Id: Ic135cd00137c2857c73c683ed9fdc5ac4418715d
2025-05-07 11:28:39 -07:00
Baruch Tabanpour 421c487d9d Set mocap_pos/quat in make_data. Fixes #2606.
PiperOrigin-RevId: 755903897
Change-Id: Ied04e9bd3febfe1bbbba24ed1f52b3c0c6e50f38
2025-05-07 10:13:17 -07:00
Yuval Tassa ecb769fc3a Refactor islands to be memory contiguous.
PiperOrigin-RevId: 755803476
Change-Id: I41972b07e0d5ef5d0117c94f565b93367b87458b
2025-05-07 05:06:27 -07:00
Alessio Quaglino 449de73430 Do not skip cow and touch_grid during WriteReadCompare.
PiperOrigin-RevId: 755370618
Change-Id: I90dfe66b20c316b19c943eab8d031f5aef187fa7
2025-05-06 07:54:39 -07:00
Robin Alazard 253abad210 Add MeshCollisionAPI to collider Meshes with convexHull approximation.
PiperOrigin-RevId: 754014642
Change-Id: I44cff505a2b9b7120a38f8c896b2c6560ce51c43
2025-05-02 08:35:15 -07:00
Sam Haves ab63a7e824 Add CMakeLists for usdMjcf file format plugin.
This adds an option MUJOCO_BUILD_USD_PLUGINS to the top level CMakeLists which allows us to build the usdMjcf file format plugin with the rest of mujoco.

In this first version, we allow building against either standalone USD or against Houdini (DCC) since it has it's own fork of USD. When building against standalone USD we also build the file format tests.

PiperOrigin-RevId: 753969974
Change-Id: If691eecbddf45d18b7c4ff76f7650999d42e99c5
2025-05-02 05:48:33 -07:00
Robin Alazard 02656532c2 Fix Mesh PhysicsCollisionAPI by accounting for how it's referenced/instanced.
Because we introduce an additional parent scope when referencing a `Mesh` prim (required for instancing), we need to create an `over` prim that allows to actually operate on the to-be-referenced Mesh.

PiperOrigin-RevId: 753941355
Change-Id: I829be9e82fe650802afcbc46f4b2f4c81eb53bd1
2025-05-02 03:47:31 -07:00
Sam Haves 6c319310b8 On Darwin archs, add ArchConstructEntry using to placate compile errors.
PiperOrigin-RevId: 753235230
Change-Id: I621fd879ba1a0e6b7668454386f35ae76a190c13
2025-04-30 11:01:41 -07:00
Sam Haves bb07fa0c78 Move Mujoco USD test fixture out of MJCF plugin directory and rename to test_utils.
PiperOrigin-RevId: 753183581
Change-Id: Iedd6594ac679ca026f8af29c647d18ae93003a53
2025-04-30 08:44:14 -07:00
Sam Haves 177fce9fa1 Remove absl dep and custom MujocoTest from usd plugin tests.
PiperOrigin-RevId: 753144576
Change-Id: I3d4fd470c698967a50b189b99c1bb808a9a80306
2025-04-30 06:34:52 -07:00
Robin Alazard 45d3fef2fc Add initial support for colliders
By default every geom is a collider unless contype=conaffinity=0.

PiperOrigin-RevId: 753108713
Change-Id: I0e1a81b254c41e9103c34f69696205ff5c0bd6dc
2025-04-30 04:15:39 -07:00
Yuval Tassa 7742f62803 Add mju_mulSymVecSparse, private engine function
Multiply sparse symmetric matrix (only lower triangle represented) by vector

PiperOrigin-RevId: 752926934
Change-Id: I5aaae1266256aa88aee8c25e242b7a7c51ea8dd7
2025-04-29 16:33:54 -07:00
Yuval Tassa 1766a388cc Improve warmstarting if island structure exists.
PiperOrigin-RevId: 752901506
Change-Id: I062d14df7da7d9dc1a2c1c30a16d0db7215af336
2025-04-29 15:18:14 -07:00
Yuval Tassa 4c92c60988 Remove time from test model keyframe
PiperOrigin-RevId: 752847956
Change-Id: Iebc28c4c73d39c3d37c5fa7abd53ea8a9e11f7f9
2025-04-29 12:56:40 -07:00
Yuval Tassa 8078a45727 Add private functions mju_blockDiag and mju_blockDiagSparse
PiperOrigin-RevId: 752815446
Change-Id: Ia7f73160315ce57b78a2c34bc781f00e1b0f05c4
2025-04-29 11:31:03 -07:00
Robin Alazard d657e628f0 Fix radius sizes of geom shapes
PiperOrigin-RevId: 752750452
Change-Id: I2ac08ad4014718320f014ed8ba7cc3b87586f6c0
2025-04-29 08:44:50 -07:00
Alessio Quaglino 3e9d130092 Add mjs_getPluginAttributes.
PiperOrigin-RevId: 752691116
Change-Id: Ib503a99f8d10661b8bf92410ccf471420f924986
2025-04-29 05:19:09 -07:00
Yuval Tassa 2545ec5383 Don't call getchar on error.
PiperOrigin-RevId: 752680097
Change-Id: Idce87a3e33ebce703bf3eedc18026f6a13d05f35
2025-04-29 04:37:22 -07:00
Alessio Quaglino 75f196c7ef Add missing PointToLocal call in mjCPlugin copy constructor.
PiperOrigin-RevId: 752486555
Change-Id: I08b14476b9098e6473a4c00918ef3f9a287f35f6
2025-04-28 16:23:45 -07:00
Google DeepMind 4137a4c774 Bump version to 3.3.3 following the 3.3.2 release
PiperOrigin-RevId: 752482043
Change-Id: I3dae8a0b9de2be4d456e856825c18f16f62bf51a
2025-04-28 16:09:25 -07:00
Google DeepMind 1dc5bcb04a Update changelog for 3.3.2 release
PiperOrigin-RevId: 752389725
Change-Id: I0976279bece09a099b6a34029575b24ba2d8fd1b
2025-04-28 11:46:41 -07:00
Alessio Quaglino fb30e0e00c Add docs for mjSpec serialization.
PiperOrigin-RevId: 752230683
Change-Id: Id237ccc1b265e99bf15892f8fd208ba38f4c6ded
2025-04-28 02:58:46 -07:00
Google DeepMind d3bc0544d3 Add basic support for geom rgba.
Adds primvar:displayColor/primvar:displayOpacity to the geom prim if its rgba attribute differs from the default (0.5, 0.5, 0.5, 1.0).  This sets the color and opacity directly on the prim with no need for an external material, making it consistent with how rgba is used in mujoco.

PiperOrigin-RevId: 751013128
Change-Id: I059943ec5b266e62c3696d9a0ac4f2033db9e07f
2025-04-24 08:59:02 -07:00
Google DeepMind 8df3614781 Add support for plane geometry.
PiperOrigin-RevId: 750994019
Change-Id: Ia3b085bed5b8e2fcdb00ffc69dd5551a7fa3c30d
2025-04-24 07:54:56 -07:00
Kyle Bayes 9e72874801 Remove EPA tolerance in the discrete case in nativeccd.
PiperOrigin-RevId: 750649926
Change-Id: I8ab317cd6b227c9486a2916ae9c6445906c23401
2025-04-23 10:52:14 -07:00
Yuval Tassa 8f768be2da Remove solver_nisland field from mjData.
PiperOrigin-RevId: 750527660
Change-Id: I6b34944c92483ea2abc774df75efd868255a2bac
2025-04-23 03:27:41 -07:00
Yuval Tassa c2ac0d724e Add mju_gather and mju_scatter, private engine functions.
PiperOrigin-RevId: 750245294
Change-Id: I3a14ccdd55a324d3fe206e388fb2a513772f5f5e
2025-04-22 10:33:33 -07:00
Alessio Quaglino 99490163df Prevent NaN in cylinder SDF.
Fixes #2573.

The correction matches the one used in MJX (see _cylinder_grad in collision_sdf.py).

PiperOrigin-RevId: 747887406
Change-Id: I1a4f1ac769adb96c98665eace7ce54fb09a7d3a2
2025-04-15 08:34:05 -07:00
Taylor Howell d168135189 Remove duplicate test_tendon_force_clamp from inverse_test.py.
PiperOrigin-RevId: 747835971
Change-Id: I96ca7a2e3f71dbc05af238c269a81b41b51fa48b
2025-04-15 05:40:25 -07:00
Saran Tunyasuvunakool 71a7004057 Fix array extent parsing logic for introspect.
Also fix the mjxmacro_test to correctly assert that all array extents defined in the X macros can be correctly parsed from field comments.

PiperOrigin-RevId: 747808525
Change-Id: I0b08dc263f8a46118a07200ae044d6c491207245
2025-04-15 04:03:04 -07:00
Alessio Quaglino ec186430ef Add setting plugin config properties via Python bindings.
PiperOrigin-RevId: 747421357
Change-Id: Ie80f1a889f2f6ec457c1e16193fa0694e07d3fe9
2025-04-14 08:07:14 -07:00
Taylor Howell f317bd17c3 Add tendon actuator force sensor to MJX.
PiperOrigin-RevId: 747344916
Change-Id: Iab513ff953408c002216ffff12e3f8c825cedc10
2025-04-14 03:51:20 -07:00
Google DeepMind 8e7457d7c6 Initial support for writing UsdPhysics data starting with UsdPhysicsRigidbodyAPI support.
The SDF_FORMAT_ARGS `usdMjcfToggleUsdPhysics` is introduced to toggle writing UsdPhysics or not when converting. Off by default

PiperOrigin-RevId: 746467942
Change-Id: I26cb9a4c4ae2eef96163dab967a74f14940a2a6d
2025-04-11 08:19:11 -07:00
Gabe Oppenheimer 006c18b1d8 Update numbering in the 3.3.1 release notes to give MJX a numbered bullet in the docs.
PiperOrigin-RevId: 746455557
Change-Id: I04849ed1a5b97c0f6408d2333b13419e6cd35688
2025-04-11 07:37:24 -07:00
Sam Haves 446a8f1742 Add basic site support to Mjcf SdfFileFormat plugin.
We will still need to tag these with a custom API schema to ease round-tripping but that will follow creation of such a schema.

PiperOrigin-RevId: 746421793
Change-Id: I2df2209b4bc90d763718fb4bea8158b8598755c6
2025-04-11 05:28:03 -07:00
Gabe Oppenheimer 440ce5eb7a Update the version number to 3.3.2 following the 3.3.1 release.
PiperOrigin-RevId: 746147577
Change-Id: Idb7b4e7e06a4730b4f2eea8f6600b898e998f8db
2025-04-10 13:17:20 -07:00
Alessio Quaglino a209134315 Enable procedural plugin activation in Python bindings.
PiperOrigin-RevId: 746055614
Change-Id: Idcc2f62fdfeccdca356e3d1acadf168b46a98881
2025-04-10 09:13:21 -07:00
Kyle Bayes b1f8d444f2 Fix bug in replaceSimplex3 in nativeccd.
PiperOrigin-RevId: 746014344
Change-Id: I93b32ab5f67ee48ab72238de53f7cda07638cb79
2025-04-10 07:04:27 -07:00
Yuval Tassa 25126e88c7 Move mju_cholFactorCount to engine_util_solve.
PiperOrigin-RevId: 746011856
Change-Id: If9812251420053644f4eca81adb5116d370ee524
2025-04-10 06:56:31 -07:00
Taylor Howell 3c530976e3 Add rne_postconstraint dependence for FRAMELINACC and FRAMEANGACC sensors to MJX.
PiperOrigin-RevId: 746009774
Change-Id: Ide45298b463f1ad04f1ffa7f60a7a8aeaf18f063
2025-04-10 06:48:40 -07:00
Taylor Howell 51c489fc30 Add inverse dynamics to MJX.
PiperOrigin-RevId: 745998273
Change-Id: I203af89332ace5d7a60fff3ec6ff4cc88c02340d
2025-04-10 06:08:41 -07:00
Yuval Tassa d3664b5d01 Avoid square root in mju_makeFrame
PiperOrigin-RevId: 745974380
Change-Id: I90879fac05e62daf60acd2223f814e833634b242
2025-04-10 04:41:23 -07:00