Skip to content

Commit 65ae967

Browse files
committed
Adopted Site workflow
1 parent 1e200ca commit 65ae967

24 files changed

Lines changed: 743 additions & 233 deletions

asv/benchmarks/simulation/bench_sensor_camera.py

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

4-
"""Rendering benchmarks for the shape-backed camera sensor.
4+
"""Rendering benchmarks for the site-backed camera sensor.
55
66
``FastSensorCamera`` and ``FastSensorCameraPixel`` measure Isaac Lab's Franka
77
cabinet scene with tiled and pixel-priority rendering in CI. The other scene
@@ -245,7 +245,7 @@ def _look_at_transform(
245245

246246

247247
class _SensorCameraSceneRig:
248-
"""A scene replicated across worlds with a shape-backed camera sensor ready to render."""
248+
"""A scene replicated across worlds with a site-backed camera sensor ready to render."""
249249

250250
def __init__(
251251
self,
@@ -266,7 +266,7 @@ def __init__(
266266
)
267267
)
268268
camera = _look_at_transform(preset.camera_eye, preset.camera_target)
269-
world.add_shape_camera(camera=self.sensor, xform=camera)
269+
world.add_site(camera=self.sensor, xform=camera)
270270

271271
scene = newton.ModelBuilder()
272272
scene.default_bvh_cfg.mesh_constructor = "cubql"
@@ -290,6 +290,7 @@ def __init__(
290290
shape_indices=np.arange(self.model.shape_count, dtype=np.int32)
291291
)
292292
self.sensor.render_context = self.render_context
293+
self.sensor.finalize()
293294

294295
self.color_image = self.sensor.create_color_image_output()
295296
self.depth_image = self.sensor.create_depth_image_output()

docs/api/newton.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ newton
2929

3030
Axis
3131
BodyFlags
32+
CameraFisheyeFThetaSpec
33+
CameraFisheyeKannalaBrandtSpec
34+
CameraFisheyeOpenCVSpec
35+
CameraPinholeSpec
36+
CameraSpec
3237
ClearData
3338
CollisionPipeline
3439
Contacts

docs/api/newton_sensors.rst

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

16+
CameraFisheyeFThetaSpec
17+
CameraFisheyeKannalaBrandtSpec
18+
CameraFisheyeOpenCVSpec
19+
CameraPinholeSpec
20+
CameraSpec
1621
SensorCamera
1722
SensorContact
1823
SensorFrameTransform

newton/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,25 @@
141141
"WorldRenderFlag",
142142
]
143143

144+
# ==================================================================================
145+
# sensors
146+
# ==================================================================================
147+
from ._src.sensors import ( # noqa: E402
148+
CameraFisheyeFThetaSpec,
149+
CameraFisheyeKannalaBrandtSpec,
150+
CameraFisheyeOpenCVSpec,
151+
CameraPinholeSpec,
152+
CameraSpec,
153+
)
154+
155+
__all__ += [
156+
"CameraFisheyeFThetaSpec",
157+
"CameraFisheyeKannalaBrandtSpec",
158+
"CameraFisheyeOpenCVSpec",
159+
"CameraPinholeSpec",
160+
"CameraSpec",
161+
]
162+
144163
# ==================================================================================
145164
# submodule APIs
146165
# ==================================================================================

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 or type == GeoType.CAMERA:
703-
# Heightfields are always static terrain; render sensors/assets contribute no mass.
702+
elif type == GeoType.HFIELD or type == GeoType.GAUSSIAN:
703+
# Heightfields are always static terrain; Gaussian render 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: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ class GeoType(enum.IntEnum):
111111
GAUSSIAN = 11
112112
"""Gaussian splat."""
113113

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

newton/_src/geometry/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ 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
128126
else:
129127
return 10.0
130128

newton/_src/render/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class RenderOrder(enum.IntEnum):
3131

3232

3333
class WorldRenderFlag(enum.IntFlag):
34-
"""Per-world rendering behavior for shape-backed camera sensors."""
34+
"""Per-world rendering behavior for site-backed camera sensors."""
3535

3636
DISABLE_PRESERVE = 0
3737
"""Skip rendering and leave output pixels unchanged."""

newton/_src/sensors/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025 The Newton Developers
22
# SPDX-License-Identifier: Apache-2.0
33

4-
from .sensor_camera import SensorCamera
4+
from .sensor_camera import (
5+
CameraFisheyeFThetaSpec,
6+
CameraFisheyeKannalaBrandtSpec,
7+
CameraFisheyeOpenCVSpec,
8+
CameraPinholeSpec,
9+
CameraSpec,
10+
SensorCamera,
11+
)
512

613
__all__ = [
14+
"CameraFisheyeFThetaSpec",
15+
"CameraFisheyeKannalaBrandtSpec",
16+
"CameraFisheyeOpenCVSpec",
17+
"CameraPinholeSpec",
18+
"CameraSpec",
719
"SensorCamera",
820
]

0 commit comments

Comments
 (0)