Do not namespace the body that contains the frame during mjs_attachFrame.

PiperOrigin-RevId: 730912252
Change-Id: I026993af648766c09d569709d268430207d83169
This commit is contained in:
Alessio Quaglino
2025-02-25 09:15:45 -08:00
committed by Copybara-Service
parent fbe0990b17
commit ed7adf3d17
2 changed files with 5 additions and 0 deletions
+2
View File
@@ -917,8 +917,10 @@ mjCBody& mjCBody::operator+=(const mjCFrame& other) {
CopyList(lights, subtree->lights, fmap, &other);
if (!model->deepcopy_) {
std::string name = subtree->name;
subtree->SetModel(model);
subtree->NameSpace(other_model);
subtree->name = name;
}
int nbodies = (int)subtree->bodies.size();
+3
View File
@@ -1193,6 +1193,9 @@ TEST_F(MujocoTest, AttachFrame) {
// check that the spec was copied
EXPECT_THAT(mjs_findSpec(parent, "child"), NotNull());
// check that the parent body was not namespaced
EXPECT_THAT(mjs_findBody(child, "world"), NotNull());
// compile new model
mjModel* m_attached = mj_compile(parent, 0);
EXPECT_THAT(m_attached, NotNull());