Add sleep related data structures
PiperOrigin-RevId: 829055431 Change-Id: I1ccbd77a57044a754ae7db611b4c2c0010fbda53
This commit is contained in:
committed by
Copybara-Service
parent
3080e3424f
commit
252a0d73df
+18
-5
@@ -2931,12 +2931,25 @@ void mjCModel::CopyTree(mjModel* m) {
|
||||
}
|
||||
}
|
||||
|
||||
// count bodies with gravity compensation, compute ngravcomp
|
||||
int ngravcomp = 0;
|
||||
for (int i=0; i < nbody; i++) {
|
||||
ngravcomp += (m->body_gravcomp[i] > 0);
|
||||
// initialize AUTO sleep policy for all trees
|
||||
for (int i=0; i < m->ntree; i++) {
|
||||
m->tree_sleep_policy[i] = mjSLEEP_AUTO;
|
||||
}
|
||||
|
||||
// loop over bodies, check and set non-default sleep policy
|
||||
for (int i=1; i < nbody; i++) {
|
||||
mjCBody* pb = bodies_[i];
|
||||
|
||||
// validate and set non-default sleep policy
|
||||
if (pb->sleep != mjSLEEP_AUTO) {
|
||||
int treeid = m->body_treeid[i];
|
||||
// non-default sleep policy only allowed for first body in a tree
|
||||
if (treeid == -1 || treeid == m->body_treeid[i-1]) {
|
||||
throw mjCError(pb, "sleep policy only allowed for movable root bodies");
|
||||
}
|
||||
m->tree_sleep_policy[treeid] = pb->sleep;
|
||||
}
|
||||
}
|
||||
m->ngravcomp = ngravcomp;
|
||||
|
||||
// recompute nM and dof_Madr given m.dof_parentid, validate
|
||||
int nM_post = 0;
|
||||
|
||||
@@ -2489,8 +2489,8 @@ void mjCBody::Compile(void) {
|
||||
joints[0]->spec.type == mjJNT_FREE && // it is a free joint AND
|
||||
bodies.empty() && // no child bodies AND
|
||||
(joints[0]->spec.align == 1 || // either joint.align="true"
|
||||
(joints[0]->spec.align == 2 && // or joint.align="auto"
|
||||
compiler->alignfree))); // and compiler->align="true"
|
||||
(joints[0]->spec.align == 2 && // or (joint.align="auto"
|
||||
compiler->alignfree))); // and compiler->align="true")
|
||||
|
||||
// free-joint alignment, phase 1 (this body + child geoms)
|
||||
double ipos_inverse[3], iquat_inverse[4];
|
||||
|
||||
Reference in New Issue
Block a user