Introduce mjPreContact, a minimal struct passed into the collision functions.
PiperOrigin-RevId: 918533795 Change-Id: I2b5af05c1479b25d5c2cfdc690321a26fce6ede6
This commit is contained in:
committed by
Copybara-Service
parent
53b3137a12
commit
7174d33f08
@@ -936,6 +936,15 @@ MJCF element :ref:`statistic <statistic>`. One instance of it is embedded in mjM
|
||||
.. mujoco-include:: mjStatistic
|
||||
|
||||
|
||||
.. _mjPreContact:
|
||||
|
||||
mjPreContact
|
||||
~~~~~~~~~~~~
|
||||
|
||||
This is the data structure holding information about one contact filled out by a narrowphase collision detector.
|
||||
|
||||
.. mujoco-include:: mjPreContact
|
||||
|
||||
.. _mjContact:
|
||||
|
||||
mjContact
|
||||
@@ -1780,7 +1789,7 @@ mjfCollision
|
||||
.. code-block:: C
|
||||
|
||||
typedef int (*mjfCollision)(const mjModel* m, const mjData* d,
|
||||
mjContact* con, int g1, int g2, mjtNum margin);
|
||||
mjPreContact* con, int g1, int g2, mjtNum margin);
|
||||
|
||||
This is the function type of the callbacks in the collision table :ref:`mjCOLLISIONFUNC`.
|
||||
|
||||
|
||||
@@ -70,6 +70,9 @@ General
|
||||
Negative ``margin`` values are now permitted (corresponding to ``gap > margin`` under the old semantics). The
|
||||
constraint ``margin + gap >= 0`` should be maintained to ensure valid collision detection.
|
||||
|
||||
- The :ref:`mjfCollision` functions now populate the :ref:`mjPreContact` struct instead of the :ref:`mjContact`
|
||||
struct. The :ref:`mjPreContact` only contains the necessary fields needed for the narrowphase collision detection.
|
||||
|
||||
- MJX: Removed the deprecated ``nconmax`` argument from ``mjx.make_data`` and ``mjx.put_data`` in favor of
|
||||
``naconmax``.
|
||||
|
||||
|
||||
@@ -101,8 +101,15 @@ typedef enum mjtSleepState_ { // sleep state of an object
|
||||
mjS_ASLEEP = 0, // object is asleep
|
||||
mjS_AWAKE = 1 // object is awake
|
||||
} mjtSleepState;
|
||||
struct mjPreContact_ { // contact parameters set by narrowphase collision functions
|
||||
mjtNum dist;
|
||||
mjtNum pos[3];
|
||||
mjtNum normal[3]; // contact normal of the collision
|
||||
mjtNum tangent[3]; // first tangent direction
|
||||
};
|
||||
typedef struct mjPreContact_ mjPreContact;
|
||||
struct mjContact_ { // result of collision detection functions
|
||||
// contact parameters set by near-phase collision function
|
||||
// contact parameters set by narrowphase collision function
|
||||
mjtNum dist; // distance between nearest points; neg: penetration
|
||||
mjtNum pos[3]; // position of contact point: midpoint between geoms
|
||||
mjtNum frame[9]; // normal is in [0-2], points from geom[0] to geom[1]
|
||||
|
||||
Reference in New Issue
Block a user