Add insidesite sensor for detecting when an object is inside the volume of a site.

PiperOrigin-RevId: 780993257
Change-Id: I2dcfc840d222680adc3b934344a0819f4d78b6eb
This commit is contained in:
Yuval Tassa
2025-07-09 04:55:51 -07:00
committed by Copybara-Service
parent a86461fc57
commit e6c5715903
17 changed files with 244 additions and 27 deletions
+39
View File
@@ -7123,6 +7123,45 @@ The presence of this sensor in a model triggers a call to :ref:`mj_subtreeVel` d
:at:`body`: :at-val:`string, required`
Name of the body where the kinematic subtree is rooted.
.. _sensor-insidesite:
:el-prefix:`sensor/` |-| **insidesite** (*)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This element creates a sensor that returns 1 if the given object is inside a site, 0 otherwise.
It is useful for triggering events in surrounding environment logic.
See `example model <https://github.com/google-deepmind/mujoco/blob/main/test/engine/testdata/sensor/insidesite.xml>`__.
.. _sensor-insidesite-name:
.. _sensor-insidesite-noise:
.. _sensor-insidesite-cutoff:
.. _sensor-insidesite-user:
:at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
See :ref:`CSensor`.
.. _sensor-insidesite-objtype:
:at:`objtype`: :at-val:`[body, xbody, geom, site, camera], required`
The type of the object whose position will be queried.
See :ref:`framepos<sensor-framepos>`.
.. _sensor-insidesite-objname:
:at:`objname`: :at-val:`string, required`
The name of the object whose position will be queried.
See :ref:`framepos<sensor-framepos>`.
.. _sensor-insidesite-site:
:at:`site`: :at-val:`string`
The site defining the volume used for the inside check.
.. _collision-sensors:
collision sensors
+9
View File
@@ -1203,6 +1203,15 @@
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |_| sensor |br| |_| |L| | | .. table:: |
| :ref:`insidesite | \* | :class: mjcf-attributes |
| <sensor-insidesite>` | | |
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
| | | | :ref:`name<sensor-insidesite-name>` | :ref:`site<sensor-insidesite-site>` | :ref:`objtype<sensor-insidesite-objtype>` | :ref:`objname<sensor-insidesite-objname>` | |
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
| | | | :ref:`cutoff<sensor-insidesite-cutoff>` | :ref:`noise<sensor-insidesite-noise>` | :ref:`user<sensor-insidesite-user>` | | |
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |_| sensor |br| |_| |L| | | .. table:: |
| :ref:`distance | \* | :class: mjcf-attributes |
| <sensor-distance>` | | |
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
+5
View File
@@ -2,6 +2,11 @@
Changelog
=========
Upcoming version (not yet released)
-----------------------------------
- Added the :ref:`insidesite<sensor-insidesite>` sensor, for checking if an object is inside the volume of a site.
It is useful for triggering events in surrounding environment logic.
Version 3.3.4 (July 8, 2025)
-----------------------------------
+2 -1
View File
@@ -725,7 +725,8 @@ typedef enum mjtSensor_ { // type of sensor
mjSENS_SUBTREELINVEL, // 3D linear velocity of subtree
mjSENS_SUBTREEANGMOM, // 3D angular momentum of subtree
// sensors for geometric distance; attached to geoms or bodies
// sensors of geometric relationships
mjSENS_INSIDESITE, // 1 if object is inside a site, 0 otherwise
mjSENS_GEOMDIST, // signed distance between two geoms
mjSENS_GEOMNORMAL, // normal direction between two geoms
mjSENS_GEOMFROMTO, // segment between two geoms