Add control values to keyframes.

- Add basic test for keyframes.
- Add missing documentation for keyframe mocap positions and quaternions.

PiperOrigin-RevId: 459021649
Change-Id: I91cf7ecbddc6262e8c72a868eeb82d627f389fb3
This commit is contained in:
Yuval Tassa
2022-07-05 01:07:07 -07:00
committed by Copybara-Service
parent 5ba880506c
commit 09a5efc09e
15 changed files with 161 additions and 11 deletions
+9 -2
View File
@@ -348,7 +348,7 @@ static const char* MJCF[nMJCF][mjXATTRNUM] = {
{"keyframe", "*", "0"},
{"<"},
{"key", "*", "7", "name", "time", "qpos", "qvel", "act", "mpos", "mquat"},
{"key", "*", "8", "name", "time", "qpos", "qvel", "act", "mpos", "mquat", "ctrl"},
{">"},
{">"}
};
@@ -2788,7 +2788,7 @@ void mjXReader::Keyframe(XMLElement* section) {
mjuu_copyvec(pk->qvel.data(), data, n);
}
// read qvel
// read act
n = ReadAttr(elem, "act", 1000, data, text, false, false);
if (n) {
pk->act.resize(n);
@@ -2809,6 +2809,13 @@ void mjXReader::Keyframe(XMLElement* section) {
mjuu_copyvec(pk->mquat.data(), data, n);
}
// read ctrl
n = ReadAttr(elem, "ctrl", 1000, data, text, false, false);
if (n) {
pk->ctrl.resize(n);
mjuu_copyvec(pk->ctrl.data(), data, n);
}
// advance to next element
elem = elem->NextSiblingElement();
}