This function allows the caller to extract a subset of components of a state previously obtained via `mj_getState` without having to first write it back into `mjData`.
PiperOrigin-RevId: 822165077
Change-Id: I6433261f4f5ec2e8d024bb7dee8f7dbf1e62666c
- Updated docs to clarify that only the lower triangle is touched
- The function was unnecessarily adding the upper triangle in the sparse case
- The test used an unnecessarily large model and stepping it leading to timeouts under ASAN
PiperOrigin-RevId: 798528736
Change-Id: I592cc17dfb62379bb0cd6b332a8eb7e8b0ef6355
Nullable arguments will be added to the `introspect` datastructures in a future change.
PiperOrigin-RevId: 789350522
Change-Id: I0bfd12fab5121f94b937264570f907593b63cf64
In a follow-up, mjs_detach will be changed to only remove without deleting an element.
PiperOrigin-RevId: 773637351
Change-Id: I9ee4d3584ba88ccc225591337cf036bab806e25c
Also add `SaveAndReadXML` function to test fixture using `mjSpec` as input.
PiperOrigin-RevId: 765393821
Change-Id: Ic257addd2fc89678fc11b226c168c077626cc51e
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
Also raise error if the frame is not found in the mjCBody copy constructor.
Fixes#2543.
PiperOrigin-RevId: 742624013
Change-Id: I4999b3165c97f8d079412214d027ca7a8dae8cb3
This is required in preparation of changing the spec.attach behavior in the Python bindings.
PiperOrigin-RevId: 730810198
Change-Id: I095808f0afe62b5bbd27201ed5c75804e0e9c4bf
These flexes use only 24 DOFs (3 per vertex of the bounding box), while colliding with the full high resolution mesh.
On an 8x8x8 cube, the performance using DOFs at all vertices is
```
Simulation time : 18.74 s
Steps per second : 533
Realtime factor : 0.53 x
Time per step : 1874.4 µs
Contacts per step : 114.88
Constraints per step : 3322.51
Degrees of freedom : 1536
```
With the new implementation, it is the following:
```
Simulation time : 1.82 s
Steps per second : 5507
Realtime factor : 5.51 x
Time per step : 181.6 µs
Contacts per step : 38.84
Constraints per step : 155.36
Degrees of freedom : 24
```
PiperOrigin-RevId: 721008829
Change-Id: I833df027527db578d86667cc4b24295bcf6f7d22
This can happen when a body is detached without compiling or recompiling.
Also added error catching when trying to delete a body instead of detaching it.
Fixes#2327
PiperOrigin-RevId: 712526730
Change-Id: I4b48df83120fca12d475c85b3a54893841449653
This function extracts the 3D rotation from an arbitrary 3x3 matrix by refining the input quaternion. It is based on the paper "A robust method to extract the rotational part of deformations" by Müller, Matthias, Jan Bender, Nuttapong Chentanez, and Miles Macklin.
PiperOrigin-RevId: 700006006
Change-Id: I77550993233dea9cdf68601762a3ae7ded749bdf
This functionality is meant for fast copying of `mjModel` when synchronizing the visualization state, as in the Python passive viewer.
PiperOrigin-RevId: 699199743
Change-Id: I13a5160063eb09139ec1aee9c4969bc1c6f547f1