Class CameraClient

A gRPC-web client for the Camera component.

Implements

Constructors

Properties

callOptions: CallOptions = ...
name: string

The name of the resource.

Methods

  • Send/Receive arbitrary commands to the resource.

    Parameters

    • command: Struct | Record<string, JsonValue>

      The command to execute. Accepts either a Struct or a plain object, which will be converted automatically.

    • callOptions: CallOptions = ...

    Returns Promise<JsonValue>

    // Plain object (recommended)
    const result = await resource.doCommand({
    myCommand: { key: 'value' },
    });

    // Struct (still supported)
    import { Struct } from '@viamrobotics/sdk';

    const result = await resource.doCommand(
    Struct.fromJson({ myCommand: { key: 'value' } })
    );
  • Get the geometries of the component in their current configuration

    Parameters

    • extra: {} = {}
    • callOptions: CallOptions = ...

    Returns Promise<commonApi.Geometry[]>

  • Return a frame from a camera.

    Parameters

    • filterSourceNames: string[] = []

      A list of source names to filter the images by. If empty or undefined, all images will be returned.

    • extra: {} = {}

      Extra parameters to pass to the camera.

    • callOptions: CallOptions = ...

    Returns Promise<
        {
            images: { image: Uint8Array; mimeType: string; sourceName: string }[];
            metadata: ResponseMetadata;
        },
    >

    const camera = new VIAM.CameraClient(machine, 'my_camera');
    const images = await camera.getImages();

    TODO(docs): include docs link for get images TS example

  • Return a point cloud from a camera.

    Parameters

    • extra: {} = {}
    • callOptions: CallOptions = ...

    Returns Promise<Uint8Array>

    const camera = new VIAM.CameraClient(machine, 'my_camera');
    const pointCloud = await camera.getPointCloud();

    For more information, see Camera API.