in robogym/envs/dactyl/face_perpendicular.py [0:0]
def _build_mujoco_cube_xml(cls, xml, cube_xml_path):
xml.append(
MujocoXML.parse(cube_xml_path)
.add_name_prefix("cube:")
.set_named_objects_attr("cube:middle", tag="body", pos=[1.0, 0.87, 0.2])
# Leave +/- z driver joints
.remove_objects_by_name(names="cube:cubelet:driver:neg_x", tag="joint")
.remove_objects_by_name(names="cube:cubelet:driver:pos_x", tag="joint")
.remove_objects_by_name(names="cube:cubelet:driver:neg_y", tag="joint")
.remove_objects_by_name(names="cube:cubelet:driver:pos_y", tag="joint")
# Remove x/y cubelet hinge joints
.remove_objects_by_prefix(prefix="cube:cubelet:rotx:", tag="joint")
.remove_objects_by_prefix(prefix="cube:cubelet:roty:", tag="joint")
# Delete springs for now
.remove_objects_by_prefix(prefix="cube:cubelet:spring:", tag="joint")
# Remove remaining cubelet joints we're not interested in
.remove_objects_by_name(
names=[
"cube:cubelet:rotz:neg_x_pos_y",
"cube:cubelet:rotz:neg_x_neg_y",
"cube:cubelet:rotz:pos_x_pos_y",
"cube:cubelet:rotz:pos_x_neg_y",
],
tag="joint",
)
)
# Target
xml.append(
MujocoXML.parse(cube_xml_path)
.add_name_prefix("target:")
.set_named_objects_attr("target:middle", tag="body", pos=[1.0, 0.87, 0.2])
# Disable collisions
.set_objects_attr(tag="geom", group="2", conaffinity="0", contype="0")
# Leave +/- z driver joints
.remove_objects_by_name(names="target:cubelet:driver:neg_x", tag="joint")
.remove_objects_by_name(names="target:cubelet:driver:pos_x", tag="joint")
.remove_objects_by_name(names="target:cubelet:driver:neg_y", tag="joint")
.remove_objects_by_name(names="target:cubelet:driver:pos_y", tag="joint")
# Remove x/y cubelet hinge joints
.remove_objects_by_prefix(prefix="target:cubelet:rotx:", tag="joint")
.remove_objects_by_prefix(prefix="target:cubelet:roty:", tag="joint")
.remove_objects_by_prefix(prefix="target:cubelet:spring:", tag="joint")
# Remove remaining cubelet joints we're not interested in
.remove_objects_by_name(
names=[
"target:cubelet:rotz:neg_x_pos_y",
"target:cubelet:rotz:neg_x_neg_y",
"target:cubelet:rotz:pos_x_pos_y",
"target:cubelet:rotz:pos_x_neg_y",
],
tag="joint",
)
)