viam.services.slam.slam
Module Contents
Classes
SLAM represents a SLAM service. |
- class viam.services.slam.slam.SLAM(name: str)[source]
Bases:
viam.services.service_base.ServiceBase
SLAM represents a SLAM service.
This acts as an abstract base class for any drivers representing specific arm 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_internal_state(*, timeout: Optional[float]) List[bytes] [source]
Get the internal state of the SLAM algorithm required to continue mapping/localization.
- Returns:
Chunks of the internal state of the SLAM algorithm
- Return type:
List[GetInternalStateResponse]
- abstract async get_point_cloud_map(*, timeout: Optional[float]) List[bytes] [source]
Get the point cloud map.
- Returns:
- Complete pointcloud in standard PCD format. Chunks of the PointCloud, concatenating all
GetPointCloudMapResponse.point_cloud_pcd_chunk values
- Return type:
List[GetPointCloudMapResponse]
- abstract async get_latest_map_info(*, timeout: Optional[float]) datetime.datetime [source]
Get the timestamp of the last update to the point cloud SLAM map.
- Returns:
The timestamp of the last update.
- Return type:
datetime
- abstract async get_position(*, timeout: Optional[float]) viam.services.slam.Pose [source]
Get current position of the specified component in the SLAM Map.
- Returns:
The current position of the specified component
- Return type:
- 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: