Return attached body/frame in mjs_attachBody/Frame.

PiperOrigin-RevId: 679601525
Change-Id: Icdc4616808e14bf0a3ebc17d89392382d084c31b
This commit is contained in:
Alessio Quaglino
2024-09-27 08:32:52 -07:00
committed by Copybara-Service
parent 176345b4e1
commit 25e4d75a07
11 changed files with 67 additions and 45 deletions
+6 -6
View File
@@ -660,8 +660,8 @@ TEST_F(MujocoTest, AttachSame) {
EXPECT_THAT(body, NotNull());
// attach child to parent frame
EXPECT_THAT(
mjs_attachBody(frame, body, /*prefix=*/"attached-", /*suffix=*/"-1"), 0);
mjsBody* attached = mjs_attachBody(frame, body, "attached-", "-1");
EXPECT_THAT(attached, mjs_findBody(parent, "attached-body-1"));
// compile new model
mjModel* m_attached = mj_compile(parent, 0);
@@ -782,8 +782,8 @@ TEST_F(MujocoTest, AttachDifferent) {
EXPECT_THAT(body, NotNull());
// attach child to parent frame
EXPECT_EQ(
mjs_attachBody(frame, body, /*prefix=*/"attached-", /*suffix=*/"-1"), 0);
mjsBody* attached = mjs_attachBody(frame, body, "attached-", "-1");
EXPECT_THAT(attached, mjs_findBody(parent, "attached-body-1"));
// compile new model
mjModel* m_attached = mj_compile(parent, 0);
@@ -904,8 +904,8 @@ TEST_F(MujocoTest, AttachFrame) {
EXPECT_THAT(frame, NotNull());
// attach child frame to parent body
EXPECT_THAT(
mjs_attachFrame(body, frame, /*prefix=*/"attached-", /*suffix=*/"-1"), 0);
mjsFrame* attached = mjs_attachFrame(body, frame, "attached-", "-1");
EXPECT_THAT(attached, mjs_findFrame(parent, "attached-pframe-1"));
// compile new model
mjModel* m_attached = mj_compile(parent, 0);