Increase mjNSENS to 3
PiperOrigin-RevId: 788468705 Change-Id: Id22f131bebb6accc9a29c9aa285efa75fa8b2c16
This commit is contained in:
committed by
Copybara-Service
parent
4575089f48
commit
a771fc6c09
@@ -445,7 +445,7 @@ shown in the table below. Their names are in the format ``mjKEY_XXX``. They corr
|
|||||||
- The maximal number of real-valued parameters used to define the impedance of each scalar constraint.
|
- The maximal number of real-valued parameters used to define the impedance of each scalar constraint.
|
||||||
Determines the size of all ``mjModel.XXX_solimp`` fields.
|
Determines the size of all ``mjModel.XXX_solimp`` fields.
|
||||||
* - ``mjNSENS``
|
* - ``mjNSENS``
|
||||||
- 2
|
- 3
|
||||||
- The number of sensor parameters.
|
- The number of sensor parameters.
|
||||||
Determines the size of ``mjModel.sensor_intprm``.
|
Determines the size of ``mjModel.sensor_intprm``.
|
||||||
* - ``mjNSOLVER``
|
* - ``mjNSOLVER``
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
#define mjNFLUID 12 // number of fluid interaction parameters
|
#define mjNFLUID 12 // number of fluid interaction parameters
|
||||||
#define mjNREF 2 // number of solver reference parameters
|
#define mjNREF 2 // number of solver reference parameters
|
||||||
#define mjNIMP 5 // number of solver impedance parameters
|
#define mjNIMP 5 // number of solver impedance parameters
|
||||||
#define mjNSENS 2 // number of sensor parameters
|
#define mjNSENS 3 // number of sensor parameters
|
||||||
#define mjNSOLVER 200 // size of one mjData.solver array
|
#define mjNSOLVER 200 // size of one mjData.solver array
|
||||||
#define mjNISLAND 20 // number of mjData.solver arrays
|
#define mjNISLAND 20 // number of mjData.solver arrays
|
||||||
|
|
||||||
|
|||||||
@@ -567,7 +567,7 @@ def sensor_acc(m: Model, d: Data) -> Data:
|
|||||||
size += size_i
|
size += size_i
|
||||||
return size
|
return size
|
||||||
|
|
||||||
dataspecs, reduces = m.sensor_intprm[idx].T
|
dataspecs, reduces, _ = m.sensor_intprm[idx].T
|
||||||
dims = m.sensor_dim[idx]
|
dims = m.sensor_dim[idx]
|
||||||
objtypes = m.sensor_objtype[idx]
|
objtypes = m.sensor_objtype[idx]
|
||||||
refid = m.sensor_refid[idx]
|
refid = m.sensor_refid[idx]
|
||||||
|
|||||||
@@ -10408,7 +10408,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
|||||||
name='intprm',
|
name='intprm',
|
||||||
type=ArrayType(
|
type=ArrayType(
|
||||||
inner_type=ValueType(name='int'),
|
inner_type=ValueType(name='int'),
|
||||||
extents=(2,),
|
extents=(3,),
|
||||||
),
|
),
|
||||||
doc='integer parameters',
|
doc='integer parameters',
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1338,7 +1338,7 @@ class SpecsTest(absltest.TestCase):
|
|||||||
objtype=mujoco.mjtObj.mjOBJ_GEOM,
|
objtype=mujoco.mjtObj.mjOBJ_GEOM,
|
||||||
objname='sphere1',
|
objname='sphere1',
|
||||||
dim=1,
|
dim=1,
|
||||||
intprm=[0, 0],
|
intprm=[0, 0, 0],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
@@ -1351,7 +1351,7 @@ class SpecsTest(absltest.TestCase):
|
|||||||
objtype=mujoco.mjtObj.mjOBJ_GEOM,
|
objtype=mujoco.mjtObj.mjOBJ_GEOM,
|
||||||
objname='sphere1',
|
objname='sphere1',
|
||||||
dim=1,
|
dim=1,
|
||||||
intprm=[1 << 10, 0],
|
intprm=[1 << 10, 0, 0],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
@@ -1364,7 +1364,7 @@ class SpecsTest(absltest.TestCase):
|
|||||||
objtype=mujoco.mjtObj.mjOBJ_GEOM,
|
objtype=mujoco.mjtObj.mjOBJ_GEOM,
|
||||||
objname='sphere1',
|
objname='sphere1',
|
||||||
dim=1,
|
dim=1,
|
||||||
intprm=[(1 << 10) | 1, 0],
|
intprm=[(1 << 10) | 1, 0, 0],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
@@ -1376,7 +1376,7 @@ class SpecsTest(absltest.TestCase):
|
|||||||
objtype=mujoco.mjtObj.mjOBJ_GEOM,
|
objtype=mujoco.mjtObj.mjOBJ_GEOM,
|
||||||
objname='sphere1',
|
objname='sphere1',
|
||||||
dim=2,
|
dim=2,
|
||||||
intprm=[2, 0], # force (size 3)
|
intprm=[2, 0, 0], # force (size 3)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
@@ -1386,7 +1386,7 @@ class SpecsTest(absltest.TestCase):
|
|||||||
objtype=mujoco.mjtObj.mjOBJ_GEOM,
|
objtype=mujoco.mjtObj.mjOBJ_GEOM,
|
||||||
objname='sphere1',
|
objname='sphere1',
|
||||||
dim=1,
|
dim=1,
|
||||||
intprm=[1, 4],
|
intprm=[1, 4, 0],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ TEST_F(SensorTest, IntPrm) {
|
|||||||
</sensor>
|
</sensor>
|
||||||
</mujoco>
|
</mujoco>
|
||||||
)";
|
)";
|
||||||
ASSERT_EQ(mjNSENS, 2);
|
ASSERT_EQ(mjNSENS, 3);
|
||||||
|
|
||||||
char err[1024];
|
char err[1024];
|
||||||
mjSpec* spec = mj_parseXMLString(xml, 0, err, sizeof(err));
|
mjSpec* spec = mj_parseXMLString(xml, 0, err, sizeof(err));
|
||||||
@@ -588,9 +588,11 @@ TEST_F(SensorTest, IntPrm) {
|
|||||||
mjsSensor* s = mjs_asSensor(mjs_findElement(spec, mjOBJ_SENSOR, "dummy"));
|
mjsSensor* s = mjs_asSensor(mjs_findElement(spec, mjOBJ_SENSOR, "dummy"));
|
||||||
s->intprm[0] = 3;
|
s->intprm[0] = 3;
|
||||||
s->intprm[1] = 4;
|
s->intprm[1] = 4;
|
||||||
|
s->intprm[2] = 5;
|
||||||
model = mj_compile(spec, nullptr);
|
model = mj_compile(spec, nullptr);
|
||||||
EXPECT_EQ(model->sensor_intprm[0], 3);
|
EXPECT_EQ(model->sensor_intprm[0], 3);
|
||||||
EXPECT_EQ(model->sensor_intprm[1], 4);
|
EXPECT_EQ(model->sensor_intprm[1], 4);
|
||||||
|
EXPECT_EQ(model->sensor_intprm[2], 5);
|
||||||
mj_deleteModel(model);
|
mj_deleteModel(model);
|
||||||
mj_deleteSpec(spec);
|
mj_deleteSpec(spec);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public const int mjNBIAS = 10;
|
|||||||
public const int mjNFLUID = 12;
|
public const int mjNFLUID = 12;
|
||||||
public const int mjNREF = 2;
|
public const int mjNREF = 2;
|
||||||
public const int mjNIMP = 5;
|
public const int mjNIMP = 5;
|
||||||
public const int mjNSENS = 2;
|
public const int mjNSENS = 3;
|
||||||
public const int mjNSOLVER = 200;
|
public const int mjNSOLVER = 200;
|
||||||
public const int mjNISLAND = 20;
|
public const int mjNISLAND = 20;
|
||||||
public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJPLUGIN_H_ = true;
|
public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJPLUGIN_H_ = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user