Commit Graph

1379 Commits

Author SHA1 Message Date
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
Yuval Tassa a3d251f552 Add mjModel.sensor_intprm, integer parameters of sensors
PiperOrigin-RevId: 781053754
Change-Id: I90e5ef1cab3f87b894dbc70dccfc8bf0046ce1b6
2025-07-09 08:00:21 -07:00
Sam Haves 9d64ed9575 Remove leftover MJ_USD_TARGET_NAME include directories call from USD CMake.
PiperOrigin-RevId: 781023625
Change-Id: Id75cb94c0eafc27c47a275d3cf4280020ed0c17a
2025-07-09 06:33:55 -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
Yuval Tassa e6c5715903 Add insidesite sensor for detecting when an object is inside the volume of a site.
PiperOrigin-RevId: 780993257
Change-Id: I2dcfc840d222680adc3b934344a0819f4d78b6eb
2025-07-09 04:56:42 -07:00
Taylor Howell 13621879c6 Remove unnecessary loop from mj_collideOBB.
PiperOrigin-RevId: 780629489
Change-Id: I715cd1f72012c0655997ba4c967fa7b5b8731d54
2025-07-08 10:50:33 -07:00
Sam Haves 14972d2490 Add mj_loadUSD function. Change simulate to use that instead of manual spec compilation.
PiperOrigin-RevId: 780608874
Change-Id: I333238c756fe76b371518a7cdf9452b93da3540a
2025-07-08 10:04:08 -07:00
Sam Haves e507e31922 Fix schema naming in mjcPhysics to avoid collisions.
PiperOrigin-RevId: 780537076
Change-Id: I4ea24162ba20d6aae10207491f9aae2250808576
2025-07-08 06:27:30 -07:00
Yuval Tassa d464165e30 Print contact forces in mj_printData.
PiperOrigin-RevId: 780503111
Change-Id: I17c6f1584d5260fa9c88c54d0aea9ec0101c082b
2025-07-08 04:11:10 -07:00
Alessio Quaglino 1a4ddca6cf Make mjs_findElement find meshes by file name.
PiperOrigin-RevId: 780150428
Change-Id: Ie500062fa8cca755683b66540e84ede588d7c331
2025-07-07 09:51:33 -07:00
Yuval Tassa 7a09145161 Rename variables to avoid shadowing in user_objects.cc
PiperOrigin-RevId: 780137314
Change-Id: Ife5abd0ecc3851837a7aef7048efe80dbdfcf60e
2025-07-07 09:15:03 -07:00
Yuval Tassa e01c4b454a Rename variables to avoid shadowing in xml_native_reader.cc
PiperOrigin-RevId: 780135233
Change-Id: I509ac6a0807e102ad8749f81562ad45bf4c04335
2025-07-07 09:10:02 -07:00
Yuval Tassa 783e6499d8 Remove explicit mjModel dependency from engine_util_misc.c
PiperOrigin-RevId: 780123513
Change-Id: I567e09db3cd13a93a4720742affb62b54bfa5426
2025-07-07 08:33:19 -07:00
Yuval Tassa 6ccc4f77bc Defer sensor reference id resolution from sensor compiler to model compiler
PiperOrigin-RevId: 780070082
Change-Id: I7166f589f15bb0cd14b92e213d7a9f2a3bbad4e4
2025-07-07 05:37:53 -07:00
Sam Haves 1742ba510c Swap out apostrophe for single quote in mjcPhysics actuator lengthRange docs.
PiperOrigin-RevId: 780051495
Change-Id: Ib56a012ded364740564b879456a9e0570b5a0d7a
2025-07-07 04:27:49 -07:00
Sam Haves 2c4fed07d2 Add missing source files to mj_usd target.
PiperOrigin-RevId: 779244207
Change-Id: I3a913f8add82838a1d7371f84b4f03f271a1897b
2025-07-04 11:46:48 -07:00
Sam Haves be3c3ef8a9 Add missing gravity attribute authoring to Mjcf SdfFileFormat plugin.
PiperOrigin-RevId: 779239797
Change-Id: I039b1089e5b436498d14df384c1aee830fd4b48a
2025-07-04 11:25:49 -07:00
Robin Alazard e69b6cc5f3 Fix wrong extent authoring for Cube.
PiperOrigin-RevId: 779230125
Change-Id: I96c3d5daa7a760cd87a714a14ea74a15faf3d7db
2025-07-04 10:39:32 -07:00
Robin Alazard 21a852504c Make sure we never apply the ArticulationRoot API more than once.
PiperOrigin-RevId: 779185190
Change-Id: If441d0e2ba24191883839977b46864db2b4b8204
2025-07-04 07:36:05 -07:00
Robin Alazard 85ad1eec91 Rework USD scene traversal, ensure DFS order of bodies is respected, remove implicit welding of non-jointed nested bodies
PiperOrigin-RevId: 779121640
Change-Id: Ic3281ac10ce51975cd681e9342b2fffd5f24376f
2025-07-04 03:25:49 -07:00
Yuval Tassa 2937efd5f2 Use sparse math in mjd_actuator_vel.
PiperOrigin-RevId: 778924297
Change-Id: I221fb338c894f278e9f8401f25056539c62ccc65
2025-07-03 10:52:54 -07:00
Alessio Quaglino af7d20c035 Change mjs_nextChild to be DFS to match XML parsing.
PiperOrigin-RevId: 778915232
Change-Id: I5e290f47b7d2530597bb6c85b66ff2ae807e5510
2025-07-03 10:07:13 -07:00
Alessio Quaglino 564c51ddb9 Check for duplicated names when setting element names.
PiperOrigin-RevId: 778827590
Change-Id: I77a208c1571cf735cae80840ea830aa347681f71
2025-07-03 03:20:55 -07:00
Alessio Quaglino 594e17074a Replace name attribute with setters and getters in the C API of mjSpec.
PiperOrigin-RevId: 778816015
Change-Id: Ieffb7a5bce37e887ff009f9a02d2434435e79ca1
2025-07-03 02:30:56 -07:00
Sam Haves d2840ce665 Add missing files to mjusd cmake.
PiperOrigin-RevId: 778800306
Change-Id: I1bd5766108c59fb05a6a2c6c8b3207476aca60ea
2025-07-03 01:27:12 -07:00
Sam Haves 1d613b9b9a Add support for mjcPhysics keyframes to USD interop.
PiperOrigin-RevId: 778552679
Change-Id: I04026599f7a2836e3fe1cf0d553bcc86a5795f98
2025-07-02 10:17:41 -07:00
Robin Alazard 072b327430 Fix the parsing of USD scenes that use ResetXformStack
Also add a new test for it

