This enables to find the spec associated with the compiler option stored in the objects, which do not necessarily belong to the model that owns them.
PiperOrigin-RevId: 713259419
Change-Id: I579c770147ff07ed2a5edd20e7a795ee7cc27147
This is required to have parent body info during attach and during body to frame tranformation for uncompiled models.
PiperOrigin-RevId: 703038426
Change-Id: Ib482059ba419a020860c649d6ea1b1088045f2e1
Also associate all children that need a parent body to the parent of the deleted body.
This is a bug that was causing the former children of the body that gets transformed to a frame to not be children of the new frame.
PiperOrigin-RevId: 702702853
Change-Id: I36d48f0446bc87c665b18d34e0b0609d82c70f51
Note:
- Move compiler options into `mjsCompiler` struct.
- The compiler options from the attached model are not written by mj_SaveXML.
PiperOrigin-RevId: 689391440
Change-Id: I1d63c146a32f87c737b7a55b64a54b0ffe3aecc9
For `mjs_attachFrame` and `mjs_attachBody`, require either a prefix or suffix.
It is tempting for users to not use a prefix (see #2162), but this causes issues. For example, it creates a duplicate "main" default class in the parent as a child of the already existing "main" default.
PiperOrigin-RevId: 688535755
Change-Id: I653181ca35943f1e4eb89c70fca8b5289818324e
The qposadr_ and dofadr_ variables of the joints were not being reset to -1 when a joint is copied. This could lead to errors when calling mj_recompile after attaching a compiled spec.
PiperOrigin-RevId: 686152004
Change-Id: I9e058089ce87ea0d8e51a7f43475bc48c6527a26
The `extension` section used to discard the plugin name and write the instance name in `plugin.name`, while all of the other sections wrote the instance name in `plugin.instance_name` and optionally the plugin name in `plugin.name` (via the function `OnePlugin`). Now all plugin names are in `plugin.plugin_name` and the instance is written in `plugin.name`, so that it is possible to lookup a plugin via its unique instance name.
PiperOrigin-RevId: 683183804
Change-Id: I179ef5d221143b720db24d745b09e327bf1449ef
This enables to generate a list of all body children of a given type.
Also, add recursive option to mjs_firstChild and mjs_nextChild. Fixes#2112.
PiperOrigin-RevId: 681039348
Change-Id: Iebbb26fd5ec314150206edfdddd88633baa0bec6
This is a no-op change for keyframes but it shows an example of behavior.
Also, fixed two bugs:
- Missing namespace when attaching frames.
- Incorrect body id and subtreedof when attaching a compiled spec. Fixes#2063.
PiperOrigin-RevId: 680289467
Change-Id: I2ddaa7ad2226fa466ec3bbf74a7553d497bb4bb9
- Add errors in body compiler for incorrect mixing of specifiers.
- Correctly process inertia orientation specifiers.
PiperOrigin-RevId: 676843326
Change-Id: I7e7eb22e25a6769754794f98fad5e0dcc0e5946f
The "undefined" body position is a remnant of the now-removed `compiler/coordinate` attribute, see [documentation in version 2.3.3](https://mujoco.readthedocs.io/en/2.3.3/modeling.html#cframe) (or older).
PiperOrigin-RevId: 676361485
Change-Id: I104c8da2a988a0430eb85fff8b9b60f8c1e08582
This enables to preserve the paths of the child spec during `attach`.
PiperOrigin-RevId: 673349237
Change-Id: Ibf075c7ec037ff5d540bc60d6e77c12f60269791
Limitations:
- Supports attaching a single keyframe. If multiple keyframes are present in the child, only the first one will be attached.
- Does not support time, ctrl, mpos, mquat.
- If mjs_detachBody is used, all keyframes are removed.
PiperOrigin-RevId: 662517666
Change-Id: If6e3839471e1884afc14e1a75e7ce1957c2f3581