Viam SDK
    Preparing search index...

    Interface Gantry

    Represents a physical gantry that exists in three-dimensional space.

    interface Gantry {
        getGeometries: (extra?: Struct) => Promise<commonApi.Geometry[]>;
        getKinematics: (extra?: Struct) => Promise<GetKinematicsResult>;
        getLengths: (extra?: Struct) => Promise<number[]>;
        getPosition: (extra?: Struct) => Promise<number[]>;
        home: (extra?: Struct) => Promise<boolean>;
        isMoving: () => Promise<boolean>;
        moveToPosition: (
            positionsMm: number[],
            speedsMmPerSec: number[],
            extra?: Struct,
        ) => Promise<void>;
        name: string;
        stop: (extra?: Struct) => Promise<void>;
        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.

    const gantry = new VIAM.GantryClient(machine, 'my_gantry');

    // Get the geometries of this component
    const geometries = await gantry.getGeometries();

    For more information, see Gantry API.

    getKinematics: (extra?: Struct) => Promise<GetKinematicsResult>

    Get the kinematics information associated with the gantry.

    Type Declaration

      • (extra?: Struct): Promise<GetKinematicsResult>
      • Parameters

        Returns Promise<GetKinematicsResult>

        The legacy kinematics data shape or the newer object containing kinematics data plus a map of URDF mesh file paths to mesh data.

    const gantry = new VIAM.GantryClient(machine, 'my_gantry');

    // Get the kinematics information associated with the gantry
    const kinematics = await gantry.getKinematics();

    For more information, see Gantry API.

    getLengths: (extra?: Struct) => Promise<number[]>

    Get the lengths of the axes of the gantry in millimeters.

    Type Declaration

      • (extra?: Struct): Promise<number[]>
      • Parameters

        Returns Promise<number[]>

        A list of the length of each axis in millimeters.

    const gantry = new VIAM.GantryClient(machine, 'my_gantry');

    // Get the lengths of the axes in millimeters
    const lengths = await gantry.getLengths();

    For more information, see Gantry API.

    getPosition: (extra?: Struct) => Promise<number[]>

    Get the current position of each axis.

    Type Declaration

      • (extra?: Struct): Promise<number[]>
      • Parameters

        Returns Promise<number[]>

        A list of the current position of each axis in millimeters.

    const gantry = new VIAM.GantryClient(machine, 'my_gantry');

    // Get the current positions of the axes in millimeters
    const positions = await gantry.getPosition();

    For more information, see Gantry API.

    home: (extra?: Struct) => Promise<boolean>

    Runs the homing sequence to find the start and end positions of the gantry axis.

    Type Declaration

      • (extra?: Struct): Promise<boolean>
      • Parameters

        Returns Promise<boolean>

        A bool representing whether the gantry has run the homing sequence successfully.

    const gantry = new VIAM.GantryClient(machine, 'my_gantry');

    // Run the homing sequence
    const success = await gantry.home();

    For more information, see Gantry API.

    isMoving: () => Promise<boolean>

    Get if the gantry is currently moving.

    const gantry = new VIAM.GantryClient(machine, 'my_gantry');

    // Check if the gantry is moving
    const moving = await gantry.isMoving();
    console.log('Moving:', moving);

    For more information, see Gantry API.

    moveToPosition: (
        positionsMm: number[],
        speedsMmPerSec: number[],
        extra?: Struct,
    ) => Promise<void>

    Move each axis of the gantry to the positionsMm at the speeds in speedsMmPerSec.

    Type Declaration

      • (positionsMm: number[], speedsMmPerSec: number[], extra?: Struct): Promise<void>
      • Parameters

        • positionsMm: number[]

          The goal positions for each axis of the gantry.

        • speedsMmPerSec: number[]

          The desired speed for each axis to move to the respective position in positionsMm.

        • Optionalextra: Struct

        Returns Promise<void>

    const gantry = new VIAM.GantryClient(machine, 'my_gantry');

    // Create positions for a 3-axis gantry
    const positions = [1, 2, 3];
    const speeds = [3, 9, 12];

    // Move the axes to the specified positions
    await gantry.moveToPosition(positions, speeds);

    For more information, see Gantry API.

    name: string

    The name of the resource.

    stop: (extra?: Struct) => Promise<void>

    Stop the motion of the gantry.

    const gantry = new VIAM.GantryClient(machine, 'my_gantry');

    // Stop all motion of the gantry
    await gantry.stop();

    For more information, see Gantry API.

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