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
+13
View File
@@ -3980,6 +3980,7 @@ mjCKey::mjCKey(mjCModel* _model) {
act.clear();
mpos.clear();
mquat.clear();
ctrl.clear();
}
@@ -3991,6 +3992,7 @@ mjCKey::~mjCKey() {
act.clear();
mpos.clear();
mquat.clear();
ctrl.clear();
}
@@ -4063,4 +4065,15 @@ void mjCKey::Compile(const mjModel* m) {
} else if (mquat.size()!=4*m->nmocap) {
throw mjCError(this, "key %d: invalid mquat size", 0, id);
}
// ctrl: allocate or check size
if (ctrl.empty()) {
ctrl.resize(m->nu);
for (i=0; i<m->nu; i++) {
ctrl[i] = 0;
}
} else if (ctrl.size()!=m->nu) {
throw mjCError(this, "key %d: invalid ctrl size", 0, id);
}
}