Commit Graph

106 Commits

Author SHA1 Message Date
Yuval Tassa 0e04436d51 Remove `mjWARN_VGEOMFULL, handle visual geom buffer full warnings in mjvScene`.
PiperOrigin-RevId: 896483023
Change-Id: I6dde2c20d8e8e229cf95e1f002dd10525d3376e6
2026-04-08 07:17:53 -07:00
Sam Haves ef78f07ffb Automated g4 rollback of changelist 885555524.
*** Reason for rollback ***

Rolling back obj/stl decoder inclusion as sources due to broken windows build.

*** Original change description ***

Include obj and stl decoder plugins as sources in CMake builds.

This removes the need to load these decoders via mj_loadAllPluginLibraries when using MuJoCo built with CMake. Other plugins are unchanged.

***

PiperOrigin-RevId: 885576586
Change-Id: I31e6fa4d10697862f7d800d0d771ca752747e36d
2026-03-18 07:18:19 -07:00
Sam Haves 15ca42ff68 Include obj and stl decoder plugins as sources in CMake builds.
This removes the need to load these decoders via mj_loadAllPluginLibraries when using MuJoCo built with CMake. Other plugins are unchanged.

PiperOrigin-RevId: 885555524
Change-Id: I20aa5b6c55b678398345d49cb1c47667ae2bebcf
2026-03-18 06:23:26 -07:00
Yuval Tassa efae9157a7 Polynomial stiffness and damping https://youtu.be/aKa3ZlEF9_Y
PiperOrigin-RevId: 884607673
Change-Id: If8088dbf37fed1055304778a7eb84dec52cba920
2026-03-16 13:25:25 -07:00
Copybara-Service 9362031644 Merge pull request #3112 from LouRohanNV:fixUsdEqualities
PiperOrigin-RevId: 880843178
Change-Id: I23e817364772abab6cea9a0b92f7681b1372c2db
2026-03-09 07:19:09 -07:00
Copybara-Service cc9a474ed8 Merge pull request #3148 from LouRohanNV:usd-visual-prim-mesh-inertia
PiperOrigin-RevId: 880822823
Change-Id: Ib1fe2e4b500f64f44e306eb6adacf8b1c5e39ceb
2026-03-09 06:22:17 -07:00
Sam Haves ed0d7ba29f Move STL handling to a mjpDecoder.
PiperOrigin-RevId: 880820344
Change-Id: Ib3a714dd9698335433e518ed6af17d7b8407a8fb
2026-03-09 06:15:04 -07:00
Lou Rohan a1bc4f219f Parse UsdPhysicsJoint enabled attr to set equality->active 2026-03-05 15:45:30 -06:00
Lou Rohan 42ee943ec5 Fix USD equality decoding
- handle when body0 or body1 are the default prim/world
- add site-based equalities to the constrainst list so they aren't skipped
- support connect constraints by checking for spherical joints
2026-03-05 13:31:32 -06:00
Copybara-Service fce504beea Merge pull request #3129 from LouRohanNV:UsdContactExcludes
PiperOrigin-RevId: 879028113
Change-Id: I8798761bf40a8e60ef9aba83337bcabd96813cb9
2026-03-05 06:15:59 -08:00
Sam Haves b25f8433fe Refactor USD connect and weld equality decoding to align with MuJoCo's relpose semantics.
The relpose in mujoco represents the anchor in body1 space and the relative orientation of body2 in body1 space. Previously we were computing it as the relative position of body2 from body1 space.

Further, we now properly account for the setting of strictly the anchor and not the relpos by setting localPos0 *only*.

