viam.services.slam.client
Module Contents
Classes
Connect to the SLAMService, which allows the robot to create a map of its surroundings and find its location in that map. |
- class viam.services.slam.client.SLAMClient(name: str, channel: grpclib.client.Channel)[source]
Bases:
viam.services.slam.slam.SLAM
,viam.resource.rpc_client_base.ReconfigurableResourceRPCClientBase
Connect to the SLAMService, which allows the robot to create a map of its surroundings and find its location in that map.
- async get_position(*, timeout: Optional[float] = None) 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:
- async get_point_cloud_map(*, timeout: Optional[float] = None) List[viam.proto.service.slam.GetPointCloudMapResponse] [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]
- async get_internal_state(*, timeout: Optional[float] = None) List[viam.proto.service.slam.GetInternalStateResponse] [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]
- async get_latest_map_info(*, timeout: Optional[float] = None) 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
- async do_command(command: Mapping[str, viam.utils.ValueTypes], *, timeout: Optional[float] = None) Mapping[str, viam.utils.ValueTypes] [source]
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 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
- 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: