Interface MovementSensor

Represents any sensor that reports information about the robot's direction, position, and/or speed.

interface MovementSensor {
    name: string;
    doCommand(command: Struct): Promise<JsonValue>;
    getAccuracy(extra?: Struct): Promise<GetAccuracyResponse>;
    getAngularVelocity(
        extra?: Struct,
    ): Promise<PlainMessage<commonApi.Vector3>>;
    getCompassHeading(extra?: Struct): Promise<number>;
    getLinearAcceleration(
        extra?: Struct,
    ): Promise<PlainMessage<commonApi.Vector3>>;
    getLinearVelocity(extra?: Struct): Promise<PlainMessage<commonApi.Vector3>>;
    getOrientation(
        extra?: Struct,
    ): Promise<PlainMessage<commonApi.Orientation>>;
    getPosition(extra?: Struct): Promise<movementSensorApi.GetPositionResponse>;
    getProperties(
        extra?: Struct,
    ): Promise<movementSensorApi.GetPropertiesResponse>;
    getReadings(extra?: Struct): Promise<Record<string, JsonValue>>;
}

Hierarchy (View Summary, Expand)

Implemented by

Properties

name: string

The name of the resource.

Methods

  • Send/Receive arbitrary commands to the resource.

    Parameters

    • command: Struct

      The command to execute.

    Returns Promise<JsonValue>

    const result = await resource.doCommand({
    name: 'myCommand',
    args: { key: 'value' },
    });
  • Get the accuracy of various sensors.

    Parameters

    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 compass heading, which is a number from 0-359 where 0 is North, 90 is East, 180 is South, and 270 is West.

    Parameters

    Returns Promise<number>

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

    For more information, see Movement Sensor API.

  • Return the readings of a sensor.

    Parameters

    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.

MMNEPVFCICPMFPCPTTAAATR