PiperOrigin-RevId: 778114814
Change-Id: Ib019768ac45ecf7ec6d437199a3d1427557b2f06
2025-07-01 11:07:07 -07:00
Robin Alazard 50de1b3c2c Read new Mujoco-specific JointAPI when converting USD.
PiperOrigin-RevId: 778037519
Change-Id: Idd81dc5dc14e2dfb40ba7db4404fd09f9ff50a9f
2025-07-01 07:40:23 -07:00
Robin Alazard 9dc67b50cd Write new Mujoco-specific JointAPI data to USD.
PiperOrigin-RevId: 778035661
Change-Id: I945aa38fc58973023d78ab0ab5fad7783d23e1ef
2025-07-01 07:35:34 -07:00
Robin Alazard 862436f9b3 Add JointAPI schema in mjcPhysics.
PiperOrigin-RevId: 778030981
Change-Id: I22a4bf2a550fb78e47bef0ff171b10ce5912887e
2025-07-01 07:22:05 -07:00
Nimrod Gileadi 3db03dcce5 Don't output a warning about duplicate geom names for unnamed geoms in URDF.
PiperOrigin-RevId: 777998616
Change-Id: Id87533e30567fe5a0e372220ba57819383d42236
2025-07-01 05:36:17 -07:00
Taylor Howell 9eb0745968 Fix comment typo in getimpedance.
PiperOrigin-RevId: 777997980
Change-Id: I0fe87196360e6771db10f4d9b08d43448ea5f54e
2025-07-01 05:33:47 -07:00
Alessio Quaglino 5c1f1f9dba Add octree to meshes of SDF geoms.
PiperOrigin-RevId: 777634862
Change-Id: I3210c2f8d73fd30ceecb0a11abd1d82e086b3d5d
2025-06-30 10:50:15 -07:00
Sam Haves 106df98946 Create Keyframe schema in mjcPhysics.
PiperOrigin-RevId: 777568003
Change-Id: I036fd54e2926c138f9ca8de87040b263b8427df3
2025-06-30 07:48:48 -07:00
Yuval Tassa 57b3d6d0f4 Make island discovery compatible with flex
PiperOrigin-RevId: 777490642
Change-Id: Iae2f4e8297cc24bded833e04ebfe32895f3a5460
2025-06-30 03:16:57 -07:00
Yuval Tassa c945247e7c Don't write limited and actuatorfrclimited attributes when "true" is not a valid value.
Saved XMLs are filled with
```
<joint type="free" limited="false" actuatorforcelimited="false"/>
```

