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
+8 -1
View File
@@ -42,7 +42,7 @@ using tinyxml2::XMLElement;
//---------------------------------- MJCF schema ---------------------------------------------------
static const int nMJCF = 162;
static const int nMJCF = 163;
static const char* MJCF[nMJCF][mjXATTRNUM] = {
{"mujoco", "!", "1", "model"},
{"<"},
@@ -342,6 +342,7 @@ static const char* MJCF[nMJCF][mjXATTRNUM] = {
{"subtreecom", "*", "5", "name", "body", "cutoff", "noise", "user"},
{"subtreelinvel", "*", "5", "name", "body", "cutoff", "noise", "user"},
{"subtreeangmom", "*", "5", "name", "body", "cutoff", "noise", "user"},
{"clock", "*", "4", "name", "cutoff", "noise", "user"},
{"user", "*", "9", "name", "objtype", "objname", "datatype", "needstage",
"dim", "cutoff", "noise", "user"},
{">"},
@@ -2735,6 +2736,12 @@ void mjXReader::Sensor(XMLElement* section) {
ReadAttrTxt(elem, "body", psen->objname, true);
}
// global sensors
else if (type=="clock") {
psen->type = mjSENS_CLOCK;
psen->objtype = mjOBJ_UNKNOWN;
}
// user-defined sensor
else if (type=="user") {
psen->type = mjSENS_USER;