Work in progress: this documentation is still being written and reviewed. Check details against the source code.

Point-cloud filtering relay

ROS point-cloud relay with optional Open3D statistical filtering and voxel reduction. The default voxel size is 0.02 metres. Noise filtering runs only when downsampling is enabled.

beambot.mapping.pointcloud_relay · Source

Perception and mapping · Guide · Symbol index

How it is used

The mapping path places this node between camera clouds and Octomap generation. Its callback optionally reduces the cloud with Open3D, then publishes the result on the configured output topic. main() starts and spins the relay.

Downsampling and noise filtering are optional. If filtering is unavailable or fails, the callback forwards the original cloud; consumers should not assume every published message was filtered.

Start here

Callable

Purpose

main

Initialize and spin the point-cloud relay, then perform normal shutdown.

PointCloudRelay.callback

Publish a filtered cloud when downsampling succeeds, otherwise relay the original message.

Functions

main()

Initialize and spin the point-cloud relay, then perform normal shutdown.

Entry point · Source

main(args=None)

Parameter

Meaning

args

Optional ROS command-line arguments passed to rclpy.init().

Returns: None on normal completion.

Errors: There is no try/finally around spin; an exception or KeyboardInterrupt can skip the explicit destroy/shutdown calls.

Side effects: Starts ROS and cloud subscriptions, blocks in spin, and destroys/shuts down only when spin returns normally.

PointCloudRelay

ROS node that relays camera point clouds and optionally applies outlier filtering and voxel reduction. The callback owns fallback behavior; the private helper processes one cloud.

Inherits from: Node.

PointCloudRelay.callback()

Publish a filtered cloud when downsampling succeeds, otherwise relay the original message.

Callback · Source

callback(self, msg: PointCloud2)

Parameter

Meaning

msg

Incoming PointCloud2 message.

Returns: None.

Errors: A None filter result triggers original-message fallback. Publisher/logging errors are not caught here. Noise filtering runs only within the enabled downsampling path.

Side effects: Publishes one cloud and logs point counts/reduction. Passthrough preserves all original fields; filtered output contains XYZ only.

Referenced in source (1)

PointCloudRelay.__init__()

Configure cloud input/output and optional filtering, then create ROS endpoints.

Lifecycle · Source

__init__(self)

Returns: None; initializes the node.

Errors: If Open3D is unavailable, requested downsampling is disabled with a warning. ROS/parameter errors propagate.

Side effects: Declares input_topic=/points/xyz, output_topic=/points/xyz_relayed, voxel_size=0.02 m, enable_downsampling=true, enable_noise_filter=false, noise_nb_neighbors=20, and noise_std_ratio=2.0. Creates reliable volatile cloud subscription/publisher.

Referenced in source (1)
  • main — beambot.mapping.pointcloud_relay

Internal callbacks and helpers

PointCloudRelay._downsample_pointcloud()

Decode XYZ, remove NaN rows, optionally reject statistical outliers, and voxel-downsample through Open3D.

Internal helper · Source

_downsample_pointcloud(self, msg: PointCloud2) -> PointCloud2

Parameter

Meaning

msg

PointCloud2 with x/y/z fields accepted by sensor_msgs_py.point_cloud2.read_points_numpy. Field decoding is delegated to that ROS helper rather than assuming fixed float32 byte offsets.

Returns: New XYZ-only PointCloud2 preserving input frame/timestamp, or None despite the non-optional annotation.

Errors: Missing coordinate fields, no points after NaN removal, or any caught conversion/filtering exception returns None with logs. Infinity is not filtered explicitly.

Side effects: Allocates NumPy/Open3D data and output cloud. Drops non-XYZ fields and organized image layout; does not publish itself.

Referenced in source (1)