Make "acc" the default computation stage for sensors of type user.
PiperOrigin-RevId: 492689134 Change-Id: I21c07c74cb4b94d39c091ae98b169fd1235769d4
This commit is contained in:
committed by
Copybara-Service
parent
66cb7d611b
commit
dee1d6020a
@@ -3943,7 +3943,7 @@ bodies whose center of mass is of interest.
|
|||||||
The type of output generated by this sensor. "axis" means a unit-length 3D vector. "quat" means a unit quaternion.
|
The type of output generated by this sensor. "axis" means a unit-length 3D vector. "quat" means a unit quaternion.
|
||||||
These need to be declared because when MuJoCo adds noise, it must respect the vector normalization. "real" means a
|
These need to be declared because when MuJoCo adds noise, it must respect the vector normalization. "real" means a
|
||||||
generic array (or scalar) of real values to which noise can be added independently.
|
generic array (or scalar) of real values to which noise can be added independently.
|
||||||
:at:`needstage`: :at-val:`[pos, vel, acc], required`
|
:at:`needstage`: :at-val:`[pos, vel, acc], "acc"`
|
||||||
The MuJoCo computation stage that must be completed before the user callback mjcb_sensor() is able to evaluate the
|
The MuJoCo computation stage that must be completed before the user callback mjcb_sensor() is able to evaluate the
|
||||||
output of this sensor.
|
output of this sensor.
|
||||||
:at:`dim`: :at-val:`int, required`
|
:at:`dim`: :at-val:`int, required`
|
||||||
|
|||||||
+3
-2
@@ -69,8 +69,9 @@ General
|
|||||||
register one or more MuJoCo plugins on load.
|
register one or more MuJoCo plugins on load.
|
||||||
- Add an optional ``visualize`` callback to plugins, which is called during ``mjv_updateScene``. This callback allows
|
- Add an optional ``visualize`` callback to plugins, which is called during ``mjv_updateScene``. This callback allows
|
||||||
custom plugin visualizations. Enable stree visualization for the Cable plugin as an example.
|
custom plugin visualizations. Enable stree visualization for the Cable plugin as an example.
|
||||||
- Sensors of type :ref:`user<sensor-user>` no longer require :at:`objtype` and :at:`objname`. If unspecified, the
|
- Sensors of type :ref:`user<sensor-user>` no longer require :at:`objtype`, :at:`objname` and :at:`needstage`. If
|
||||||
objtype will be :ref:`mjOBJ_UNKNOWN<mjtObj>`. ``user`` sensors :at:`datatype` default is now :at-val:`"real"`.
|
unspecified, the objtype is now :ref:`mjOBJ_UNKNOWN<mjtObj>`. ``user`` sensors :at:`datatype` default is now
|
||||||
|
:at-val:`"real"`, :at:`needstage` default is now :at-val:`"acc"`.
|
||||||
- Add support for capsules in URDF import.
|
- Add support for capsules in URDF import.
|
||||||
- On macOS, issue an informative error message when run under `Rosetta 2 <https://support.apple.com/en-gb/HT211861>`_
|
- On macOS, issue an informative error message when run under `Rosetta 2 <https://support.apple.com/en-gb/HT211861>`_
|
||||||
translation on an Apple Silicon machine. Pre-built MuJoCo binaries make use of
|
translation on an Apple Silicon machine. Pre-built MuJoCo binaries make use of
|
||||||
|
|||||||
@@ -3159,8 +3159,9 @@ void mjXReader::Sensor(XMLElement* section) {
|
|||||||
ReadAttrInt(elem, "dim", &psen->dim, true);
|
ReadAttrInt(elem, "dim", &psen->dim, true);
|
||||||
|
|
||||||
// keywords
|
// keywords
|
||||||
MapValue(elem, "needstage", &n, stage_map, stage_sz, true);
|
if (MapValue(elem, "needstage", &n, stage_map, stage_sz)) {
|
||||||
psen->needstage = (mjtStage)n;
|
psen->needstage = (mjtStage)n;
|
||||||
|
}
|
||||||
if (MapValue(elem, "datatype", &n, datatype_map, datatype_sz)) {
|
if (MapValue(elem, "datatype", &n, datatype_map, datatype_sz)) {
|
||||||
psen->datatype = (mjtDataType)n;
|
psen->datatype = (mjtDataType)n;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -967,6 +967,25 @@ TEST_F(SensorParseTest, UserObjNameNoType) {
|
|||||||
EXPECT_THAT(error.data(), HasSubstr("objname 'kevin' given but"));
|
EXPECT_THAT(error.data(), HasSubstr("objname 'kevin' given but"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(SensorParseTest, UserNeedstageAcc) {
|
||||||
|
static constexpr char xml[] = R"(
|
||||||
|
<mujoco>
|
||||||
|
<sensor>
|
||||||
|
<user dim="1" needstage="vel"/>
|
||||||
|
<user dim="1"/>
|
||||||
|
<user dim="1" needstage="pos"/>
|
||||||
|
</sensor>
|
||||||
|
</mujoco>
|
||||||
|
)";
|
||||||
|
std::array<char, 1024> error;
|
||||||
|
mjModel* model = LoadModelFromString(xml, error.data(), error.size());
|
||||||
|
ASSERT_THAT(model, NotNull()) << error.data();
|
||||||
|
EXPECT_EQ(model->sensor_needstage[0], mjSTAGE_VEL);
|
||||||
|
EXPECT_EQ(model->sensor_needstage[1], mjSTAGE_ACC);
|
||||||
|
EXPECT_EQ(model->sensor_needstage[2], mjSTAGE_POS);
|
||||||
|
mj_deleteModel(model);
|
||||||
|
}
|
||||||
|
|
||||||
// ------------- test general parsing ------------------------------------------
|
// ------------- test general parsing ------------------------------------------
|
||||||
|
|
||||||
TEST_F(XMLReaderTest, ZnearZeroNotAllowed) {
|
TEST_F(XMLReaderTest, ZnearZeroNotAllowed) {
|
||||||
|
|||||||
Reference in New Issue
Block a user