Viam SDK
    Preparing search index...

    Class GripperClient

    A gRPC-web client for the Gripper component.

    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' } }));
    • Get the current input values of the gripper.

      Parameters

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

      Returns Promise<number[]>

      const gripper = new VIAM.GripperClient(machine, 'my_gripper');

      // Get the current inputs of the gripper
      const inputs = await gripper.getCurrentInputs();
      console.log('Current inputs:', inputs);
    • Get the geometries of the component in their current configuration.

      Parameters

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

      Returns Promise<commonApi.Geometry[]>

      const gripper = new VIAM.GripperClient(machine, 'my_gripper');

      // Get the geometries of this component
      const geometries = await gripper.getGeometries();
      console.log('Geometries:', geometries);

      For more information, see Gripper API.

    • Get the status of the resource.

      Parameters

      • callOptions: CallOptions = ...

      Returns Promise<JsonValue>

    • Move the gripper to the given input values.

      Parameters

      • values: number[]

        The input values to move the gripper to.

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

      Returns Promise<void>

      const gripper = new VIAM.GripperClient(machine, 'my_gripper');

      // Move the gripper to specific input values
      await gripper.goToInputs([0.5]);
    • Request a gripper of the underlying robot to grab.

      Parameters

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

      Returns Promise<void>

      const gripper = new VIAM.GripperClient(machine, 'my_gripper');

      // Close the gripper to grab
      await gripper.grab();

      For more information, see Gripper API.

    • Get information about whether the gripper is currently holding onto an object.

      Parameters

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

      Returns Promise<boolean>

      const gripper = new VIAM.GripperClient(machine, 'my_gripper');

      // Check if the gripper is holding something
      const holding = await gripper.isHoldingSomething();
      console.log('Gripper is holding something:', holding);

      For more information, see Gripper API.

    • Report if the gripper is in motion.

      Parameters

      • callOptions: CallOptions = ...

      Returns Promise<boolean>

      const gripper = new VIAM.GripperClient(machine, 'my_gripper');

      // Check if the gripper is currently moving
      const moving = await gripper.isMoving();
      console.log('Gripper is moving:', moving);

      For more information, see Gripper API.

    • Open a gripper of the underlying robot.

      Parameters

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

      Returns Promise<void>

      const gripper = new VIAM.GripperClient(machine, 'my_gripper');

      // Open the gripper
      await gripper.open();

      For more information, see Gripper API.

    • Stop a robot's gripper.

      Parameters

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

      Returns Promise<void>

      const gripper = new VIAM.GripperClient(machine, 'my_gripper');

      // Stop the gripper's current motion
      await gripper.stop();

      For more information, see Gripper API.