Class NavigationClient

A gRPC-web client for a Navigation service.

Implements

  • Navigation

Constructors

Properties

callOptions: CallOptions = ...
name: string

The name of the resource.

Methods

  • Add a waypoint to the service's data storage.

    Parameters

    • location: PlainMessage

      A waypoint described by latitude and longitude values.

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

    Returns Promise<void>

    const navigation = new VIAM.NavigationClient(machine, 'my_navigation');

    const location = { latitude: 40.7128, longitude: -74.006 };
    await navigation.addWayPoint(location);

    For more information, see Navigation API.

  • Send/Receive arbitrary commands to the resource.

    Parameters

    • command: Struct

      The command to execute.

    • callOptions: CallOptions = ...

    Returns Promise<JsonValue>

    import { Struct } from '@viamrobotics/sdk';

    const result = await resource.doCommand(
    Struct.fromJson({
    myCommand: { key: 'value' },
    })
    );
  • Get the current location of the robot.

    Parameters

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

    Returns Promise<navigationApi.GetLocationResponse>

    const navigation = new VIAM.NavigationClient(machine, 'my_navigation');

    const location = await navigation.getLocation();

    For more information, see Navigation API.

  • Get the mode the robot is operating in.

    Parameters

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

    Returns Promise<navigationApi.Mode>

    const navigation = new VIAM.NavigationClient(machine, 'my_navigation');

    const mode = await navigation.getMode();

    For more information, see Navigation API.

  • Get a list of obstacles.

    Parameters

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

    Returns Promise<commonApi.GeoGeometry[]>

    const navigation = new VIAM.NavigationClient(machine, 'my_navigation');

    const obstacles = await navigation.getObstacles();

    For more information, see Navigation API.

  • Gets the list of paths known to the navigation service.

    Parameters

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

    Returns Promise<navigationApi.Path[]>

    const navigation = new VIAM.NavigationClient(machine, 'my_navigation');

    const paths = await navigation.getPaths();

    For more information, see Navigation API.

  • Gets information on the properties of the current navigation service.

    Parameters

    • callOptions: CallOptions = ...

    Returns Promise<navigationApi.GetPropertiesResponse>

    const navigation = new VIAM.NavigationClient(machine, 'my_navigation');

    const properties = await navigation.getProperties();

    For more information, see Navigation API.

  • Get an array of waypoints currently in the service's data storage.

    Parameters

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

    Returns Promise<navigationApi.Waypoint[]>

    const navigation = new VIAM.NavigationClient(machine, 'my_navigation');

    const waypoints = await navigation.getWayPoints();

    For more information, see Navigation API.

  • Remove a waypoint from the service's data storage.

    Parameters

    • id: string

      The MongoDB ObjectID of the waypoint to remove from the service's data storage.

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

    Returns Promise<void>

    const navigation = new VIAM.NavigationClient(machine, 'my_navigation');

    // Remove the first waypoint
    if (waypoints.length > 0) {
    await navigation.removeWayPoint(waypoints[0].id);
    }

    For more information, see Navigation API.

  • Set the mode the robot is operating in.

    Parameters

    • mode: navigationApi.Mode

      The mode for the service to operate in.

      • 0: MODE_UNSPECIFIED
      • 1: MODE_MANUAL
      • 2: MODE_WAYPOINT
      • 3: MODE_EXPLORE
    • extra: {} = {}
    • callOptions: CallOptions = ...

    Returns Promise<void>

    const navigation = new VIAM.NavigationClient(machine, 'my_navigation');

    // Set the mode to 2 which corresponds to WAYPOINT
    await navigation.setMode(2);

    For more information, see Navigation API.