Move tactile sensor to the engine.

PiperOrigin-RevId: 788863133
Change-Id: I3172ebb7641fa8146469da25cba7db794760e7b1
This commit is contained in:
Alessio Quaglino
2025-07-30 05:26:39 -07:00
committed by Copybara-Service
parent 89f4789085
commit 51babec9c5
28 changed files with 418 additions and 687 deletions
+24 -2
View File
@@ -6720,9 +6720,12 @@ void mjCSensor::ResolveReferences(const mjCModel* m) {
throw mjCError(this, "unrecognized name '%s' of sensorized object", objname_.c_str());
}
// if geom mark it as non visual
// if geom or mesh, mark it as non visual
if (objtype == mjOBJ_GEOM) {
((mjCGeom*)obj)->SetNotVisual();
static_cast<mjCGeom*>(obj)->SetNotVisual();
}
if (objtype == mjOBJ_MESH) {
static_cast<mjCMesh*>(obj)->SetNotVisual();
}
} else if (type != mjSENS_E_POTENTIAL &&
@@ -6746,6 +6749,14 @@ void mjCSensor::ResolveReferences(const mjCModel* m) {
throw mjCError(this, "unrecognized name '%s' of object", refname_.c_str());
}
// if geom or mesh, mark it as non visual
if (reftype == mjOBJ_GEOM) {
static_cast<mjCGeom*>(ref)->SetNotVisual();
}
if (reftype == mjOBJ_MESH) {
static_cast<mjCMesh*>(ref)->SetNotVisual();
}
// must be attached to object with spatial frame
if (reftype != mjOBJ_BODY && reftype != mjOBJ_XBODY &&
reftype != mjOBJ_GEOM && reftype != mjOBJ_SITE && reftype != mjOBJ_CAMERA) {
@@ -7147,6 +7158,17 @@ void mjCSensor::Compile(void) {
}
break;
case mjSENS_TACTILE:
needstage = mjSTAGE_ACC;
datatype = mjDATATYPE_REAL;
if (objtype != mjOBJ_MESH) {
throw mjCError(this, "sensor must be associated with a mesh");
}
if (reftype != mjOBJ_GEOM) {
throw mjCError(this, "sensor must be associated with a geom");
}
break;
case mjSENS_PLUGIN:
datatype = mjDATATYPE_REAL; // no noise added to plugin sensors, this attribute is unused