Viam SDK
    Preparing search index...

    Class NavigationClient

    A gRPC-web client for a Navigation service.

    Implements

    • Navigation
    Index
    callOptions: CallOptions = ...
    name: string

    The name of the resource.

    • Save a named position on the active map. If position is omitted, the robot's current position from getPosition is saved.

      Parameters

      • locationName: string

        The name to save the location under.

      • Optionalposition: PlainMessage<navigationApi.Position>

        The position to save. Defaults to the robot's current position.

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

      Returns Promise<navigationApi.Location>

    • Create a named route from an ordered list of waypoints. Every referenced location must already exist.

      Parameters

      • routeName: string

        The name to save the route under.

      • waypoints: PlainMessage<navigationApi.Waypoint>[]

        The ordered list of waypoints for the route.

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

      Returns Promise<navigationApi.Route>

    • Create a keep-out or speed-limit zone on the active map. The planner avoids keep-out zones and caps speed inside speed-limit zones.

      Parameters

      • zoneName: string

        The name to save the zone under.

      • type: string

        Either "keepout" or "speed_limit".

      • geometry: Struct

        The zone's geometry (circle, box, or polygon).

      • OptionalmaxSpeed: number

        The max speed in meters/sec. Required when type is "speed_limit".

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

      Returns Promise<navigationApi.Zone>

    • Stop all motion and discard both the active goal and any suspended goal.

      Parameters

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

      Returns Promise<navigationApi.Status>

    • Delete a saved location. The location is also removed from every route that references it.

      Parameters

      • locationName: string

        The name of the location to delete.

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

      Returns Promise<void>

    • Delete a route. The locations it references are not affected.

      Parameters

      • routeName: string

        The name of the route to delete.

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

      Returns Promise<void>

    • Delete a zone.

      Parameters

      • zoneName: string

        The name of the zone to delete.

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

      Returns Promise<void>

    • 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' } }));
    • Drive a Plan, typically from planToPoint or planToLocation. While navigating, the active path is available on getNavigationStatus. Rejected if the path is empty.

      Parameters

      • plan: Plan

        The plan to execute.

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

      Returns Promise<navigationApi.Status>

    • Get the local or global costmap as a downsampled grid, for display in UIs.

      Parameters

      • layer: string = 'auto'

        Optional; "auto", "local", or "global". Defaults to "auto".

      • stride: number = 2

        Optional; the downsample factor. Defaults to 2.

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

      Returns Promise<GetCostmapResponse>

    • Get a saved location by name. This does not return the robot's current position; use getPosition for that.

      Parameters

      • locationName: string

        The name of the location to get.

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

      Returns Promise<navigationApi.Location>

    • Get the full navigation state, including the robot's current position and the latest goal.

      Parameters

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

      Returns Promise<navigationApi.Status>

    • Get the robot's current position on the active map. Use this for frequent position polling; getNavigationStatus reports the same position alongside the rest of the navigation state.

      Parameters

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

      Returns Promise<navigationApi.Position>

    • Get the map type the service operates on and robot properties. These values do not change while the service is running.

      Parameters

      • callOptions: CallOptions = ...

      Returns Promise<navigationApi.Properties>

    • Get a route by name.

      Parameters

      • routeName: string

        The name of the route to get.

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

      Returns Promise<navigationApi.Route>

    • Get the status of the resource.

      Parameters

      • callOptions: CallOptions = ...

      Returns Promise<JsonValue>

    • Get a zone by name.

      Parameters

      • zoneName: string

        The name of the zone to get.

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

      Returns Promise<navigationApi.Zone>

    • Drive directly to a saved location with a closed-loop controller, without full path planning. Intended for short hops and docking.

      Parameters

      • locationName: string

        The name of the saved location to go to.

      • wait: boolean = true

        Optional; defaults to true. With false, returns immediately while navigating.

      • OptionallinearMPerSec: number

        Optional; the linear speed to drive at.

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

      Returns Promise<navigationApi.Status>

    • Drive directly to a Position with a closed-loop controller, without full path planning. Intended for short hops and docking.

      Parameters

      • destination: Position

        The destination to go to.

      • wait: boolean = true

        Optional; defaults to true. With false, returns immediately while navigating.

      • OptionallinearMPerSec: number

        Optional; the linear speed to drive at.

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

      Returns Promise<navigationApi.Status>

    • List all saved locations on the active map.

      Parameters

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

      Returns Promise<navigationApi.Location[]>

    • List all routes on the active map.

      Parameters

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

      Returns Promise<navigationApi.Route[]>

    • List zones on the active map, optionally filtered by type.

      Parameters

      • type: string = ''

        Optional; "keepout" or "speed_limit".

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

      Returns Promise<navigationApi.Zone[]>

    • Drive a route one waypoint at a time using the obstacle-aware planner. Provide either routeName (a saved route) or waypoints (an inline list).

      Parameters

      Returns Promise<navigationApi.Status>

      const status = await navigation.navigateRoute({ routeName: 'patrol', loop: true });
      
    • Plan an obstacle-aware path to a saved location and start driving it. Returns once the goal is accepted; track progress with getNavigationStatus.

      Parameters

      • locationName: string

        The name of the saved location to navigate to.

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

      Returns Promise<navigationApi.Status>

    • Plan an obstacle-aware path to a Position and start driving it. Returns once the goal is accepted; track progress with getNavigationStatus.

      Parameters

      • destination: Position

        The destination to navigate to.

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

      Returns Promise<navigationApi.Status>

    • Compute a path to a saved location without moving. Accepts the same optional start as planToPoint. Raises an error if no path exists.

      Parameters

      • locationName: string

        The name of the saved location to plan to.

      • Optionalstart: PlainMessage<navigationApi.Position>

        Optional; the starting position. Defaults to getPosition.

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

      Returns Promise<navigationApi.Plan>

    • Compute a path from the robot (or a given start) to a Position without moving. Pass a feasible result to executePlan to drive it. Raises an error if no path exists.

      Parameters

      • destination: Position

        The destination to plan to.

      • Optionalstart: PlainMessage<navigationApi.Position>

        Optional; the starting position. Defaults to getPosition.

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

      Returns Promise<navigationApi.Plan>

    • Resume the suspended goal the same way it was started: planned navigation, simple go-to, or a route from its current waypoint.

      Parameters

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

      Returns Promise<navigationApi.Status>

    • Stop motion but remember the current goal, including the current waypoint and loop setting for routes. A suspended goal must be canceled before a new one starts.

      Parameters

      • reason: string = ''

        Optional; reported on the suspended goal.

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

      Returns Promise<navigationApi.Status>

    • Change a saved location's position or name. Renaming a location updates every route waypoint that references it.

      Parameters

      • locationName: string

        The name of the location to update.

      • Optionalposition: PlainMessage<navigationApi.Position>

        The new position. Omit to leave the position unchanged.

      • OptionalnewName: string

        The new name. Omit to leave the name unchanged.

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

      Returns Promise<navigationApi.Location>

    • Rename a route and/or replace its waypoints. An omitted waypoints list leaves the waypoints unchanged; an empty list clears them.

      Parameters

      • routeName: string

        The name of the route to update.

      • OptionalnewName: string

        The new name. Omit to leave the name unchanged.

      • Optionalwaypoints: PlainMessage<navigationApi.Waypoint>[]

        The replacement waypoints. Omit to leave them unchanged.

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

      Returns Promise<navigationApi.Route>

    • Change a zone's type, geometry, speed limit, or name.

      Parameters

      • zoneName: string

        The name of the zone to update.

      • Optionaltype: string

        Optional; "keepout" or "speed_limit".

      • Optionalgeometry: Struct

        Optional; the zone's new geometry.

      • OptionalmaxSpeed: number

        Optional; the new max speed in meters/sec.

      • OptionalnewName: string

        Optional; the new name for the zone.

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

      Returns Promise<navigationApi.Zone>