Add clock sensor type.

PiperOrigin-RevId: 459720950
Change-Id: Ibda48ae7dc4aa7be451a947a1c53d10a7eaf176b
This commit is contained in:
Yuval Tassa
2022-07-08 03:49:29 -07:00
committed by Copybara-Service
parent d3a86bb748
commit c14a7ef4a7
10 changed files with 85 additions and 10 deletions
+7 -1
View File
@@ -3533,7 +3533,7 @@ void mjCSensor::Compile(void) {
// get sensorized object id
objid = pobj->id;
} else {
} else if (type != mjSENS_CLOCK) {
throw mjCError(this, "invalid type in sensor '%s' (id = %d)", name.c_str(), id);
}
@@ -3804,6 +3804,12 @@ void mjCSensor::Compile(void) {
}
break;
case mjSENS_CLOCK:
dim = 1;
needstage = mjSTAGE_POS;
datatype = mjDATATYPE_REAL;
break;
case mjSENS_USER:
// check for negative dim
if (dim<0) {