Allow contact sensor subtree1/subtree2 to be any body.

PiperOrigin-RevId: 799632590
Change-Id: If9cd6c5a3a5f83d89ae024a8f64232ab1f1d603a
This commit is contained in:
Yuval Tassa
2025-08-26 10:59:44 -07:00
committed by Copybara-Service
parent 9eaa31af2f
commit 7443e685ac
7 changed files with 64 additions and 32 deletions
-10
View File
@@ -7152,11 +7152,6 @@ void mjCSensor::Compile(void) {
throw mjCError(this, "first matching criterion: if set, must be (x)body, geom or site");
}
// check that subtree1 is a full tree
if (objtype == mjOBJ_XBODY && static_cast<mjCBody*>(obj)->GetParent()->id != 0) {
throw mjCError(this, "subtree1 must be a child of the world");
}
// check second matching criterion
if (reftype != mjOBJ_BODY &&
reftype != mjOBJ_XBODY &&
@@ -7165,11 +7160,6 @@ void mjCSensor::Compile(void) {
throw mjCError(this, "second matching criterion: if set, must be (x)body or geom");
}
// check that subtree2 is a full tree
if (reftype == mjOBJ_XBODY && static_cast<mjCBody*>(ref)->GetParent()->id != 0) {
throw mjCError(this, "subtree2 must be a child of the world");
}
// check for dataspec correctness
int dataspec = intprm[0];
if (dataspec <= 0) {