Fix bug in xml_native_writer that was causing frames to be skipped.

PiperOrigin-RevId: 683721505
Change-Id: I8622f4ea42ecda934fbc805c429de40e7717fdef
This commit is contained in:
Alessio Quaglino
2024-10-08 12:22:25 -07:00
committed by Copybara-Service
parent b66da3d369
commit 8256546432
2 changed files with 6 additions and 5 deletions
-5
View File
@@ -1718,11 +1718,6 @@ void mjXWriter::Body(XMLElement* elem, mjCBody* body, mjCFrame* frame, string_vi
: body->classname;
Body(OneFrame(elem, fframe), body, fframe, childclass);
}
// stop if we reached the frame of the current child body, ignore if there are no bodies
if (bframe && bframe == fframe) {
break;
}
}
// if there are no bodies, we only want to run the loop once
+6
View File
@@ -749,6 +749,9 @@ TEST_F(XMLWriterTest, WritesFrameDefaults) {
</frame>
</frame>
</frame>
<frame>
<light pos="0 0 1"/>
</frame>
</body>
</worldbody>
</mujoco>
@@ -775,6 +778,9 @@ TEST_F(XMLWriterTest, WritesFrameDefaults) {
</frame>
</frame>
</frame>
<frame>
<light pos="0 0 1" dir="0 0 -1"/>
</frame>
</body>
<frame name="f1">
<geom size="0.5" quat="0.906308 0 0 0.422618"/>