Add a disable flag for sensors.

PiperOrigin-RevId: 469473066
Change-Id: I296ed790c6261c4fb15b349540edcb77e53e0567
This commit is contained in:
Yuval Tassa
2022-08-23 09:02:15 -07:00
committed by Copybara-Service
parent 83ce236479
commit 090fe2db3f
11 changed files with 101 additions and 18 deletions
+15
View File
@@ -193,6 +193,11 @@ void mj_sensorPos(const mjModel* m, mjData* d) {
int ne = d->ne, nf = d->nf, nefc = d->nefc;
mjtNum rvec[3], *xpos, *xmat, *xpos_ref, *xmat_ref;
// disabled sensors: return
if (mjDISABLED(mjDSBL_SENSOR)) {
return;
}
// process sensors matching stage
for (int i=0; i<m->nsensor; i++) {
if (m->sensor_needstage[i]==mjSTAGE_POS) {
@@ -349,6 +354,11 @@ void mj_sensorVel(const mjModel* m, mjData* d) {
int ne = d->ne, nf = d->nf, nefc = d->nefc;
mjtNum xvel[6];
// disabled sensors: return
if (mjDISABLED(mjDSBL_SENSOR)) {
return;
}
// process sensors matching stage
int subtreeVel = 0;
for (int i=0; i<m->nsensor; i++) {
@@ -502,6 +512,11 @@ void mj_sensorAcc(const mjModel* m, mjData* d) {
mjtNum tmp[6], conforce[6], conray[3];
mjContact* con;
// disabled sensors: return
if (mjDISABLED(mjDSBL_SENSOR)) {
return;
}
// process sensors matching stage
int rnePost = 0;
for (int i=0; i<m->nsensor; i++) {