Allow connect constraints to be specified using sites.
PiperOrigin-RevId: 668925419 Change-Id: I10cb71e6706e617c830cd90d6d0836b94a5a8cfa
This commit is contained in:
committed by
Copybara-Service
parent
646455406c
commit
a1036b86d3
@@ -286,12 +286,22 @@ static void set0(mjModel* m, mjData* d) {
|
||||
|
||||
// connect constraint
|
||||
if (m->eq_type[i] == mjEQ_CONNECT) {
|
||||
// pos = anchor position in global frame
|
||||
mj_local2Global(d, pos, 0, m->eq_data+mjNEQDATA*i, 0, id1, 0);
|
||||
switch ((mjtObj) m->eq_objtype[i]) {
|
||||
case mjOBJ_BODY:
|
||||
// pos = anchor position in global frame
|
||||
mj_local2Global(d, pos, 0, m->eq_data+mjNEQDATA*i, 0, id1, 0);
|
||||
|
||||
// data[3-5] = anchor position in body2 local frame
|
||||
mju_subFrom3(pos, d->xpos+3*id2);
|
||||
mju_mulMatTVec3(m->eq_data+mjNEQDATA*i+3, d->xmat+9*id2, pos);
|
||||
// data[3-5] = anchor position in body2 local frame
|
||||
mju_subFrom3(pos, d->xpos+3*id2);
|
||||
mju_mulMatTVec3(m->eq_data+mjNEQDATA*i+3, d->xmat+9*id2, pos);
|
||||
break;
|
||||
case mjOBJ_SITE:
|
||||
// site-based connect, eq_data is unused
|
||||
mju_zero(m->eq_data+mjNEQDATA*i, mjNEQDATA);
|
||||
break;
|
||||
default:
|
||||
mjERROR("invalid objtype in connect constraint %d", i);
|
||||
}
|
||||
}
|
||||
|
||||
// weld constraint
|
||||
|
||||
Reference in New Issue
Block a user