viam-sdk 0.3.0__py3-none-linux_armv6l.whl → 0.66.0__py3-none-linux_armv6l.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.
Potentially problematic release.
This version of viam-sdk might be problematic. Click here for more details.
- viam/__init__.py +29 -2
- viam/app/_logs.py +34 -0
- viam/app/app_client.py +2696 -0
- viam/app/billing_client.py +185 -0
- viam/app/data_client.py +2231 -0
- viam/app/ml_training_client.py +249 -0
- viam/app/provisioning_client.py +93 -0
- viam/app/viam_client.py +275 -0
- viam/components/arm/__init__.py +3 -26
- viam/components/arm/arm.py +123 -8
- viam/components/arm/client.py +37 -24
- viam/components/arm/service.py +35 -32
- 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_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 +6 -11
- viam/components/base/base.py +134 -8
- viam/components/base/client.py +51 -23
- viam/components/base/service.py +33 -30
- viam/components/board/__init__.py +3 -12
- viam/components/board/board.py +247 -91
- viam/components/board/client.py +149 -83
- viam/components/board/service.py +63 -33
- 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 +3 -3
- viam/components/camera/camera.py +62 -27
- viam/components/camera/client.py +59 -27
- viam/components/camera/service.py +42 -65
- viam/components/component_base.py +28 -5
- viam/components/encoder/__init__.py +1 -1
- viam/components/encoder/client.py +25 -14
- viam/components/encoder/encoder.py +48 -10
- viam/components/encoder/service.py +14 -18
- viam/components/gantry/__init__.py +1 -13
- viam/components/gantry/client.py +80 -25
- viam/components/gantry/gantry.py +123 -9
- viam/components/gantry/service.py +51 -29
- viam/components/generic/__init__.py +1 -1
- viam/components/generic/client.py +21 -8
- viam/components/generic/generic.py +10 -2
- viam/components/generic/service.py +12 -7
- viam/components/gripper/__init__.py +3 -13
- viam/components/gripper/client.py +69 -21
- viam/components/gripper/gripper.py +123 -3
- viam/components/gripper/service.py +44 -22
- viam/components/input/__init__.py +1 -14
- viam/components/input/client.py +55 -23
- viam/components/input/input.py +106 -3
- viam/components/input/service.py +16 -21
- viam/components/motor/__init__.py +1 -21
- viam/components/motor/client.py +56 -33
- viam/components/motor/motor.py +127 -4
- viam/components/motor/service.py +33 -44
- viam/components/movement_sensor/__init__.py +1 -1
- viam/components/movement_sensor/client.py +102 -45
- viam/components/movement_sensor/movement_sensor.py +130 -61
- viam/components/movement_sensor/service.py +38 -41
- viam/components/pose_tracker/__init__.py +1 -1
- viam/components/pose_tracker/client.py +18 -7
- viam/components/pose_tracker/pose_tracker.py +4 -2
- viam/components/pose_tracker/service.py +12 -10
- viam/components/power_sensor/__init__.py +17 -0
- viam/components/power_sensor/client.py +86 -0
- viam/components/power_sensor/power_sensor.py +104 -0
- viam/components/power_sensor/service.py +72 -0
- viam/components/sensor/__init__.py +2 -1
- viam/components/sensor/client.py +26 -10
- viam/components/sensor/sensor.py +22 -4
- viam/components/sensor/service.py +20 -11
- viam/components/servo/__init__.py +1 -13
- viam/components/servo/client.py +47 -21
- viam/components/servo/service.py +15 -22
- viam/components/servo/servo.py +61 -2
- 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 +98 -0
- viam/errors.py +10 -0
- viam/gen/app/agent/v1/agent_grpc.py +29 -0
- viam/gen/app/agent/v1/agent_pb2.py +47 -0
- viam/gen/app/agent/v1/agent_pb2.pyi +280 -0
- viam/gen/app/cloudslam/v1/__init__.py +0 -0
- viam/gen/app/cloudslam/v1/cloud_slam_grpc.py +70 -0
- viam/gen/app/cloudslam/v1/cloud_slam_pb2.py +54 -0
- viam/gen/app/cloudslam/v1/cloud_slam_pb2.pyi +384 -0
- viam/gen/app/data/v1/data_grpc.py +197 -8
- viam/gen/app/data/v1/data_pb2.py +238 -99
- viam/gen/app/data/v1/data_pb2.pyi +1222 -259
- viam/gen/app/datapipelines/__init__.py +0 -0
- viam/gen/app/datapipelines/v1/__init__.py +0 -0
- 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/__init__.py +0 -0
- viam/gen/app/dataset/v1/__init__.py +0 -0
- viam/gen/app/dataset/v1/dataset_grpc.py +68 -0
- viam/gen/app/dataset/v1/dataset_pb2.py +44 -0
- viam/gen/app/dataset/v1/dataset_pb2.pyi +214 -0
- viam/gen/app/datasync/v1/data_sync_grpc.py +21 -4
- viam/gen/app/datasync/v1/data_sync_pb2.py +62 -128
- viam/gen/app/datasync/v1/data_sync_pb2.pyi +156 -199
- 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 +51 -3
- viam/gen/app/mltraining/v1/ml_training_pb2.py +135 -58
- viam/gen/app/mltraining/v1/ml_training_pb2.pyi +328 -39
- viam/gen/app/packages/v1/packages_grpc.py +15 -1
- viam/gen/app/packages/v1/packages_pb2.py +44 -64
- viam/gen/app/packages/v1/packages_pb2.pyi +75 -85
- viam/gen/app/v1/app_grpc.py +644 -3
- viam/gen/app/v1/app_pb2.py +695 -295
- viam/gen/app/v1/app_pb2.pyi +4488 -635
- viam/gen/app/v1/billing_grpc.py +53 -11
- viam/gen/app/v1/billing_pb2.py +94 -39
- viam/gen/app/v1/billing_pb2.pyi +391 -191
- viam/gen/app/v1/end_user_grpc.py +59 -0
- viam/gen/app/v1/end_user_pb2.py +55 -0
- viam/gen/app/v1/end_user_pb2.pyi +181 -0
- viam/gen/app/v1/robot_grpc.py +16 -1
- viam/gen/app/v1/robot_pb2.py +122 -94
- viam/gen/app/v1/robot_pb2.pyi +463 -123
- viam/gen/common/v1/common_pb2.py +87 -58
- viam/gen/common/v1/common_pb2.pyi +456 -149
- viam/gen/component/arm/v1/arm_grpc.py +58 -2
- viam/gen/component/arm/v1/arm_pb2.py +68 -51
- viam/gen/component/arm/v1/arm_pb2.pyi +108 -42
- 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_grpc.py +25 -2
- viam/gen/component/audioinput/v1/audioinput_pb2.py +36 -31
- viam/gen/component/audioinput/v1/audioinput_pb2.pyi +22 -22
- 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_grpc.py +42 -2
- viam/gen/component/base/v1/base_pb2.py +58 -47
- viam/gen/component/base/v1/base_pb2.pyi +65 -30
- viam/gen/component/board/v1/board_grpc.py +59 -7
- viam/gen/component/board/v1/board_pb2.py +94 -73
- viam/gen/component/board/v1/board_pb2.pyi +165 -68
- 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_grpc.py +38 -2
- viam/gen/component/camera/v1/camera_pb2.py +60 -43
- viam/gen/component/camera/v1/camera_pb2.pyi +191 -37
- viam/gen/component/encoder/v1/encoder_grpc.py +25 -2
- viam/gen/component/encoder/v1/encoder_pb2.py +36 -31
- viam/gen/component/encoder/v1/encoder_pb2.pyi +15 -15
- viam/gen/component/gantry/v1/gantry_grpc.py +47 -2
- viam/gen/component/gantry/v1/gantry_pb2.py +56 -43
- viam/gen/component/gantry/v1/gantry_pb2.pyi +67 -31
- viam/gen/component/generic/v1/generic_grpc.py +16 -2
- viam/gen/component/generic/v1/generic_pb2.py +16 -11
- viam/gen/component/gripper/v1/gripper_grpc.py +44 -2
- viam/gen/component/gripper/v1/gripper_pb2.py +48 -35
- viam/gen/component/gripper/v1/gripper_pb2.pyi +62 -24
- viam/gen/component/inputcontroller/v1/input_controller_grpc.py +28 -2
- viam/gen/component/inputcontroller/v1/input_controller_pb2.py +46 -41
- viam/gen/component/inputcontroller/v1/input_controller_pb2.pyi +32 -36
- viam/gen/component/motor/v1/motor_grpc.py +51 -2
- viam/gen/component/motor/v1/motor_pb2.py +78 -67
- viam/gen/component/motor/v1/motor_pb2.pyi +75 -46
- viam/gen/component/movementsensor/v1/movementsensor_grpc.py +48 -2
- viam/gen/component/movementsensor/v1/movementsensor_pb2.py +70 -63
- viam/gen/component/movementsensor/v1/movementsensor_pb2.pyi +84 -57
- viam/gen/component/posetracker/v1/pose_tracker_grpc.py +19 -2
- viam/gen/component/posetracker/v1/pose_tracker_pb2.py +26 -21
- viam/gen/component/posetracker/v1/pose_tracker_pb2.pyi +9 -13
- viam/gen/component/powersensor/__init__.py +0 -0
- viam/gen/component/powersensor/v1/__init__.py +0 -0
- viam/gen/component/powersensor/v1/powersensor_grpc.py +62 -0
- viam/gen/component/powersensor/v1/powersensor_pb2.py +42 -0
- viam/gen/component/powersensor/v1/powersensor_pb2.pyi +124 -0
- viam/gen/component/sensor/v1/sensor_grpc.py +21 -5
- viam/gen/component/sensor/v1/sensor_pb2.py +18 -22
- viam/gen/component/sensor/v1/sensor_pb2.pyi +1 -69
- viam/gen/component/servo/v1/servo_grpc.py +28 -2
- viam/gen/component/servo/v1/servo_pb2.py +42 -37
- viam/gen/component/servo/v1/servo_pb2.pyi +22 -26
- 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_grpc.py +15 -0
- viam/gen/component/testecho/v1/testecho_pb2.py +29 -26
- viam/gen/component/testecho/v1/testecho_pb2.pyi +16 -20
- viam/gen/module/v1/module_grpc.py +18 -0
- viam/gen/module/v1/module_pb2.py +36 -33
- viam/gen/module/v1/module_pb2.pyi +39 -34
- viam/gen/opentelemetry/__init__.py +0 -0
- viam/gen/opentelemetry/proto/__init__.py +0 -0
- viam/gen/opentelemetry/proto/common/__init__.py +0 -0
- viam/gen/opentelemetry/proto/common/v1/__init__.py +0 -0
- viam/gen/opentelemetry/proto/common/v1/common_grpc.py +0 -0
- viam/gen/opentelemetry/proto/common/v1/common_pb2.py +27 -0
- viam/gen/opentelemetry/proto/common/v1/common_pb2.pyi +208 -0
- viam/gen/opentelemetry/proto/resource/__init__.py +0 -0
- viam/gen/opentelemetry/proto/resource/v1/__init__.py +0 -0
- viam/gen/opentelemetry/proto/resource/v1/resource_grpc.py +0 -0
- viam/gen/opentelemetry/proto/resource/v1/resource_pb2.py +18 -0
- viam/gen/opentelemetry/proto/resource/v1/resource_pb2.pyi +59 -0
- viam/gen/opentelemetry/proto/trace/__init__.py +0 -0
- viam/gen/opentelemetry/proto/trace/v1/__init__.py +0 -0
- viam/gen/opentelemetry/proto/trace/v1/trace_grpc.py +0 -0
- viam/gen/opentelemetry/proto/trace/v1/trace_pb2.py +37 -0
- viam/gen/opentelemetry/proto/trace/v1/trace_pb2.pyi +402 -0
- viam/gen/proto/rpc/examples/echo/v1/echo_grpc.py +12 -0
- viam/gen/proto/rpc/examples/echo/v1/echo_pb2.py +25 -22
- viam/gen/proto/rpc/examples/echo/v1/echo_pb2.pyi +13 -17
- viam/gen/proto/rpc/examples/echoresource/v1/echoresource_grpc.py +12 -0
- viam/gen/proto/rpc/examples/echoresource/v1/echoresource_pb2.py +23 -20
- viam/gen/proto/rpc/examples/echoresource/v1/echoresource_pb2.pyi +13 -17
- viam/gen/proto/rpc/v1/auth_grpc.py +11 -0
- viam/gen/proto/rpc/v1/auth_pb2.py +27 -24
- viam/gen/proto/rpc/v1/auth_pb2.pyi +12 -16
- viam/gen/proto/rpc/webrtc/v1/grpc_pb2.py +35 -32
- viam/gen/proto/rpc/webrtc/v1/grpc_pb2.pyi +37 -41
- viam/gen/proto/rpc/webrtc/v1/signaling_grpc.py +15 -0
- viam/gen/proto/rpc/webrtc/v1/signaling_pb2.py +62 -57
- viam/gen/proto/rpc/webrtc/v1/signaling_pb2.pyi +78 -69
- viam/gen/provisioning/__init__.py +0 -0
- viam/gen/provisioning/v1/__init__.py +0 -0
- viam/gen/provisioning/v1/provisioning_grpc.py +59 -0
- viam/gen/provisioning/v1/provisioning_pb2.py +45 -0
- viam/gen/provisioning/v1/provisioning_pb2.pyi +229 -0
- viam/gen/robot/v1/robot_grpc.py +144 -15
- viam/gen/robot/v1/robot_pb2.py +193 -119
- viam/gen/robot/v1/robot_pb2.pyi +565 -137
- viam/gen/service/datamanager/v1/data_manager_grpc.py +20 -2
- viam/gen/service/datamanager/v1/data_manager_pb2.py +27 -17
- viam/gen/service/datamanager/v1/data_manager_pb2.pyi +52 -10
- 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/__init__.py +0 -0
- viam/gen/service/generic/v1/__init__.py +0 -0
- viam/gen/service/generic/v1/generic_grpc.py +29 -0
- viam/gen/service/generic/v1/generic_pb2.py +21 -0
- viam/gen/service/generic/v1/generic_pb2.pyi +6 -0
- viam/gen/service/mlmodel/v1/mlmodel_grpc.py +9 -0
- viam/gen/service/mlmodel/v1/mlmodel_pb2.py +76 -29
- viam/gen/service/mlmodel/v1/mlmodel_pb2.pyi +307 -28
- viam/gen/service/motion/v1/motion_grpc.py +42 -4
- viam/gen/service/motion/v1/motion_pb2.py +119 -51
- viam/gen/service/motion/v1/motion_pb2.pyi +595 -120
- viam/gen/service/navigation/v1/navigation_grpc.py +49 -1
- viam/gen/service/navigation/v1/navigation_pb2.py +76 -51
- viam/gen/service/navigation/v1/navigation_pb2.pyi +188 -33
- viam/gen/service/sensors/v1/sensors_grpc.py +12 -0
- viam/gen/service/sensors/v1/sensors_pb2.py +60 -29
- viam/gen/service/sensors/v1/sensors_pb2.pyi +18 -21
- viam/gen/service/shell/v1/shell_grpc.py +27 -1
- viam/gen/service/shell/v1/shell_pb2.py +37 -15
- viam/gen/service/shell/v1/shell_pb2.pyi +260 -7
- viam/gen/service/slam/v1/slam_grpc.py +24 -2
- viam/gen/service/slam/v1/slam_pb2.py +44 -30
- viam/gen/service/slam/v1/slam_pb2.pyi +128 -27
- 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_grpc.py +39 -1
- viam/gen/service/vision/v1/vision_pb2.py +61 -45
- viam/gen/service/vision/v1/vision_pb2.pyi +180 -41
- 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/__init__.py +0 -0
- viam/gen/stream/v1/__init__.py +0 -0
- viam/gen/stream/v1/stream_grpc.py +59 -0
- viam/gen/stream/v1/stream_pb2.py +39 -0
- viam/gen/stream/v1/stream_pb2.pyi +161 -0
- viam/gen/tagger/v1/tagger_pb2.py +9 -8
- viam/logging.py +160 -17
- viam/media/__init__.py +0 -9
- viam/media/audio.py +22 -10
- viam/media/utils/__init__.py +0 -0
- viam/media/utils/pil/__init__.py +55 -0
- viam/media/{viam_rgba_plugin.py → utils/pil/viam_rgba_plugin.py} +10 -16
- viam/media/viam_rgba.py +10 -0
- viam/media/video.py +197 -73
- viam/module/module.py +191 -44
- viam/module/resource_data_consumer.py +41 -0
- viam/module/service.py +9 -1
- viam/module/types.py +4 -5
- viam/operations.py +4 -3
- viam/proto/app/__init__.py +361 -5
- viam/proto/app/agent/__init__.py +28 -0
- viam/proto/app/billing.py +51 -27
- viam/proto/app/cloudslam/__init__.py +48 -0
- viam/proto/app/data/__init__.py +103 -17
- viam/proto/app/datapipelines/__init__.py +56 -0
- viam/proto/app/dataset/__init__.py +40 -0
- viam/proto/app/datasync/__init__.py +11 -5
- viam/proto/app/end_user.py +34 -0
- viam/proto/app/mlinference/__init__.py +15 -0
- viam/proto/app/mltraining/__init__.py +25 -1
- viam/proto/app/packages/__init__.py +3 -3
- viam/proto/app/robot.py +19 -1
- viam/proto/common/__init__.py +35 -8
- viam/proto/component/arm/__init__.py +9 -1
- viam/proto/component/audioin/__init__.py +16 -0
- viam/proto/component/audioinput/__init__.py +3 -1
- viam/proto/component/audioout/__init__.py +15 -0
- viam/proto/component/base/__init__.py +7 -1
- viam/proto/component/board/__init__.py +13 -5
- viam/proto/component/button/__init__.py +15 -0
- viam/proto/component/camera/__init__.py +9 -1
- viam/proto/component/encoder/__init__.py +3 -1
- viam/proto/component/gantry/__init__.py +7 -1
- viam/proto/component/generic/__init__.py +3 -1
- viam/proto/component/gripper/__init__.py +7 -1
- viam/proto/component/inputcontroller/__init__.py +7 -1
- viam/proto/component/motor/__init__.py +7 -1
- viam/proto/component/movementsensor/__init__.py +7 -1
- viam/proto/component/posetracker/__init__.py +7 -1
- viam/proto/component/powersensor/__init__.py +30 -0
- viam/proto/component/sensor/__init__.py +3 -4
- viam/proto/component/servo/__init__.py +3 -1
- viam/proto/component/switch/__init__.py +26 -0
- viam/proto/component/testecho/__init__.py +3 -1
- viam/proto/module/__init__.py +3 -1
- viam/proto/opentelemetry/__init__.py +0 -0
- viam/proto/opentelemetry/proto/__init__.py +0 -0
- viam/proto/opentelemetry/proto/common/__init__.py +15 -0
- viam/proto/opentelemetry/proto/resource/__init__.py +10 -0
- viam/proto/opentelemetry/proto/trace/__init__.py +15 -0
- viam/proto/provisioning/__init__.py +42 -0
- viam/proto/robot/__init__.py +57 -9
- viam/proto/rpc/auth.py +11 -1
- viam/proto/rpc/examples/echo/__init__.py +3 -1
- viam/proto/rpc/examples/echoresource/__init__.py +7 -1
- viam/proto/rpc/webrtc/grpc.py +3 -1
- viam/proto/rpc/webrtc/signaling.py +5 -1
- viam/proto/service/datamanager/__init__.py +15 -2
- viam/proto/service/discovery/__init__.py +15 -0
- viam/proto/service/generic/__init__.py +12 -0
- viam/proto/service/mlmodel/__init__.py +27 -1
- viam/proto/service/motion/__init__.py +35 -5
- viam/proto/service/navigation/__init__.py +19 -1
- viam/proto/service/sensors/__init__.py +3 -1
- viam/proto/service/shell/__init__.py +25 -2
- viam/proto/service/slam/__init__.py +13 -1
- viam/proto/service/video/__init__.py +15 -0
- viam/proto/service/vision/__init__.py +11 -1
- viam/proto/service/worldstatestore/__init__.py +32 -0
- viam/proto/stream/__init__.py +36 -0
- viam/py.typed +0 -0
- viam/resource/base.py +45 -8
- viam/resource/easy_resource.py +149 -0
- viam/resource/manager.py +35 -14
- viam/resource/registry.py +40 -52
- viam/resource/rpc_client_base.py +33 -1
- viam/resource/rpc_service_base.py +15 -8
- viam/resource/types.py +39 -26
- viam/robot/client.py +458 -91
- viam/robot/service.py +13 -107
- viam/rpc/dial.py +133 -15
- viam/rpc/libviam_rust_utils.so +0 -0
- viam/rpc/server.py +59 -15
- 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 +18 -0
- viam/services/generic/client.py +58 -0
- viam/services/generic/generic.py +58 -0
- viam/services/generic/service.py +29 -0
- viam/services/mlmodel/__init__.py +15 -1
- viam/services/mlmodel/client.py +20 -15
- viam/services/mlmodel/mlmodel.py +44 -7
- viam/services/mlmodel/service.py +9 -13
- viam/services/mlmodel/utils.py +101 -0
- viam/services/motion/__init__.py +15 -3
- viam/services/motion/client.py +109 -150
- viam/services/motion/motion.py +380 -0
- viam/services/motion/service.py +132 -0
- viam/services/navigation/__init__.py +11 -0
- viam/services/navigation/client.py +99 -0
- viam/services/navigation/navigation.py +250 -0
- viam/services/navigation/service.py +137 -0
- viam/services/service_base.py +43 -4
- viam/services/service_client_base.py +4 -4
- viam/services/slam/__init__.py +4 -1
- viam/services/slam/client.py +21 -11
- viam/services/slam/service.py +16 -19
- viam/services/slam/slam.py +66 -5
- viam/services/vision/__init__.py +8 -0
- viam/services/vision/client.py +115 -111
- viam/services/vision/service.py +143 -0
- viam/services/vision/vision.py +317 -0
- 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 +254 -0
- viam/streams.py +44 -0
- viam/utils.py +143 -15
- viam/version_metadata.py +4 -0
- viam_sdk-0.66.0.dist-info/METADATA +157 -0
- viam_sdk-0.66.0.dist-info/RECORD +531 -0
- {viam_sdk-0.3.0.dist-info → viam_sdk-0.66.0.dist-info}/WHEEL +1 -1
- viam/components/audio_input/__init__.py +0 -18
- viam/components/audio_input/audio_input.py +0 -79
- viam/components/audio_input/client.py +0 -60
- viam/components/audio_input/service.py +0 -118
- viam/components/types.py +0 -5
- viam/gen/app/model/v1/model_grpc.py +0 -39
- viam/gen/app/model/v1/model_pb2.py +0 -71
- viam/gen/app/model/v1/model_pb2.pyi +0 -285
- viam/gen/proto/rpc/examples/fileupload/v1/fileupload_grpc.py +0 -21
- viam/gen/proto/rpc/examples/fileupload/v1/fileupload_pb2.py +0 -18
- viam/gen/proto/rpc/examples/fileupload/v1/fileupload_pb2.pyi +0 -49
- viam/media/media.py +0 -53
- viam/proto/app/model/__init__.py +0 -40
- viam/proto/rpc/examples/fileupload/__init__.py +0 -13
- viam/services/sensors/__init__.py +0 -5
- viam/services/sensors/client.py +0 -63
- viam_sdk-0.3.0.dist-info/LICENSE +0 -202
- viam_sdk-0.3.0.dist-info/METADATA +0 -122
- viam_sdk-0.3.0.dist-info/RECORD +0 -372
- /viam/{gen/app/model → app}/__init__.py +0 -0
- /viam/gen/app/{model/v1 → agent}/__init__.py +0 -0
- /viam/gen/{proto/rpc/examples/fileupload → app/agent/v1}/__init__.py +0 -0
- /viam/gen/{proto/rpc/examples/fileupload/v1 → app/cloudslam}/__init__.py +0 -0
- /LICENSE → /viam_sdk-0.66.0.dist-info/licenses/LICENSE +0 -0
|
@@ -3,7 +3,7 @@ from dataclasses import dataclass
|
|
|
3
3
|
from typing import Any, Dict, Final, Optional, Tuple
|
|
4
4
|
|
|
5
5
|
from viam.proto.component.encoder import PositionType
|
|
6
|
-
from viam.resource.types import RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT
|
|
6
|
+
from viam.resource.types import API, RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT
|
|
7
7
|
|
|
8
8
|
from ..component_base import ComponentBase
|
|
9
9
|
|
|
@@ -20,9 +20,17 @@ class Encoder(ComponentBase):
|
|
|
20
20
|
This acts as an abstract base class for any drivers representing specific
|
|
21
21
|
encoder implementations. This cannot be used on its own. If the ``__init__()`` function is
|
|
22
22
|
overridden, it must call the ``super().__init__()`` function.
|
|
23
|
+
|
|
24
|
+
::
|
|
25
|
+
|
|
26
|
+
from viam.components.encoder import Encoder
|
|
27
|
+
|
|
28
|
+
For more information, see `Encoder component <https://docs.viam.com/dev/reference/apis/components/encoder/>`_.
|
|
23
29
|
"""
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
API: Final = API( # pyright: ignore [reportIncompatibleVariableOverride]
|
|
32
|
+
RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT, "encoder"
|
|
33
|
+
)
|
|
26
34
|
|
|
27
35
|
@abc.abstractmethod
|
|
28
36
|
async def reset_position(
|
|
@@ -34,6 +42,16 @@ class Encoder(ComponentBase):
|
|
|
34
42
|
):
|
|
35
43
|
"""
|
|
36
44
|
Set the current position to be the new zero (home) position.
|
|
45
|
+
|
|
46
|
+
::
|
|
47
|
+
|
|
48
|
+
my_encoder = Encoder.from_robot(robot=machine, name='my_encoder')
|
|
49
|
+
|
|
50
|
+
# Reset the zero position of the encoder.
|
|
51
|
+
await my_encoder.reset_position()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
For more information, see `Encoder component <https://docs.viam.com/dev/reference/apis/components/encoder/#resetposition>`_.
|
|
37
55
|
"""
|
|
38
56
|
...
|
|
39
57
|
|
|
@@ -50,15 +68,27 @@ class Encoder(ComponentBase):
|
|
|
50
68
|
Report the position of the encoder.
|
|
51
69
|
The value returned is the current position in terms of it's ``position_type``.
|
|
52
70
|
The position will be either in relative units (ticks away from a zero position) for
|
|
53
|
-
``PositionType.
|
|
71
|
+
``PositionType.POSITION_TYPE_TICKS_COUNT`` or absolute units (degrees along a circle)
|
|
72
|
+
for ``PositionType.POSITION_TYPE_ANGLE_DEGREES``.
|
|
73
|
+
|
|
74
|
+
::
|
|
75
|
+
|
|
76
|
+
my_encoder = Encoder.from_robot(robot=machine, name='my_encoder')
|
|
77
|
+
|
|
78
|
+
# Get the position of the encoder in ticks
|
|
79
|
+
position = await my_encoder.get_position(PositionType.POSITION_TYPE_TICKS_COUNT)
|
|
80
|
+
print("The encoder position is currently ", position[0], position[1])
|
|
54
81
|
|
|
55
82
|
Args:
|
|
56
|
-
position_type (PositionType
|
|
83
|
+
position_type (PositionType): The desired output type of the position.
|
|
57
84
|
|
|
58
85
|
Returns:
|
|
59
|
-
float:
|
|
60
|
-
|
|
61
|
-
|
|
86
|
+
Tuple[float, PositionType]:
|
|
87
|
+
A tuple containing two values; the first [0] the position of the encoder which can either be
|
|
88
|
+
ticks since last zeroing for a relative encoder or degrees for an absolute encoder, and the second [1] the type of
|
|
89
|
+
position the encoder returns (ticks or degrees).
|
|
90
|
+
|
|
91
|
+
For more information, see `Encoder component <https://docs.viam.com/dev/reference/apis/components/encoder/#getposition>`_.
|
|
62
92
|
"""
|
|
63
93
|
...
|
|
64
94
|
|
|
@@ -71,10 +101,18 @@ class Encoder(ComponentBase):
|
|
|
71
101
|
**kwargs,
|
|
72
102
|
) -> Properties:
|
|
73
103
|
"""
|
|
74
|
-
|
|
75
|
-
|
|
104
|
+
Return a dictionary of the types of position reporting this encoder supports.
|
|
105
|
+
|
|
106
|
+
::
|
|
107
|
+
|
|
108
|
+
my_encoder = Encoder.from_robot(robot=machine, name='my_encoder')
|
|
109
|
+
|
|
110
|
+
# Get whether the encoder returns position in ticks or degrees.
|
|
111
|
+
properties = await my_encoder.get_properties()
|
|
76
112
|
|
|
77
113
|
Returns:
|
|
78
|
-
Properties: Map of position types to supported status.
|
|
114
|
+
Encoder.Properties: Map of position types to supported status.
|
|
115
|
+
|
|
116
|
+
For more information, see `Encoder component <https://docs.viam.com/dev/reference/apis/components/encoder/#getproperties>`_.
|
|
79
117
|
"""
|
|
80
118
|
...
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from grpclib.server import Stream
|
|
2
2
|
|
|
3
|
-
from viam.
|
|
4
|
-
from viam.proto.common import DoCommandRequest, DoCommandResponse
|
|
3
|
+
from viam.proto.common import DoCommandRequest, DoCommandResponse, GetGeometriesRequest, GetGeometriesResponse
|
|
5
4
|
from viam.proto.component.encoder import (
|
|
6
5
|
EncoderServiceBase,
|
|
7
6
|
GetPositionRequest,
|
|
@@ -28,10 +27,7 @@ class EncoderRPCService(EncoderServiceBase, ResourceRPCServiceBase[Encoder]):
|
|
|
28
27
|
request = await stream.recv_message()
|
|
29
28
|
assert request is not None
|
|
30
29
|
name = request.name
|
|
31
|
-
|
|
32
|
-
encoder = self.get_resource(name)
|
|
33
|
-
except ResourceNotFoundError as e:
|
|
34
|
-
raise e.grpc_error
|
|
30
|
+
encoder = self.get_resource(name)
|
|
35
31
|
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
36
32
|
await encoder.reset_position(extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata)
|
|
37
33
|
await stream.send_message(ResetPositionResponse())
|
|
@@ -40,10 +36,7 @@ class EncoderRPCService(EncoderServiceBase, ResourceRPCServiceBase[Encoder]):
|
|
|
40
36
|
request = await stream.recv_message()
|
|
41
37
|
assert request is not None
|
|
42
38
|
name = request.name
|
|
43
|
-
|
|
44
|
-
encoder = self.get_resource(name)
|
|
45
|
-
except ResourceNotFoundError as e:
|
|
46
|
-
raise e.grpc_error
|
|
39
|
+
encoder = self.get_resource(name)
|
|
47
40
|
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
48
41
|
position, pos_type = await encoder.get_position(
|
|
49
42
|
position_type=request.position_type, extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata
|
|
@@ -54,10 +47,7 @@ class EncoderRPCService(EncoderServiceBase, ResourceRPCServiceBase[Encoder]):
|
|
|
54
47
|
request = await stream.recv_message()
|
|
55
48
|
assert request is not None
|
|
56
49
|
name = request.name
|
|
57
|
-
|
|
58
|
-
encoder = self.get_resource(name)
|
|
59
|
-
except ResourceNotFoundError as e:
|
|
60
|
-
raise e.grpc_error
|
|
50
|
+
encoder = self.get_resource(name)
|
|
61
51
|
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
62
52
|
properties = await encoder.get_properties(extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata)
|
|
63
53
|
response = GetPropertiesResponse(**properties.__dict__)
|
|
@@ -66,11 +56,17 @@ class EncoderRPCService(EncoderServiceBase, ResourceRPCServiceBase[Encoder]):
|
|
|
66
56
|
async def DoCommand(self, stream: Stream[DoCommandRequest, DoCommandResponse]) -> None:
|
|
67
57
|
request = await stream.recv_message()
|
|
68
58
|
assert request is not None
|
|
69
|
-
|
|
70
|
-
encoder = self.get_resource(request.name)
|
|
71
|
-
except ResourceNotFoundError as e:
|
|
72
|
-
raise e.grpc_error
|
|
59
|
+
encoder = self.get_resource(request.name)
|
|
73
60
|
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
74
61
|
result = await encoder.do_command(command=struct_to_dict(request.command), timeout=timeout, metadata=stream.metadata)
|
|
75
62
|
response = DoCommandResponse(result=dict_to_struct(result))
|
|
76
63
|
await stream.send_message(response)
|
|
64
|
+
|
|
65
|
+
async def GetGeometries(self, stream: Stream[GetGeometriesRequest, GetGeometriesResponse]) -> None:
|
|
66
|
+
request = await stream.recv_message()
|
|
67
|
+
assert request is not None
|
|
68
|
+
arm = self.get_resource(request.name)
|
|
69
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
70
|
+
geometries = await arm.get_geometries(extra=struct_to_dict(request.extra), timeout=timeout)
|
|
71
|
+
response = GetGeometriesResponse(geometries=geometries)
|
|
72
|
+
await stream.send_message(response)
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
|
|
3
|
-
from viam.proto.component.gantry import Status as GantryStatus
|
|
4
|
-
from viam.proto.robot import Status
|
|
5
1
|
from viam.resource.registry import Registry, ResourceRegistration
|
|
6
|
-
from viam.utils import message_to_struct
|
|
7
2
|
|
|
8
3
|
from .client import GantryClient
|
|
9
4
|
from .gantry import Gantry
|
|
@@ -13,11 +8,4 @@ __all__ = [
|
|
|
13
8
|
"Gantry",
|
|
14
9
|
]
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
async def create_status(component: Gantry) -> Status:
|
|
18
|
-
(positions_mm, lengths_mm, is_moving) = await asyncio.gather(component.get_position(), component.get_lengths(), component.is_moving())
|
|
19
|
-
s = GantryStatus(positions_mm=positions_mm, lengths_mm=lengths_mm, is_moving=is_moving)
|
|
20
|
-
return Status(name=Gantry.get_resource_name(component.name), status=message_to_struct(s))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Registry.register_subtype(ResourceRegistration(Gantry, GantryRPCService, lambda name, channel: GantryClient(name, channel), create_status))
|
|
11
|
+
Registry.register_api(ResourceRegistration(Gantry, GantryRPCService, lambda name, channel: GantryClient(name, channel)))
|
viam/components/gantry/client.py
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
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,
|
|
9
16
|
GetLengthsResponse,
|
|
10
17
|
GetPositionRequest,
|
|
11
18
|
GetPositionResponse,
|
|
19
|
+
HomeRequest,
|
|
20
|
+
HomeResponse,
|
|
12
21
|
IsMovingRequest,
|
|
13
22
|
IsMovingResponse,
|
|
14
23
|
MoveToPositionRequest,
|
|
15
24
|
StopRequest,
|
|
16
25
|
)
|
|
17
26
|
from viam.resource.rpc_client_base import ReconfigurableResourceRPCClientBase
|
|
18
|
-
from viam.utils import ValueTypes, dict_to_struct, struct_to_dict
|
|
27
|
+
from viam.utils import ValueTypes, dict_to_struct, get_geometries, struct_to_dict
|
|
19
28
|
|
|
20
29
|
from .gantry import Gantry
|
|
21
30
|
|
|
@@ -30,46 +39,92 @@ class GantryClient(Gantry, ReconfigurableResourceRPCClientBase):
|
|
|
30
39
|
self.client = GantryServiceStub(channel)
|
|
31
40
|
super().__init__(name)
|
|
32
41
|
|
|
33
|
-
async def get_position(
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
async def get_position(
|
|
43
|
+
self,
|
|
44
|
+
*,
|
|
45
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
46
|
+
timeout: Optional[float] = None,
|
|
47
|
+
**kwargs,
|
|
48
|
+
) -> List[float]:
|
|
49
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
36
50
|
request = GetPositionRequest(name=self.name, extra=dict_to_struct(extra))
|
|
37
|
-
response: GetPositionResponse = await self.client.GetPosition(request, timeout=timeout)
|
|
51
|
+
response: GetPositionResponse = await self.client.GetPosition(request, timeout=timeout, metadata=md)
|
|
38
52
|
return list(response.positions_mm)
|
|
39
53
|
|
|
40
54
|
async def move_to_position(
|
|
41
55
|
self,
|
|
42
56
|
positions: List[float],
|
|
57
|
+
speeds: List[float],
|
|
43
58
|
*,
|
|
44
59
|
extra: Optional[Dict[str, Any]] = None,
|
|
45
60
|
timeout: Optional[float] = None,
|
|
61
|
+
**kwargs,
|
|
46
62
|
):
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
63
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
64
|
+
request = MoveToPositionRequest(name=self.name, positions_mm=positions, speeds_mm_per_sec=speeds, extra=dict_to_struct(extra))
|
|
65
|
+
await self.client.MoveToPosition(request, timeout=timeout, metadata=md)
|
|
66
|
+
|
|
67
|
+
async def home(
|
|
68
|
+
self,
|
|
69
|
+
*,
|
|
70
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
71
|
+
timeout: Optional[float] = None,
|
|
72
|
+
**kwargs,
|
|
73
|
+
) -> bool:
|
|
74
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
75
|
+
request = HomeRequest(name=self.name, extra=dict_to_struct(extra))
|
|
76
|
+
response: HomeResponse = await self.client.Home(request, timeout=timeout, metadata=md)
|
|
77
|
+
return response.homed
|
|
51
78
|
|
|
52
|
-
async def get_lengths(
|
|
53
|
-
|
|
54
|
-
|
|
79
|
+
async def get_lengths(
|
|
80
|
+
self,
|
|
81
|
+
*,
|
|
82
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
83
|
+
timeout: Optional[float] = None,
|
|
84
|
+
**kwargs,
|
|
85
|
+
) -> List[float]:
|
|
86
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
55
87
|
request = GetLengthsRequest(name=self.name, extra=dict_to_struct(extra))
|
|
56
|
-
response: GetLengthsResponse = await self.client.GetLengths(request, timeout=timeout)
|
|
88
|
+
response: GetLengthsResponse = await self.client.GetLengths(request, timeout=timeout, metadata=md)
|
|
57
89
|
return list(response.lengths_mm)
|
|
58
90
|
|
|
59
|
-
async def stop(
|
|
60
|
-
|
|
61
|
-
|
|
91
|
+
async def stop(
|
|
92
|
+
self,
|
|
93
|
+
*,
|
|
94
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
95
|
+
timeout: Optional[float] = None,
|
|
96
|
+
**kwargs,
|
|
97
|
+
):
|
|
98
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
62
99
|
request = StopRequest(name=self.name, extra=dict_to_struct(extra))
|
|
63
|
-
await self.client.Stop(request, timeout=timeout)
|
|
100
|
+
await self.client.Stop(request, timeout=timeout, metadata=md)
|
|
64
101
|
|
|
65
|
-
async def is_moving(self, *,
|
|
66
|
-
|
|
67
|
-
extra = {}
|
|
102
|
+
async def is_moving(self, *, timeout: Optional[float] = None, **kwargs) -> bool:
|
|
103
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
68
104
|
request = IsMovingRequest(name=self.name)
|
|
69
|
-
response: IsMovingResponse = await self.client.IsMoving(request, timeout=timeout)
|
|
105
|
+
response: IsMovingResponse = await self.client.IsMoving(request, timeout=timeout, metadata=md)
|
|
70
106
|
return response.is_moving
|
|
71
107
|
|
|
72
|
-
async def do_command(
|
|
108
|
+
async def do_command(
|
|
109
|
+
self,
|
|
110
|
+
command: Mapping[str, ValueTypes],
|
|
111
|
+
*,
|
|
112
|
+
timeout: Optional[float] = None,
|
|
113
|
+
**kwargs,
|
|
114
|
+
) -> Mapping[str, ValueTypes]:
|
|
115
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
73
116
|
request = DoCommandRequest(name=self.name, command=dict_to_struct(command))
|
|
74
|
-
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout)
|
|
117
|
+
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout, metadata=md)
|
|
75
118
|
return struct_to_dict(response.result)
|
|
119
|
+
|
|
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
|
|
|
@@ -13,17 +14,34 @@ class Gantry(ComponentBase):
|
|
|
13
14
|
This acts as an abstract base class for any drivers representing specific
|
|
14
15
|
gantry implementations. This cannot be used on its own. If the ``__init__()`` function is
|
|
15
16
|
overridden, it must call the ``super().__init__()`` function.
|
|
17
|
+
|
|
18
|
+
::
|
|
19
|
+
|
|
20
|
+
from viam.components.gantry import Gantry
|
|
21
|
+
|
|
22
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/>`_.
|
|
16
23
|
"""
|
|
17
24
|
|
|
18
|
-
|
|
25
|
+
API: Final = API( # pyright: ignore [reportIncompatibleVariableOverride]
|
|
26
|
+
RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT, "gantry"
|
|
27
|
+
)
|
|
19
28
|
|
|
20
29
|
@abc.abstractmethod
|
|
21
30
|
async def get_position(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> List[float]:
|
|
22
31
|
"""
|
|
23
|
-
Get the
|
|
32
|
+
Get the positions of the axes of the gantry in millimeters.
|
|
33
|
+
|
|
34
|
+
::
|
|
35
|
+
|
|
36
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
37
|
+
|
|
38
|
+
# Get the current positions of the axes of the gantry in millimeters.
|
|
39
|
+
positions = await my_gantry.get_position()
|
|
24
40
|
|
|
25
41
|
Returns:
|
|
26
|
-
List[float]:
|
|
42
|
+
List[float]: A list of the position of the axes of the gantry in millimeters.
|
|
43
|
+
|
|
44
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/#getposition>`_.
|
|
27
45
|
"""
|
|
28
46
|
...
|
|
29
47
|
|
|
@@ -31,27 +49,70 @@ class Gantry(ComponentBase):
|
|
|
31
49
|
async def move_to_position(
|
|
32
50
|
self,
|
|
33
51
|
positions: List[float],
|
|
52
|
+
speeds: List[float],
|
|
34
53
|
*,
|
|
35
54
|
extra: Optional[Dict[str, Any]] = None,
|
|
36
55
|
timeout: Optional[float] = None,
|
|
37
56
|
**kwargs,
|
|
38
57
|
):
|
|
39
58
|
"""
|
|
40
|
-
Move the gantry to
|
|
59
|
+
Move the axes of the gantry to the desired positions (mm) at the requested speeds (mm/sec).
|
|
60
|
+
|
|
61
|
+
::
|
|
62
|
+
|
|
63
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
64
|
+
|
|
65
|
+
# Create a list of positions for the axes of the gantry to move to. Assume in
|
|
66
|
+
# this example that the gantry is multi-axis, with 3 axes.
|
|
67
|
+
examplePositions = [1, 2, 3]
|
|
68
|
+
|
|
69
|
+
exampleSpeeds = [3, 9, 12]
|
|
70
|
+
|
|
71
|
+
# Move the axes of the gantry to the positions specified.
|
|
72
|
+
await my_gantry.move_to_position(
|
|
73
|
+
positions=examplePositions, speeds=exampleSpeeds)
|
|
41
74
|
|
|
42
75
|
Args:
|
|
43
|
-
positions (List[float]):
|
|
44
|
-
|
|
76
|
+
positions (List[float]): A list of positions for the axes of the gantry to move to, in millimeters.
|
|
77
|
+
speeds (List[float]): A list of speeds in millimeters per second for the gantry to move at respective to each axis.
|
|
78
|
+
|
|
79
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/#movetoposition>`_.
|
|
45
80
|
"""
|
|
46
81
|
...
|
|
47
82
|
|
|
83
|
+
@abc.abstractmethod
|
|
84
|
+
async def home(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> bool:
|
|
85
|
+
"""
|
|
86
|
+
Run the homing sequence of the gantry to re-calibrate the axes with respect to the limit switches.
|
|
87
|
+
|
|
88
|
+
::
|
|
89
|
+
|
|
90
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
91
|
+
|
|
92
|
+
await my_gantry.home()
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
bool: Whether the gantry has run the homing sequence successfully.
|
|
96
|
+
|
|
97
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/#home>`_.
|
|
98
|
+
"""
|
|
99
|
+
|
|
48
100
|
@abc.abstractmethod
|
|
49
101
|
async def get_lengths(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> List[float]:
|
|
50
102
|
"""
|
|
51
103
|
Get the lengths of the axes of the gantry in millimeters.
|
|
52
104
|
|
|
105
|
+
::
|
|
106
|
+
|
|
107
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
108
|
+
|
|
109
|
+
# Get the lengths of the axes of the gantry in millimeters.
|
|
110
|
+
lengths_mm = await my_gantry.get_lengths()
|
|
111
|
+
|
|
53
112
|
Returns:
|
|
54
|
-
List[float]:
|
|
113
|
+
List[float]: A list of the lengths of the axes of the gantry in millimeters.
|
|
114
|
+
|
|
115
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/#getlengths>`_.
|
|
55
116
|
"""
|
|
56
117
|
...
|
|
57
118
|
|
|
@@ -59,6 +120,16 @@ class Gantry(ComponentBase):
|
|
|
59
120
|
async def stop(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs):
|
|
60
121
|
"""
|
|
61
122
|
Stop all motion of the gantry. It is assumed that the gantry stops immediately.
|
|
123
|
+
|
|
124
|
+
::
|
|
125
|
+
|
|
126
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
127
|
+
|
|
128
|
+
# Stop all motion of the gantry. It is assumed that the gantry stops
|
|
129
|
+
# immediately.
|
|
130
|
+
await my_gantry.stop()
|
|
131
|
+
|
|
132
|
+
For more information, see `Gantry component <https://docs.viam.com/dev/reference/apis/components/gantry/#stop>`_.
|
|
62
133
|
"""
|
|
63
134
|
...
|
|
64
135
|
|
|
@@ -67,7 +138,50 @@ class Gantry(ComponentBase):
|
|
|
67
138
|
"""
|
|
68
139
|
Get if the gantry is currently moving.
|
|
69
140
|
|
|
141
|
+
::
|
|
142
|
+
|
|
143
|
+
my_gantry = Gantry.from_robot(robot=machine, name="my_gantry")
|
|
144
|
+
|
|
145
|
+
# Stop all motion of the gantry. It is assumed that the
|
|
146
|
+
# gantry stops immediately.
|
|
147
|
+
await my_gantry.stop()
|
|
148
|
+
|
|
149
|
+
# Print if the gantry is currently moving.
|
|
150
|
+
print(await my_gantry.is_moving())
|
|
151
|
+
|
|
70
152
|
Returns:
|
|
71
153
|
bool: Whether the gantry is moving.
|
|
154
|
+
|
|
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>`_.
|
|
72
186
|
"""
|
|
73
187
|
...
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
from grpclib.server import Stream
|
|
2
2
|
|
|
3
|
-
from viam.
|
|
4
|
-
|
|
3
|
+
from viam.proto.common import (
|
|
4
|
+
DoCommandRequest,
|
|
5
|
+
DoCommandResponse,
|
|
6
|
+
GetGeometriesRequest,
|
|
7
|
+
GetGeometriesResponse,
|
|
8
|
+
GetKinematicsRequest,
|
|
9
|
+
GetKinematicsResponse,
|
|
10
|
+
)
|
|
5
11
|
from viam.proto.component.gantry import (
|
|
6
|
-
GantryServiceBase,
|
|
7
12
|
GetLengthsRequest,
|
|
8
13
|
GetLengthsResponse,
|
|
9
14
|
GetPositionRequest,
|
|
10
15
|
GetPositionResponse,
|
|
16
|
+
HomeRequest,
|
|
17
|
+
HomeResponse,
|
|
11
18
|
IsMovingRequest,
|
|
12
19
|
IsMovingResponse,
|
|
13
20
|
MoveToPositionRequest,
|
|
14
21
|
MoveToPositionResponse,
|
|
15
22
|
StopRequest,
|
|
16
23
|
StopResponse,
|
|
24
|
+
UnimplementedGantryServiceBase,
|
|
17
25
|
)
|
|
18
26
|
from viam.resource.rpc_service_base import ResourceRPCServiceBase
|
|
19
27
|
from viam.utils import dict_to_struct, struct_to_dict
|
|
@@ -21,7 +29,7 @@ from viam.utils import dict_to_struct, struct_to_dict
|
|
|
21
29
|
from .gantry import Gantry
|
|
22
30
|
|
|
23
31
|
|
|
24
|
-
class GantryRPCService(
|
|
32
|
+
class GantryRPCService(UnimplementedGantryServiceBase, ResourceRPCServiceBase[Gantry]):
|
|
25
33
|
"""
|
|
26
34
|
gRPC Service for a Gantry
|
|
27
35
|
"""
|
|
@@ -32,10 +40,7 @@ class GantryRPCService(GantryServiceBase, ResourceRPCServiceBase[Gantry]):
|
|
|
32
40
|
request = await stream.recv_message()
|
|
33
41
|
assert request is not None
|
|
34
42
|
name = request.name
|
|
35
|
-
|
|
36
|
-
gantry = self.get_resource(name)
|
|
37
|
-
except ResourceNotFoundError as e:
|
|
38
|
-
raise e.grpc_error
|
|
43
|
+
gantry = self.get_resource(name)
|
|
39
44
|
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
40
45
|
position = await gantry.get_position(extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata)
|
|
41
46
|
response = GetPositionResponse(positions_mm=position)
|
|
@@ -45,25 +50,33 @@ class GantryRPCService(GantryServiceBase, ResourceRPCServiceBase[Gantry]):
|
|
|
45
50
|
request = await stream.recv_message()
|
|
46
51
|
assert request is not None
|
|
47
52
|
name = request.name
|
|
48
|
-
|
|
49
|
-
gantry = self.get_resource(name)
|
|
50
|
-
except ResourceNotFoundError as e:
|
|
51
|
-
raise e.grpc_error
|
|
53
|
+
gantry = self.get_resource(name)
|
|
52
54
|
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
53
55
|
await gantry.move_to_position(
|
|
54
|
-
list(request.positions_mm),
|
|
56
|
+
list(request.positions_mm),
|
|
57
|
+
list(request.speeds_mm_per_sec),
|
|
58
|
+
extra=struct_to_dict(request.extra),
|
|
59
|
+
timeout=timeout,
|
|
60
|
+
metadata=stream.metadata,
|
|
55
61
|
)
|
|
56
62
|
response = MoveToPositionResponse()
|
|
57
63
|
await stream.send_message(response)
|
|
58
64
|
|
|
65
|
+
async def Home(self, stream: Stream[HomeRequest, HomeResponse]) -> None:
|
|
66
|
+
request = await stream.recv_message()
|
|
67
|
+
assert request is not None
|
|
68
|
+
name = request.name
|
|
69
|
+
gantry = self.get_resource(name)
|
|
70
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
71
|
+
homed = await gantry.home(extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata)
|
|
72
|
+
response = HomeResponse(homed=homed)
|
|
73
|
+
await stream.send_message(response)
|
|
74
|
+
|
|
59
75
|
async def GetLengths(self, stream: Stream[GetLengthsRequest, GetLengthsResponse]) -> None:
|
|
60
76
|
request = await stream.recv_message()
|
|
61
77
|
assert request is not None
|
|
62
78
|
name = request.name
|
|
63
|
-
|
|
64
|
-
gantry = self.get_resource(name)
|
|
65
|
-
except ResourceNotFoundError as e:
|
|
66
|
-
raise e.grpc_error
|
|
79
|
+
gantry = self.get_resource(name)
|
|
67
80
|
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
68
81
|
lengths = await gantry.get_lengths(extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata)
|
|
69
82
|
response = GetLengthsResponse(lengths_mm=lengths)
|
|
@@ -73,10 +86,7 @@ class GantryRPCService(GantryServiceBase, ResourceRPCServiceBase[Gantry]):
|
|
|
73
86
|
request = await stream.recv_message()
|
|
74
87
|
assert request is not None
|
|
75
88
|
name = request.name
|
|
76
|
-
|
|
77
|
-
gantry = self.get_resource(name)
|
|
78
|
-
except ResourceNotFoundError as e:
|
|
79
|
-
raise e.grpc_error
|
|
89
|
+
gantry = self.get_resource(name)
|
|
80
90
|
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
81
91
|
await gantry.stop(extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata)
|
|
82
92
|
response = StopResponse()
|
|
@@ -86,10 +96,7 @@ class GantryRPCService(GantryServiceBase, ResourceRPCServiceBase[Gantry]):
|
|
|
86
96
|
request = await stream.recv_message()
|
|
87
97
|
assert request is not None
|
|
88
98
|
name = request.name
|
|
89
|
-
|
|
90
|
-
gantry = self.get_resource(name)
|
|
91
|
-
except ResourceNotFoundError as e:
|
|
92
|
-
raise e.grpc_error
|
|
99
|
+
gantry = self.get_resource(name)
|
|
93
100
|
is_moving = await gantry.is_moving()
|
|
94
101
|
response = IsMovingResponse(is_moving=is_moving)
|
|
95
102
|
await stream.send_message(response)
|
|
@@ -97,11 +104,26 @@ class GantryRPCService(GantryServiceBase, ResourceRPCServiceBase[Gantry]):
|
|
|
97
104
|
async def DoCommand(self, stream: Stream[DoCommandRequest, DoCommandResponse]) -> None:
|
|
98
105
|
request = await stream.recv_message()
|
|
99
106
|
assert request is not None
|
|
100
|
-
|
|
101
|
-
gantry = self.get_resource(request.name)
|
|
102
|
-
except ResourceNotFoundError as e:
|
|
103
|
-
raise e.grpc_error
|
|
107
|
+
gantry = self.get_resource(request.name)
|
|
104
108
|
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
105
109
|
result = await gantry.do_command(command=struct_to_dict(request.command), timeout=timeout, metadata=stream.metadata)
|
|
106
110
|
response = DoCommandResponse(result=dict_to_struct(result))
|
|
107
111
|
await stream.send_message(response)
|
|
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
|
+
|
|
122
|
+
async def GetGeometries(self, stream: Stream[GetGeometriesRequest, GetGeometriesResponse]) -> None:
|
|
123
|
+
request = await stream.recv_message()
|
|
124
|
+
assert request is not None
|
|
125
|
+
gantry = self.get_resource(request.name)
|
|
126
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
127
|
+
geometries = await gantry.get_geometries(extra=struct_to_dict(request.extra), timeout=timeout)
|
|
128
|
+
response = GetGeometriesResponse(geometries=geometries)
|
|
129
|
+
await stream.send_message(response)
|