Viam SDK
    Preparing search index...

    Interface Camera

    Represents any physical hardware that can capture frames.

    interface Camera {
        getGeometries: (extra?: Struct) => Promise<commonApi.Geometry[]>;
        getImages: (
            filterSourceNames?: string[],
            extra?: Struct,
        ) => Promise<{ images: NamedImage[]; metadata: ResponseMetadata }>;
        getPointCloud: (extra?: Struct) => Promise<Uint8Array<ArrayBufferLike>>;
        getProperties: () => Promise<Properties>;
        name: string;
        doCommand(command: Struct | Record<string, JsonValue>): Promise<JsonValue>;
        getStatus(): Promise<JsonValue>;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    getGeometries: (extra?: Struct) => Promise<commonApi.Geometry[]>

    Get the geometries of the component in their current configuration

    getImages: (
        filterSourceNames?: string[],
        extra?: Struct,
    ) => Promise<{ images: NamedImage[]; metadata: ResponseMetadata }>

    Return a frame from a camera.

    Type Declaration

      • (
            filterSourceNames?: string[],
            extra?: Struct,
        ): Promise<{ images: NamedImage[]; metadata: ResponseMetadata }>
      • Parameters

        • OptionalfilterSourceNames: string[]

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

        • Optionalextra: Struct

          Extra parameters to pass to the camera.

        Returns Promise<{ images: NamedImage[]; metadata: ResponseMetadata }>

    const camera = new VIAM.CameraClient(machine, 'my_camera');
    const images = await camera.getImages();
    getPointCloud: (extra?: Struct) => Promise<Uint8Array<ArrayBufferLike>>

    Return a point cloud from a camera.

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

    For more information, see Camera API.

    getProperties: () => Promise<Properties>

    Return the camera properties.

    const camera = new VIAM.CameraClient(machine, 'my_camera');
    const properties = await camera.getProperties();

    For more information, see Camera API.

    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.

      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' } }));