|
1 | | -from typing import Any, Dict, List, Mapping, Optional |
| 1 | +from typing import Any, Dict, List, Mapping, Optional, Tuple |
2 | 2 |
|
3 | 3 | from grpclib.client import Channel |
4 | 4 |
|
5 | | -from viam.proto.common import DoCommandRequest, DoCommandResponse, Geometry |
| 5 | +from viam.proto.common import DoCommandRequest, DoCommandResponse, Geometry, GetKinematicsRequest, GetKinematicsResponse |
6 | 6 | from viam.proto.component.gripper import ( |
7 | 7 | GrabRequest, |
8 | 8 | GrabResponse, |
|
17 | 17 |
|
18 | 18 | from .gripper import Gripper |
19 | 19 |
|
| 20 | +from . import KinematicsFileFormat |
20 | 21 |
|
21 | 22 | class GripperClient(Gripper, ReconfigurableResourceRPCClientBase): |
22 | 23 | """ |
@@ -83,3 +84,15 @@ async def do_command( |
83 | 84 | async def get_geometries(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> List[Geometry]: |
84 | 85 | md = kwargs.get("metadata", self.Metadata()) |
85 | 86 | return await get_geometries(self.client, self.name, extra, timeout, md) |
| 87 | + |
| 88 | + async def get_kinematics( |
| 89 | + self, |
| 90 | + *, |
| 91 | + extra: Optional[Dict[str, Any]] = None, |
| 92 | + timeout: Optional[float] = None, |
| 93 | + **kwargs, |
| 94 | + ) -> Tuple[KinematicsFileFormat.ValueType, bytes]: |
| 95 | + md = kwargs.get("metadata", self.Metadata()).proto |
| 96 | + request = GetKinematicsRequest(name=self.name, extra=dict_to_struct(extra)) |
| 97 | + response: GetKinematicsResponse = await self.client.GetKinematics(request, timeout=timeout, metadata=md) |
| 98 | + return (response.format, response.kinematics_data) |
0 commit comments