Viam SDK
    Preparing search index...

    Class ArmClient

    A gRPC-web client for the Arm 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 3D models of the component

      Parameters

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

      Returns Promise<Record<string, Mesh>>

      const arm = new VIAM.ArmClient(machine, 'my_arm');
      const models = await arm.get3DModels();
      console.log(models);
    • Get the position of the end of the arm expressed as a pose

      Parameters

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

      Returns Promise<commonApi.Pose>

      const arm = new VIAM.ArmClient(machine, 'my_arm');
      const pose = await arm.getEndPosition();

      For more information, see Arm API.

    • Get the geometries of the component in their current configuration

      Parameters

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

      Returns Promise<commonApi.Geometry[]>

      const arm = new VIAM.ArmClient(machine, 'my_arm');
      const geometries = await arm.getGeometries();
      console.log(geometries);

      For more information, see Arm API.

    • Gets the current position of each joint.

      Parameters

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

      Returns Promise<JointPositions>

      const arm = new VIAM.ArmClient(machine, 'my_arm');
      const jointPositions = await arm.getJointPositions();

      For more information, see Arm API.

    • Get the kinematics information associated with the arm.

      Parameters

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

      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 arm = new VIAM.ArmClient(machine, 'my_arm');
      const kinematics = await arm.getKinematics();
      console.log(kinematics);

      For more information, see [Arm
      API](https://docs.viam.com/dev/reference/apis/components/arm/#getkinematics).
    • Get the status of the resource.

      Parameters

      • callOptions: CallOptions = ...

      Returns Promise<JsonValue>

    • Get if the arm is currently moving.

      Parameters

      • callOptions: CallOptions = ...

      Returns Promise<boolean>

      const arm = new VIAM.ArmClient(machine, 'my_arm');
      const isMoving = await arm.isMoving();
      console.log(isMoving);

      For more information, see Arm API.

    • Move each joint of the arm based on the angles on the joint positions.

      Parameters

      • jointPositionsList: number[]

        List of angles (0-360) to move each joint to.

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

      Returns Promise<void>

      const arm = new VIAM.ArmClient(machine, 'my_arm');

      // Move an arm with 6 joints (6 DoF)
      await arm.moveToJointPositions([90, 0, 0, 0, 15, 0]);

      For more information, see Arm API.

    • Move the end of the arm to the pose.

      Parameters

      • pose: Pose

        The destination pose for the arm.

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

      Returns Promise<void>

      const arm = new VIAM.ArmClient(machine, 'my_arm');

      // Create a pose for the arm to move to
      const pose: Pose = {
      x: -500,
      y: -200,
      z: 62,
      oX: 1,
      oY: 0,
      oZ: 1,
      theta: 90,
      };

      // Move the arm to the pose
      await arm.moveToPosition(pose);

      For more information, see Arm API.

    • Stop the motion of the arm.

      Parameters

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

      Returns Promise<void>

      const arm = new VIAM.ArmClient(machine, 'my_arm');
      await arm.stop();

      For more information, see Arm API.