Commit Graph

721 Commits

Author SHA1 Message Date
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 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
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 c2ac0d724e Add mju_gather and mju_scatter, private engine functions.
PiperOrigin-RevId: 750245294
Change-Id: I3a14ccdd55a324d3fe206e388fb2a513772f5f5e
2025-04-22 10:33:33 -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
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
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
Mohammad Hamid 3429a4881a Detect mismatch between maxNodes and Nodes in a gmsh block. Fixes #2342
PiperOrigin-RevId: 745967745
Change-Id: If1b5fcd71079a0e6a6def9b442758678e31a5828
2025-04-10 04:15:21 -07:00
Kyle Bayes 85b323c7fb Remove square roots when possible in EPA improving numerical precision.
PiperOrigin-RevId: 745559836
Change-Id: I3f8b23406e93ccfc4bc3499bfbed829b35462a74
2025-04-09 06:18:51 -07:00
Taylor Howell 96dda6ea75 Add tendon actuator force limits and tendon actuator force sensor.
PiperOrigin-RevId: 745096883
Change-Id: Ib9acb727fbbfc6b0b0323ee6a889053a7a878056
2025-04-08 05:16:35 -07:00
Kyle Bayes 606f00f802 Remove contact pruning with box-box collisions in nativeccd and add benchmarks.
PiperOrigin-RevId: 744732382
Change-Id: I2e20b646c541ee99888f1e964302d1b4363b2dc4
2025-04-07 08:34:04 -07:00
Alessio Quaglino d7027fb1c0 Do not skip mjSpec's with repeated model names when attaching a new mjSpec.
PiperOrigin-RevId: 744705838
Change-Id: Ie47a3c029f443910629619b7f9ff43ab07646725
2025-04-07 06:52:12 -07:00
Kyle Bayes 58234b2217 Replace mjMAXVAL with numerical max limit where necessary in nativeccd.
PiperOrigin-RevId: 744693156
Change-Id: I72c3122701be281d468291dfc2ad1e4bb1da5a1c
2025-04-07 05:59:02 -07:00
Alessio Quaglino cc2f57d820 Change mjSpec and mjModel signature mechanism.
The signature now contains the necessary information to safely perform `bind`. The private UIDs are now removed.

Fixes an issue of changing signature when compiling a copy of an mjSpec.

PiperOrigin-RevId: 744670626
Change-Id: Id3c66419cf2afbe78e91bc4b37d2299f5ec00ab1
2025-04-07 04:21:27 -07:00
Yuval Tassa d05251af2a Add tendon armature
PiperOrigin-RevId: 743939992
Change-Id: I587214f5d6fabbc0cc273c33d82decbe9ad8f919
2025-04-04 07:44:04 -07:00
Yuval Tassa e1f5ceb65a Add mjModel.tendon_armature (in preparation, not yet implemented)
PiperOrigin-RevId: 743649968
Change-Id: I1d893e3e06afc48b652575bc7837750ab3573670
2025-04-03 12:06:27 -07:00
Yuval Tassa f96f3e1c22 Add XML compiler/saveinertial flag. Fixes #2405
PiperOrigin-RevId: 743607654
Change-Id: I1f2e61be89b79c1995e079f36aa285096f9fb441
2025-04-03 10:12:42 -07:00
Alessio Quaglino 8941f56e86 Copy UIDs during mj_copySpec.
This will produce the same mjSpec signature after a deep copy.

PiperOrigin-RevId: 743538018
Change-Id: Ic0f5b06a00e8883cb92dc98159db3bea02cb7a36
2025-04-03 06:29:07 -07:00
Yuval Tassa e5912c3ce4 Use tolerance to compare quaternion components in UserObjectsTest.Inertial
Fixes #2515

PiperOrigin-RevId: 742704324
Change-Id: Ib26891e43128e66d2ac1840ed574285781fb12a5
2025-04-01 08:12:01 -07:00
Alessio Quaglino a02a27d4a4 Combine all mjs_attach functions into one.
PiperOrigin-RevId: 742702092
Change-Id: I89e35c59ada017cd061e2031584eeea71776743d
2025-04-01 08:05:58 -07:00
Kyle Bayes 08d22baea1 Fix bug in horizon code in nativeccd where parallel faces are included in horizon.
PiperOrigin-RevId: 742687622
Change-Id: I4a180cb9c7451e0a2c22ffd77b7b6f6fd68836a4
2025-04-01 07:21:14 -07:00
Kyle Bayes 9ecec6f238 Fix bad contact from passing through polytope2 in nativeccd.
PiperOrigin-RevId: 742666700
Change-Id: I76034579b4e663f9abfa265ec3e2bc608f631f59
2025-04-01 06:11:20 -07:00
Alessio Quaglino 648a03c2cf Override inertia of body with visual geoms if discardvisual is true.
Fixes #2546.

PiperOrigin-RevId: 742650702
Change-Id: I753c1e1c89da732ece100676644bbecf9d6373bb
2025-04-01 05:21:48 -07:00
Alessio Quaglino 86c970bc23 Add error checking in mjs_setFrame.
Also raise error if the frame is not found in the mjCBody copy constructor.

Fixes #2543.

PiperOrigin-RevId: 742624013
Change-Id: I4999b3165c97f8d079412214d027ca7a8dae8cb3
2025-04-01 03:34:48 -07:00
Yuval Tassa 05f3e914b0 Improve armature documentation
PiperOrigin-RevId: 742583729
Change-Id: I18d1c95a91f4d70b842c680d4a0f4d0b04476894
2025-04-01 01:16:58 -07:00
Alessio Quaglino 01d4c46753 Store the mjsCompiler -> appended mjSpec map when appending an mjSpec.
Previously, we stored the source `mjSpec` during a copy as a hack for having access to the compiler options, but this is not robust since we cannot guarantee that 1) the source `mjSpec` is not destroyed before we need to look up the compiler options nor 2) that the `mjSpec` was appended without a copy.

While 2) could be solved by simply handling an additional case in `mjCModel::FindSpec`, using a map also solves 1) and it is easier to understand.

PiperOrigin-RevId: 741504264
Change-Id: Iab1bfd9e61299a94fa8caf3a244c067b09d54384
2025-03-28 06:27:22 -07:00
Google DeepMind 644b42bee3 Add mujoco/experimental and move USD work there.
PiperOrigin-RevId: 740730698
Change-Id: If9c68798cda502d6d7632906a034437e2557802e
2025-03-26 05:37:45 -07:00
Kyle Bayes d6943731b2 Fix bug in nativeccd multiccd.
PiperOrigin-RevId: 740495321
Change-Id: I7eaa0da8514e27c233d49567c276d1d238808d1f
2025-03-25 14:56:21 -07:00
Yuval Tassa c931565fdc Add internal functionmj_tendonDot: time derivative of tendon Jacobian for one tendon.
Notes:
- Currently always uses dense math, even for sparse models. This should be easy to change in the future.
- Does not support geom wrapping. This is possible but harder, requires derivatives of mju_wrap.
PiperOrigin-RevId: 740378741
Change-Id: Id39ef2c4bfbb7ee11ec33c97d7d83140441cdab2
2025-03-25 09:36:30 -07:00
Kyle Bayes 12b40b948e Remove MuJoCo stack calls in nativeccd.
1. There is now thread local static memory for use with a conservative max number of iterations needed for contact.
2. For possible needs of high precision contact recovery with large iteration numbers (i.e. ellipsoid-ellipsoid collisions), there are callbacks to allocate memory when needed.

PiperOrigin-RevId: 739187134
Change-Id: I3d210f75218922d969c78465da3fe50da4fe3080
2025-03-21 08:20:51 -07:00
Alessio Quaglino dc96ed6bdb Remove plugins that are not referenced after detaching a body.
Fixes #2497.

Also, use `Release()` instead of `delete` for removing elements when detaching a body in order to preserve correct reference count.

PiperOrigin-RevId: 739133888
Change-Id: I7ccfad84446fb15259bad30c4ba1e6f7fa601518
2025-03-21 04:34:05 -07:00
Tom Power 8d92a0fbe6 Clear body subtreedofs when compiling. Fixes issue when attaching previously compiled model.
PiperOrigin-RevId: 738906593
Change-Id: I74875b4d07c422e397358dff5daf6682ec1bd655
2025-03-20 12:52:36 -07:00
Kyle Bayes 467a63d203 Add BoxBox to ccd benchmarks.
PiperOrigin-RevId: 738761460
Change-Id: If59d306748d64e9e30abe65daa746a4f8e9ec78c
2025-03-20 05:16:33 -07:00
Tom Power be64747166 add mjs_detachDefault to delete a default class from mjSpec
PiperOrigin-RevId: 738452369
Change-Id: I5a53a6dc8f89e1e8136aeefc09d7d9b7b7204e1f
2025-03-19 10:31:04 -07:00
Alessio Quaglino 209d2bd2c5 Added functionality for user payload data in mjSpec.
PiperOrigin-RevId: 738343134
Change-Id: I6217362ced9993afcd5a2914c78718ffe3bf753a
2025-03-19 04:36:00 -07:00
Alessio Quaglino bae5175cf2 Accumulate rotation after updating pos and quat in replicate.
Fixes #2501.

PiperOrigin-RevId: 737929158
Change-Id: I0cad2de37190f1d30d427ae646acbde335b5be56
2025-03-18 02:51:05 -07:00
Alessio Quaglino 35774706ee Set parent frame of new frames after copying all frames.
PiperOrigin-RevId: 737620918
Change-Id: I8f49570cab39bd84b2da908d3683dddc3b29cb3c
2025-03-17 08:19:04 -07:00