Conversation
| <mujoco model="Poncho"> | ||
| <include file="mannequin.xml"/> | ||
| <option solver="CG" tolerance="1e-6" jacobian="sparse"/> | ||
| <option integrator="Euler" solver="CG" viscosity="0.05" tolerance="1e-6"/> |
There was a problem hiding this comment.
do we need to include 'integrator="Euler"' since this is the default integrator option?
| <mujoco model="Poncho"> | ||
| <include file="mannequin.xml"/> | ||
| <option solver="CG" tolerance="1e-6" jacobian="sparse"/> | ||
| <option integrator="Euler" solver="CG" viscosity="0.05" tolerance="1e-6"/> |
There was a problem hiding this comment.
do we expect the viscosity option to be changed/removed in the future? if so, maybe we add a todo to update this parameter
| np.testing.assert_equal(result, True, f"Contact {i} not found in Gjk results") | ||
|
|
||
| self.assertEqual(d.nacon.numpy()[0], mjd.ncon) | ||
| if check_version("mujoco>=3.5.1.dev888028695"): |
There was a problem hiding this comment.
i think these changes are also available in #1263
| </worldbody> | ||
| </mujoco> | ||
| """ | ||
| mjm = mujoco.MjModel.from_xml_string(xml) |
There was a problem hiding this comment.
lets utilize test_data.fixture
|
|
||
| mujoco.mj_forward(mjm, mjd) | ||
|
|
||
| # Count C self-contacts. |
There was a problem hiding this comment.
maybe vectorized this code?
| d = mjwarp.put_data(mjm, mjd) | ||
| mjwarp.kinematics(m, d) | ||
| mjwarp.collision(m, d) | ||
| wp.synchronize_device() |
| warp_self = 0 | ||
|
|
||
| self.assertGreater(warp_self, 0, f"Warp should produce self-contacts (nacon={nacon})") | ||
| self.assertGreaterEqual(warp_self, c_self, f"Warp={warp_self} should be >= C={c_self} self-contacts") |
There was a problem hiding this comment.
should the number of contacts generated by mujoco and mujoco warp be the same? if not, maybe add a comment explaining why the counts are different
| </worldbody> | ||
| </mujoco> | ||
| """ | ||
| mjm_c = mujoco.MjModel.from_xml_string(xml) |
There was a problem hiding this comment.
lets utilize test_data.fixture
| mjd_c = mujoco.MjData(mjm_c) | ||
| mujoco.mj_forward(mjm_c, mjd_c) | ||
| c_self = 0 | ||
| for c in range(mjd_c.ncon): |
| d = mjwarp.put_data(mjm_c, mjd_clean) | ||
| mjwarp.kinematics(m, d) | ||
| mjwarp.collision(m, d) | ||
| wp.synchronize_device() |
| else: | ||
| warp_self = 0 | ||
|
|
||
| self.assertGreaterEqual(warp_self, c_self, f"Warp={warp_self} should be >= C={c_self} self-contacts") |
There was a problem hiding this comment.
is there a reason to expect that mujoco warp might generate more contacts than mujoco? if so, lets add a comment for the reason
| self.assertGreaterEqual(warp_self, c_self, f"Warp={warp_self} should be >= C={c_self} self-contacts") | ||
|
|
||
| def test_unsupported_selfcollide_raises(self): | ||
| """Verify unsupported selfcollide modes raise NotImplementedError.""" |
There was a problem hiding this comment.
the docstring says 'modes', should we be testing additional configurations?
| </mujoco> | ||
| """ | ||
| mjm = mujoco.MjModel.from_xml_string(xml) | ||
| mjd = mujoco.MjData(mjm) |
There was a problem hiding this comment.
lets add a test with more than one world in order to test batched evaluation?
| d02 = wp.dot(v0, v2) | ||
| d11 = wp.dot(v1, v1) | ||
| d12 = wp.dot(v1, v2) | ||
| inv = 1.0 / (d00 * d11 - d01 * d01 + 1e-30) |
There was a problem hiding this comment.
1e-30 is quite small, should we consider increasing this value a bit?
| # ensure njmax_nnz can hold the actual data from mjd | ||
| if is_sparse(mjm) and mjd.nefc > 0 and mujoco.mj_isSparse(mjm): | ||
| actual_nnz = int(mjd.efc_J_rownnz[: mjd.nefc].sum()) | ||
| njmax_nnz = max(njmax_nnz, actual_nnz) |
There was a problem hiding this comment.
maybe we should raise an error if njmax_nnz < actual_nnz?
| worldid, pairid = wp.tid() | ||
|
|
||
| for f in range(nflex): | ||
| if flex_selfcollide[f] == int(FlexSelfCollideType.NONE): |
| # Self-collision: only for dim=2 elements with selfcollide enabled. | ||
| # flex_self_max_pairs is precomputed in put_model to avoid device→host | ||
| # copies during CUDA graph capture. | ||
| if m.flex_self_max_pairs > 0: |
There was a problem hiding this comment.
we can remove this check since flex_self_max_pairs is one of the launch dimensions
No description provided.