Skip to content

Viam C++ Module to join PCD camera outputs using Point Cloud Library (PCL)

License

Notifications You must be signed in to change notification settings

viam-modules/join-point-clouds

Repository files navigation

Join Point Clouds

The join-point-clouds model uses Point Cloud Library (PCL) to combine the PCD outputs of depth cameras already registered in your config to create a joined point cloud output. It uses the Viam builtin frame system, and optionally the iterative closest points (ICP) algorithm, to align and combine the clouds within a single frame.

Note: combining PCDs with RGB data is currently unsupported.

Configure your join-point-clouds component

Navigate to the CONFIGURE tab of your machine's page in the Viam app, searching for the modular component join-point-clouds and selecting the model viam:join-camera:join-point-clouds.

Fill in the attributes as applicable to the component, according to the example below.

    {
      "name": "jpc-component",
      "namespace": "rdk",
      "type": "camera",
      "model": "viam:join-camera:join-point-clouds",
      "attributes": {
        "source_cameras": [
          "pcd-cam-1",
          "pcd-cam-2"  // other camera components to get PCDs to join from
        ],
        "target_frame": "world" | "<name-of-frame-in-frame-system>",
        "merge_method": "naive" | "icp",
        "proximity_threshold_mm": 0.05
      },
      "frame": {  // frame system setup
        "parent": "world",
        "translation": {
          "x": 0,
          "y": 0,
          "z": 0  // modify translation based on position in frame
        },
        "orientation": {
          "type": "quaternion",
          "value": {
            "x": 0,
            "y": 0,
            "z": 0,
            "w": 1  // modify quaternion based on rotation
          }
        }
      }
    },

Make sure to set up the source_cameras components frame system data accurately for best results.

The following attributes are available for the join-point-clouds component:

Attribute Type Required? Description
source_cameras []string Required The list of existing camera components in your machine to get input PCDs from
target_frame string Required The target frame in the machine frame system to align the resultant PCD to
merge_method string Optional Either "naive" or "icp"— "icp" will use ICP to further align the PCDs and combine points below the proximity threshold. Naive will use only the frame system transformation with no further processing.
proximity_threshold_mm int Optional Only used when ICP is requested. ICP will combine points under this distance from each other.
Default: 0.05.