Class MotorClient

A gRPC-web client for the Motor component.

Implements

Constructors

Properties

callOptions: CallOptions = ...
client: PromiseClient<{
    methods: {
        doCommand: {
            I: typeof DoCommandRequest;
            O: typeof DoCommandResponse;
            kind: Unary;
            name: "DoCommand";
        };
        getGeometries: {
            I: typeof GetGeometriesRequest;
            O: typeof GetGeometriesResponse;
            kind: Unary;
            name: "GetGeometries";
        };
        getPosition: {
            I: typeof motorApi.GetPositionRequest;
            O: typeof motorApi.GetPositionResponse;
            kind: Unary;
            name: "GetPosition";
        };
        getProperties: {
            I: typeof motorApi.GetPropertiesRequest;
            O: typeof motorApi.GetPropertiesResponse;
            kind: Unary;
            name: "GetProperties";
        };
        goFor: {
            I: typeof GoForRequest;
            O: typeof GoForResponse;
            kind: Unary;
            name: "GoFor";
        };
        goTo: {
            I: typeof GoToRequest;
            O: typeof GoToResponse;
            kind: Unary;
            name: "GoTo";
        };
        isMoving: {
            I: typeof motorApi.IsMovingRequest;
            O: typeof motorApi.IsMovingResponse;
            kind: Unary;
            name: "IsMoving";
        };
        isPowered: {
            I: typeof IsPoweredRequest;
            O: typeof IsPoweredResponse;
            kind: Unary;
            name: "IsPowered";
        };
        resetZeroPosition: {
            I: typeof ResetZeroPositionRequest;
            O: typeof ResetZeroPositionResponse;
            kind: Unary;
            name: "ResetZeroPosition";
        };
        setPower: {
            I: typeof motorApi.SetPowerRequest;
            O: typeof motorApi.SetPowerResponse;
            kind: Unary;
            name: "SetPower";
        };
        setRPM: {
            I: typeof SetRPMRequest;
            O: typeof SetRPMResponse;
            kind: Unary;
            name: "SetRPM";
        };
        stop: {
            I: typeof motorApi.StopRequest;
            O: typeof motorApi.StopResponse;
            kind: Unary;
            name: "Stop";
        };
    };
    typeName: "viam.component.motor.v1.MotorService";
}>