PiperOrigin-RevId: 878506356
Change-Id: I83fc7e97cd1a891e17f0bb091f8950b581be0e01
2026-03-04 08:34:09 -08:00
Lou Rohan 1378ab6d58 Fix indentation 2026-03-04 09:55:59 -06:00
Lou Rohan b1908c475c Call ParseMjcPhysicsMeshCollisionAPI() on visual prims that have an inertia attribute 2026-03-03 15:13:23 -06:00
Sam Haves 91d3565cd5 Move OBJ handling to a mjpDecoder.
PiperOrigin-RevId: 878041994
Change-Id: I6e7f6876e65fd2184ff5637d4268644cefcabecf
2026-03-03 11:22:02 -08:00
Sam Haves 0ec836b281 Rollback of Move OBJ handling to a mjpDecoder.
PiperOrigin-RevId: 875705083
Change-Id: I21403d84abd56ef72de915bddc724fe3efa506e6
2026-02-26 07:04:39 -08:00
Sam Haves b907ffedaa Move OBJ handling to a mjpDecoder.
PiperOrigin-RevId: 875194599
Change-Id: I2cccc683d69a217f1817e70d16bc1815e366d00c
2026-02-25 09:13:09 -08:00
Lou Rohan e895820e24 Check for the UsdPhysicsFilteredPairsAPI in the body parsing function 2026-02-23 12:51:02 -06:00
Lou Rohan 4fe8f73e44 Add USD parsing for contact excludes
- Contact excludes use the UsdPhysicsFilteredPairsAPI schema. Body1 is the body with the schema, body2 is contained in the list of filtered targets within the schema.
2026-02-23 12:44:48 -06:00
Copybara-Service 7ef3ae6ad1 Merge pull request #3061 from LouRohanNV:fixUsdMaterialInterfaces
PiperOrigin-RevId: 868177637
Change-Id: I2de8f2af3b5fc126d103256b1ea00c5f8c7a8955
2026-02-10 09:12:10 -08:00
Sam Haves e93a69ea01 Add MjcPhysicsEqualityConnectAPI to MjcPhysics for equality/connect parsing.
PiperOrigin-RevId: 867736241
Change-Id: I2d4e9abcb14280dcfbbf63ff5f888fb57350cfb6
2026-02-09 13:02:42 -08:00
Sam Haves c63ba211e5 Refactor MjcPhysics EqualityJointAPI polynomial coefficients.
The single array attribute `mjc:polycoef` has been replaced by five individual double attributes: `mjc:coef0`, `mjc:coef1`, `mjc:coef2`, `mjc:coef3`, and `mjc:coef4`.

PiperOrigin-RevId: 865947359
Change-Id: If9d14a77b0a06e5dc712eeadd6e9402411570706
2026-02-05 07:56:11 -08:00
Sam Haves 7b0b3cf8e3 Set CMAKE_INSTALL_RPATH for USD decoder plugin.
PiperOrigin-RevId: 865918418
Change-Id: If56b83925301b8d02411c35ae5906901a8dd97f8
2026-02-05 06:37:18 -08:00
Lou Rohan c6e982cfac Add support for USD material interfaces
- use GetValueProducingAttributes() for improved input resolution.
- use std::filesystem  to avoid leaking file handles
2026-01-30 10:28:13 -06:00
Sam Haves f434578d30 USD decoder improvements: Support actuators targeting tendons and improve side site index handling.
Adds support for mjTRN_TENDON actuators in the USD decoder. Modifies the tendon path parsing to correctly handle side site indices, allowing -1 to signify no side site for a given path element.

PiperOrigin-RevId: 862755621
Change-Id: I18b13b160e3d1c27945d0972a69012d6307131e9
2026-01-29 08:51:02 -08:00
Sam Haves 2582a83ac3 Add equalityJointAPI to mjcPhysics.
PiperOrigin-RevId: 860081702
Change-Id: Ifd961dcb2a8e0f5d885e9e9dadc0153b03cb5f4d
2026-01-23 06:28:29 -08:00
Sam Haves c08e1d9e6e Add MjcEqualityAPI as a base class for MuJoCo constraints and MjcEqualityWeldAPI for representing weld constraints.
This change introduces two new USD API schema:
* MjcEqualityAPI - base API for representing MuJoCo equality constraints in USD, this will typically be applied to joints such as UsdPhysicsFixedJoint.
* MjcEqualityWeldAPI - extends MjcEqualityAPI for MuJoCo's weld equality constraints with an attribute for torqueScale.

The usd_decoder is updated to parse UsdPhysicsFixedJoints and convert the new schema attributes into the appropriate mjsEquality data fields.

PiperOrigin-RevId: 856723634
Change-Id: I0982fd3168b643f8e91d87bb5ae5933e526b63a1
2026-01-15 10:44:27 -08:00
Sam Haves d816b38f4c mjcPhysics MjcTendon path now has an indices attribute to allow repeated sites in tendon path.
Since relationships in USD can only contain a single instance of a path, it was previously impossible to have a tendon path that visits the same wrap target more than once. This is a fairly common occurence when dealing with tendons that have pulleys.

