Fix multiple bugs related to connect and weld constraints with site semantics. Fixes #2179
The introduction of site specification to connects and welds in 3.2.3 conditionally changed the semantics of `mjData.eq_obj1id` and `mjData.eq_obj2id`. These changes were not properly propagated in several places leading to incorrect computations of constraint inertia, readings of affected force/torque sensors and runtime enabling/disabling of such constraints. PiperOrigin-RevId: 690670420 Change-Id: I55ee8a013cbee8457f8d6c7f33c2981aedafbab6
This commit is contained in:
committed by
Copybara-Service
parent
2c86136dd6
commit
864b805a6e
@@ -257,8 +257,17 @@ static int treeFirst(const mjModel* m, const mjData* d, int tree[2], int i) {
|
||||
if (efc_type == mjCNSTR_EQUALITY) {
|
||||
mjtEq eq_type = m->eq_type[efc_id];
|
||||
if (eq_type == mjEQ_CONNECT || eq_type == mjEQ_WELD) {
|
||||
tree[0] = m->body_treeid[m->eq_obj1id[efc_id]];
|
||||
tree[1] = m->body_treeid[m->eq_obj2id[efc_id]];
|
||||
int b1 = m->eq_obj1id[efc_id];
|
||||
int b2 = m->eq_obj2id[efc_id];
|
||||
|
||||
// get body ids if using site semantics
|
||||
if (m->eq_objtype[efc_id] == mjOBJ_SITE) {
|
||||
b1 = m->site_bodyid[b1];
|
||||
b2 = m->site_bodyid[b2];
|
||||
}
|
||||
|
||||
tree[0] = m->body_treeid[b1];
|
||||
tree[1] = m->body_treeid[b2];
|
||||
|
||||
// handle static bodies
|
||||
if (tree[0] < 0) {
|
||||
|
||||
Reference in New Issue
Block a user