Change mj_ray behaviour to match geom visualisation conventions:

- Planes and height-fields respect `mj_ray`'s `geom_group` argument.
- The `flg_static` argument now applies to all static geoms, not only those directly in the world body.

Before this change:
- Rays always intersected with height fields and planes, unless `flg_static` was set to 0.
- `flg_static` only applied to static geoms that were direct children of the world, but not geoms that were children of static bodies.

PiperOrigin-RevId: 534969091
Change-Id: I8dc7c320c63d6af95709b9f5e83a3c50e1c199fa
This commit is contained in:
Yuval Tassa
2023-05-24 13:50:32 -07:00
committed by Copybara-Service
parent 55c7f45dc5
commit c66d79409c
3 changed files with 23 additions and 25 deletions
+20 -17
View File
@@ -5,27 +5,29 @@ Changelog
Upcoming version (not yet released)
-----------------------------------
.. youtube:: hqIMTNGaLF4
.. youtube:: ZppeDArq6AU
:align: right
:width: 240px
Models
^^^^^^
- Added `3x3x3 cube <https://github.com/deepmind/mujoco/blob/main/model/cube/cube_3x3x3.xml>`__ example model. See
`README <https://github.com/deepmind/mujoco/blob/main/model/cube/README.md>`__ for details.
Bug fixes
^^^^^^^
^^^^^^^^^
- Fixed a bug that was causing an incorrect computation of the mesh bounding box and coordinate frame if the volume was
invalid. In such case, now MuJoCo only accepts a non-watertight geometry if :ref:`shellinertia<body-geom-shellinertia>`
is equal to ``true``.
invalid. In such case, now MuJoCo only accepts a non-watertight geometry if
:ref:`shellinertia<body-geom-shellinertia>` is equal to ``true``.
- Fixed the sparse Jacobian multiplication logic that is used to compute derivatives for tendon damping and fluid force,
which affects the behaviour of the :ref:`implicit and implicitfast integrators<geIntegration>`.
- Fixes to :ref:`mj_ray`, in line with geom visualisation conventions:
Plugins
^^^^^^^
- Added touch-grid sensor plugin. See `documentation <https://github.com/deepmind/mujoco/blob/main/plugin/sensor/README.md>`_
for details, and associated `touch_grid.xml <https://github.com/deepmind/mujoco/blob/main/model/plugin/touch_grid.xml>`_
example model. The plugin includes `in-scene visualisation <https://youtu.be/0LOJ3WMnqeA>`_.
- Planes and height-fields respect the `geom_group` and `flg_static` arguments. Before this change, rays would
intersect planes and height-fields unconditionally.
- ``flg_static`` now apllies to all static geoms, not just those which are direct children of the world body.
General
^^^^^^^
@@ -55,16 +57,17 @@ General
model, within a range of width tausmooth. See :ref:`Muscle actuators<CMuscle>` for more details.
Relatedly, :ref:`mju_muscleDynamics` now takes 3 parameters instead of 2, adding the new smoothing-width parameter.
.. youtube:: ZppeDArq6AU
.. youtube:: hqIMTNGaLF4
:align: right
:width: 240px
Models
^^^^^^
Plugins
^^^^^^^
- Added touch-grid sensor plugin. See `documentation <https://github.com/deepmind/mujoco/blob/main/plugin/sensor/README.md>`_
for details, and associated `touch_grid.xml <https://github.com/deepmind/mujoco/blob/main/model/plugin/touch_grid.xml>`_
example model. The plugin includes `in-scene visualisation <https://youtu.be/0LOJ3WMnqeA>`_.
- Added `3x3x3 cube <https://github.com/deepmind/mujoco/blob/main/model/cube/cube_3x3x3.xml>`__ example model. See
`README <https://github.com/deepmind/mujoco/blob/main/model/cube/README.md>`__ for details.
Version 2.3.5 (April 25, 2023)
------------------------------
+1 -6
View File
@@ -82,15 +82,10 @@ static int ray_eliminate(const mjModel* m, const mjData* d, int geomid,
}
// static exclusion
if (!flg_static && m->geom_bodyid[geomid]==0) {
if (!flg_static && m->body_weldid[m->geom_bodyid[geomid]]==0) {
return 1;
}
// plane and hfield inclusion
if (m->geom_type[geomid]==mjGEOM_PLANE || m->geom_type[geomid]==mjGEOM_HFIELD) {
return 0;
}
// no geomgroup inclusion
if (!geomgroup) {
return 0;
+2 -2
View File
@@ -39,10 +39,10 @@ static constexpr char kSingleGeomModel[] = R"(
static constexpr char kRayCastingModel[] = R"(
<mujoco>
<worldbody>
<geom name="static_group1" type="sphere" size=".1" pos="1 0 0"
group="1"/>
<geom name="static_group1" type="sphere" size=".1" pos="1 0 0" group="1"/>
<body pos="0 0 0">
<body pos="0 0 0">
<joint/>
<geom name="group0" type="sphere" size=".1" pos="3 0 0"/>
</body>
<geom name="group2" type="sphere" size=".1" pos="5 0 0" group="2"/>