MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / _AttachmentFrameChild

Class _AttachmentFrameChild

dm_control/mjcf/element.py:1107–1139  ·  view source on GitHub ↗

A child element of an attachment frame. Right now, this is always a or a . The name of the joint is not freely specifiable, but instead just inherits from the parent frame. This ensures uniqueness, as attachment frame identifiers always end in '/'.

Source from the content-addressed store, hash-verified

1105
1106
1107class _AttachmentFrameChild(_ElementImpl):
1108 """A child element of an attachment frame.
1109
1110 Right now, this is always a <joint> or a <freejoint>. The name of the joint
1111 is not freely specifiable, but instead just inherits from the parent frame.
1112 This ensures uniqueness, as attachment frame identifiers always end in '/'.
1113 """
1114 __slots__ = []
1115
1116 def to_xml(self, prefix_root=None, debug_context=None,
1117 *,
1118 precision=constants.XML_DEFAULT_PRECISION,
1119 zero_threshold=0,
1120 filename_with_hash=True):
1121 xml_element = (super().to_xml(prefix_root, debug_context,
1122 precision=precision,
1123 zero_threshold=zero_threshold,
1124 filename_with_hash=filename_with_hash))
1125 if self.spec.namespace is not None:
1126 if self.name:
1127 name = (self._parent.prefixed_identifier(prefix_root) +
1128 self.name + constants.PREFIX_SEPARATOR)
1129 else:
1130 name = self._parent.prefixed_identifier(prefix_root)
1131 xml_element.set('name', name)
1132 return xml_element
1133
1134 def prefixed_identifier(self, prefix_root=None):
1135 if self.name:
1136 return (self._parent.prefixed_identifier(prefix_root) +
1137 self.name + constants.PREFIX_SEPARATOR)
1138 else:
1139 return self._parent.prefixed_identifier(prefix_root)
1140
1141
1142class _DefaultElement(_ElementImpl):

Callers 1

_make_elementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…