Fix mjSpec colab after changing the default behavior of attach to be a shallow copy.
PiperOrigin-RevId: 724375710 Change-Id: I5fac7d24c1d0b1ad4d427c021022c47620accf53
This commit is contained in:
committed by
Copybara-Service
parent
c1ecc50081
commit
06758e35ab
+8
-6
@@ -547,16 +547,18 @@ It is possible to combine multiple specs by using attachments. The following opt
|
||||
the reference to the attached body, which should be identical to the body used as input.
|
||||
- Attach a frame from the child spec to a body in the parent spec: ``body.attach_frame(frame, prefix, suffix)``,
|
||||
returns the reference to the attached frame, which should be identical to the frame used as input.
|
||||
- Attach a child spec to a site in the parent spec: ``spec.attach(child_spec, site=site_name_or_obj)``, returns the
|
||||
reference to a frame, which is the attached worldbody transformed into a frame. The site must belong to the child
|
||||
spec. Prefix and suffix can also be specified as keyword arguments.
|
||||
- Attach a child spec to a site in the parent spec: ``parent_spec.attach(child_spec, site=site_name_or_obj)``, returns
|
||||
the reference to a frame, which is the attached worldbody transformed into a frame. The site must belong to the
|
||||
child spec. Prefix and suffix can also be specified as keyword arguments.
|
||||
- Attach a child spec to a frame in the parent spec: ``parent_spec.attach(child_spec, frame=frame_name_or_obj)``,
|
||||
returns the reference to a frame, which is the attached worldbody transformed into a frame. The frame must belong to
|
||||
the child spec. Prefix and suffix can also be specified as keyword arguments.
|
||||
|
||||
Attaching does not copy, so all the child references are still valid in the parent and therefore modifying the child will
|
||||
modify the parent. This is not true for the attach :ref:`attach<body-attach>` and :ref:`replicate<replicate>`
|
||||
meta-elements in MJCF, which create deep copies while attaching.
|
||||
The default behavior of attaching is to not copy, so all the child references (except for the worldbody) are still valid
|
||||
in the parent and therefore modifying the child will modify the parent. This is not true for the attach
|
||||
:ref:`attach<body-attach>` and :ref:`replicate<replicate>` meta-elements in MJCF, which create deep copies while
|
||||
attaching. However, it is possible to override the default behavior by setting ``spec.copy_during_attaching`` to
|
||||
``True``. In this case, the child spec is copied and the references to the child will not point to the parent.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
||||
Reference in New Issue
Block a user