Type declaration

  • Readonly methods: {
        doCommand: {
            I: typeof DoCommandRequest;
            O: typeof DoCommandResponse;
            kind: Unary;
            name: "DoCommand";
        };
        getGeometries: {
            I: typeof GetGeometriesRequest;
            O: typeof GetGeometriesResponse;
            kind: Unary;
            name: "GetGeometries";
        };
        getPosition: {
            I: typeof motorApi.GetPositionRequest;
            O: typeof motorApi.GetPositionResponse;
            kind: Unary;
            name: "GetPosition";
        };
        getProperties: {
            I: typeof motorApi.GetPropertiesRequest;
            O: typeof motorApi.GetPropertiesResponse;
            kind: Unary;
            name: "GetProperties";
        };
        goFor: {
            I: typeof GoForRequest;
            O: typeof GoForResponse;
            kind: Unary;
            name: "GoFor";
        };
        goTo: {
            I: typeof GoToRequest;
            O: typeof GoToResponse;
            kind: Unary;
            name: "GoTo";
        };
        isMoving: {
            I: typeof motorApi.IsMovingRequest;
            O: typeof motorApi.IsMovingResponse;
            kind: Unary;
            name: "IsMoving";
        };
        isPowered: {
            I: typeof IsPoweredRequest;
            O: typeof IsPoweredResponse;
            kind: Unary;
            name: "IsPowered";
        };
        resetZeroPosition: {
            I: typeof ResetZeroPositionRequest;
            O: typeof ResetZeroPositionResponse;
            kind: Unary;
            name: "ResetZeroPosition";
        };
        setPower: {
            I: typeof motorApi.SetPowerRequest;
            O: typeof motorApi.SetPowerResponse;
            kind: Unary;
            name: "SetPower";
        };
        setRPM: {
            I: typeof SetRPMRequest;
            O: typeof SetRPMResponse;
            kind: Unary;
            name: "SetRPM";
        };
        stop: {
            I: typeof motorApi.StopRequest;
            O: typeof motorApi.StopResponse;
            kind: Unary;
            name: "Stop";
        };
    }
    • Readonly doCommand: {
          I: typeof DoCommandRequest;
          O: typeof DoCommandResponse;
          kind: Unary;
          name: "DoCommand";
      }

      DoCommand sends/receives arbitrary commands

      Generated

      from rpc viam.component.motor.v1.MotorService.DoCommand

    • Readonly getGeometries: {
          I: typeof GetGeometriesRequest;
          O: typeof GetGeometriesResponse;
          kind: Unary;
          name: "GetGeometries";
      }

      GetGeometries returns the geometries of the component in their current configuration

      Generated

      from rpc viam.component.motor.v1.MotorService.GetGeometries

    • Readonly getPosition: {
          I: typeof motorApi.GetPositionRequest;
          O: typeof motorApi.GetPositionResponse;
          kind: Unary;
          name: "GetPosition";
      }

      Position reports the position of the robot's motor relative to its zero position This method will return an error if position reporting is not supported

      Generated

      from rpc viam.component.motor.v1.MotorService.GetPosition

    • Readonly getProperties: {
          I: typeof motorApi.GetPropertiesRequest;
          O: typeof motorApi.GetPropertiesResponse;
          kind: Unary;
          name: "GetProperties";
      }

      GetProperties returns a message of booleans indicating which optional features the robot's motor supports

      Generated

      from rpc viam.component.motor.v1.MotorService.GetProperties

    • Readonly goFor: {
          I: typeof GoForRequest;
          O: typeof GoForResponse;
          kind: Unary;
          name: "GoFor";
      }

      GoFor instructs the motor to turn at a specified speed, which is expressed in RPM, for a specified number of rotations relative to its starting position This method will return an error if position reporting is not supported If revolutions != 0, this will block until the number of revolutions has been completed or another operation comes in. Deprecated: If revolutions is 0, this will run the motor at rpm indefinitely.

      Generated

      from rpc viam.component.motor.v1.MotorService.GoFor

    • Readonly goTo: {
          I: typeof GoToRequest;
          O: typeof GoToResponse;
          kind: Unary;
          name: "GoTo";
      }

      GoTo requests the robot's motor to move to a specific position that is relative to its home position at a specified speed which is expressed in RPM This method will return an error if position reporting is not supported

      Generated

      from rpc viam.component.motor.v1.MotorService.GoTo

    • Readonly isMoving: {
          I: typeof motorApi.IsMovingRequest;
          O: typeof motorApi.IsMovingResponse;
          kind: Unary;
          name: "IsMoving";
      }

      IsMoving reports if a component is in motion

      Generated

      from rpc viam.component.motor.v1.MotorService.IsMoving

    • Readonly isPowered: {
          I: typeof IsPoweredRequest;
          O: typeof IsPoweredResponse;
          kind: Unary;
          name: "IsPowered";
      }

      IsPowered returns true if the robot's motor is on

      Generated

      from rpc viam.component.motor.v1.MotorService.IsPowered

    • Readonly resetZeroPosition: {
          I: typeof ResetZeroPositionRequest;
          O: typeof ResetZeroPositionResponse;
          kind: Unary;
          name: "ResetZeroPosition";
      }

      ResetZeroPosition sets the current position of the motor as the new zero position This method will return an error if position reporting is not supported

      Generated

      from rpc viam.component.motor.v1.MotorService.ResetZeroPosition

    • Readonly setPower: {
          I: typeof motorApi.SetPowerRequest;
          O: typeof motorApi.SetPowerResponse;
          kind: Unary;
          name: "SetPower";
      }

      SetPower sets the percentage of the motor's total power that should be employed expressed a value between -1 and 1 where negative values indicate a backwards direction and positive values a forward direction

      Generated

      from rpc viam.component.motor.v1.MotorService.SetPower

    • Readonly setRPM: {
          I: typeof SetRPMRequest;
          O: typeof SetRPMResponse;
          kind: Unary;
          name: "SetRPM";
      }

      SetRPM instructs the motor to move at the specified RPM indefinitely.

      Generated

      from rpc viam.component.motor.v1.MotorService.SetRPM

    • Readonly stop: {
          I: typeof motorApi.StopRequest;
          O: typeof motorApi.StopResponse;
          kind: Unary;
          name: "Stop";
      }

      Stop turns the robot's motor off

      Generated

      from rpc viam.component.motor.v1.MotorService.Stop

  • Readonly typeName: "viam.component.motor.v1.MotorService"
name: string
options: Options

Methods

  • Send/Receive arbitrary commands to the resource.

    Parameters

    • command: Struct

      The command to execute.

    • callOptions: CallOptions = ...

    Returns Promise<JsonValue>

  • Return the position of the motor relative to its zero position. Raise an error if position reporting is not supported.

    Parameters

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

      Returns Promise<number>

    • Return the motor's properties.

      Parameters

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

        Returns Promise<{
            positionReporting: boolean;
        }>

      • Turn the motor at a specified speed for either a specified number of revolutions or indefinitely. Raise an error if position reporting is not supported.

        Parameters

        • rpm: number

          Speed in revolutions per minute.

        • revolutions: number

          Number of revolutions relative to the motor's starting position. If this value is 0, this will run the motor at the given rpm indefinitely. If this value is nonzero, this will block until the number of revolutions has been completed or another operation comes in.

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

          Returns Promise<void>

        • Move the motor to a specific position relative to its home position at a specified speed. Raise an error if position reporting is not supported.

          Parameters

          • rpm: number

            Speed in revolutions per minute.

          • positionRevolutions: number

            Number of revolutions relative to the motor's home position.

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

            Returns Promise<void>

          • Return true if the motor is in motion.

            Parameters

            • callOptions: CallOptions = ...

            Returns Promise<boolean>

          • Return true if the motor is on.

            Parameters

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

              Returns Promise<readonly [boolean, number]>

            • Set the current position of the motor as the new zero position, offset by a given position. Raise an error if position reporting is not supported.

              Parameters

              • offset: number

                Position from which to offset the current position.

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

                Returns Promise<void>

              • Set the percentage of the motor's total power that should be employed.

                Parameters

                • power: number

                  A value between -1 and 1 where negative values indicate a backwards direction and positive values a forward direction.

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

                  Returns Promise<void>

                • Move the motor indefinitely at a specified speed. Raise an error if position reporting is not supported.

                  Parameters

                  • rpm: number

                    Speed in revolutions per minute.

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

                    Returns Promise<void>

                  • Turn the motor off.

                    Parameters

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

                      Returns Promise<void>