Resize keyframes also at the start of compilation.

Previously, it was assumed that attaching was the last operation performed on the mjSpec, so keyframes resulted in the incorrect size. In order to prevent information loss, we now only allow the resize function to expand the keyframe array, since attach should never remove a degree of freedom.

PiperOrigin-RevId: 804917828
Change-Id: Icfacd207ced1c6aac600d514f8d9065ceff2d347
This commit is contained in:
Alessio Quaglino
2025-09-09 08:15:34 -07:00
committed by Copybara-Service
parent 3b738ebb67
commit 9d5063799f
6 changed files with 83 additions and 22 deletions
+1 -1
View File
@@ -464,7 +464,7 @@ TEST_F(KeyframeTest, BadSize) {
size_t error_sz = 1024;
mjModel* model = LoadModelFromString(xml, error, error_sz);
EXPECT_THAT(model, IsNull());
EXPECT_THAT(error, HasSubstr("invalid qpos size, expected length 0"));
EXPECT_THAT(error, HasSubstr("invalid qpos size, expected 0, got 1"));
}
// ------------- test relative frame sensor compilation-------------------------