Add function mjs_sensorDim to user API.
Note: change to (unreleased) contact sensor mjSpec API PiperOrigin-RevId: 788507423 Change-Id: Ie639afb7ed01dc3f7bab43a3e812e8e0b0c67d07
This commit is contained in:
committed by
Copybara-Service
parent
a771fc6c09
commit
46dc67b7eb
@@ -4216,20 +4216,19 @@ void mjXReader::Sensor(XMLElement* section) {
|
||||
}
|
||||
sensor->intprm[0] = dataspec;
|
||||
|
||||
// number of contacts, sensor dim
|
||||
sensor->dim = 1;
|
||||
ReadAttrInt(elem, "num", &sensor->dim);
|
||||
if (sensor->dim <= 0) {
|
||||
throw mjXError(elem, "'num' must be positive in sensor");
|
||||
}
|
||||
sensor->dim *= mju_condataSize(dataspec);
|
||||
|
||||
// reduction type (intprm[1])
|
||||
sensor->intprm[1] = 0;
|
||||
if (MapValue(elem, "reduce", &n, reduce_map, reduce_sz)) {
|
||||
sensor->intprm[1] = n;
|
||||
}
|
||||
|
||||
// number of contacts (intprm[2])
|
||||
sensor->intprm[2] = 1;
|
||||
ReadAttrInt(elem, "num", &sensor->intprm[2]);
|
||||
if (sensor->intprm[2] <= 0) {
|
||||
throw mjXError(elem, "'num' must be positive in sensor");
|
||||
}
|
||||
|
||||
// sensor type
|
||||
sensor->type = mjSENS_CONTACT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user