viam-sdk 0.25.2__py3-none-linux_armv7l.whl → 0.62.0__py3-none-linux_armv7l.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- viam/app/_logs.py +3 -6
- viam/app/app_client.py +606 -262
- viam/app/billing_client.py +60 -18
- viam/app/data_client.py +1086 -315
- viam/app/ml_training_client.py +51 -48
- viam/app/provisioning_client.py +3 -5
- viam/app/viam_client.py +105 -11
- viam/components/arm/__init__.py +1 -25
- viam/components/arm/arm.py +21 -22
- viam/components/arm/client.py +27 -30
- viam/components/arm/service.py +3 -3
- viam/components/audio_in/__init__.py +24 -0
- viam/components/audio_in/audio_in.py +74 -0
- viam/components/audio_in/client.py +76 -0
- viam/components/audio_in/service.py +83 -0
- viam/components/audio_input/__init__.py +1 -1
- viam/components/audio_input/audio_input.py +4 -3
- viam/components/audio_input/client.py +19 -8
- viam/components/audio_input/service.py +10 -0
- viam/components/audio_out/__init__.py +21 -0
- viam/components/audio_out/audio_out.py +72 -0
- viam/components/audio_out/client.py +67 -0
- viam/components/audio_out/service.py +63 -0
- viam/components/base/__init__.py +2 -10
- viam/components/base/base.py +20 -20
- viam/components/base/client.py +27 -30
- viam/components/board/__init__.py +2 -25
- viam/components/board/board.py +39 -77
- viam/components/board/client.py +39 -73
- viam/components/button/__init__.py +10 -0
- viam/components/button/button.py +41 -0
- viam/components/button/client.py +52 -0
- viam/components/button/service.py +46 -0
- viam/components/camera/__init__.py +1 -1
- viam/components/camera/camera.py +31 -22
- viam/components/camera/client.py +30 -20
- viam/components/camera/service.py +14 -12
- viam/components/component_base.py +10 -7
- viam/components/encoder/__init__.py +1 -1
- viam/components/encoder/client.py +15 -16
- viam/components/encoder/encoder.py +9 -9
- viam/components/gantry/__init__.py +1 -13
- viam/components/gantry/client.py +41 -28
- viam/components/gantry/gantry.py +48 -17
- viam/components/gantry/service.py +21 -5
- viam/components/generic/__init__.py +1 -1
- viam/components/generic/client.py +11 -7
- viam/components/generic/generic.py +3 -3
- viam/components/gripper/__init__.py +3 -12
- viam/components/gripper/client.py +43 -20
- viam/components/gripper/gripper.py +87 -12
- viam/components/gripper/service.py +32 -3
- viam/components/input/__init__.py +1 -14
- viam/components/input/client.py +22 -23
- viam/components/input/input.py +18 -12
- viam/components/motor/__init__.py +1 -21
- viam/components/motor/client.py +36 -42
- viam/components/motor/motor.py +24 -24
- viam/components/movement_sensor/__init__.py +1 -1
- viam/components/movement_sensor/client.py +33 -40
- viam/components/movement_sensor/movement_sensor.py +12 -12
- viam/components/pose_tracker/__init__.py +1 -1
- viam/components/pose_tracker/client.py +9 -8
- viam/components/pose_tracker/pose_tracker.py +2 -2
- viam/components/power_sensor/__init__.py +1 -1
- viam/components/power_sensor/client.py +15 -18
- viam/components/power_sensor/power_sensor.py +12 -12
- viam/components/sensor/__init__.py +1 -1
- viam/components/sensor/client.py +9 -8
- viam/components/sensor/sensor.py +5 -5
- viam/components/servo/__init__.py +1 -13
- viam/components/servo/client.py +18 -18
- viam/components/servo/servo.py +12 -12
- viam/components/switch/__init__.py +10 -0
- viam/components/switch/client.py +83 -0
- viam/components/switch/service.py +72 -0
- viam/components/switch/switch.py +95 -0
- viam/gen/app/agent/v1/agent_pb2.py +40 -29
- viam/gen/app/agent/v1/agent_pb2.pyi +73 -11
- viam/gen/app/cloudslam/v1/cloud_slam_pb2.py +45 -42
- viam/gen/app/data/v1/data_grpc.py +98 -2
- viam/gen/app/data/v1/data_pb2.py +238 -119
- viam/gen/app/data/v1/data_pb2.pyi +804 -34
- viam/gen/app/datapipelines/v1/data_pipelines_grpc.py +84 -0
- viam/gen/app/datapipelines/v1/data_pipelines_pb2.py +57 -0
- viam/gen/app/datapipelines/v1/data_pipelines_pb2.pyi +387 -0
- viam/gen/app/dataset/v1/dataset_grpc.py +10 -2
- viam/gen/app/dataset/v1/dataset_pb2.py +38 -31
- viam/gen/app/dataset/v1/dataset_pb2.pyi +36 -1
- viam/gen/app/datasync/v1/data_sync_grpc.py +1 -1
- viam/gen/app/datasync/v1/data_sync_pb2.py +61 -51
- viam/gen/app/datasync/v1/data_sync_pb2.pyi +52 -12
- viam/gen/app/mlinference/__init__.py +0 -0
- viam/gen/app/mlinference/v1/__init__.py +0 -0
- viam/gen/app/mlinference/v1/ml_inference_grpc.py +28 -0
- viam/gen/app/mlinference/v1/ml_inference_pb2.py +23 -0
- viam/gen/app/mlinference/v1/ml_inference_pb2.pyi +63 -0
- viam/gen/app/mltraining/v1/ml_training_grpc.py +18 -2
- viam/gen/app/mltraining/v1/ml_training_pb2.py +134 -101
- viam/gen/app/mltraining/v1/ml_training_pb2.pyi +193 -7
- viam/gen/app/packages/v1/packages_pb2.py +43 -40
- viam/gen/app/v1/app_grpc.py +290 -2
- viam/gen/app/v1/app_pb2.py +670 -453
- viam/gen/app/v1/app_pb2.pyi +3133 -947
- viam/gen/app/v1/billing_grpc.py +34 -2
- viam/gen/app/v1/billing_pb2.py +94 -35
- viam/gen/app/v1/billing_pb2.pyi +314 -61
- viam/gen/app/v1/end_user_pb2.py +50 -29
- viam/gen/app/v1/robot_pb2.py +120 -111
- viam/gen/app/v1/robot_pb2.pyi +137 -15
- viam/gen/common/v1/common_pb2.py +86 -66
- viam/gen/common/v1/common_pb2.pyi +184 -8
- viam/gen/component/arm/v1/arm_grpc.py +18 -2
- viam/gen/component/arm/v1/arm_pb2.py +68 -55
- viam/gen/component/arm/v1/arm_pb2.pyi +73 -3
- viam/gen/component/audioin/__init__.py +0 -0
- viam/gen/component/audioin/v1/__init__.py +0 -0
- viam/gen/component/audioin/v1/audioin_grpc.py +54 -0
- viam/gen/component/audioin/v1/audioin_pb2.py +34 -0
- viam/gen/component/audioin/v1/audioin_pb2.pyi +94 -0
- viam/gen/component/audioinput/v1/audioinput_pb2.py +35 -32
- viam/gen/component/audioout/__init__.py +0 -0
- viam/gen/component/audioout/v1/__init__.py +0 -0
- viam/gen/component/audioout/v1/audioout_grpc.py +54 -0
- viam/gen/component/audioout/v1/audioout_pb2.py +32 -0
- viam/gen/component/audioout/v1/audioout_pb2.pyi +47 -0
- viam/gen/component/base/v1/base_pb2.py +57 -54
- viam/gen/component/board/v1/board_pb2.py +93 -90
- viam/gen/component/button/__init__.py +0 -0
- viam/gen/component/button/v1/__init__.py +0 -0
- viam/gen/component/button/v1/button_grpc.py +38 -0
- viam/gen/component/button/v1/button_pb2.py +28 -0
- viam/gen/component/button/v1/button_pb2.pyi +39 -0
- viam/gen/component/camera/v1/camera_pb2.py +58 -55
- viam/gen/component/camera/v1/camera_pb2.pyi +31 -7
- viam/gen/component/encoder/v1/encoder_pb2.py +35 -32
- viam/gen/component/gantry/v1/gantry_grpc.py +9 -1
- viam/gen/component/gantry/v1/gantry_pb2.py +56 -51
- viam/gen/component/generic/v1/generic_pb2.py +15 -12
- viam/gen/component/gripper/v1/gripper_grpc.py +18 -2
- viam/gen/component/gripper/v1/gripper_pb2.py +48 -37
- viam/gen/component/gripper/v1/gripper_pb2.pyi +43 -1
- viam/gen/component/inputcontroller/v1/input_controller_pb2.py +45 -42
- viam/gen/component/motor/v1/motor_pb2.py +77 -74
- viam/gen/component/movementsensor/v1/movementsensor_pb2.py +69 -66
- viam/gen/component/posetracker/v1/pose_tracker_pb2.py +25 -22
- viam/gen/component/powersensor/v1/powersensor_pb2.py +33 -30
- viam/gen/component/sensor/v1/sensor_pb2.py +17 -14
- viam/gen/component/servo/v1/servo_pb2.py +41 -38
- viam/gen/component/switch/__init__.py +0 -0
- viam/gen/component/switch/v1/__init__.py +0 -0
- viam/gen/component/switch/v1/switch_grpc.py +54 -0
- viam/gen/component/switch/v1/switch_pb2.py +40 -0
- viam/gen/component/switch/v1/switch_pb2.pyi +116 -0
- viam/gen/component/testecho/v1/testecho_pb2.py +29 -26
- viam/gen/module/v1/module_pb2.py +36 -33
- viam/gen/module/v1/module_pb2.pyi +7 -2
- viam/gen/proto/rpc/examples/echo/v1/echo_pb2.py +26 -23
- viam/gen/proto/rpc/examples/echoresource/v1/echoresource_pb2.py +23 -20
- viam/gen/proto/rpc/v1/auth_pb2.py +27 -24
- viam/gen/proto/rpc/webrtc/v1/grpc_pb2.py +35 -32
- viam/gen/proto/rpc/webrtc/v1/signaling_pb2.py +62 -57
- viam/gen/proto/rpc/webrtc/v1/signaling_pb2.pyi +18 -4
- viam/gen/provisioning/v1/provisioning_grpc.py +10 -2
- viam/gen/provisioning/v1/provisioning_pb2.py +38 -31
- viam/gen/provisioning/v1/provisioning_pb2.pyi +20 -2
- viam/gen/robot/v1/robot_grpc.py +61 -29
- viam/gen/robot/v1/robot_pb2.py +186 -155
- viam/gen/robot/v1/robot_pb2.pyi +278 -59
- viam/gen/service/datamanager/v1/data_manager_grpc.py +11 -2
- viam/gen/service/datamanager/v1/data_manager_pb2.py +27 -17
- viam/gen/service/datamanager/v1/data_manager_pb2.pyi +47 -1
- viam/gen/service/discovery/__init__.py +0 -0
- viam/gen/service/discovery/v1/__init__.py +0 -0
- viam/gen/service/discovery/v1/discovery_grpc.py +39 -0
- viam/gen/service/discovery/v1/discovery_pb2.py +29 -0
- viam/gen/service/discovery/v1/discovery_pb2.pyi +51 -0
- viam/gen/service/generic/v1/generic_pb2.py +13 -10
- viam/gen/service/mlmodel/v1/mlmodel_pb2.py +75 -72
- viam/gen/service/motion/v1/motion_pb2.py +118 -85
- viam/gen/service/motion/v1/motion_pb2.pyi +130 -68
- viam/gen/service/navigation/v1/navigation_pb2.py +75 -72
- viam/gen/service/sensors/v1/sensors_pb2.py +59 -56
- viam/gen/service/shell/v1/shell_pb2.py +35 -32
- viam/gen/service/slam/v1/slam_pb2.py +43 -40
- viam/gen/service/slam/v1/slam_pb2.pyi +1 -1
- viam/gen/service/video/__init__.py +0 -0
- viam/gen/service/video/v1/__init__.py +0 -0
- viam/gen/service/video/v1/video_grpc.py +39 -0
- viam/gen/service/video/v1/video_pb2.py +29 -0
- viam/gen/service/video/v1/video_pb2.pyi +72 -0
- viam/gen/service/vision/v1/vision_pb2.py +60 -57
- viam/gen/service/vision/v1/vision_pb2.pyi +28 -3
- viam/gen/service/worldstatestore/__init__.py +0 -0
- viam/gen/service/worldstatestore/v1/__init__.py +0 -0
- viam/gen/service/worldstatestore/v1/world_state_store_grpc.py +55 -0
- viam/gen/service/worldstatestore/v1/world_state_store_pb2.py +39 -0
- viam/gen/service/worldstatestore/v1/world_state_store_pb2.pyi +171 -0
- viam/gen/stream/v1/stream_grpc.py +17 -1
- viam/gen/stream/v1/stream_pb2.py +34 -21
- viam/gen/stream/v1/stream_pb2.pyi +79 -1
- viam/gen/tagger/v1/tagger_pb2.py +9 -8
- viam/logging.py +77 -18
- viam/media/audio.py +28 -0
- viam/media/utils/pil/__init__.py +7 -3
- viam/media/video.py +80 -17
- viam/module/module.py +111 -38
- viam/module/resource_data_consumer.py +41 -0
- viam/module/service.py +9 -1
- viam/module/types.py +2 -4
- viam/proto/app/__init__.py +199 -0
- viam/proto/app/agent/__init__.py +5 -2
- viam/proto/app/billing.py +31 -4
- viam/proto/app/cloudslam/__init__.py +1 -0
- viam/proto/app/data/__init__.py +63 -0
- viam/proto/app/datapipelines/__init__.py +56 -0
- viam/proto/app/dataset/__init__.py +5 -0
- viam/proto/app/datasync/__init__.py +3 -0
- viam/proto/app/end_user.py +1 -0
- viam/proto/app/mlinference/__init__.py +15 -0
- viam/proto/app/mltraining/__init__.py +13 -0
- viam/proto/app/packages/__init__.py +1 -0
- viam/proto/app/robot.py +7 -0
- viam/proto/common/__init__.py +15 -0
- viam/proto/component/arm/__init__.py +7 -0
- viam/proto/component/audioin/__init__.py +16 -0
- viam/proto/component/audioinput/__init__.py +1 -0
- viam/proto/component/audioout/__init__.py +15 -0
- viam/proto/component/base/__init__.py +1 -0
- viam/proto/component/board/__init__.py +1 -0
- viam/proto/component/button/__init__.py +15 -0
- viam/proto/component/camera/__init__.py +1 -0
- viam/proto/component/encoder/__init__.py +1 -0
- viam/proto/component/gantry/__init__.py +1 -0
- viam/proto/component/generic/__init__.py +1 -0
- viam/proto/component/gripper/__init__.py +5 -0
- viam/proto/component/inputcontroller/__init__.py +1 -0
- viam/proto/component/motor/__init__.py +1 -0
- viam/proto/component/movementsensor/__init__.py +1 -0
- viam/proto/component/posetracker/__init__.py +1 -0
- viam/proto/component/powersensor/__init__.py +1 -0
- viam/proto/component/sensor/__init__.py +1 -0
- viam/proto/component/servo/__init__.py +1 -0
- viam/proto/component/switch/__init__.py +26 -0
- viam/proto/component/testecho/__init__.py +1 -0
- viam/proto/module/__init__.py +1 -0
- viam/proto/provisioning/__init__.py +5 -0
- viam/proto/robot/__init__.py +29 -8
- viam/proto/rpc/auth.py +1 -0
- viam/proto/rpc/examples/echo/__init__.py +1 -0
- viam/proto/rpc/examples/echoresource/__init__.py +1 -0
- viam/proto/rpc/webrtc/grpc.py +1 -0
- viam/proto/rpc/webrtc/signaling.py +3 -0
- viam/proto/service/datamanager/__init__.py +9 -1
- viam/proto/service/discovery/__init__.py +15 -0
- viam/proto/service/generic/__init__.py +1 -0
- viam/proto/service/mlmodel/__init__.py +1 -0
- viam/proto/service/motion/__init__.py +3 -0
- viam/proto/service/navigation/__init__.py +1 -0
- viam/proto/service/sensors/__init__.py +1 -0
- viam/proto/service/shell/__init__.py +1 -0
- viam/proto/service/slam/__init__.py +1 -0
- viam/proto/service/video/__init__.py +15 -0
- viam/proto/service/vision/__init__.py +1 -0
- viam/proto/service/worldstatestore/__init__.py +32 -0
- viam/proto/stream/__init__.py +11 -0
- viam/py.typed +0 -0
- viam/resource/base.py +12 -8
- viam/resource/easy_resource.py +24 -13
- viam/resource/manager.py +6 -5
- viam/resource/registry.py +39 -51
- viam/resource/rpc_client_base.py +33 -1
- viam/resource/types.py +13 -14
- viam/robot/client.py +190 -122
- viam/robot/service.py +2 -50
- viam/rpc/dial.py +54 -4
- viam/rpc/libviam_rust_utils.so +0 -0
- viam/rpc/server.py +25 -11
- viam/rpc/types.py +2 -4
- viam/services/discovery/__init__.py +12 -0
- viam/services/discovery/client.py +55 -0
- viam/services/discovery/discovery.py +52 -0
- viam/services/discovery/service.py +43 -0
- viam/services/generic/__init__.py +1 -1
- viam/services/generic/client.py +8 -5
- viam/services/generic/generic.py +2 -2
- viam/services/mlmodel/__init__.py +1 -1
- viam/services/mlmodel/client.py +17 -7
- viam/services/mlmodel/mlmodel.py +23 -12
- viam/services/mlmodel/service.py +5 -2
- viam/services/mlmodel/utils.py +11 -1
- viam/services/motion/__init__.py +2 -2
- viam/services/motion/client.py +32 -32
- viam/services/motion/motion.py +66 -62
- viam/services/navigation/__init__.py +1 -1
- viam/services/navigation/client.py +30 -20
- viam/services/navigation/navigation.py +23 -23
- viam/services/service_base.py +13 -9
- viam/services/service_client_base.py +3 -3
- viam/services/slam/__init__.py +1 -1
- viam/services/slam/client.py +15 -10
- viam/services/slam/slam.py +11 -11
- viam/services/vision/__init__.py +1 -1
- viam/services/vision/client.py +31 -24
- viam/services/vision/service.py +8 -8
- viam/services/vision/vision.py +36 -53
- viam/services/worldstatestore/__init__.py +18 -0
- viam/services/worldstatestore/client.py +94 -0
- viam/services/worldstatestore/service.py +55 -0
- viam/services/worldstatestore/worldstatestore.py +90 -0
- viam/sessions_client.py +115 -46
- viam/streams.py +3 -6
- viam/utils.py +44 -14
- viam/version_metadata.py +4 -0
- {viam_sdk-0.25.2.dist-info → viam_sdk-0.62.0.dist-info}/METADATA +27 -28
- viam_sdk-0.62.0.dist-info/RECORD +514 -0
- {viam_sdk-0.25.2.dist-info → viam_sdk-0.62.0.dist-info}/WHEEL +1 -1
- viam/gen/proto/rpc/examples/fileupload/v1/fileupload_grpc.py +0 -27
- viam/gen/proto/rpc/examples/fileupload/v1/fileupload_pb2.py +0 -18
- viam/gen/proto/rpc/examples/fileupload/v1/fileupload_pb2.pyi +0 -45
- viam/proto/rpc/examples/fileupload/__init__.py +0 -18
- viam/services/sensors/__init__.py +0 -5
- viam/services/sensors/client.py +0 -65
- viam_sdk-0.25.2.dist-info/LICENSE +0 -202
- viam_sdk-0.25.2.dist-info/RECORD +0 -442
- /viam/gen/{proto/rpc/examples/fileupload → app/datapipelines}/__init__.py +0 -0
- /viam/gen/{proto/rpc/examples/fileupload → app/datapipelines}/v1/__init__.py +0 -0
- /LICENSE → /viam_sdk-0.62.0.dist-info/licenses/LICENSE +0 -0
viam/components/gantry/client.py
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
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
|
|
5
|
+
from viam.proto.common import (
|
|
6
|
+
DoCommandRequest,
|
|
7
|
+
DoCommandResponse,
|
|
8
|
+
Geometry,
|
|
9
|
+
GetKinematicsRequest,
|
|
10
|
+
GetKinematicsResponse,
|
|
11
|
+
KinematicsFileFormat,
|
|
12
|
+
)
|
|
6
13
|
from viam.proto.component.gantry import (
|
|
7
14
|
GantryServiceStub,
|
|
8
15
|
GetLengthsRequest,
|
|
@@ -37,12 +44,11 @@ class GantryClient(Gantry, ReconfigurableResourceRPCClientBase):
|
|
|
37
44
|
*,
|
|
38
45
|
extra: Optional[Dict[str, Any]] = None,
|
|
39
46
|
timeout: Optional[float] = None,
|
|
40
|
-
**
|
|
47
|
+
**kwargs,
|
|
41
48
|
) -> List[float]:
|
|
42
|
-
|
|
43
|
-
extra = {}
|
|
49
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
44
50
|
request = GetPositionRequest(name=self.name, extra=dict_to_struct(extra))
|
|
45
|
-
response: GetPositionResponse = await self.client.GetPosition(request, timeout=timeout)
|
|
51
|
+
response: GetPositionResponse = await self.client.GetPosition(request, timeout=timeout, metadata=md)
|
|
46
52
|
return list(response.positions_mm)
|
|
47
53
|
|
|
48
54
|
async def move_to_position(
|
|
@@ -52,24 +58,22 @@ class GantryClient(Gantry, ReconfigurableResourceRPCClientBase):
|
|
|
52
58
|
*,
|
|
53
59
|
extra: Optional[Dict[str, Any]] = None,
|
|
54
60
|
timeout: Optional[float] = None,
|
|
55
|
-
**
|
|
61
|
+
**kwargs,
|
|
56
62
|
):
|
|
57
|
-
|
|
58
|
-
extra = {}
|
|
63
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
59
64
|
request = MoveToPositionRequest(name=self.name, positions_mm=positions, speeds_mm_per_sec=speeds, extra=dict_to_struct(extra))
|
|
60
|
-
await self.client.MoveToPosition(request, timeout=timeout)
|
|
65
|
+
await self.client.MoveToPosition(request, timeout=timeout, metadata=md)
|
|
61
66
|
|
|
62
67
|
async def home(
|
|
63
68
|
self,
|
|
64
69
|
*,
|
|
65
70
|
extra: Optional[Dict[str, Any]] = None,
|
|
66
71
|
timeout: Optional[float] = None,
|
|
67
|
-
**
|
|
72
|
+
**kwargs,
|
|
68
73
|
) -> bool:
|
|
69
|
-
|
|
70
|
-
extra = {}
|
|
74
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
71
75
|
request = HomeRequest(name=self.name, extra=dict_to_struct(extra))
|
|
72
|
-
response: HomeResponse = await self.client.Home(request, timeout=timeout)
|
|
76
|
+
response: HomeResponse = await self.client.Home(request, timeout=timeout, metadata=md)
|
|
73
77
|
return response.homed
|
|
74
78
|
|
|
75
79
|
async def get_lengths(
|
|
@@ -77,12 +81,11 @@ class GantryClient(Gantry, ReconfigurableResourceRPCClientBase):
|
|
|
77
81
|
*,
|
|
78
82
|
extra: Optional[Dict[str, Any]] = None,
|
|
79
83
|
timeout: Optional[float] = None,
|
|
80
|
-
**
|
|
84
|
+
**kwargs,
|
|
81
85
|
) -> List[float]:
|
|
82
|
-
|
|
83
|
-
extra = {}
|
|
86
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
84
87
|
request = GetLengthsRequest(name=self.name, extra=dict_to_struct(extra))
|
|
85
|
-
response: GetLengthsResponse = await self.client.GetLengths(request, timeout=timeout)
|
|
88
|
+
response: GetLengthsResponse = await self.client.GetLengths(request, timeout=timeout, metadata=md)
|
|
86
89
|
return list(response.lengths_mm)
|
|
87
90
|
|
|
88
91
|
async def stop(
|
|
@@ -90,16 +93,16 @@ class GantryClient(Gantry, ReconfigurableResourceRPCClientBase):
|
|
|
90
93
|
*,
|
|
91
94
|
extra: Optional[Dict[str, Any]] = None,
|
|
92
95
|
timeout: Optional[float] = None,
|
|
93
|
-
**
|
|
96
|
+
**kwargs,
|
|
94
97
|
):
|
|
95
|
-
|
|
96
|
-
extra = {}
|
|
98
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
97
99
|
request = StopRequest(name=self.name, extra=dict_to_struct(extra))
|
|
98
|
-
await self.client.Stop(request, timeout=timeout)
|
|
100
|
+
await self.client.Stop(request, timeout=timeout, metadata=md)
|
|
99
101
|
|
|
100
|
-
async def is_moving(self, *, timeout: Optional[float] = None) -> bool:
|
|
102
|
+
async def is_moving(self, *, timeout: Optional[float] = None, **kwargs) -> bool:
|
|
103
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
101
104
|
request = IsMovingRequest(name=self.name)
|
|
102
|
-
response: IsMovingResponse = await self.client.IsMoving(request, timeout=timeout)
|
|
105
|
+
response: IsMovingResponse = await self.client.IsMoving(request, timeout=timeout, metadata=md)
|
|
103
106
|
return response.is_moving
|
|
104
107
|
|
|
105
108
|
async def do_command(
|
|
@@ -107,11 +110,21 @@ class GantryClient(Gantry, ReconfigurableResourceRPCClientBase):
|
|
|
107
110
|
command: Mapping[str, ValueTypes],
|
|
108
111
|
*,
|
|
109
112
|
timeout: Optional[float] = None,
|
|
110
|
-
**
|
|
113
|
+
**kwargs,
|
|
111
114
|
) -> Mapping[str, ValueTypes]:
|
|
115
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
112
116
|
request = DoCommandRequest(name=self.name, command=dict_to_struct(command))
|
|
113
|
-
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout)
|
|
117
|
+
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout, metadata=md)
|
|
114
118
|
return struct_to_dict(response.result)
|
|
115
119
|
|
|
116
|
-
async def
|
|
117
|
-
|
|
120
|
+
async def get_kinematics(
|
|
121
|
+
self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs
|
|
122
|
+
) -> Tuple[KinematicsFileFormat.ValueType, bytes]:
|
|
123
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
124
|
+
request = GetKinematicsRequest(name=self.name, extra=dict_to_struct(extra))
|
|
125
|
+
response: GetKinematicsResponse = await self.client.GetKinematics(request, timeout=timeout, metadata=md)
|
|
126
|
+
return (response.format, response.kinematics_data)
|
|
127
|
+
|
|
128
|
+
async def get_geometries(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> List[Geometry]:
|
|
129
|
+
md = kwargs.get("metadata", self.Metadata())
|
|
130
|
+
return await get_geometries(self.client, self.name, extra, timeout, md)
|
viam/components/gantry/gantry.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import abc
|
|
2
|
-
from typing import Any, Dict, Final, List, Optional
|
|
2
|
+
from typing import Any, Dict, Final, List, Optional, Tuple
|
|
3
3
|
|
|
4
|
-
from viam.
|
|
4
|
+
from viam.components.arm import KinematicsFileFormat
|
|
5
|
+
from viam.resource.types import API, RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT
|
|
5
6
|
|
|
6
7
|
from ..component_base import ComponentBase
|
|
7
8
|
|
|
@@ -18,10 +19,10 @@ class Gantry(ComponentBase):
|
|
|
18
19
|
|
|
19
20
|
from viam.components.gantry import Gantry
|
|
20
21
|
|
|
21
|
-
For more information, see `Gantry component <https://docs.viam.com/components/gantry/>`_.
|
|
22
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/>`_.
|
|
22
23
|
"""
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
API: Final = API( # pyright: ignore [reportIncompatibleVariableOverride]
|
|
25
26
|
RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT, "gantry"
|
|
26
27
|
)
|
|
27
28
|
|
|
@@ -32,7 +33,7 @@ class Gantry(ComponentBase):
|
|
|
32
33
|
|
|
33
34
|
::
|
|
34
35
|
|
|
35
|
-
my_gantry = Gantry.from_robot(robot=
|
|
36
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
36
37
|
|
|
37
38
|
# Get the current positions of the axes of the gantry in millimeters.
|
|
38
39
|
positions = await my_gantry.get_position()
|
|
@@ -40,7 +41,7 @@ class Gantry(ComponentBase):
|
|
|
40
41
|
Returns:
|
|
41
42
|
List[float]: A list of the position of the axes of the gantry in millimeters.
|
|
42
43
|
|
|
43
|
-
For more information, see `Gantry component <https://docs.viam.com/components/gantry
|
|
44
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/#getposition>`_.
|
|
44
45
|
"""
|
|
45
46
|
...
|
|
46
47
|
|
|
@@ -59,7 +60,7 @@ class Gantry(ComponentBase):
|
|
|
59
60
|
|
|
60
61
|
::
|
|
61
62
|
|
|
62
|
-
my_gantry = Gantry.from_robot(robot=
|
|
63
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
63
64
|
|
|
64
65
|
# Create a list of positions for the axes of the gantry to move to. Assume in
|
|
65
66
|
# this example that the gantry is multi-axis, with 3 axes.
|
|
@@ -75,7 +76,7 @@ class Gantry(ComponentBase):
|
|
|
75
76
|
positions (List[float]): A list of positions for the axes of the gantry to move to, in millimeters.
|
|
76
77
|
speeds (List[float]): A list of speeds in millimeters per second for the gantry to move at respective to each axis.
|
|
77
78
|
|
|
78
|
-
For more information, see `Gantry component <https://docs.viam.com/components/gantry
|
|
79
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/#movetoposition>`_.
|
|
79
80
|
"""
|
|
80
81
|
...
|
|
81
82
|
|
|
@@ -86,14 +87,14 @@ class Gantry(ComponentBase):
|
|
|
86
87
|
|
|
87
88
|
::
|
|
88
89
|
|
|
89
|
-
my_gantry = Gantry.from_robot(robot=
|
|
90
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
90
91
|
|
|
91
92
|
await my_gantry.home()
|
|
92
93
|
|
|
93
94
|
Returns:
|
|
94
95
|
bool: Whether the gantry has run the homing sequence successfully.
|
|
95
96
|
|
|
96
|
-
For more information, see `Gantry component <https://docs.viam.com/components/gantry
|
|
97
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/#home>`_.
|
|
97
98
|
"""
|
|
98
99
|
|
|
99
100
|
@abc.abstractmethod
|
|
@@ -103,7 +104,7 @@ class Gantry(ComponentBase):
|
|
|
103
104
|
|
|
104
105
|
::
|
|
105
106
|
|
|
106
|
-
my_gantry = Gantry.from_robot(robot=
|
|
107
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
107
108
|
|
|
108
109
|
# Get the lengths of the axes of the gantry in millimeters.
|
|
109
110
|
lengths_mm = await my_gantry.get_lengths()
|
|
@@ -111,7 +112,7 @@ class Gantry(ComponentBase):
|
|
|
111
112
|
Returns:
|
|
112
113
|
List[float]: A list of the lengths of the axes of the gantry in millimeters.
|
|
113
114
|
|
|
114
|
-
For more information, see `Gantry component <https://docs.viam.com/components/gantry
|
|
115
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/#getlengths>`_.
|
|
115
116
|
"""
|
|
116
117
|
...
|
|
117
118
|
|
|
@@ -122,13 +123,13 @@ class Gantry(ComponentBase):
|
|
|
122
123
|
|
|
123
124
|
::
|
|
124
125
|
|
|
125
|
-
my_gantry = Gantry.from_robot(robot=
|
|
126
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
126
127
|
|
|
127
128
|
# Stop all motion of the gantry. It is assumed that the gantry stops
|
|
128
129
|
# immediately.
|
|
129
130
|
await my_gantry.stop()
|
|
130
131
|
|
|
131
|
-
For more information, see `Gantry component <https://docs.viam.com/components/gantry
|
|
132
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/#stop>`_.
|
|
132
133
|
"""
|
|
133
134
|
...
|
|
134
135
|
|
|
@@ -139,18 +140,48 @@ class Gantry(ComponentBase):
|
|
|
139
140
|
|
|
140
141
|
::
|
|
141
142
|
|
|
142
|
-
my_gantry = Gantry.from_robot(robot=
|
|
143
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
143
144
|
|
|
144
145
|
# Stop all motion of the gantry. It is assumed that the
|
|
145
146
|
# gantry stops immediately.
|
|
146
147
|
await my_gantry.stop()
|
|
147
148
|
|
|
148
149
|
# Print if the gantry is currently moving.
|
|
149
|
-
print(my_gantry.is_moving())
|
|
150
|
+
print(await my_gantry.is_moving())
|
|
150
151
|
|
|
151
152
|
Returns:
|
|
152
153
|
bool: Whether the gantry is moving.
|
|
153
154
|
|
|
154
|
-
For more information, see `Gantry component <https://docs.viam.com/components/gantry
|
|
155
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/#ismoving>`_.
|
|
156
|
+
"""
|
|
157
|
+
...
|
|
158
|
+
|
|
159
|
+
@abc.abstractmethod
|
|
160
|
+
async def get_kinematics(
|
|
161
|
+
self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs
|
|
162
|
+
) -> Tuple[KinematicsFileFormat.ValueType, bytes]:
|
|
163
|
+
"""
|
|
164
|
+
Get the kinematics information associated with the gantry.
|
|
165
|
+
|
|
166
|
+
::
|
|
167
|
+
|
|
168
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
169
|
+
|
|
170
|
+
# Get the kinematics information associated with the gantry.
|
|
171
|
+
kinematics = await my_gantry.get_kinematics()
|
|
172
|
+
|
|
173
|
+
# Get the format of the kinematics file.
|
|
174
|
+
k_file = kinematics[0]
|
|
175
|
+
|
|
176
|
+
# Get the byte contents of the file.
|
|
177
|
+
k_bytes = kinematics[1]
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
Tuple[KinematicsFileFormat.ValueType, bytes]: A tuple containing two values; the first [0] value represents the format of the
|
|
181
|
+
file, either in URDF format (``KinematicsFileFormat.KINEMATICS_FILE_FORMAT_URDF``) or
|
|
182
|
+
Viam's kinematic parameter format (spatial vector algebra) (``KinematicsFileFormat.KINEMATICS_FILE_FORMAT_SVA``),
|
|
183
|
+
and the second [1] value represents the byte contents of the file.
|
|
184
|
+
|
|
185
|
+
For more information, see `Arm component <https://docs.viam.com/dev/reference/apis/components/arm/#getkinematics>`_.
|
|
155
186
|
"""
|
|
156
187
|
...
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
from grpclib.server import Stream
|
|
2
2
|
|
|
3
|
-
from viam.proto.common import
|
|
3
|
+
from viam.proto.common import (
|
|
4
|
+
DoCommandRequest,
|
|
5
|
+
DoCommandResponse,
|
|
6
|
+
GetGeometriesRequest,
|
|
7
|
+
GetGeometriesResponse,
|
|
8
|
+
GetKinematicsRequest,
|
|
9
|
+
GetKinematicsResponse,
|
|
10
|
+
)
|
|
4
11
|
from viam.proto.component.gantry import (
|
|
5
|
-
GantryServiceBase,
|
|
6
12
|
GetLengthsRequest,
|
|
7
13
|
GetLengthsResponse,
|
|
8
14
|
GetPositionRequest,
|
|
@@ -15,6 +21,7 @@ from viam.proto.component.gantry import (
|
|
|
15
21
|
MoveToPositionResponse,
|
|
16
22
|
StopRequest,
|
|
17
23
|
StopResponse,
|
|
24
|
+
UnimplementedGantryServiceBase,
|
|
18
25
|
)
|
|
19
26
|
from viam.resource.rpc_service_base import ResourceRPCServiceBase
|
|
20
27
|
from viam.utils import dict_to_struct, struct_to_dict
|
|
@@ -22,7 +29,7 @@ from viam.utils import dict_to_struct, struct_to_dict
|
|
|
22
29
|
from .gantry import Gantry
|
|
23
30
|
|
|
24
31
|
|
|
25
|
-
class GantryRPCService(
|
|
32
|
+
class GantryRPCService(UnimplementedGantryServiceBase, ResourceRPCServiceBase[Gantry]):
|
|
26
33
|
"""
|
|
27
34
|
gRPC Service for a Gantry
|
|
28
35
|
"""
|
|
@@ -103,11 +110,20 @@ class GantryRPCService(GantryServiceBase, ResourceRPCServiceBase[Gantry]):
|
|
|
103
110
|
response = DoCommandResponse(result=dict_to_struct(result))
|
|
104
111
|
await stream.send_message(response)
|
|
105
112
|
|
|
113
|
+
async def GetKinematics(self, stream: Stream[GetKinematicsRequest, GetKinematicsResponse]) -> None:
|
|
114
|
+
request = await stream.recv_message()
|
|
115
|
+
assert request is not None
|
|
116
|
+
gantry = self.get_resource(request.name)
|
|
117
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
118
|
+
format, data = await gantry.get_kinematics(extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata)
|
|
119
|
+
response = GetKinematicsResponse(format=format, kinematics_data=data)
|
|
120
|
+
await stream.send_message(response)
|
|
121
|
+
|
|
106
122
|
async def GetGeometries(self, stream: Stream[GetGeometriesRequest, GetGeometriesResponse]) -> None:
|
|
107
123
|
request = await stream.recv_message()
|
|
108
124
|
assert request is not None
|
|
109
|
-
|
|
125
|
+
gantry = self.get_resource(request.name)
|
|
110
126
|
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
111
|
-
geometries = await
|
|
127
|
+
geometries = await gantry.get_geometries(extra=struct_to_dict(request.extra), timeout=timeout)
|
|
112
128
|
response = GetGeometriesResponse(geometries=geometries)
|
|
113
129
|
await stream.send_message(response)
|
|
@@ -5,7 +5,7 @@ from grpclib.client import Channel
|
|
|
5
5
|
|
|
6
6
|
from viam.proto.common import DoCommandRequest, DoCommandResponse, Geometry
|
|
7
7
|
from viam.proto.component.generic import GenericServiceStub
|
|
8
|
-
from viam.resource.rpc_client_base import ReconfigurableResourceRPCClientBase
|
|
8
|
+
from viam.resource.rpc_client_base import ReconfigurableResourceRPCClientBase, ResourceRPCClientBase
|
|
9
9
|
from viam.utils import ValueTypes, dict_to_struct, get_geometries, struct_to_dict
|
|
10
10
|
|
|
11
11
|
from .generic import Generic
|
|
@@ -17,6 +17,7 @@ class GenericClient(Generic, ReconfigurableResourceRPCClientBase):
|
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
def __init__(self, name: str, channel: Channel):
|
|
20
|
+
self.channel = channel
|
|
20
21
|
self.client = GenericServiceStub(channel)
|
|
21
22
|
super().__init__(name)
|
|
22
23
|
|
|
@@ -25,11 +26,12 @@ class GenericClient(Generic, ReconfigurableResourceRPCClientBase):
|
|
|
25
26
|
command: Mapping[str, Any],
|
|
26
27
|
*,
|
|
27
28
|
timeout: Optional[float] = None,
|
|
28
|
-
**
|
|
29
|
+
**kwargs,
|
|
29
30
|
) -> Mapping[str, Any]:
|
|
31
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
30
32
|
request = DoCommandRequest(name=self.name, command=dict_to_struct(command))
|
|
31
33
|
try:
|
|
32
|
-
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout)
|
|
34
|
+
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout, metadata=md)
|
|
33
35
|
except GRPCError as e:
|
|
34
36
|
if e.status == Status.UNIMPLEMENTED:
|
|
35
37
|
raise NotImplementedError()
|
|
@@ -37,12 +39,13 @@ class GenericClient(Generic, ReconfigurableResourceRPCClientBase):
|
|
|
37
39
|
|
|
38
40
|
return struct_to_dict(response.result)
|
|
39
41
|
|
|
40
|
-
async def get_geometries(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None) -> List[Geometry]:
|
|
41
|
-
|
|
42
|
+
async def get_geometries(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> List[Geometry]:
|
|
43
|
+
md = kwargs.get("metadata", self.Metadata())
|
|
44
|
+
return await get_geometries(self.client, self.name, extra, timeout, md)
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
async def do_command(
|
|
45
|
-
channel: Channel, name: str, command: Mapping[str, ValueTypes], *, timeout: Optional[float] = None
|
|
48
|
+
channel: Channel, name: str, command: Mapping[str, ValueTypes], *, timeout: Optional[float] = None, **kwargs
|
|
46
49
|
) -> Mapping[str, ValueTypes]:
|
|
47
50
|
"""Convenience method to allow component clients to execute ``do_command`` functions
|
|
48
51
|
|
|
@@ -54,5 +57,6 @@ async def do_command(
|
|
|
54
57
|
Returns:
|
|
55
58
|
Dict[str, Any]: The result of the executed command
|
|
56
59
|
"""
|
|
60
|
+
md = kwargs.get("metadata", ResourceRPCClientBase.Metadata()).proto
|
|
57
61
|
client = GenericClient(name, channel)
|
|
58
|
-
return await client.do_command(command, timeout=timeout)
|
|
62
|
+
return await client.do_command(command, timeout=timeout, metadata=md)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Final
|
|
2
2
|
|
|
3
|
-
from viam.resource.types import RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT
|
|
3
|
+
from viam.resource.types import API, RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT
|
|
4
4
|
|
|
5
5
|
from ..component_base import ComponentBase
|
|
6
6
|
|
|
@@ -68,9 +68,9 @@ class Generic(ComponentBase):
|
|
|
68
68
|
await asyncio.sleep(10)
|
|
69
69
|
component.power # 0
|
|
70
70
|
|
|
71
|
-
For more information, see `Gantry component <https://docs.viam.com/components/generic/>`_.
|
|
71
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/generic/>`_.
|
|
72
72
|
"""
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
API: Final = API( # pyright: ignore [reportIncompatibleVariableOverride]
|
|
75
75
|
RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT, "generic"
|
|
76
76
|
)
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
from viam.proto.common import
|
|
2
|
-
from viam.proto.robot import Status
|
|
1
|
+
from viam.proto.common import KinematicsFileFormat
|
|
3
2
|
from viam.resource.registry import Registry, ResourceRegistration
|
|
4
|
-
from viam.utils import message_to_struct
|
|
5
3
|
|
|
6
4
|
from .client import GripperClient
|
|
7
5
|
from .gripper import Gripper
|
|
@@ -9,14 +7,7 @@ from .service import GripperRPCService
|
|
|
9
7
|
|
|
10
8
|
__all__ = [
|
|
11
9
|
"Gripper",
|
|
10
|
+
"KinematicsFileFormat",
|
|
12
11
|
]
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
async def create_status(component: Gripper) -> Status:
|
|
16
|
-
s = ActuatorStatus(is_moving=await component.is_moving())
|
|
17
|
-
return Status(name=Gripper.get_resource_name(component.name), status=message_to_struct(s))
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Registry.register_subtype(
|
|
21
|
-
ResourceRegistration(Gripper, GripperRPCService, lambda name, channel: GripperClient(name, channel), create_status)
|
|
22
|
-
)
|
|
13
|
+
Registry.register_api(ResourceRegistration(Gripper, GripperRPCService, lambda name, channel: GripperClient(name, channel)))
|
|
@@ -1,12 +1,14 @@
|
|
|
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,
|
|
9
9
|
GripperServiceStub,
|
|
10
|
+
IsHoldingSomethingRequest,
|
|
11
|
+
IsHoldingSomethingResponse,
|
|
10
12
|
IsMovingRequest,
|
|
11
13
|
IsMovingResponse,
|
|
12
14
|
OpenRequest,
|
|
@@ -15,6 +17,7 @@ from viam.proto.component.gripper import (
|
|
|
15
17
|
from viam.resource.rpc_client_base import ReconfigurableResourceRPCClientBase
|
|
16
18
|
from viam.utils import ValueTypes, dict_to_struct, get_geometries, struct_to_dict
|
|
17
19
|
|
|
20
|
+
from . import KinematicsFileFormat
|
|
18
21
|
from .gripper import Gripper
|
|
19
22
|
|
|
20
23
|
|
|
@@ -33,24 +36,22 @@ class GripperClient(Gripper, ReconfigurableResourceRPCClientBase):
|
|
|
33
36
|
*,
|
|
34
37
|
extra: Optional[Dict[str, Any]] = None,
|
|
35
38
|
timeout: Optional[float] = None,
|
|
36
|
-
**
|
|
39
|
+
**kwargs,
|
|
37
40
|
):
|
|
38
|
-
|
|
39
|
-
extra = {}
|
|
41
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
40
42
|
request = OpenRequest(name=self.name, extra=dict_to_struct(extra))
|
|
41
|
-
await self.client.Open(request, timeout=timeout)
|
|
43
|
+
await self.client.Open(request, timeout=timeout, metadata=md)
|
|
42
44
|
|
|
43
45
|
async def grab(
|
|
44
46
|
self,
|
|
45
47
|
*,
|
|
46
48
|
extra: Optional[Dict[str, Any]] = None,
|
|
47
49
|
timeout: Optional[float] = None,
|
|
48
|
-
**
|
|
50
|
+
**kwargs,
|
|
49
51
|
) -> bool:
|
|
50
|
-
|
|
51
|
-
extra = {}
|
|
52
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
52
53
|
request = GrabRequest(name=self.name, extra=dict_to_struct(extra))
|
|
53
|
-
response: GrabResponse = await self.client.Grab(request, timeout=timeout)
|
|
54
|
+
response: GrabResponse = await self.client.Grab(request, timeout=timeout, metadata=md)
|
|
54
55
|
return response.success
|
|
55
56
|
|
|
56
57
|
async def stop(
|
|
@@ -58,16 +59,24 @@ class GripperClient(Gripper, ReconfigurableResourceRPCClientBase):
|
|
|
58
59
|
*,
|
|
59
60
|
extra: Optional[Dict[str, Any]] = None,
|
|
60
61
|
timeout: Optional[float] = None,
|
|
61
|
-
**
|
|
62
|
+
**kwargs,
|
|
62
63
|
):
|
|
63
|
-
|
|
64
|
-
extra = {}
|
|
64
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
65
65
|
request = StopRequest(name=self.name, extra=dict_to_struct(extra))
|
|
66
|
-
await self.client.Stop(request, timeout=timeout)
|
|
66
|
+
await self.client.Stop(request, timeout=timeout, metadata=md)
|
|
67
67
|
|
|
68
|
-
async def
|
|
68
|
+
async def is_holding_something(
|
|
69
|
+
self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs
|
|
70
|
+
) -> Gripper.HoldingStatus:
|
|
71
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
72
|
+
request = IsHoldingSomethingRequest(name=self.name, extra=dict_to_struct(extra))
|
|
73
|
+
response: IsHoldingSomethingResponse = await self.client.IsHoldingSomething(request, timeout=timeout, metadata=md)
|
|
74
|
+
return Gripper.HoldingStatus(response.is_holding_something, meta=struct_to_dict(response.meta))
|
|
75
|
+
|
|
76
|
+
async def is_moving(self, *, timeout: Optional[float] = None, **kwargs) -> bool:
|
|
77
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
69
78
|
request = IsMovingRequest(name=self.name)
|
|
70
|
-
response: IsMovingResponse = await self.client.IsMoving(request, timeout=timeout)
|
|
79
|
+
response: IsMovingResponse = await self.client.IsMoving(request, timeout=timeout, metadata=md)
|
|
71
80
|
return response.is_moving
|
|
72
81
|
|
|
73
82
|
async def do_command(
|
|
@@ -75,11 +84,25 @@ class GripperClient(Gripper, ReconfigurableResourceRPCClientBase):
|
|
|
75
84
|
command: Mapping[str, ValueTypes],
|
|
76
85
|
*,
|
|
77
86
|
timeout: Optional[float] = None,
|
|
78
|
-
**
|
|
87
|
+
**kwargs,
|
|
79
88
|
) -> Mapping[str, ValueTypes]:
|
|
89
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
80
90
|
request = DoCommandRequest(name=self.name, command=dict_to_struct(command))
|
|
81
|
-
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout)
|
|
91
|
+
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout, metadata=md)
|
|
82
92
|
return struct_to_dict(response.result)
|
|
83
93
|
|
|
84
|
-
async def get_geometries(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None) -> List[Geometry]:
|
|
85
|
-
|
|
94
|
+
async def get_geometries(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> List[Geometry]:
|
|
95
|
+
md = kwargs.get("metadata", self.Metadata())
|
|
96
|
+
return await get_geometries(self.client, self.name, extra, timeout, md)
|
|
97
|
+
|
|
98
|
+
async def get_kinematics(
|
|
99
|
+
self,
|
|
100
|
+
*,
|
|
101
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
102
|
+
timeout: Optional[float] = None,
|
|
103
|
+
**kwargs,
|
|
104
|
+
) -> Tuple[KinematicsFileFormat.ValueType, bytes]:
|
|
105
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
106
|
+
request = GetKinematicsRequest(name=self.name, extra=dict_to_struct(extra))
|
|
107
|
+
response: GetKinematicsResponse = await self.client.GetKinematics(request, timeout=timeout, metadata=md)
|
|
108
|
+
return (response.format, response.kinematics_data)
|