viam.services.navigation
Submodules
Package Contents
Classes
GeoObstacle contains information about the geometric structure of an obstacle and the location of the obstacle, |
|
Abstract base class for protocol messages. |
|
A user provided destination and the set of geopoints that |
|
Abstract base class for protocol messages. |
|
Navigation represents a Navigation service. |
- class viam.services.navigation.GeoObstacle(*, location: global___GeoPoint | None = ..., geometries: collections.abc.Iterable[global___Geometry] | None = ...)
Bases:
google.protobuf.message.Message
GeoObstacle contains information about the geometric structure of an obstacle and the location of the obstacle, captured in latitude and longitude.
- property location: global___GeoPoint
Location of the obstacle
- property geometries: google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Geometry]
Geometries that describe the obstacle, where embedded Pose data is with respect to the specified location
- HasField(field_name: Literal[location, b'location']) → bool
Checks if a certain field is set for the message.
For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor,
ValueError
will be raised.- Parameters:
field_name (str) – The name of the field to check for presence.
- Returns:
Whether a value has been set for the named field.
- Return type:
bool
- Raises:
ValueError – if the field_name is not a member of this message.
- class viam.services.navigation.GeoPoint(*, latitude: float = ..., longitude: float = ...)
Bases:
google.protobuf.message.Message
Abstract base class for protocol messages.
Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.
- latitude: float
- longitude: float
- class viam.services.navigation.Mode
Bases:
_Mode
- class viam.services.navigation.Path(*, destination_waypoint_id: str = ..., geopoints: collections.abc.Iterable[viam.gen.common.v1.common_pb2.GeoPoint] | None = ...)
Bases:
google.protobuf.message.Message
A user provided destination and the set of geopoints that the robot is expected to take to get there
- property geopoints: google.protobuf.internal.containers.RepeatedCompositeFieldContainer[viam.gen.common.v1.common_pb2.GeoPoint]
List of geopoints that the motion planner output to reach the destination The first geopoint is the starting position of the robot for that path
- destination_waypoint_id: str
The id of the user specified waypoint
- class viam.services.navigation.Waypoint(*, id: str = ..., location: viam.gen.common.v1.common_pb2.GeoPoint | None = ...)
Bases:
google.protobuf.message.Message
Abstract base class for protocol messages.
Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.
- property location: viam.gen.common.v1.common_pb2.GeoPoint
- id: str
- HasField(field_name: Literal[location, b'location']) → bool
Checks if a certain field is set for the message.
For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor,
ValueError
will be raised.- Parameters:
field_name (str) – The name of the field to check for presence.
- Returns:
Whether a value has been set for the named field.
- Return type:
bool
- Raises:
ValueError – if the field_name is not a member of this message.
- class viam.services.navigation.Navigation(name: str)[source]
Bases:
viam.services.service_base.ServiceBase
Navigation represents a Navigation service.
This acts as an abstract base class for any drivers representing specific navigation service implementations. This cannot be used on its own. If the
__init__()
function is overridden, it must call thesuper().__init__()
function.- SUBTYPE: Final
- abstract async get_paths(*, timeout: Optional[float]) → List[viam.services.navigation.Path][source]
- abstract async get_location(*, timeout: Optional[float]) → viam.services.navigation.GeoPoint[source]
- abstract async get_obstacles(*, timeout: Optional[float]) → List[viam.services.navigation.GeoObstacle][source]
- abstract async get_waypoints(*, timeout: Optional[float]) → List[viam.services.navigation.Waypoint][source]
- abstract async add_waypoint(point: viam.services.navigation.GeoPoint, *, timeout: Optional[float])[source]
- abstract async get_mode(*, timeout: Optional[float]) → viam.services.navigation.Mode.ValueType[source]
- abstract async set_mode(mode: viam.services.navigation.Mode.ValueType, *, timeout: Optional[float])[source]
- classmethod from_robot(robot: viam.robot.client.RobotClient, name: str) → typing_extensions.Self
Get the service named
name
from the provided robot.- Parameters:
robot (RobotClient) – The robot
name (str) – The name of the service
- Returns:
The service, if it exists on the robot
- Return type:
Self
- abstract async do_command(command: Mapping[str, viam.utils.ValueTypes], *, timeout: Optional[float] = None, **kwargs) → Mapping[str, viam.utils.ValueTypes]
Send/Receive arbitrary commands to the Resource
- Parameters:
command (Mapping[str, ValueTypes]) – The command to execute
- Raises:
NotImplementedError – Raised if the Resource does not support arbitrary commands
- Returns:
Result of the executed command
- Return type:
Mapping[str, ValueTypes]
- classmethod get_resource_name(name: str) → viam.proto.common.ResourceName
Get the ResourceName for this Resource with the given name
- Parameters:
name (str) – The name of the Resource
- get_operation(kwargs: Mapping[str, Any]) → viam.operations.Operation
Get the
Operation
associated with the currently running function.When writing custom resources, you should get the
Operation
by calling this function and check to see if it’s cancelled. If theOperation
is cancelled, then you can perform any necessary (terminating long running tasks, cleaning up connections, etc. ).- Parameters:
kwargs (Mapping[str, Any]) – The kwargs object containing the operation
- Returns:
The operation associated with this function
- Return type:
- async close()
Safely shut down the resource and prevent further use.
Close must be idempotent. Later configuration may allow a resource to be “open” again. If a resource does not want or need a close function, it is assumed that the resource does not need to retun errors when future non-Close methods are called.