Skip to content

Commit 941fae7

Browse files
authored
Fix actuator fixture warnings (#4079)
1 parent 18f1d8b commit 941fae7

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

newton/tests/test_actuators.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ def _build_lstm_onnx(
201201
# ---------------------------------------------------------------------------
202202

203203

204+
# Regularize the fixtures' idealized point masses without changing their
205+
# effective dynamics from the inertia that validation previously synthesized.
206+
_POINT_MASS_INERTIA = wp.mat33(1.0e-6, 0.0, 0.0, 0.0, 1.0e-6, 0.0, 0.0, 0.0, 1.0e-6)
207+
208+
204209
def _write_dof_values(
205210
model: newton.Model,
206211
array: wp.array[float],
@@ -222,8 +227,7 @@ def _build_pendulum(device: wp.Device, worlds: int = 1) -> newton.Model:
222227
worlds: Number of identical worlds to replicate the pendulum into.
223228
"""
224229
template = newton.ModelBuilder(gravity=(0.0, 0.0, 0.0))
225-
body = template.add_link(mass=1.0)
226-
template.body_com[body] = wp.vec3(0.5, 0.0, 0.0)
230+
body = template.add_link(com=wp.vec3(0.5, 0.0, 0.0), inertia=_POINT_MASS_INERTIA, mass=1.0)
227231
joint = template.add_joint_revolute(parent=-1, child=body, axis=newton.Axis.Z)
228232
template.add_articulation([joint])
229233
if worlds == 1:
@@ -244,11 +248,10 @@ def _two_link_builder(armature: float = 0.0, dummy_body: bool = False) -> newton
244248
"""
245249
builder = newton.ModelBuilder(gravity=(0.0, 0.0, 0.0))
246250
if dummy_body:
247-
builder.add_joint_revolute(parent=-1, child=builder.add_link(mass=1.0), axis=newton.Axis.Z)
248-
base = builder.add_link(mass=2.0)
249-
tip = builder.add_link(mass=1.0)
250-
builder.body_com[base] = wp.vec3(0.3, 0.0, 0.0)
251-
builder.body_com[tip] = wp.vec3(0.25, 0.0, 0.0)
251+
dummy = builder.add_link(inertia=_POINT_MASS_INERTIA, mass=1.0)
252+
builder.add_joint_revolute(parent=-1, child=dummy, axis=newton.Axis.Z)
253+
base = builder.add_link(com=wp.vec3(0.3, 0.0, 0.0), inertia=_POINT_MASS_INERTIA, mass=2.0)
254+
tip = builder.add_link(com=wp.vec3(0.25, 0.0, 0.0), inertia=_POINT_MASS_INERTIA, mass=1.0)
252255
j0 = builder.add_joint_revolute(parent=-1, child=base, axis=newton.Axis.Z, armature=armature)
253256
j1 = builder.add_joint_revolute(
254257
parent=base,

newton/tests/thirdparty/unittest_parallel.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,21 @@
4343
# The following variables are NVIDIA Modifications
4444
START_DIRECTORY = os.path.dirname(__file__) # The directory to start test discovery
4545

46+
# Add warning-clean test modules incrementally. Eventually this should cover
47+
# the entire test_* surface and be replaced by a single test_.* filter.
48+
_STRICT_WARNING_TEST_MODULES = ("test_actuators",)
49+
4650

4751
def _enable_strict_warnings():
48-
"""Escalate DeprecationWarnings and any newton.* warning to errors.
52+
"""Escalate actionable and caller-attributed cleaned-test warnings to errors.
4953
5054
Installed before discovery and in each worker initializer so import-time
5155
warnings from test modules are escalated too, not just runtime ones.
5256
"""
5357
warnings.filterwarnings("error", category=DeprecationWarning)
5458
warnings.filterwarnings("error", module=r"newton(\.|$)")
59+
for module in _STRICT_WARNING_TEST_MODULES:
60+
warnings.filterwarnings("error", module=rf"{module}$")
5561

5662

5763
def _use_coord_layout_targets():

0 commit comments

Comments
 (0)