Skip to content

Commit 7c68a23

Browse files
authored
RSDK-670: update docs around creating resource names (#204)
1 parent b9a89e6 commit 7c68a23

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/viam/services/motion.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ async def move(
4141
"""Plan and execute a movement to move the component specified to its goal destination.
4242
4343
Note: Frames designated with respect to components can also be used as the ``component_name`` when calling for a move. This
44-
technique allows for planning and moving the frame itself to the ``destination``. To do so, simply override the ``name`` attribute
45-
for a given resource with the originating ReferenceFrame. Then pass in the updated resource into the ``component_name``. Ex::
44+
technique allows for planning and moving the frame itself to the ``destination``. To do so, simply create a resource name with
45+
originating ReferenceFrame's name. Then pass in the resource name into ``component_name``. Ex::
4646
47-
resource = Arm.get_resource_name("arm")
48-
resource.name = "externalFrame"
49-
success = await MotionServiceClient.move(resource, ...)
47+
resource_name = Arm.get_resource_name("externalFrame")
48+
success = await MotionServiceClient.move(resource_name, ...)
5049
5150
Args:
5251
component_name (ResourceName): Name of a component on a given robot.
@@ -109,13 +108,19 @@ async def get_pose(
109108
self,
110109
component_name: ResourceName,
111110
destination_frame: str,
112-
supplemental_transforms: Optional[List[Transform]] = [],
111+
supplemental_transforms: Optional[List[Transform]] = None,
113112
*,
114113
extra: Optional[Mapping[str, Any]] = None,
115114
timeout: Optional[float] = None,
116115
) -> PoseInFrame:
117116
"""
118-
Get the Pose and observer frame for any given component on a robot.
117+
Get the Pose and observer frame for any given component on a robot. A ``component_name`` can be created like this::
118+
119+
component_name = Arm.get_resource_name("arm")
120+
121+
Note that the example uses the ``Arm`` class, but any component class that inherits from ``ComponentBase`` will work
122+
(``Base``, ``Gripper``, etc).
123+
119124
120125
Args:
121126
component_name (ResourceName): Name of a component on a robot.
@@ -125,6 +130,8 @@ async def get_pose(
125130
Returns:
126131
``Pose`` (PoseInFrame): Pose of the given component and the frame in which it was observed.
127132
"""
133+
if supplemental_transforms is None:
134+
supplemental_transforms = []
128135
if extra is None:
129136
extra = {}
130137
request = GetPoseRequest(
@@ -136,3 +143,6 @@ async def get_pose(
136143
)
137144
response: GetPoseResponse = await self.client.GetPose(request, timeout=timeout)
138145
return response.pose
146+
147+
class Pose:
148+
pass

0 commit comments

Comments
 (0)