Remove mjOption.collision and associated option/collision attribute.
PiperOrigin-RevId: 566427090 Change-Id: I6e5873b8db707586820b17b53c7ab4bbff0f0b2b
This commit is contained in:
committed by
Copybara-Service
parent
9902b73502
commit
9cf1f6eba4
@@ -174,18 +174,6 @@ Numerical integrator types. These values are used in ``m->opt.integrator``.
|
||||
|
||||
.. mujoco-include:: mjtIntegrator
|
||||
|
||||
|
||||
.. _mjtCollision:
|
||||
|
||||
mjtCollision
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Collision modes specifying how candidate geom pairs are generated for near-phase collision checking. These values are
|
||||
used in ``m->opt.collision``.
|
||||
|
||||
.. mujoco-include:: mjtCollision
|
||||
|
||||
|
||||
.. _mjtCone:
|
||||
|
||||
mjtCone
|
||||
|
||||
@@ -1931,14 +1931,6 @@ adjust it properly through the XML.
|
||||
Implicit-in-velocity Euler method, and :at:`implicitfast`, which drops the Coriolis and centrifugal terms. See
|
||||
:ref:`Numerical Integration<geIntegration>` for more details.
|
||||
|
||||
.. _option-collision:
|
||||
|
||||
:at:`collision`: :at-val:`[all, predefined, dynamic], "all"`
|
||||
This attribute specifies which geom pairs should be checked for collision; recall :ref:`Collision` in the Computation
|
||||
chapter. "predefined" means that only the explicitly-defined contact :ref:`pairs <contact-pair>` are checked.
|
||||
"dynamic" means that only the contact pairs generated dynamically are checked. "all" means that the contact pairs
|
||||
from both sources are checked.
|
||||
|
||||
.. _option-cone:
|
||||
|
||||
:at:`cone`: :at-val:`[pyramidal, elliptic], "pyramidal"`
|
||||
|
||||
+3
-3
@@ -224,11 +224,11 @@
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`o_margin<option-o_margin>` | :ref:`o_solref<option-o_solref>` | :ref:`o_solimp<option-o_solimp>` | :ref:`integrator<option-integrator>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`collision<option-collision>` | :ref:`cone<option-cone>` | :ref:`jacobian<option-jacobian>` | :ref:`solver<option-solver>` | |
|
||||
| | | | :ref:`cone<option-cone>` | :ref:`jacobian<option-jacobian>` | :ref:`solver<option-solver>` | :ref:`iterations<option-iterations>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`iterations<option-iterations>` | :ref:`ls_iterations<option-ls_iterations>` | :ref:`noslip_iterations<option-noslip_iterations>` | :ref:`mpr_iterations<option-mpr_iterations>` | |
|
||||
| | | | :ref:`ls_iterations<option-ls_iterations>` | :ref:`noslip_iterations<option-noslip_iterations>` | :ref:`mpr_iterations<option-mpr_iterations>` | :ref:`sdf_iterations<option-sdf_iterations>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`sdf_iterations<option-sdf_iterations>` | :ref:`sdf_initpoints<option-sdf_initpoints>` | | | |
|
||||
| | | | :ref:`sdf_initpoints<option-sdf_initpoints>` | | | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_| option |br| |_| |L| | | .. table:: |
|
||||
|
||||
+22
-11
@@ -62,35 +62,46 @@ General
|
||||
- Renamed ``mjData.solver_iter`` to ``solver_niter``. Both this member and ``mjData.solver_nnz`` are now integer
|
||||
vectors of length ``mjNISLAND``.
|
||||
|
||||
8. Added a new :ref:`dyntype<actuator-general-dyntype>`, ``filterexact``, which updates first-order filter states with
|
||||
8. Removed ``mjOption.collision`` and the associated ``option/collision`` attribute.
|
||||
|
||||
**Migration:**
|
||||
|
||||
- For models which have ``<option collision="all"/>``, delete the attribute.
|
||||
- For models which have ``<option collision="dynamic"/>``, delete all :ref:`pair<contact-pair>` elements.
|
||||
- For models which have ``<option collision="pair"/>``, disable all dynamic collisions (determined
|
||||
via contype/conaffinity) by first deleting all :ref:`contype<body-geom-contype>` and
|
||||
:ref:`conaffinity<body-geom-conaffinity>` attributes in the model and then setting them globally to ``0`` using
|
||||
|br| ``<default> <geom contype="0" conaffinity="0"/> </default>``.
|
||||
|
||||
9. Added a new :ref:`dyntype<actuator-general-dyntype>`, ``filterexact``, which updates first-order filter states with
|
||||
the exact formula rather than with Euler integration.
|
||||
9. Added an actuator attribute, :ref:`actearly<actuator-general-actearly>`, which uses semi-implicit integration for
|
||||
actuator forces: using the next step's actuator state to compute the current actuator forces at the current timestep.
|
||||
10. Renamed ``actuatorforcerange`` and ``actuatorforcelimited``, introduced in the previous version to
|
||||
10. Added an actuator attribute, :ref:`actearly<actuator-general-actearly>`, which uses semi-implicit integration for
|
||||
actuator forces: using the next step's actuator state to compute the current actuator forces at the current timestep.
|
||||
11. Renamed ``actuatorforcerange`` and ``actuatorforcelimited``, introduced in the previous version to
|
||||
:ref:`actuatorfrcrange<body-joint-actuatorfrcrange>` and
|
||||
:ref:`actuatorfrclimited<body-joint-actuatorfrclimited>`, respectively.
|
||||
11. Added the flag :ref:`eulerdamp<option-flag-eulerdamp>`, which disables implicit integration of joint damping in the
|
||||
12. Added the flag :ref:`eulerdamp<option-flag-eulerdamp>`, which disables implicit integration of joint damping in the
|
||||
Euler integrator. See the :ref:`Numerical Integration<geIntegration>` section for more details.
|
||||
12. Added the flag :ref:`invdiscrete<option-flag-invdiscrete>`, which enables discrete-time inverse dynamics for all
|
||||
13. Added the flag :ref:`invdiscrete<option-flag-invdiscrete>`, which enables discrete-time inverse dynamics for all
|
||||
:ref:`integrators<option-integrator>` other than ``RK4``. See the flag documentation for more details.
|
||||
13. Added :ref:`ls_iterations<option-ls_iterations>` and :ref:`ls_tolerance<option-ls_tolerance>` options for adjusting
|
||||
14. Added :ref:`ls_iterations<option-ls_iterations>` and :ref:`ls_tolerance<option-ls_tolerance>` options for adjusting
|
||||
linesearch stopping criteria in CG and Newton solvers. These can be useful for performance tuning.
|
||||
14. Added ``mesh_pos`` and ``mesh_quat`` fields to :ref:`mjModel` to store the normalizing transformation applied to
|
||||
15. Added ``mesh_pos`` and ``mesh_quat`` fields to :ref:`mjModel` to store the normalizing transformation applied to
|
||||
mesh assets. Fixes `#409 <https://github.com/google-deepmind/mujoco/issues/409>`__ .
|
||||
15. Added camera :ref:`resolution<body-camera-resolution>` attribute and :ref:`camprojection<sensor-camprojection>`
|
||||
16. Added camera :ref:`resolution<body-camera-resolution>` attribute and :ref:`camprojection<sensor-camprojection>`
|
||||
sensor. If camera resolution is set to positive values, the camera projection sensor will report the location of a
|
||||
target site, projected onto the camera image, in pixel coordinates.
|
||||
|
||||
Python bindings
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
16. Fixed `#870 <https://github.com/google-deepmind/mujoco/issues/870>`__ where calling ``update_scene`` with an invalid
|
||||
17. Fixed `#870 <https://github.com/google-deepmind/mujoco/issues/870>`__ where calling ``update_scene`` with an invalid
|
||||
camera name used the default camera.
|
||||
|
||||
Bug fixes
|
||||
^^^^^^^^^
|
||||
|
||||
17. Fixed a bug that was causing :ref:`geom margin<body-geom-margin>` to be ignored during the construction of
|
||||
18. Fixed a bug that was causing :ref:`geom margin<body-geom-margin>` to be ignored during the construction of
|
||||
midphase collision trees.
|
||||
|
||||
|
||||
|
||||
+10
-17
@@ -1466,25 +1466,18 @@ others can be pruned quickly without a detailed check. MuJoCo has flexible mecha
|
||||
checked in detail. The decision process involves two stages: generation and filtering.
|
||||
|
||||
Generation
|
||||
First we generate a list of candidate geom pairs in one of two ways: "pair" or "dynamic". The user can also specify
|
||||
"all" which merges both sources (and is the default). This is done via the setting ``mjModel.opt.collision``. "Pair"
|
||||
refers to an explicit list of geom pairs defined with the :ref:`pair <contact-pair>` element in MJCF. It gives the
|
||||
user full control, however it is a static mechanism (independent of the spatial arrangement of the geoms at runtime)
|
||||
and can be tedious for large models. It is normally used to supplement the output of the "dynamic" mechanism. Dynamic
|
||||
generation works with bodies rather than geoms; when a body pair is included this means that all geoms attached to
|
||||
one body can collide with all geoms attached to the other body.
|
||||
First we generate a list of candidate geom pairs in two ways:
|
||||
|
||||
The body pairs are generated via broad-phase collision detection based on a modified sweep-and-prune algorithm. The
|
||||
modification is that the axis for sorting is chosen as the principal eigenvector of the covariance matrix of all geom
|
||||
centers - which maximizes the spread. Then, for each body pair, a mid-phase collision detection using a static
|
||||
bounding volume hierarchy (a BVH binary tree) of axis-aligned bounding boxes (AABB) is performed. Each body is
|
||||
equipped with an AABB tree of its geoms, aligned with the body inertial or geom frames for all inner or leaf nodes,
|
||||
respectively.
|
||||
- Using predefined geom pairs, specified with the :ref:`contact-pair <contact-pair>` element. This mechanism is
|
||||
independent of the spatial arrangement of the geoms at runtime.
|
||||
- Generating candidate geom pairs by examining the runtime locations of bodies. First, a sweep-and-prune broadphase
|
||||
collision stage prunes bodies that cannot collide. Then, a mid-phase collision stage further prunes geom pairs from
|
||||
remaining body pairs using a static Bounding Volume Hierarchy (a binary tree) of axis-aligned bounding boxes.
|
||||
Each body is equipped with an AABB tree of its geoms, aligned with the body inertial or geom frames for all inner
|
||||
or leaf nodes, respectively.
|
||||
- The user can also explicitly exclude certain body pairs using the :ref:`exclude <contact-exclude>` element.
|
||||
|
||||
Finally, the user can explicitly exclude certain body pairs using the :ref:`exclude <contact-exclude>` element
|
||||
in MJCF. Exclusion is applied when "dynamic" or "all" are selected, but not when "pair" is selected. At the end of
|
||||
this step we have a list of geoms pairs that is typically much smaller than :math:`n (n-1)/2`, but can still be
|
||||
pruned further before detailed collision checking.
|
||||
These two lists are then merged.
|
||||
|
||||
Filtering
|
||||
Next we apply four filters to the list generated in the previous step. Filters 1 and 2 are applied to all geom pairs.
|
||||
|
||||
@@ -460,11 +460,6 @@ typedef enum mjtIntegrator_ { // integrator mode
|
||||
mjINT_IMPLICIT, // implicit in velocity
|
||||
mjINT_IMPLICITFAST // implicit in velocity, no rne derivative
|
||||
} mjtIntegrator;
|
||||
typedef enum mjtCollision_ { // collision mode for selecting geom pairs
|
||||
mjCOL_ALL = 0, // test precomputed and dynamic pairs
|
||||
mjCOL_PAIR, // test predefined pairs only
|
||||
mjCOL_DYNAMIC // test dynamic pairs only
|
||||
} mjtCollision;
|
||||
typedef enum mjtCone_ { // type of friction cone
|
||||
mjCONE_PYRAMIDAL = 0, // pyramidal
|
||||
mjCONE_ELLIPTIC // elliptic
|
||||
@@ -694,7 +689,6 @@ struct mjOption_ { // physics options
|
||||
|
||||
// discrete settings
|
||||
int integrator; // integration mode (mjtIntegrator)
|
||||
int collision; // collision mode (mjtCollision)
|
||||
int cone; // type of friction cone (mjtCone)
|
||||
int jacobian; // type of Jacobian (mjtJacobian)
|
||||
int solver; // solver algorithm (mjtSolver)
|
||||
|
||||
@@ -140,13 +140,6 @@ typedef enum mjtIntegrator_ { // integrator mode
|
||||
} mjtIntegrator;
|
||||
|
||||
|
||||
typedef enum mjtCollision_ { // collision mode for selecting geom pairs
|
||||
mjCOL_ALL = 0, // test precomputed and dynamic pairs
|
||||
mjCOL_PAIR, // test predefined pairs only
|
||||
mjCOL_DYNAMIC // test dynamic pairs only
|
||||
} mjtCollision;
|
||||
|
||||
|
||||
typedef enum mjtCone_ { // type of friction cone
|
||||
mjCONE_PYRAMIDAL = 0, // pyramidal
|
||||
mjCONE_ELLIPTIC // elliptic
|
||||
@@ -417,7 +410,6 @@ struct mjOption_ { // physics options
|
||||
|
||||
// discrete settings
|
||||
int integrator; // integration mode (mjtIntegrator)
|
||||
int collision; // collision mode (mjtCollision)
|
||||
int cone; // type of friction cone (mjtCone)
|
||||
int jacobian; // type of Jacobian (mjtJacobian)
|
||||
int solver; // solver algorithm (mjtSolver)
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#define MJOPTION_INTS \
|
||||
X( int, integrator ) \
|
||||
X( int, collision ) \
|
||||
X( int, cone ) \
|
||||
X( int, jacobian ) \
|
||||
X( int, solver ) \
|
||||
|
||||
@@ -128,16 +128,6 @@ ENUMS: Mapping[str, EnumDecl] = dict([
|
||||
('mjINT_IMPLICITFAST', 3),
|
||||
]),
|
||||
)),
|
||||
('mjtCollision',
|
||||
EnumDecl(
|
||||
name='mjtCollision',
|
||||
declname='enum mjtCollision_',
|
||||
values=dict([
|
||||
('mjCOL_ALL', 0),
|
||||
('mjCOL_PAIR', 1),
|
||||
('mjCOL_DYNAMIC', 2),
|
||||
]),
|
||||
)),
|
||||
('mjtCone',
|
||||
EnumDecl(
|
||||
name='mjtCone',
|
||||
|
||||
@@ -223,11 +223,6 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
type=ValueType(name='int'),
|
||||
doc='integration mode (mjtIntegrator)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='collision',
|
||||
type=ValueType(name='int'),
|
||||
doc='collision mode (mjtCollision)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cone',
|
||||
type=ValueType(name='int'),
|
||||
|
||||
@@ -657,7 +657,6 @@ void MakePhysicsSection(mj::Simulate* sim, int oldstate) {
|
||||
mjuiDef defPhysics[] = {
|
||||
{mjITEM_SECTION, "Physics", oldstate, nullptr, "AP"},
|
||||
{mjITEM_SELECT, "Integrator", 2, &(opt->integrator), "Euler\nRK4\nimplicit\nimplicitfast"},
|
||||
{mjITEM_SELECT, "Collision", 2, &(opt->collision), "All\nPair\nDynamic"},
|
||||
{mjITEM_SELECT, "Cone", 2, &(opt->cone), "Pyramidal\nElliptic"},
|
||||
{mjITEM_SELECT, "Jacobian", 2, &(opt->jacobian), "Dense\nSparse\nAuto"},
|
||||
{mjITEM_SELECT, "Solver", 2, &(opt->solver), "PGS\nCG\nNewton"},
|
||||
@@ -1773,7 +1772,6 @@ void Simulate::Sync() {
|
||||
X(o_solref);
|
||||
X(o_solimp);
|
||||
X(integrator);
|
||||
X(collision);
|
||||
X(cone);
|
||||
X(jacobian);
|
||||
X(solver);
|
||||
|
||||
@@ -385,7 +385,7 @@ quicksortfunc(contactcompare, context, el1, el2) {
|
||||
|
||||
void mj_collision(const mjModel* m, mjData* d) {
|
||||
int g1, g2, merged, b1 = 0, b2 = 0, exadr = 0, pairadr = 0, startadr;
|
||||
int nexclude = m->nexclude, npair = m->npair, nbodypair = ((m->nbody-1)*m->nbody)/2;
|
||||
int nexclude = m->nexclude, npair = m->npair;
|
||||
int *broadphasepair = 0;
|
||||
|
||||
// reset the size of the contact array and invalidate efc arrays
|
||||
@@ -410,97 +410,82 @@ void mj_collision(const mjModel* m, mjData* d) {
|
||||
|
||||
mj_markStack(d);
|
||||
|
||||
// predefined only; ignore exclude
|
||||
if (m->opt.collision == mjCOL_PAIR) {
|
||||
d->nbodypair_broad = npair;
|
||||
for (pairadr=0; pairadr < npair; pairadr++) {
|
||||
int ngeompair_narrow_before = d->ngeompair_narrow;
|
||||
int ngeompair_mid_before = d->ngeompair_mid;
|
||||
collideGeoms(m, d, pairadr, -1, 0, 0);
|
||||
if (d->ngeompair_narrow > ngeompair_narrow_before) d->nbodypair_narrow++;
|
||||
if (d->ngeompair_mid > ngeompair_mid_before) d->nbodypair_broad++;
|
||||
// call broadphase collision detector
|
||||
int nbodypair = (m->nbody*(m->nbody - 1))/2;
|
||||
broadphasepair = mj_stackAllocInt(d, nbodypair);
|
||||
nbodypair = mj_broadphase(m, d, broadphasepair, nbodypair);
|
||||
unsigned int last_signature = -1;
|
||||
|
||||
// loop over body pairs
|
||||
for (int i=0; i < nbodypair; i++) {
|
||||
// reconstruct body pair ids
|
||||
b1 = (broadphasepair[i]>>16) & 0xFFFF;
|
||||
b2 = broadphasepair[i] & 0xFFFF;
|
||||
|
||||
// compute signature for this body pair
|
||||
unsigned int signature = ((b1+1)<<16) + (b2+1);
|
||||
// pairs come sorted by signature, but may not be unique
|
||||
// if signature is repeated, skip it
|
||||
if (signature == last_signature) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
last_signature = signature;
|
||||
|
||||
// dynamic only or merge; apply exclude
|
||||
else {
|
||||
// call broadphase collision detector
|
||||
int npairs = (m->nbody*(m->nbody - 1))/2;
|
||||
broadphasepair = mj_stackAllocInt(d, npairs);
|
||||
nbodypair = mj_broadphase(m, d, broadphasepair, npairs);
|
||||
unsigned int last_signature = -1;
|
||||
|
||||
// loop over body pairs (broadphase or all)
|
||||
for (int i=0; i < nbodypair; i++) {
|
||||
// reconstruct body pair ids
|
||||
b1 = (broadphasepair[i]>>16) & 0xFFFF;
|
||||
b2 = broadphasepair[i] & 0xFFFF;
|
||||
|
||||
// compute signature for this body pair
|
||||
unsigned int signature = ((b1+1)<<16) + (b2+1);
|
||||
// pairs come sorted by signature, but may not be unique
|
||||
// if signature is repeated, skip it
|
||||
if (signature == last_signature) {
|
||||
continue;
|
||||
}
|
||||
last_signature = signature;
|
||||
|
||||
// merge predefined pairs
|
||||
merged = 0;
|
||||
startadr = pairadr;
|
||||
if (npair && m->opt.collision == mjCOL_ALL) {
|
||||
// test all predefined pairs for which pair_signature<=signature
|
||||
while (pairadr < npair && m->pair_signature[pairadr] <= signature) {
|
||||
if (m->pair_signature[pairadr] == signature) {
|
||||
merged = 1;
|
||||
}
|
||||
collideGeoms(m, d, pairadr++, -1, 0, 0);
|
||||
// merge predefined pairs
|
||||
merged = 0;
|
||||
startadr = pairadr;
|
||||
if (npair) {
|
||||
// test all predefined pairs for which pair_signature<=signature
|
||||
while (pairadr < npair && m->pair_signature[pairadr] <= signature) {
|
||||
if (m->pair_signature[pairadr] == signature) {
|
||||
merged = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// handle exclusion
|
||||
if (nexclude) {
|
||||
// advance exadr while exclude_signature < signature
|
||||
while (exadr < nexclude && m->exclude_signature[exadr] < signature) {
|
||||
exadr++;
|
||||
}
|
||||
|
||||
// skip this body pair if its signature is found in exclude array
|
||||
if (exadr < nexclude && m->exclude_signature[exadr] == signature) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
int ngeompair_narrow_before = d->ngeompair_narrow;
|
||||
int ngeompair_mid_before = d->ngeompair_mid;
|
||||
|
||||
// test all geom pairs within this body pair
|
||||
if (m->body_geomnum[b1] && m->body_geomnum[b2]) {
|
||||
if (!mjDISABLED(mjDSBL_MIDPHASE) && m->body_geomnum[b1]*m->body_geomnum[b2] > 1) {
|
||||
int ncon_before = d->ncon;
|
||||
collideTree(m, d, b1, b2, merged, startadr, pairadr);
|
||||
int ncon_after = d->ncon;
|
||||
void* context = (void*) m;
|
||||
mjQUICKSORT(d->contact + ncon_before, ncon_after - ncon_before,
|
||||
sizeof(mjContact), contactcompare, context);
|
||||
} else {
|
||||
for (g1=m->body_geomadr[b1]; g1 < m->body_geomadr[b1]+m->body_geomnum[b1]; g1++) {
|
||||
for (g2=m->body_geomadr[b2]; g2 < m->body_geomadr[b2]+m->body_geomnum[b2]; g2++) {
|
||||
collidePair(m, d, g1, g2, merged, startadr, pairadr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (d->ngeompair_narrow > ngeompair_narrow_before) d->nbodypair_narrow++;
|
||||
if (d->ngeompair_mid > ngeompair_mid_before) d->nbodypair_broad++;
|
||||
}
|
||||
|
||||
// finish merging predefined pairs
|
||||
if (npair && m->opt.collision == mjCOL_ALL) {
|
||||
while (pairadr < npair) {
|
||||
collideGeoms(m, d, pairadr++, -1, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// handle exclusion
|
||||
if (nexclude) {
|
||||
// advance exadr while exclude_signature < signature
|
||||
while (exadr < nexclude && m->exclude_signature[exadr] < signature) {
|
||||
exadr++;
|
||||
}
|
||||
|
||||
// skip this body pair if its signature is found in exclude array
|
||||
if (exadr < nexclude && m->exclude_signature[exadr] == signature) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
int ngeompair_narrow_before = d->ngeompair_narrow;
|
||||
int ngeompair_mid_before = d->ngeompair_mid;
|
||||
|
||||
// test all geom pairs within this body pair
|
||||
if (m->body_geomnum[b1] && m->body_geomnum[b2]) {
|
||||
if (!mjDISABLED(mjDSBL_MIDPHASE) && m->body_geomnum[b1]*m->body_geomnum[b2] > 1) {
|
||||
int ncon_before = d->ncon;
|
||||
collideTree(m, d, b1, b2, merged, startadr, pairadr);
|
||||
int ncon_after = d->ncon;
|
||||
void* context = (void*) m;
|
||||
mjQUICKSORT(d->contact + ncon_before, ncon_after - ncon_before,
|
||||
sizeof(mjContact), contactcompare, context);
|
||||
} else {
|
||||
for (g1=m->body_geomadr[b1]; g1 < m->body_geomadr[b1]+m->body_geomnum[b1]; g1++) {
|
||||
for (g2=m->body_geomadr[b2]; g2 < m->body_geomadr[b2]+m->body_geomnum[b2]; g2++) {
|
||||
collidePair(m, d, g1, g2, merged, startadr, pairadr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (d->ngeompair_narrow > ngeompair_narrow_before) d->nbodypair_narrow++;
|
||||
if (d->ngeompair_mid > ngeompair_mid_before) d->nbodypair_broad++;
|
||||
}
|
||||
|
||||
// finish merging predefined pairs
|
||||
if (npair) {
|
||||
while (pairadr < npair) {
|
||||
collideGeoms(m, d, pairadr++, -1, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
mj_freeStack(d);
|
||||
|
||||
@@ -146,7 +146,6 @@ void mj_defaultOption(mjOption* opt) {
|
||||
|
||||
// discrete options
|
||||
opt->integrator = mjINT_EULER;
|
||||
opt->collision = mjCOL_ALL;
|
||||
opt->cone = mjCONE_PYRAMIDAL;
|
||||
opt->jacobian = mjJAC_AUTO;
|
||||
opt->solver = mjSOL_NEWTON;
|
||||
|
||||
@@ -95,11 +95,11 @@ static const char* MJCF[nMJCF][mjXATTRNUM] = {
|
||||
"inttotal", "interval", "tolrange"},
|
||||
{">"},
|
||||
|
||||
{"option", "*", "26",
|
||||
{"option", "*", "25",
|
||||
"timestep", "apirate", "impratio", "tolerance", "ls_tolerance", "noslip_tolerance",
|
||||
"mpr_tolerance", "gravity", "wind", "magnetic", "density", "viscosity",
|
||||
"o_margin", "o_solref", "o_solimp",
|
||||
"integrator", "collision", "cone", "jacobian",
|
||||
"integrator", "cone", "jacobian",
|
||||
"solver", "iterations", "ls_iterations", "noslip_iterations", "mpr_iterations",
|
||||
"sdf_iterations", "sdf_initpoints"},
|
||||
{"<"},
|
||||
@@ -536,16 +536,6 @@ const mjMap integrator_map[integrator_sz] = {
|
||||
{"implicitfast", mjINT_IMPLICITFAST}
|
||||
};
|
||||
|
||||
|
||||
// collision type
|
||||
const int collision_sz = 3;
|
||||
const mjMap collision_map[collision_sz] = {
|
||||
{"all", mjCOL_ALL},
|
||||
{"predefined", mjCOL_PAIR},
|
||||
{"dynamic", mjCOL_DYNAMIC}
|
||||
};
|
||||
|
||||
|
||||
// cone type
|
||||
const int cone_sz = 2;
|
||||
const mjMap cone_map[cone_sz] = {
|
||||
@@ -973,7 +963,6 @@ void mjXReader::Option(XMLElement* section, mjOption* opt) {
|
||||
ReadAttr(section, "o_solimp", mjNIMP, opt->o_solimp, text, false, false);
|
||||
|
||||
MapValue(section, "integrator", &opt->integrator, integrator_map, integrator_sz);
|
||||
MapValue(section, "collision", &opt->collision, collision_map, collision_sz);
|
||||
MapValue(section, "cone", &opt->cone, cone_map, cone_sz);
|
||||
MapValue(section, "jacobian", &opt->jacobian, jac_map, jac_sz);
|
||||
MapValue(section, "solver", &opt->solver, solver_map, solver_sz);
|
||||
|
||||
@@ -809,8 +809,6 @@ void mjXWriter::Option(XMLElement* root) {
|
||||
|
||||
WriteAttrKey(section, "integrator", integrator_map, integrator_sz,
|
||||
model->option.integrator, opt.integrator);
|
||||
WriteAttrKey(section, "collision", collision_map, collision_sz,
|
||||
model->option.collision, opt.collision);
|
||||
WriteAttrKey(section, "cone", cone_map, cone_sz,
|
||||
model->option.cone, opt.cone);
|
||||
WriteAttrKey(section, "jacobian", jac_map, jac_sz,
|
||||
|
||||
@@ -49,22 +49,6 @@ static std::vector<GeomPair> colliding_pairs(
|
||||
return result;
|
||||
}
|
||||
|
||||
TEST_F(MjCollisionTest, PredefinedPairsOnly) {
|
||||
static const char* const kModelFilePath =
|
||||
"engine/testdata/collisions.xml";
|
||||
const std::string xml_path = GetTestDataFilePath(kModelFilePath);
|
||||
mjModel* model = mj_loadXML(xml_path.c_str(), nullptr, 0, 0);
|
||||
|
||||
model->opt.collision = mjCOL_PAIR;
|
||||
mjData* data = mj_makeData(model);
|
||||
mj_fwdPosition(model, data);
|
||||
EXPECT_THAT(colliding_pairs(model, data), ElementsAre(
|
||||
GeomPair("box", "sphere_predefined")));
|
||||
|
||||
mj_deleteData(data);
|
||||
mj_deleteModel(model);
|
||||
}
|
||||
|
||||
TEST_F(MjCollisionTest, AllCollisions) {
|
||||
static const char* const kModelFilePath =
|
||||
"engine/testdata/collisions.xml";
|
||||
|
||||
@@ -39,7 +39,6 @@ TEST_F(HeaderTest, EnumsAreInts) {
|
||||
EXPECT_EQ(sizeof(mjtCamLight), sizeof(int));
|
||||
EXPECT_EQ(sizeof(mjtTexture), sizeof(int));
|
||||
EXPECT_EQ(sizeof(mjtIntegrator), sizeof(int));
|
||||
EXPECT_EQ(sizeof(mjtCollision), sizeof(int));
|
||||
EXPECT_EQ(sizeof(mjtCone), sizeof(int));
|
||||
EXPECT_EQ(sizeof(mjtJacobian), sizeof(int));
|
||||
EXPECT_EQ(sizeof(mjtSolver), sizeof(int));
|
||||
|
||||
@@ -209,11 +209,6 @@ public enum mjtIntegrator : int{
|
||||
mjINT_IMPLICIT = 2,
|
||||
mjINT_IMPLICITFAST = 3,
|
||||
}
|
||||
public enum mjtCollision : int{
|
||||
mjCOL_ALL = 0,
|
||||
mjCOL_PAIR = 1,
|
||||
mjCOL_DYNAMIC = 2,
|
||||
}
|
||||
public enum mjtCone : int{
|
||||
mjCONE_PYRAMIDAL = 0,
|
||||
mjCONE_ELLIPTIC = 1,
|
||||
@@ -4789,7 +4784,6 @@ public unsafe struct mjOption_ {
|
||||
public fixed double o_solref[2];
|
||||
public fixed double o_solimp[5];
|
||||
public int integrator;
|
||||
public int collision;
|
||||
public int cone;
|
||||
public int jacobian;
|
||||
public int solver;
|
||||
|
||||
Reference in New Issue
Block a user