but since these are hardcoded to "false" at compile time, there is no point in saving them to XML.

PiperOrigin-RevId: 776606516
Change-Id: Iac61c5126231f776077a8c265be732f9215fbfbb
2025-06-27 09:07:30 -07:00
Sam Haves e80a62c6d5 Allow loading USD files into simulate.
PiperOrigin-RevId: 776584803
Change-Id: I66a5277b3752d69ba5d44ed419204951edb18d41
2025-06-27 07:59:21 -07:00
Alessio Quaglino e97e5d31d0 Replace box SDF with a smooth approximation.
This approximation is equivalent to the exact SDF on the surface and externally, but it is smooth on the inside, rotating the gradient from radial at the box center to normal to the faces at the surface, and interpolated linearly (using two Euler angles) in between. This enables stable contact gradients for deeper penetrations.

PiperOrigin-RevId: 776574022
Change-Id: I562976e9f0535b0067aa12b2bc9d48eccb6472e9
2025-06-27 07:21:30 -07:00
Robin Alazard 931ea6938c Add parsing tests for joints.
Also remove the not properly supported SphericalJoint (ball joint).

PiperOrigin-RevId: 776550199
Change-Id: I863dfa89c4cb564cf453e57c19df563ddade92b8
2025-06-27 06:01:19 -07:00
Robin Alazard 8f6a13aa8f Add support for displayColor/Opacity (convert to rgba)
PiperOrigin-RevId: 776488857
Change-Id: I34713748ac553b5fdfad736801cdaa7dc2b7f1b0
2025-06-27 02:16:49 -07:00
Sam Haves 24789f8fe5 Apply articulation API to the correct body when converting to USD.
PiperOrigin-RevId: 776206773
Change-Id: I84b5687a9900b42fd208124414ac98feaaa9f8c4
2025-06-26 11:07:11 -07:00
Sam Haves 1e319aebed Support joint actuator authoring in Mjcf SdfFileFormat plugin.
PiperOrigin-RevId: 776202325
Change-Id: I8503dd98c1b64502550b879e70039ae568517508
2025-06-26 10:55:49 -07:00
Yuval Tassa 21bae3a388 Report which body has too-small mass/inertia in compilation error.
PiperOrigin-RevId: 776196017
Change-Id: Ib81efb170347a57cdc4b446c14cd7b8f5357958c
2025-06-26 10:40:40 -07:00
Sam Haves afc35451a0 Expose ability to go from USD stage to MjSpec.
PiperOrigin-RevId: 776184388
Change-Id: I0325b347c9896183d148a196897e1e5d0c4bbde2
2025-06-26 10:09:55 -07:00
Sam Haves 672746f509 Use brackets for USD schema code.
PiperOrigin-RevId: 776157077
Change-Id: Id8c55a98dc695348430a99ca59ec509a6db26403
2025-06-26 08:54:55 -07:00
Robin Alazard 3441e0aa03 mj_usd plugin: add joints export.
Note that ball joint is missing, will come later.

PiperOrigin-RevId: 776057523
Change-Id: I8d13c3ea9e7f3d894af73a4640eb93202f8a2a03
2025-06-26 03:02:17 -07:00
Yuval Tassa 18d5d5d03f Improve documentation related to mjSpec element deletion.
PiperOrigin-RevId: 775677830
Change-Id: I02e51b57956b0b6a20c654326b54e001b498dd96
2025-06-25 07:23:51 -07:00
Google DeepMind da831f5d3e Add support for separate occlusion, roughness and metallic textures
PiperOrigin-RevId: 775632047
Change-Id: I40ba0b3d4ecb0c0a03534b8d93f85d279febbc9c
2025-06-25 04:37:19 -07:00
Google DeepMind 81d16b7ccc Add some comments to the material construction code
Grouped similar lines together, since they have become separated.

PiperOrigin-RevId: 775595031
Change-Id: Id75e87e07eb2e6b745698a57ea048daaff34f35c
2025-06-25 02:22:42 -07:00