Viam SDK
    Preparing search index...

    Class MovementSensorClient

    A gRPC-web client for the MovementSensor 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 accuracy of various sensors.

      Parameters

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

      Returns Promise<GetAccuracyResponse>

      const movementSensor = new VIAM.MovementSensorClient(machine, 'my_movement_sensor');
      const accuracy = await movementSensor.getAccuracy();

      For more information, see Movement Sensor API.

    • Get the angular velocity across x/y/z axes.

      Parameters

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

      Returns Promise<commonApi.Vector3>

      const movementSensor = new VIAM.MovementSensorClient(machine, 'my_movement_sensor');
      const angularVelocity = await movementSensor.getAngularVelocity();

      For more information, see Movement Sensor API.

    • Get the compass heading, which is a number from 0-359 where 0 is North, 90 is East, 180 is South, and 270 is West.

      Parameters

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

      Returns Promise<number>

      const movementSensor = new VIAM.MovementSensorClient(machine, 'my_movement_sensor');
      const compassHeading = await movementSensor.getCompassHeading();

      For more information, see Movement Sensor API.

    • Get linear acceleration across x/y/z axes.

      Parameters

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

      Returns Promise<commonApi.Vector3>

      const movementSensor = new VIAM.MovementSensorClient(machine, 'my_movement_sensor');
      const linearAcceleration = await movementSensor.getLinearAcceleration();

      For more information, see Movement Sensor API.

    • Get linear velocity across x/y/z axes.

      Parameters

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

      Returns Promise<commonApi.Vector3>

      const movementSensor = new VIAM.MovementSensorClient(machine, 'my_movement_sensor');
      const linearVelocity = await movementSensor.getLinearVelocity();

      For more information, see Movement Sensor API.

    • Get the current orientation of the sensor.

      Parameters

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

      Returns Promise<commonApi.Orientation>

      const movementSensor = new VIAM.MovementSensorClient(machine, 'my_movement_sensor');
      const orientation = await movementSensor.getOrientation();

      For more information, see Movement Sensor API.

    • Return the readings of a sensor.

      Parameters

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

      Returns Promise<Record<string, JsonValue>>

      const movementSensor = new VIAM.MovementSensorClient(machine, 'my_movement_sensor');
      const readings = await movementSensor.getReadings();

      For more information, see Movement Sensor API.