Skip to content

Commit e80f106

Browse files
committed
New CameraSensor Implementation
1 parent ff9b71d commit e80f106

34 files changed

Lines changed: 5405 additions & 6 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- Add opt-in `body_frame_origin="com"` to `ModelBuilder.add_rod()` and `ModelBuilder.add_rod_graph()` for COM-centered cable capsule body frames.
2626
- Add `sign_method` argument to `Mesh.build_sdf` and `SDF.create_from_mesh` support for a `"normal"` (angle-weighted pseudo-normal) sign strategy, for selecting the inside/outside sign of the baked SDF (`"auto"`, `"parity"`, `"winding"`, or `"normal"`).
2727
- Add `forward_depth_image` output support to `SensorTiledCamera.update()` and `SensorTiledCamera.utils.create_forward_depth_image_output()` for native forward-depth rendering without post-processing `depth_image`.
28+
- Add shape-backed `CameraSensor` rendering with MJCF and USD camera import support.
2829
- Add optional `shear_stiffness`/`shear_damping` and `twist_stiffness`/`twist_damping` controls to `ModelBuilder.add_joint_cable()`, `ModelBuilder.add_rod()`, and `ModelBuilder.add_rod_graph()`; omitted shear defaults to stretch and omitted twist defaults to bend for compatibility.
2930
- Add `newton.utils.CableStiffness` and extend `newton.utils.create_cable_stiffness_from_elastic_moduli()` with `poissons_ratio`/`shear_modulus` inputs that include torsional `GJ/L` stiffness.
3031
- Add VBD cable validation examples covering bend stiffness, analytical bend/twist response, torsion material mapping, routed twist transfer, twist-buckling link verification, Michell/Zajac threshold behavior, and Dahl hysteresis.

docs/api/newton.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ newton
2828

2929
Axis
3030
BodyFlags
31+
CameraSensor
3132
CollisionPipeline
3233
Contacts
3334
Control

docs/api/newton_geometry.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ newton.geometry
1616
BroadPhaseAllPairs
1717
BroadPhaseExplicit
1818
BroadPhaseSAP
19+
CameraSensor
1920
HydroelasticSDF
2021
NarrowPhase
2122

docs/api/newton_sensors.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ newton.sensors
1313
:toctree: _generated
1414
:nosignatures:
1515

16+
CameraSensor
1617
SensorContact
1718
SensorFrameTransform
1819
SensorIMU

newton/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
# ==================================================================================
5050
from ._src.geometry import ( # noqa: E402
5151
SDF,
52+
CameraSensor,
5253
Gaussian,
5354
GeoType,
5455
Heightfield,
@@ -61,6 +62,7 @@
6162

6263
__all__ += [
6364
"SDF",
65+
"CameraSensor",
6466
"Gaussian",
6567
"GeoType",
6668
"Heightfield",

newton/_src/geometry/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025 The Newton Developers
22
# SPDX-License-Identifier: Apache-2.0
33

4+
from ..sensors.camera_sensor import CameraSensor
45
from .broad_phase_common import test_group_pair, test_world_and_group_pair
56
from .broad_phase_nxn import BroadPhaseAllPairs, BroadPhaseExplicit
67
from .broad_phase_sap import BroadPhaseSAP
@@ -43,6 +44,7 @@
4344
"BroadPhaseAllPairs",
4445
"BroadPhaseExplicit",
4546
"BroadPhaseSAP",
47+
"CameraSensor",
4648
"Gaussian",
4749
"GeoType",
4850
"Heightfield",

newton/_src/geometry/inertia.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,8 @@ def _shift_inertia(mass, I_mat, com_from, com_to):
699699
density, scale[0] - thickness, scale[1] - thickness, scale[2] - thickness
700700
)
701701
return solid[0] - hollow[0], solid[1], solid[2] - hollow[2]
702-
elif type == GeoType.HFIELD or type == GeoType.GAUSSIAN:
703-
# Heightfields are always static terrain; Gaussians are render-only (zero mass, zero inertia)
702+
elif type == GeoType.HFIELD or type == GeoType.GAUSSIAN or type == GeoType.CAMERA:
703+
# Heightfields are always static terrain; render sensors/assets contribute no mass.
704704
return 0.0, wp.vec3(), wp.mat33()
705705
elif type == GeoType.MESH or type == GeoType.CONVEX_MESH:
706706
assert src is not None, "src must be provided for mesh or convex hull shapes"

newton/_src/geometry/types.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ class GeoType(enum.IntEnum):
111111
GAUSSIAN = 11
112112
"""Gaussian splat."""
113113

114+
CAMERA = 12
115+
"""Camera sensor."""
116+
114117
@property
115118
def is_primitive(self) -> bool:
116119
"""Return whether this is a primitive (analytically defined) shape type."""

newton/_src/geometry/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ def compute_shape_radius(geo_type: int, scale: Vec3, src: Mesh | Heightfield | N
123123
vmax = vmax + np.max(np.abs(src.scales), axis=0) * scale_arr
124124
return float(np.linalg.norm(vmax))
125125
return 10.0
126+
elif geo_type == GeoType.CAMERA:
127+
return 0.0
126128
else:
127129
return 10.0
128130

newton/_src/sensors/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025 The Newton Developers
22
# SPDX-License-Identifier: Apache-2.0
3+
4+
from .camera_sensor import CameraSensor
5+
6+
__all__ = [
7+
"CameraSensor",
8+
]

0 commit comments

Comments
 (0)