From 645e10e9116c687313e8c259d85b81a63dc20129 Mon Sep 17 00:00:00 2001 From: Sierra Guequierre Date: Tue, 15 Oct 2024 13:33:26 -0400 Subject: [PATCH] DOCS-2902: Edit machine management api from QA (#748) --- src/viam/robot/client.py | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/viam/robot/client.py b/src/viam/robot/client.py index ff86cddd8..7131d49a9 100644 --- a/src/viam/robot/client.py +++ b/src/viam/robot/client.py @@ -613,6 +613,7 @@ async def get_status(self, components: Optional[List[ResourceName]] = None) -> L # Get the status of the resources on the machine. statuses = await machine.get_status() + resource_statuses = machine_status.resources Args: components (Optional[List[viam.proto.common.ResourceName]]): Optional list of @@ -713,7 +714,24 @@ async def transform_pose( :: - pose = await machine.transform_pose(PoseInFrame(), "origin") + from viam.proto.common import Pose, PoseInFrame + + pose = Pose( + x=1.0, # X coordinate in mm + y=2.0, # Y coordinate in mm + z=3.0, # Z coordinate in mm + o_x=0.0, # X component of orientation vector + o_y=0.0, # Y component of orientation vector + o_z=0.0, # Z component of orientation vector + theta=0.0 # Orientation angle in degrees + ) + + pose_in_frame = PoseInFrame( + reference_frame="world", + pose=pose + ) + + transformed_pose = await machine.transform_pose(pose_in_frame, "world") Args: @@ -741,12 +759,15 @@ async def discover_components( queries: List[DiscoveryQuery], ) -> List[Discovery]: """ - Get the list of discovered component configurations. + Get a list of discovered potential component configurations, for example listing different supported resolutions. Currently only works for some cameras. + Returns module names for modules. :: + from viam.proto.robot import DiscoveryQuery + # Define a new discovery query. - q = machine.DiscoveryQuery(subtype=acme.API, model="some model") + q = DiscoveryQuery(subtype="camera", model="webcam") # Define a list of discovery queries. qs = [q] @@ -756,10 +777,10 @@ async def discover_components( Args: - queries (List[viam.proto.robot.DiscoveryQuery]): The list of component models to lookup configurations for. + queries (List[viam.proto.robot.DiscoveryQuery]): The list of component models to lookup potential configurations for. Returns: - List[Discovery]: A list of discovered component configurations. + List[Discovery]: A list of discovered potential component configurations. For more information, see `Machine Management API `_. """