With this change, if mjc:path:indices is not defined then the behaviour is as it was and the mjc:path is considered to be ordered. If it is authored then the parser will use the indices into mjc:path as the order. This mirrors other similar concepts in USD such as face vertex indices.

PiperOrigin-RevId: 856339887
Change-Id: I6b9503973de377acdb0689be168c16e4aa19b70b
2026-01-14 13:24:28 -08:00
Sam Haves a5dc57c0c3 Move OpenUSD parsing to usd_decoder
Add usd_decoder to mujoco/plugin.
  - Previously was src/experimental/usd/usd_to_mjspec.cc, now that same spec is returned by the plugin.

PiperOrigin-RevId: 854350962
Change-Id: Ia980190a557c50ce8197980922a2594b613859b4
2026-01-09 14:48:29 -08:00
Alessio Quaglino 51babec9c5 Move tactile sensor to the engine.
PiperOrigin-RevId: 788863133
Change-Id: I3172ebb7641fa8146469da25cba7db794760e7b1
2025-07-30 05:27:44 -07:00
Alessio Quaglino 4bbd0fb9c7 Do not store grid edges in tactile sensor.
This is in preparation for extending support to store the grid as a mesh.

PiperOrigin-RevId: 786281232
Change-Id: Ic718c2d2e1891cf0b66113270fd3c98acc1e74a5
2025-07-23 08:00:51 -07:00
Alessio Quaglino 0eb2f9f118 Use meshid in touch sensor for mesh geoms.
PiperOrigin-RevId: 784575734
Change-Id: Ibca753273c67128c6c1421dad8413814dce31182
2025-07-18 07:23:04 -07:00
Alessio Quaglino e23226509c Tidy up of touch stress plugin.
PiperOrigin-RevId: 784186240
Change-Id: I47298ff2b7676a540781561817670c5f00c1b63a
2025-07-17 08:14:49 -07:00
Alessio Quaglino 5069534a5c Small (~10%) performance improvement in touch sensor by avoiding a transpose.
PiperOrigin-RevId: 783682096
Change-Id: I8311ee8fe9f64996db852969a70398c66fca4e48
2025-07-16 03:05:05 -07:00
Alessio Quaglino 4ea778f2d3 Add octree support to MJX API.
Also, enable the touch sensor to use the octree SDF.

PiperOrigin-RevId: 783313462
Change-Id: I0032c2a7164f4770aa10a3612db3fd70bea954db
2025-07-15 06:44:43 -07:00
Alessio Quaglino bbb265da4a Do not draw touch sensor grid if contact point vis flag is disabled.
PiperOrigin-RevId: 781908115
Change-Id: Id42206b1d8b6766352071e20150e2a4047895bf7
2025-07-11 03:11:26 -07:00
Alessio Quaglino cef02fabea Remove sdflib plugin and move interpolation to engine_collision_sdf.
Before:
```
 Simulation time      : 1.71 s
 Steps per second     : 5854
 Realtime factor      : 11.71 x
 Time per step        : 170.8 µs

 Newton iters / step  : 2.19
 Contacts / step      : 3.45
 Constraints / step   : 13.79
 Degrees of freedom   : 12
 Dynamic memory usage : 0.2% of 14M
```

After:
```
 Simulation time      : 1.41 s
 Steps per second     : 7093
 Realtime factor      : 14.19 x
 Time per step        : 141.0 µs

 Newton iters / step  : 2.19
 Contacts / step      : 3.45
 Constraints / step   : 13.79
 Degrees of freedom   : 12
 Dynamic memory usage : 0.2% of 14M
```

PiperOrigin-RevId: 781087896
Change-Id: Iaf69dccc5e95af5bac862344683c74f962162186
2025-07-09 09:29:47 -07:00
Alessio Quaglino 96118da08b Move SDF precomputation to the mujoco compiler.
Before:
```
 Simulation time      : 2.24 s
 Steps per second     : 4472
 Realtime factor      : 8.94 x
 Time per step        : 223.6 µs

 Newton iters / step  : 2.47
 Contacts / step      : 3.37
 Constraints / step   : 13.49
 Degrees of freedom   : 12
 Dynamic memory usage : 0.2% of 14M
```

After:
```
 Simulation time      : 1.71 s
 Steps per second     : 5854
 Realtime factor      : 11.71 x
 Time per step        : 170.8 µs

 Newton iters / step  : 2.19
 Contacts / step      : 3.45
 Constraints / step   : 13.79
 Degrees of freedom   : 12
 Dynamic memory usage : 0.2% of 14M
```

PiperOrigin-RevId: 781075182
Change-Id: Ie509047ff581ab0df4b10bbd394c27d350ab5a13
2025-07-09 08:57:09 -07:00
Alessio Quaglino b81f1db8af Replace SdfLib with linear octree interpolation of TriangleMeshDistance.
Temporary changes to the octree:
- Changed frame from mesh to geom

Before change (tolerance 1e-3):
```
 Simulation time      : 2.34 s
 Steps per second     : 4275
 Realtime factor      : 8.55 x
 Time per step        : 233.9 µs

 Newton iters / step  : 2.26
 Contacts / step      : 3.69
 Constraints / step   : 14.76
 Degrees of freedom   : 12
 Dynamic memory usage : 0.7% of 14M
```

After change (6 octree levels):
```
 Simulation time      : 2.24 s
 Steps per second     : 4472
 Realtime factor      : 8.94 x
 Time per step        : 223.6 µs

 Newton iters / step  : 2.47
 Contacts / step      : 3.37
 Constraints / step   : 13.49
 Degrees of freedom   : 12
 Dynamic memory usage : 0.2% of 14M
```

PiperOrigin-RevId: 781019754
Change-Id: Ib15581244dfe9e571e1c6c2cac4a101cf3d8ba3d
2025-07-09 06:21:41 -07:00
Alessio Quaglino 35665c5cb3 Skip mesh geoms in touch sensor.
Also, use geom_rbound for the sensor size and check that there is at least one collision geom.

PiperOrigin-RevId: 772928954
Change-Id: I56f1577df66213a70fb1dc12488fbcd2f8a4b8b4
2025-06-18 08:24:37 -07:00
Alessio Quaglino 7edbdd0ad6 Remove the Shell plugin and integrate it into the engine.
PiperOrigin-RevId: 760688502
Change-Id: Ia70988d42b7edf571d7cb4a4f48f8fc50b51667d
2025-05-19 10:51:25 -07:00
Alessio Quaglino 71bdd915f7 Move bending stiffness from plugin to the compiler.
PiperOrigin-RevId: 758677644
Change-Id: I7d5c5140ba6948002bfa4ae9d6b4bf0f6de0e39b
2025-05-14 07:39:24 -07:00
Alessio Quaglino 34e8ff1aad Add flex edge flap connectivity to mjModel.
PiperOrigin-RevId: 758593152
Change-Id: I79836df961972c9eae8037e5fcbfc3d0122645de
2025-05-14 02:50:37 -07:00
Alessio Quaglino 2386dfd7da Add touch sensor for estimating the surface contact stresses from the SDF.
PiperOrigin-RevId: 758556339
Change-Id: Ib56d76fab084b530fd68d61a29294cb6f1d05f3f
2025-05-14 00:45:58 -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
Alessio Quaglino 0995af83f9 Add documentation for SdfLib plugin.
Fixes #2182.

PiperOrigin-RevId: 690980373
Change-Id: Ifc94f928e9cfbdbef3cb6f11ad4bffed542bf49a
2024-10-29 05:32:13 -07:00
Alessio Quaglino 4998e7b392 Move flex damping to the engine and remove membrane and solid plugins.
PiperOrigin-RevId: 676434954
Change-Id: I24e8dbaa90afcffd613a9cf106ef8b7262195328
2024-09-19 09:01:30 -07:00
Alessio Quaglino 66a9cacc90 Move elasticity force computation to the engine.
PiperOrigin-RevId: 676028775
Change-Id: I994e3dda8d6470815763c04df0c276e265aa1f54
2024-09-18 09:55:00 -07:00
Alessio Quaglino ddbc083810 Move elasticity computation to mjCFlex.
PiperOrigin-RevId: 675949380
Change-Id: Ia48f4fd6ae1ede206ccacd1205914e7e4b3c7aec
2024-09-18 05:23:10 -07:00
Alessio Quaglino 31abd7900a Add edge ids to flex elements in mjModel.
PiperOrigin-RevId: 675130981
Change-Id: If2ccfb268142d235273b7a50e15740f6399903b2
2024-09-16 06:58:10 -07:00
Alessio Quaglino b15de2c951 Add elasticity parameters to the schema.
PiperOrigin-RevId: 675115200
Change-Id: Ic6608ce61cbb857dca71b3d9cbdac057e8f1ac7a
2024-09-16 05:56:36 -07:00