Viam SDK
    Preparing search index...

    Class WorldStateStoreClient

    A gRPC-web client for a WorldStateStore service.

    Implements

    Index

    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' } }));
    • GetTransform returns a world state transform by UUID.

      Parameters

      • uuid: string

        The UUID of the transform to retrieve

      • extra: {} = {}

        Additional arguments to the method

      • callOptions: CallOptions = ...

      Returns Promise<TransformWithUUID>

      const worldStateStore = new VIAM.WorldStateStoreClient(machine, 'builtin');

      // Get a specific transform by UUID
      const transform = await worldStateStore.getTransform(uuid);
    • ListUUIDs returns all world state transform UUIDs.

      Parameters

      • extra: {} = {}

        Additional arguments to the method

      • callOptions: CallOptions = ...

      Returns Promise<string[]>

      const worldStateStore = new VIAM.WorldStateStoreClient(machine, 'builtin');

      // Get all transform UUIDs
      const uuids = await worldStateStore.listUUIDs();
    • StreamTransformChanges streams changes to world state transforms.

      The returned transform will only contain the fields that have changed.

      Parameters

      • extra: {} = {}

        Additional arguments to the method

      • callOptions: CallOptions = ...

      Returns AsyncGenerator<TransformChangeEvent, void>

      const worldStateStore = new VIAM.WorldStateStoreClient(machine, 'builtin');

      // Stream transform changes
      const stream = worldStateStore.streamTransformChanges();
      for await (const change of stream) {
      console.log('Transform change:', change.changeType, change.transform);
      }