viam-sdk 0.45.2__py3-none-win_amd64.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 +71 -0
- viam/app/__init__.py +0 -0
- viam/app/_logs.py +34 -0
- viam/app/app_client.py +2525 -0
- viam/app/billing_client.py +143 -0
- viam/app/data_client.py +1715 -0
- viam/app/ml_training_client.py +251 -0
- viam/app/provisioning_client.py +95 -0
- viam/app/viam_client.py +260 -0
- viam/components/__init__.py +0 -0
- viam/components/arm/__init__.py +16 -0
- viam/components/arm/arm.py +223 -0
- viam/components/arm/client.py +124 -0
- viam/components/arm/service.py +123 -0
- viam/components/audio_input/__init__.py +18 -0
- viam/components/audio_input/audio_input.py +81 -0
- viam/components/audio_input/client.py +70 -0
- viam/components/audio_input/service.py +114 -0
- viam/components/base/__init__.py +13 -0
- viam/components/base/base.py +260 -0
- viam/components/base/client.py +153 -0
- viam/components/base/service.py +138 -0
- viam/components/board/__init__.py +9 -0
- viam/components/board/board.py +414 -0
- viam/components/board/client.py +241 -0
- viam/components/board/service.py +223 -0
- 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 +22 -0
- viam/components/camera/camera.py +138 -0
- viam/components/camera/client.py +98 -0
- viam/components/camera/service.py +105 -0
- viam/components/component_base.py +65 -0
- viam/components/encoder/__init__.py +18 -0
- viam/components/encoder/client.py +83 -0
- viam/components/encoder/encoder.py +118 -0
- viam/components/encoder/service.py +72 -0
- viam/components/gantry/__init__.py +11 -0
- viam/components/gantry/client.py +115 -0
- viam/components/gantry/gantry.py +156 -0
- viam/components/gantry/service.py +113 -0
- viam/components/generic/__init__.py +18 -0
- viam/components/generic/client.py +62 -0
- viam/components/generic/generic.py +76 -0
- viam/components/generic/service.py +40 -0
- viam/components/gripper/__init__.py +11 -0
- viam/components/gripper/client.py +85 -0
- viam/components/gripper/gripper.py +114 -0
- viam/components/gripper/service.py +81 -0
- viam/components/input/__init__.py +15 -0
- viam/components/input/client.py +194 -0
- viam/components/input/input.py +297 -0
- viam/components/input/service.py +175 -0
- viam/components/motor/__init__.py +11 -0
- viam/components/motor/client.py +168 -0
- viam/components/motor/motor.py +301 -0
- viam/components/motor/service.py +150 -0
- viam/components/movement_sensor/__init__.py +21 -0
- viam/components/movement_sensor/client.py +161 -0
- viam/components/movement_sensor/movement_sensor.py +253 -0
- viam/components/movement_sensor/service.py +146 -0
- viam/components/pose_tracker/__init__.py +17 -0
- viam/components/pose_tracker/client.py +50 -0
- viam/components/pose_tracker/pose_tracker.py +40 -0
- viam/components/pose_tracker/service.py +45 -0
- 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 +18 -0
- viam/components/sensor/client.py +49 -0
- viam/components/sensor/sensor.py +48 -0
- viam/components/sensor/service.py +51 -0
- viam/components/servo/__init__.py +11 -0
- viam/components/servo/client.py +86 -0
- viam/components/servo/service.py +80 -0
- viam/components/servo/servo.py +114 -0
- 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/errors.py +105 -0
- viam/gen/__init__.py +0 -0
- viam/gen/app/__init__.py +0 -0
- viam/gen/app/agent/__init__.py +0 -0
- viam/gen/app/agent/v1/__init__.py +0 -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/__init__.py +0 -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/__init__.py +0 -0
- viam/gen/app/data/v1/__init__.py +0 -0
- viam/gen/app/data/v1/data_grpc.py +206 -0
- viam/gen/app/data/v1/data_pb2.py +178 -0
- viam/gen/app/data/v1/data_pb2.pyi +1485 -0
- 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 +56 -0
- viam/gen/app/datapipelines/v1/data_pipelines_pb2.pyi +370 -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 +60 -0
- viam/gen/app/dataset/v1/dataset_pb2.py +40 -0
- viam/gen/app/dataset/v1/dataset_pb2.pyi +179 -0
- viam/gen/app/datasync/__init__.py +0 -0
- viam/gen/app/datasync/v1/__init__.py +0 -0
- viam/gen/app/datasync/v1/data_sync_grpc.py +47 -0
- viam/gen/app/datasync/v1/data_sync_pb2.py +70 -0
- viam/gen/app/datasync/v1/data_sync_pb2.pyi +425 -0
- 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/__init__.py +0 -0
- viam/gen/app/mltraining/v1/__init__.py +0 -0
- viam/gen/app/mltraining/v1/ml_training_grpc.py +78 -0
- viam/gen/app/mltraining/v1/ml_training_pb2.py +124 -0
- viam/gen/app/mltraining/v1/ml_training_pb2.pyi +415 -0
- viam/gen/app/packages/__init__.py +0 -0
- viam/gen/app/packages/v1/__init__.py +0 -0
- viam/gen/app/packages/v1/packages_grpc.py +54 -0
- viam/gen/app/packages/v1/packages_pb2.py +52 -0
- viam/gen/app/packages/v1/packages_pb2.pyi +311 -0
- viam/gen/app/v1/__init__.py +0 -0
- viam/gen/app/v1/app_grpc.py +863 -0
- viam/gen/app/v1/app_pb2.py +649 -0
- viam/gen/app/v1/app_pb2.pyi +5279 -0
- viam/gen/app/v1/billing_grpc.py +76 -0
- viam/gen/app/v1/billing_pb2.py +92 -0
- viam/gen/app/v1/billing_pb2.pyi +463 -0
- 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 +55 -0
- viam/gen/app/v1/robot_pb2.py +127 -0
- viam/gen/app/v1/robot_pb2.pyi +1202 -0
- viam/gen/common/__init__.py +0 -0
- viam/gen/common/v1/__init__.py +0 -0
- viam/gen/common/v1/common_grpc.py +0 -0
- viam/gen/common/v1/common_pb2.py +78 -0
- viam/gen/common/v1/common_pb2.pyi +687 -0
- viam/gen/component/__init__.py +0 -0
- viam/gen/component/arm/__init__.py +0 -0
- viam/gen/component/arm/v1/__init__.py +0 -0
- viam/gen/component/arm/v1/arm_grpc.py +102 -0
- viam/gen/component/arm/v1/arm_pb2.py +74 -0
- viam/gen/component/arm/v1/arm_pb2.pyi +344 -0
- viam/gen/component/audioinput/__init__.py +0 -0
- viam/gen/component/audioinput/v1/__init__.py +0 -0
- viam/gen/component/audioinput/v1/audioinput_grpc.py +63 -0
- viam/gen/component/audioinput/v1/audioinput_pb2.py +45 -0
- viam/gen/component/audioinput/v1/audioinput_pb2.pyi +179 -0
- viam/gen/component/base/__init__.py +0 -0
- viam/gen/component/base/v1/__init__.py +0 -0
- viam/gen/component/base/v1/base_grpc.py +94 -0
- viam/gen/component/base/v1/base_pb2.py +66 -0
- viam/gen/component/base/v1/base_pb2.pyi +258 -0
- viam/gen/component/board/__init__.py +0 -0
- viam/gen/component/board/v1/__init__.py +0 -0
- viam/gen/component/board/v1/board_grpc.py +127 -0
- viam/gen/component/board/v1/board_pb2.py +103 -0
- viam/gen/component/board/v1/board_pb2.pyi +496 -0
- 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/__init__.py +0 -0
- viam/gen/component/camera/v1/__init__.py +0 -0
- viam/gen/component/camera/v1/camera_grpc.py +79 -0
- viam/gen/component/camera/v1/camera_pb2.py +67 -0
- viam/gen/component/camera/v1/camera_pb2.pyi +373 -0
- viam/gen/component/encoder/__init__.py +0 -0
- viam/gen/component/encoder/v1/__init__.py +0 -0
- viam/gen/component/encoder/v1/encoder_grpc.py +62 -0
- viam/gen/component/encoder/v1/encoder_pb2.py +44 -0
- viam/gen/component/encoder/v1/encoder_pb2.pyi +147 -0
- viam/gen/component/gantry/__init__.py +0 -0
- viam/gen/component/gantry/v1/__init__.py +0 -0
- viam/gen/component/gantry/v1/gantry_grpc.py +86 -0
- viam/gen/component/gantry/v1/gantry_pb2.py +62 -0
- viam/gen/component/gantry/v1/gantry_pb2.pyi +239 -0
- viam/gen/component/generic/__init__.py +0 -0
- viam/gen/component/generic/v1/__init__.py +0 -0
- viam/gen/component/generic/v1/generic_grpc.py +37 -0
- viam/gen/component/generic/v1/generic_pb2.py +23 -0
- viam/gen/component/generic/v1/generic_pb2.pyi +6 -0
- viam/gen/component/gripper/__init__.py +0 -0
- viam/gen/component/gripper/v1/__init__.py +0 -0
- viam/gen/component/gripper/v1/gripper_grpc.py +70 -0
- viam/gen/component/gripper/v1/gripper_pb2.py +48 -0
- viam/gen/component/gripper/v1/gripper_pb2.pyi +137 -0
- viam/gen/component/inputcontroller/__init__.py +0 -0
- viam/gen/component/inputcontroller/v1/__init__.py +0 -0
- viam/gen/component/inputcontroller/v1/input_controller_grpc.py +71 -0
- viam/gen/component/inputcontroller/v1/input_controller_pb2.py +55 -0
- viam/gen/component/inputcontroller/v1/input_controller_pb2.pyi +243 -0
- viam/gen/component/motor/__init__.py +0 -0
- viam/gen/component/motor/v1/__init__.py +0 -0
- viam/gen/component/motor/v1/motor_grpc.py +118 -0
- viam/gen/component/motor/v1/motor_pb2.py +86 -0
- viam/gen/component/motor/v1/motor_pb2.pyi +368 -0
- viam/gen/component/movementsensor/__init__.py +0 -0
- viam/gen/component/movementsensor/v1/__init__.py +0 -0
- viam/gen/component/movementsensor/v1/movementsensor_grpc.py +110 -0
- viam/gen/component/movementsensor/v1/movementsensor_pb2.py +78 -0
- viam/gen/component/movementsensor/v1/movementsensor_pb2.pyi +384 -0
- viam/gen/component/posetracker/__init__.py +0 -0
- viam/gen/component/posetracker/v1/__init__.py +0 -0
- viam/gen/component/posetracker/v1/pose_tracker_grpc.py +46 -0
- viam/gen/component/posetracker/v1/pose_tracker_pb2.py +34 -0
- viam/gen/component/posetracker/v1/pose_tracker_pb2.pyi +79 -0
- 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/__init__.py +0 -0
- viam/gen/component/sensor/v1/__init__.py +0 -0
- viam/gen/component/sensor/v1/sensor_grpc.py +45 -0
- viam/gen/component/sensor/v1/sensor_pb2.py +25 -0
- viam/gen/component/sensor/v1/sensor_pb2.pyi +6 -0
- viam/gen/component/servo/__init__.py +0 -0
- viam/gen/component/servo/v1/__init__.py +0 -0
- viam/gen/component/servo/v1/servo_grpc.py +70 -0
- viam/gen/component/servo/v1/servo_pb2.py +50 -0
- viam/gen/component/servo/v1/servo_pb2.pyi +150 -0
- 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 +109 -0
- viam/gen/component/testecho/__init__.py +0 -0
- viam/gen/component/testecho/v1/__init__.py +0 -0
- viam/gen/component/testecho/v1/testecho_grpc.py +52 -0
- viam/gen/component/testecho/v1/testecho_pb2.py +36 -0
- viam/gen/component/testecho/v1/testecho_pb2.pyi +114 -0
- viam/gen/module/__init__.py +0 -0
- viam/gen/module/v1/__init__.py +0 -0
- viam/gen/module/v1/module_grpc.py +61 -0
- viam/gen/module/v1/module_pb2.py +43 -0
- viam/gen/module/v1/module_pb2.pyi +211 -0
- viam/gen/proto/__init__.py +0 -0
- viam/gen/proto/rpc/__init__.py +0 -0
- viam/gen/proto/rpc/examples/__init__.py +0 -0
- viam/gen/proto/rpc/examples/echo/__init__.py +0 -0
- viam/gen/proto/rpc/examples/echo/v1/__init__.py +0 -0
- viam/gen/proto/rpc/examples/echo/v1/echo_grpc.py +44 -0
- viam/gen/proto/rpc/examples/echo/v1/echo_pb2.py +32 -0
- viam/gen/proto/rpc/examples/echo/v1/echo_pb2.pyi +87 -0
- viam/gen/proto/rpc/examples/echoresource/__init__.py +0 -0
- viam/gen/proto/rpc/examples/echoresource/v1/__init__.py +0 -0
- viam/gen/proto/rpc/examples/echoresource/v1/echoresource_grpc.py +43 -0
- viam/gen/proto/rpc/examples/echoresource/v1/echoresource_pb2.py +29 -0
- viam/gen/proto/rpc/examples/echoresource/v1/echoresource_pb2.pyi +93 -0
- viam/gen/proto/rpc/v1/__init__.py +0 -0
- viam/gen/proto/rpc/v1/auth_grpc.py +47 -0
- viam/gen/proto/rpc/v1/auth_pb2.py +34 -0
- viam/gen/proto/rpc/v1/auth_pb2.pyi +92 -0
- viam/gen/proto/rpc/webrtc/__init__.py +0 -0
- viam/gen/proto/rpc/webrtc/v1/__init__.py +0 -0
- viam/gen/proto/rpc/webrtc/v1/grpc_grpc.py +0 -0
- viam/gen/proto/rpc/webrtc/v1/grpc_pb2.py +43 -0
- viam/gen/proto/rpc/webrtc/v1/grpc_pb2.pyi +304 -0
- viam/gen/proto/rpc/webrtc/v1/signaling_grpc.py +54 -0
- viam/gen/proto/rpc/webrtc/v1/signaling_pb2.py +70 -0
- viam/gen/proto/rpc/webrtc/v1/signaling_pb2.pyi +496 -0
- viam/gen/provisioning/__init__.py +0 -0
- viam/gen/provisioning/v1/__init__.py +0 -0
- viam/gen/provisioning/v1/provisioning_grpc.py +51 -0
- viam/gen/provisioning/v1/provisioning_pb2.py +39 -0
- viam/gen/provisioning/v1/provisioning_pb2.pyi +188 -0
- viam/gen/robot/__init__.py +0 -0
- viam/gen/robot/v1/__init__.py +0 -0
- viam/gen/robot/v1/robot_grpc.py +208 -0
- viam/gen/robot/v1/robot_pb2.py +188 -0
- viam/gen/robot/v1/robot_pb2.pyi +1020 -0
- viam/gen/service/__init__.py +0 -0
- viam/gen/service/datamanager/__init__.py +0 -0
- viam/gen/service/datamanager/v1/__init__.py +0 -0
- viam/gen/service/datamanager/v1/data_manager_grpc.py +38 -0
- viam/gen/service/datamanager/v1/data_manager_pb2.py +28 -0
- viam/gen/service/datamanager/v1/data_manager_pb2.pyi +39 -0
- 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/__init__.py +0 -0
- viam/gen/service/mlmodel/v1/__init__.py +0 -0
- viam/gen/service/mlmodel/v1/mlmodel_grpc.py +37 -0
- viam/gen/service/mlmodel/v1/mlmodel_pb2.py +83 -0
- viam/gen/service/mlmodel/v1/mlmodel_pb2.pyi +480 -0
- viam/gen/service/motion/__init__.py +0 -0
- viam/gen/service/motion/v1/__init__.py +0 -0
- viam/gen/service/motion/v1/motion_grpc.py +87 -0
- viam/gen/service/motion/v1/motion_pb2.py +97 -0
- viam/gen/service/motion/v1/motion_pb2.pyi +838 -0
- viam/gen/service/navigation/__init__.py +0 -0
- viam/gen/service/navigation/v1/__init__.py +0 -0
- viam/gen/service/navigation/v1/navigation_grpc.py +102 -0
- viam/gen/service/navigation/v1/navigation_pb2.py +84 -0
- viam/gen/service/navigation/v1/navigation_pb2.pyi +419 -0
- viam/gen/service/sensors/__init__.py +0 -0
- viam/gen/service/sensors/v1/__init__.py +0 -0
- viam/gen/service/sensors/v1/sensors_grpc.py +46 -0
- viam/gen/service/sensors/v1/sensors_pb2.py +68 -0
- viam/gen/service/sensors/v1/sensors_pb2.pyi +137 -0
- viam/gen/service/shell/__init__.py +0 -0
- viam/gen/service/shell/v1/__init__.py +0 -0
- viam/gen/service/shell/v1/shell_grpc.py +55 -0
- viam/gen/service/shell/v1/shell_pb2.py +45 -0
- viam/gen/service/shell/v1/shell_pb2.pyi +307 -0
- viam/gen/service/slam/__init__.py +0 -0
- viam/gen/service/slam/v1/__init__.py +0 -0
- viam/gen/service/slam/v1/slam_grpc.py +61 -0
- viam/gen/service/slam/v1/slam_pb2.py +51 -0
- viam/gen/service/slam/v1/slam_pb2.pyi +213 -0
- viam/gen/service/vision/__init__.py +0 -0
- viam/gen/service/vision/v1/__init__.py +0 -0
- viam/gen/service/vision/v1/vision_grpc.py +87 -0
- viam/gen/service/vision/v1/vision_pb2.py +69 -0
- viam/gen/service/vision/v1/vision_pb2.pyi +454 -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/__init__.py +0 -0
- viam/gen/tagger/v1/__init__.py +0 -0
- viam/gen/tagger/v1/tagger_grpc.py +0 -0
- viam/gen/tagger/v1/tagger_pb2.py +16 -0
- viam/gen/tagger/v1/tagger_pb2.pyi +15 -0
- viam/logging.py +216 -0
- viam/media/__init__.py +0 -0
- viam/media/audio.py +16 -0
- viam/media/utils/__init__.py +0 -0
- viam/media/utils/pil/__init__.py +51 -0
- viam/media/utils/pil/viam_rgba_plugin.py +73 -0
- viam/media/viam_rgba.py +10 -0
- viam/media/video.py +217 -0
- viam/module/__init__.py +5 -0
- viam/module/module.py +281 -0
- viam/module/service.py +66 -0
- viam/module/types.py +23 -0
- viam/operations.py +124 -0
- viam/proto/__init__.py +0 -0
- viam/proto/app/__init__.py +554 -0
- viam/proto/app/agent/__init__.py +28 -0
- viam/proto/app/billing.py +58 -0
- viam/proto/app/cloudslam/__init__.py +48 -0
- viam/proto/app/data/__init__.py +138 -0
- viam/proto/app/datapipelines/__init__.py +56 -0
- viam/proto/app/dataset/__init__.py +36 -0
- viam/proto/app/datasync/__init__.py +44 -0
- viam/proto/app/end_user.py +34 -0
- viam/proto/app/mlinference/__init__.py +15 -0
- viam/proto/app/mltraining/__init__.py +52 -0
- viam/proto/app/packages/__init__.py +38 -0
- viam/proto/app/robot.py +84 -0
- viam/proto/common/__init__.py +66 -0
- viam/proto/component/__init__.py +0 -0
- viam/proto/component/arm/__init__.py +48 -0
- viam/proto/component/audioinput/__init__.py +30 -0
- viam/proto/component/base/__init__.py +42 -0
- viam/proto/component/board/__init__.py +62 -0
- viam/proto/component/button/__init__.py +15 -0
- viam/proto/component/camera/__init__.py +46 -0
- viam/proto/component/encoder/__init__.py +28 -0
- viam/proto/component/gantry/__init__.py +40 -0
- viam/proto/component/generic/__init__.py +12 -0
- viam/proto/component/gripper/__init__.py +30 -0
- viam/proto/component/inputcontroller/__init__.py +38 -0
- viam/proto/component/motor/__init__.py +56 -0
- viam/proto/component/movementsensor/__init__.py +50 -0
- viam/proto/component/posetracker/__init__.py +19 -0
- viam/proto/component/powersensor/__init__.py +30 -0
- viam/proto/component/sensor/__init__.py +12 -0
- viam/proto/component/servo/__init__.py +32 -0
- viam/proto/component/switch/__init__.py +26 -0
- viam/proto/component/testecho/__init__.py +30 -0
- viam/proto/module/__init__.py +38 -0
- viam/proto/provisioning/__init__.py +36 -0
- viam/proto/robot/__init__.py +130 -0
- viam/proto/rpc/__init__.py +0 -0
- viam/proto/rpc/auth.py +34 -0
- viam/proto/rpc/examples/__init__.py +0 -0
- viam/proto/rpc/examples/echo/__init__.py +26 -0
- viam/proto/rpc/examples/echoresource/__init__.py +30 -0
- viam/proto/rpc/webrtc/__init__.py +0 -0
- viam/proto/rpc/webrtc/grpc.py +36 -0
- viam/proto/rpc/webrtc/signaling.py +58 -0
- viam/proto/service/__init__.py +0 -0
- viam/proto/service/datamanager/__init__.py +19 -0
- viam/proto/service/discovery/__init__.py +15 -0
- viam/proto/service/generic/__init__.py +12 -0
- viam/proto/service/mlmodel/__init__.py +54 -0
- viam/proto/service/motion/__init__.py +68 -0
- viam/proto/service/navigation/__init__.py +58 -0
- viam/proto/service/sensors/__init__.py +18 -0
- viam/proto/service/shell/__init__.py +36 -0
- viam/proto/service/slam/__init__.py +36 -0
- viam/proto/service/vision/__init__.py +46 -0
- viam/proto/stream/__init__.py +36 -0
- viam/proto/tagger/__init__.py +6 -0
- viam/py.typed +0 -0
- viam/resource/__init__.py +0 -0
- viam/resource/base.py +123 -0
- viam/resource/easy_resource.py +153 -0
- viam/resource/manager.py +126 -0
- viam/resource/registry.py +199 -0
- viam/resource/rpc_client_base.py +65 -0
- viam/resource/rpc_service_base.py +48 -0
- viam/resource/types.py +213 -0
- viam/robot/__init__.py +0 -0
- viam/robot/client.py +909 -0
- viam/robot/service.py +69 -0
- viam/rpc/__init__.py +0 -0
- viam/rpc/dial.py +420 -0
- viam/rpc/libviam_rust_utils.dll +0 -0
- viam/rpc/server.py +201 -0
- viam/rpc/signaling.py +29 -0
- viam/rpc/types.py +22 -0
- viam/services/__init__.py +0 -0
- 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 +24 -0
- viam/services/mlmodel/client.py +37 -0
- viam/services/mlmodel/mlmodel.py +78 -0
- viam/services/mlmodel/service.py +38 -0
- viam/services/mlmodel/utils.py +101 -0
- viam/services/motion/__init__.py +17 -0
- viam/services/motion/client.py +215 -0
- viam/services/motion/motion.py +378 -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 +78 -0
- viam/services/service_client_base.py +46 -0
- viam/services/slam/__init__.py +17 -0
- viam/services/slam/client.py +62 -0
- viam/services/slam/service.py +75 -0
- viam/services/slam/slam.py +111 -0
- viam/services/vision/__init__.py +15 -0
- viam/services/vision/client.py +206 -0
- viam/services/vision/service.py +146 -0
- viam/services/vision/vision.py +315 -0
- viam/sessions_client.py +245 -0
- viam/streams.py +44 -0
- viam/utils.py +365 -0
- viam/version_metadata.py +4 -0
- viam_sdk-0.45.2.dist-info/METADATA +157 -0
- viam_sdk-0.45.2.dist-info/RECORD +476 -0
- viam_sdk-0.45.2.dist-info/WHEEL +4 -0
- viam_sdk-0.45.2.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
from typing import Any, Dict, Final, Optional, Tuple
|
|
3
|
+
|
|
4
|
+
from viam.resource.types import API, RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT
|
|
5
|
+
|
|
6
|
+
from ..component_base import ComponentBase
|
|
7
|
+
from . import JointPositions, KinematicsFileFormat, Pose
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Arm(ComponentBase):
|
|
11
|
+
"""
|
|
12
|
+
Arm represents a physical robot arm that exists in three-dimensional space.
|
|
13
|
+
|
|
14
|
+
This acts as an abstract base class for any drivers representing specific
|
|
15
|
+
arm implementations. This cannot be used on its own. If the ``__init__()`` function is
|
|
16
|
+
overridden, it must call the ``super().__init__()`` function.
|
|
17
|
+
|
|
18
|
+
::
|
|
19
|
+
|
|
20
|
+
from viam.components.arm import Arm
|
|
21
|
+
# To use move_to_position:
|
|
22
|
+
from viam.proto.common import Pose
|
|
23
|
+
# To use move_to_joint_positions:
|
|
24
|
+
from viam.proto.component.arm import JointPositions
|
|
25
|
+
|
|
26
|
+
For more information, see `Arm component <https://docs.viam.com/dev/reference/apis/components/arm/>`_.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
API: Final = API(RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT, "arm") # pyright: ignore [reportIncompatibleVariableOverride]
|
|
30
|
+
|
|
31
|
+
@abc.abstractmethod
|
|
32
|
+
async def get_end_position(
|
|
33
|
+
self,
|
|
34
|
+
*,
|
|
35
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
36
|
+
timeout: Optional[float] = None,
|
|
37
|
+
**kwargs,
|
|
38
|
+
) -> Pose:
|
|
39
|
+
"""
|
|
40
|
+
Get the current position of the end of the arm expressed as a ``Pose``.
|
|
41
|
+
|
|
42
|
+
::
|
|
43
|
+
|
|
44
|
+
my_arm = Arm.from_robot(robot=machine, name="my_arm")
|
|
45
|
+
|
|
46
|
+
# Get the end position of the arm as a Pose.
|
|
47
|
+
pos = await my_arm.get_end_position()
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
Pose: A representation of the arm's current position as a 6 DOF (six degrees of freedom) pose.
|
|
51
|
+
The ``Pose`` is composed of values for location and orientation with respect to the origin.
|
|
52
|
+
Location is expressed as distance, which is represented by x, y, and z coordinate values.
|
|
53
|
+
Orientation is expressed as an orientation vector, which is represented by o_x, o_y, o_z, and theta values.
|
|
54
|
+
|
|
55
|
+
For more information, see `Arm component <https://docs.viam.com/dev/reference/apis/components/arm/#getendposition>`_.
|
|
56
|
+
"""
|
|
57
|
+
...
|
|
58
|
+
|
|
59
|
+
@abc.abstractmethod
|
|
60
|
+
async def move_to_position(
|
|
61
|
+
self,
|
|
62
|
+
pose: Pose,
|
|
63
|
+
*,
|
|
64
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
65
|
+
timeout: Optional[float] = None,
|
|
66
|
+
**kwargs,
|
|
67
|
+
):
|
|
68
|
+
"""
|
|
69
|
+
Move the end of the arm to the Pose specified in ``pose``.
|
|
70
|
+
|
|
71
|
+
::
|
|
72
|
+
|
|
73
|
+
my_arm = Arm.from_robot(robot=machine, name="my_arm")
|
|
74
|
+
|
|
75
|
+
# Create a Pose for the arm.
|
|
76
|
+
examplePose = Pose(x=5, y=5, z=5, o_x=5, o_y=5, o_z=5, theta=20)
|
|
77
|
+
|
|
78
|
+
# Move your arm to the Pose.
|
|
79
|
+
await my_arm.move_to_position(pose=examplePose)
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
pose (Pose): The destination ``Pose`` for the arm. The ``Pose`` is composed of values for location and orientation
|
|
83
|
+
with respect to the origin.
|
|
84
|
+
Location is expressed as distance, which is represented by x, y, and z coordinate values.
|
|
85
|
+
Orientation is expressed as an orientation vector, which is represented by o_x, o_y, o_z, and theta values.
|
|
86
|
+
|
|
87
|
+
For more information, see `Arm component <https://docs.viam.com/dev/reference/apis/components/arm/#movetoposition>`_.
|
|
88
|
+
"""
|
|
89
|
+
...
|
|
90
|
+
|
|
91
|
+
@abc.abstractmethod
|
|
92
|
+
async def move_to_joint_positions(
|
|
93
|
+
self,
|
|
94
|
+
positions: JointPositions,
|
|
95
|
+
*,
|
|
96
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
97
|
+
timeout: Optional[float] = None,
|
|
98
|
+
**kwargs,
|
|
99
|
+
):
|
|
100
|
+
"""
|
|
101
|
+
Move each joint on the arm to the corresponding angle specified in ``positions``.
|
|
102
|
+
|
|
103
|
+
::
|
|
104
|
+
|
|
105
|
+
my_arm = Arm.from_robot(robot=machine, name="my_arm")
|
|
106
|
+
|
|
107
|
+
# Declare a list of values with your desired rotational value for each joint on
|
|
108
|
+
# the arm. This example is for a 5dof arm.
|
|
109
|
+
degrees = [0.0, 45.0, 0.0, 0.0, 0.0]
|
|
110
|
+
|
|
111
|
+
# Declare a new JointPositions with these values.
|
|
112
|
+
jointPos = JointPositions(values=degrees)
|
|
113
|
+
|
|
114
|
+
# Move each joint of the arm to the position these values specify.
|
|
115
|
+
await my_arm.move_to_joint_positions(positions=jointPos)
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
positions (JointPositions): The destination ``JointPositions`` for the arm.
|
|
119
|
+
|
|
120
|
+
For more information, see `Arm component <https://docs.viam.com/dev/reference/apis/components/arm/#movetojointpositions>`_.
|
|
121
|
+
"""
|
|
122
|
+
...
|
|
123
|
+
|
|
124
|
+
@abc.abstractmethod
|
|
125
|
+
async def get_joint_positions(
|
|
126
|
+
self,
|
|
127
|
+
*,
|
|
128
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
129
|
+
timeout: Optional[float] = None,
|
|
130
|
+
**kwargs,
|
|
131
|
+
) -> JointPositions:
|
|
132
|
+
"""
|
|
133
|
+
Get the JointPositions representing the current position of the arm.
|
|
134
|
+
|
|
135
|
+
::
|
|
136
|
+
|
|
137
|
+
my_arm = Arm.from_robot(robot=machine, name="my_arm")
|
|
138
|
+
|
|
139
|
+
# Get the current position of each joint on the arm as JointPositions.
|
|
140
|
+
pos = await my_arm.get_joint_positions()
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
JointPositions: The current ``JointPositions`` for the arm.
|
|
144
|
+
``JointPositions`` can have one attribute, ``values``, a list of joint positions with rotational values (degrees)
|
|
145
|
+
and translational values (mm).
|
|
146
|
+
|
|
147
|
+
For more information, see `Arm component <https://docs.viam.com/dev/reference/apis/components/arm/#getjointpositions>`_.
|
|
148
|
+
"""
|
|
149
|
+
...
|
|
150
|
+
|
|
151
|
+
@abc.abstractmethod
|
|
152
|
+
async def stop(
|
|
153
|
+
self,
|
|
154
|
+
*,
|
|
155
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
156
|
+
timeout: Optional[float] = None,
|
|
157
|
+
**kwargs,
|
|
158
|
+
):
|
|
159
|
+
"""
|
|
160
|
+
Stop all motion of the arm. It is assumed that the arm stops immediately.
|
|
161
|
+
|
|
162
|
+
::
|
|
163
|
+
|
|
164
|
+
my_arm = Arm.from_robot(robot=machine, name="my_arm")
|
|
165
|
+
|
|
166
|
+
# Stop all motion of the arm. It is assumed that the arm stops immediately.
|
|
167
|
+
await my_arm.stop()
|
|
168
|
+
|
|
169
|
+
For more information, see `Arm component <https://docs.viam.com/dev/reference/apis/components/arm/#stop>`_.
|
|
170
|
+
"""
|
|
171
|
+
...
|
|
172
|
+
|
|
173
|
+
@abc.abstractmethod
|
|
174
|
+
async def is_moving(self) -> bool:
|
|
175
|
+
"""
|
|
176
|
+
Get if the arm is currently moving.
|
|
177
|
+
|
|
178
|
+
::
|
|
179
|
+
|
|
180
|
+
my_arm = Arm.from_robot(robot=machine, name="my_arm")
|
|
181
|
+
|
|
182
|
+
# Stop all motion of the arm. It is assumed that the arm stops immediately.
|
|
183
|
+
await my_arm.stop()
|
|
184
|
+
|
|
185
|
+
# Print if the arm is currently moving.
|
|
186
|
+
print(await my_arm.is_moving())
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
bool: Whether the arm is moving.
|
|
190
|
+
|
|
191
|
+
For more information, see `Arm component <https://docs.viam.com/dev/reference/apis/components/arm/#ismoving>`_.
|
|
192
|
+
"""
|
|
193
|
+
...
|
|
194
|
+
|
|
195
|
+
@abc.abstractmethod
|
|
196
|
+
async def get_kinematics(
|
|
197
|
+
self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None
|
|
198
|
+
) -> Tuple[KinematicsFileFormat.ValueType, bytes]:
|
|
199
|
+
"""
|
|
200
|
+
Get the kinematics information associated with the arm.
|
|
201
|
+
|
|
202
|
+
::
|
|
203
|
+
|
|
204
|
+
my_arm = Arm.from_robot(robot=machine, name="my_arm")
|
|
205
|
+
|
|
206
|
+
# Get the kinematics information associated with the arm.
|
|
207
|
+
kinematics = await my_arm.get_kinematics()
|
|
208
|
+
|
|
209
|
+
# Get the format of the kinematics file.
|
|
210
|
+
k_file = kinematics[0]
|
|
211
|
+
|
|
212
|
+
# Get the byte contents of the file.
|
|
213
|
+
k_bytes = kinematics[1]
|
|
214
|
+
|
|
215
|
+
Returns:
|
|
216
|
+
Tuple[KinematicsFileFormat.ValueType, bytes]: A tuple containing two values; the first [0] value represents the format of the
|
|
217
|
+
file, either in URDF format (``KinematicsFileFormat.KINEMATICS_FILE_FORMAT_URDF``) or
|
|
218
|
+
Viam's kinematic parameter format (spatial vector algebra) (``KinematicsFileFormat.KINEMATICS_FILE_FORMAT_SVA``),
|
|
219
|
+
and the second [1] value represents the byte contents of the file.
|
|
220
|
+
|
|
221
|
+
For more information, see `Arm component <https://docs.viam.com/dev/reference/apis/components/arm/#getkinematics>`_.
|
|
222
|
+
"""
|
|
223
|
+
...
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
from typing import Any, Dict, List, Mapping, Optional, Tuple
|
|
2
|
+
|
|
3
|
+
from grpclib.client import Channel
|
|
4
|
+
|
|
5
|
+
from viam.proto.common import DoCommandRequest, DoCommandResponse, Geometry, GetKinematicsRequest, GetKinematicsResponse
|
|
6
|
+
from viam.proto.component.arm import (
|
|
7
|
+
ArmServiceStub,
|
|
8
|
+
GetEndPositionRequest,
|
|
9
|
+
GetEndPositionResponse,
|
|
10
|
+
GetJointPositionsRequest,
|
|
11
|
+
GetJointPositionsResponse,
|
|
12
|
+
IsMovingRequest,
|
|
13
|
+
IsMovingResponse,
|
|
14
|
+
JointPositions,
|
|
15
|
+
MoveToJointPositionsRequest,
|
|
16
|
+
MoveToPositionRequest,
|
|
17
|
+
StopRequest,
|
|
18
|
+
)
|
|
19
|
+
from viam.resource.rpc_client_base import ReconfigurableResourceRPCClientBase
|
|
20
|
+
from viam.utils import ValueTypes, dict_to_struct, get_geometries, struct_to_dict
|
|
21
|
+
|
|
22
|
+
from . import Arm, KinematicsFileFormat, Pose
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ArmClient(Arm, ReconfigurableResourceRPCClientBase):
|
|
26
|
+
"""
|
|
27
|
+
gRPC client for an Arm component.
|
|
28
|
+
|
|
29
|
+
Used to communicate with an existing ``Arm`` implementation over gRPC.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
def __init__(self, name: str, channel: Channel):
|
|
33
|
+
self.channel = channel
|
|
34
|
+
self.client = ArmServiceStub(channel)
|
|
35
|
+
super().__init__(name)
|
|
36
|
+
|
|
37
|
+
async def get_end_position(
|
|
38
|
+
self,
|
|
39
|
+
*,
|
|
40
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
41
|
+
timeout: Optional[float] = None,
|
|
42
|
+
**kwargs,
|
|
43
|
+
) -> Pose:
|
|
44
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
45
|
+
request = GetEndPositionRequest(name=self.name, extra=dict_to_struct(extra))
|
|
46
|
+
response: GetEndPositionResponse = await self.client.GetEndPosition(request, timeout=timeout, metadata=md)
|
|
47
|
+
return response.pose
|
|
48
|
+
|
|
49
|
+
async def move_to_position(
|
|
50
|
+
self,
|
|
51
|
+
pose: Pose,
|
|
52
|
+
*,
|
|
53
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
54
|
+
timeout: Optional[float] = None,
|
|
55
|
+
**kwargs,
|
|
56
|
+
):
|
|
57
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
58
|
+
request = MoveToPositionRequest(name=self.name, to=pose, extra=dict_to_struct(extra))
|
|
59
|
+
await self.client.MoveToPosition(request, timeout=timeout, metadata=md)
|
|
60
|
+
|
|
61
|
+
async def get_joint_positions(
|
|
62
|
+
self,
|
|
63
|
+
*,
|
|
64
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
65
|
+
timeout: Optional[float] = None,
|
|
66
|
+
**kwargs,
|
|
67
|
+
) -> JointPositions:
|
|
68
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
69
|
+
request = GetJointPositionsRequest(name=self.name, extra=dict_to_struct(extra))
|
|
70
|
+
response: GetJointPositionsResponse = await self.client.GetJointPositions(request, timeout=timeout, metadata=md)
|
|
71
|
+
return response.positions
|
|
72
|
+
|
|
73
|
+
async def move_to_joint_positions(
|
|
74
|
+
self,
|
|
75
|
+
positions: JointPositions,
|
|
76
|
+
*,
|
|
77
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
78
|
+
timeout: Optional[float] = None,
|
|
79
|
+
**kwargs,
|
|
80
|
+
):
|
|
81
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
82
|
+
request = MoveToJointPositionsRequest(name=self.name, positions=positions, extra=dict_to_struct(extra))
|
|
83
|
+
await self.client.MoveToJointPositions(request, timeout=timeout, metadata=md)
|
|
84
|
+
|
|
85
|
+
async def stop(
|
|
86
|
+
self,
|
|
87
|
+
*,
|
|
88
|
+
extra: Optional[Dict[str, Any]] = None,
|
|
89
|
+
timeout: Optional[float] = None,
|
|
90
|
+
**kwargs,
|
|
91
|
+
):
|
|
92
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
93
|
+
request = StopRequest(name=self.name, extra=dict_to_struct(extra))
|
|
94
|
+
await self.client.Stop(request, timeout=timeout, metadata=md)
|
|
95
|
+
|
|
96
|
+
async def is_moving(self, *, timeout: Optional[float] = None, **kwargs) -> bool:
|
|
97
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
98
|
+
request = IsMovingRequest(name=self.name)
|
|
99
|
+
response: IsMovingResponse = await self.client.IsMoving(request, timeout=timeout, metadata=md)
|
|
100
|
+
return response.is_moving
|
|
101
|
+
|
|
102
|
+
async def do_command(
|
|
103
|
+
self,
|
|
104
|
+
command: Mapping[str, Any],
|
|
105
|
+
*,
|
|
106
|
+
timeout: Optional[float] = None,
|
|
107
|
+
**kwargs,
|
|
108
|
+
) -> Mapping[str, ValueTypes]:
|
|
109
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
110
|
+
request = DoCommandRequest(name=self.name, command=dict_to_struct(command))
|
|
111
|
+
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout, metadata=md)
|
|
112
|
+
return struct_to_dict(response.result)
|
|
113
|
+
|
|
114
|
+
async def get_kinematics(
|
|
115
|
+
self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs
|
|
116
|
+
) -> Tuple[KinematicsFileFormat.ValueType, bytes]:
|
|
117
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
118
|
+
request = GetKinematicsRequest(name=self.name, extra=dict_to_struct(extra))
|
|
119
|
+
response: GetKinematicsResponse = await self.client.GetKinematics(request, timeout=timeout, metadata=md)
|
|
120
|
+
return (response.format, response.kinematics_data)
|
|
121
|
+
|
|
122
|
+
async def get_geometries(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> List[Geometry]:
|
|
123
|
+
md = kwargs.get("metadata", self.Metadata())
|
|
124
|
+
return await get_geometries(self.client, self.name, extra, timeout, md)
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from grpclib.server import Stream
|
|
2
|
+
|
|
3
|
+
from viam.proto.common import (
|
|
4
|
+
DoCommandRequest,
|
|
5
|
+
DoCommandResponse,
|
|
6
|
+
GetGeometriesRequest,
|
|
7
|
+
GetGeometriesResponse,
|
|
8
|
+
GetKinematicsRequest,
|
|
9
|
+
GetKinematicsResponse,
|
|
10
|
+
)
|
|
11
|
+
from viam.proto.component.arm import (
|
|
12
|
+
GetEndPositionRequest,
|
|
13
|
+
GetEndPositionResponse,
|
|
14
|
+
GetJointPositionsRequest,
|
|
15
|
+
GetJointPositionsResponse,
|
|
16
|
+
IsMovingRequest,
|
|
17
|
+
IsMovingResponse,
|
|
18
|
+
MoveToJointPositionsRequest,
|
|
19
|
+
MoveToJointPositionsResponse,
|
|
20
|
+
MoveToPositionRequest,
|
|
21
|
+
MoveToPositionResponse,
|
|
22
|
+
StopRequest,
|
|
23
|
+
StopResponse,
|
|
24
|
+
UnimplementedArmServiceBase,
|
|
25
|
+
)
|
|
26
|
+
from viam.resource.rpc_service_base import ResourceRPCServiceBase
|
|
27
|
+
from viam.utils import dict_to_struct, struct_to_dict
|
|
28
|
+
|
|
29
|
+
from .arm import Arm
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ArmRPCService(UnimplementedArmServiceBase, ResourceRPCServiceBase[Arm]):
|
|
33
|
+
"""
|
|
34
|
+
gRPC Service for an Arm
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
RESOURCE_TYPE = Arm
|
|
38
|
+
|
|
39
|
+
async def GetEndPosition(self, stream: Stream[GetEndPositionRequest, GetEndPositionResponse]) -> None:
|
|
40
|
+
request = await stream.recv_message()
|
|
41
|
+
assert request is not None
|
|
42
|
+
name = request.name
|
|
43
|
+
arm = self.get_resource(name)
|
|
44
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
45
|
+
position = await arm.get_end_position(extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata)
|
|
46
|
+
response = GetEndPositionResponse(pose=position)
|
|
47
|
+
await stream.send_message(response)
|
|
48
|
+
|
|
49
|
+
async def MoveToPosition(self, stream: Stream[MoveToPositionRequest, MoveToPositionResponse]) -> None:
|
|
50
|
+
request = await stream.recv_message()
|
|
51
|
+
assert request is not None
|
|
52
|
+
name = request.name
|
|
53
|
+
arm = self.get_resource(name)
|
|
54
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
55
|
+
await arm.move_to_position(request.to, extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata)
|
|
56
|
+
response = MoveToPositionResponse()
|
|
57
|
+
await stream.send_message(response)
|
|
58
|
+
|
|
59
|
+
async def GetJointPositions(self, stream: Stream[GetJointPositionsRequest, GetJointPositionsResponse]) -> None:
|
|
60
|
+
request = await stream.recv_message()
|
|
61
|
+
assert request is not None
|
|
62
|
+
name = request.name
|
|
63
|
+
arm = self.get_resource(name)
|
|
64
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
65
|
+
positions = await arm.get_joint_positions(extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata)
|
|
66
|
+
response = GetJointPositionsResponse(positions=positions)
|
|
67
|
+
await stream.send_message(response)
|
|
68
|
+
|
|
69
|
+
async def MoveToJointPositions(self, stream: Stream[MoveToJointPositionsRequest, MoveToJointPositionsResponse]) -> None:
|
|
70
|
+
request = await stream.recv_message()
|
|
71
|
+
assert request is not None
|
|
72
|
+
name = request.name
|
|
73
|
+
arm = self.get_resource(name)
|
|
74
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
75
|
+
await arm.move_to_joint_positions(request.positions, extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata)
|
|
76
|
+
response = MoveToJointPositionsResponse()
|
|
77
|
+
await stream.send_message(response)
|
|
78
|
+
|
|
79
|
+
async def Stop(self, stream: Stream[StopRequest, StopResponse]) -> None:
|
|
80
|
+
request = await stream.recv_message()
|
|
81
|
+
assert request is not None
|
|
82
|
+
name = request.name
|
|
83
|
+
arm = self.get_resource(name)
|
|
84
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
85
|
+
await arm.stop(extra=struct_to_dict(request.extra), timeout=timeout, metadata=stream.metadata)
|
|
86
|
+
response = StopResponse()
|
|
87
|
+
await stream.send_message(response)
|
|
88
|
+
|
|
89
|
+
async def IsMoving(self, stream: Stream[IsMovingRequest, IsMovingResponse]) -> None:
|
|
90
|
+
request = await stream.recv_message()
|
|
91
|
+
assert request is not None
|
|
92
|
+
name = request.name
|
|
93
|
+
arm = self.get_resource(name)
|
|
94
|
+
is_moving = await arm.is_moving()
|
|
95
|
+
response = IsMovingResponse(is_moving=is_moving)
|
|
96
|
+
await stream.send_message(response)
|
|
97
|
+
|
|
98
|
+
async def DoCommand(self, stream: Stream[DoCommandRequest, DoCommandResponse]) -> None:
|
|
99
|
+
request = await stream.recv_message()
|
|
100
|
+
assert request is not None
|
|
101
|
+
arm = self.get_resource(request.name)
|
|
102
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
103
|
+
result = await arm.do_command(command=struct_to_dict(request.command), timeout=timeout, metadata=stream.metadata)
|
|
104
|
+
response = DoCommandResponse(result=dict_to_struct(result))
|
|
105
|
+
await stream.send_message(response)
|
|
106
|
+
|
|
107
|
+
async def GetKinematics(self, stream: Stream[GetKinematicsRequest, GetKinematicsResponse]) -> None:
|
|
108
|
+
request = await stream.recv_message()
|
|
109
|
+
assert request is not None
|
|
110
|
+
arm = self.get_resource(request.name)
|
|
111
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
112
|
+
format, kinematics_data = await arm.get_kinematics(extra=struct_to_dict(request.extra), timeout=timeout)
|
|
113
|
+
response = GetKinematicsResponse(format=format, kinematics_data=kinematics_data)
|
|
114
|
+
await stream.send_message(response)
|
|
115
|
+
|
|
116
|
+
async def GetGeometries(self, stream: Stream[GetGeometriesRequest, GetGeometriesResponse]) -> None:
|
|
117
|
+
request = await stream.recv_message()
|
|
118
|
+
assert request is not None
|
|
119
|
+
arm = self.get_resource(request.name)
|
|
120
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
121
|
+
geometries = await arm.get_geometries(extra=struct_to_dict(request.extra), timeout=timeout)
|
|
122
|
+
response = GetGeometriesResponse(geometries=geometries)
|
|
123
|
+
await stream.send_message(response)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from viam.resource.registry import Registry, ResourceRegistration
|
|
2
|
+
|
|
3
|
+
from .audio_input import AudioInput
|
|
4
|
+
from .client import AudioInputClient
|
|
5
|
+
from .service import AudioInputRPCService
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"AudioInput",
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Registry.register_api(
|
|
13
|
+
ResourceRegistration(
|
|
14
|
+
AudioInput,
|
|
15
|
+
AudioInputRPCService,
|
|
16
|
+
lambda name, channel: AudioInputClient(name, channel),
|
|
17
|
+
)
|
|
18
|
+
)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from datetime import timedelta
|
|
4
|
+
from typing import Final, Optional
|
|
5
|
+
|
|
6
|
+
from google.protobuf.duration_pb2 import Duration
|
|
7
|
+
from typing_extensions import Self
|
|
8
|
+
|
|
9
|
+
from viam.media.audio import Audio, AudioStream
|
|
10
|
+
from viam.proto.component.audioinput import PropertiesResponse
|
|
11
|
+
from viam.resource.types import API, RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT
|
|
12
|
+
from viam.streams import StreamSource
|
|
13
|
+
|
|
14
|
+
from ..component_base import ComponentBase
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class AudioInput(ComponentBase, StreamSource[Audio]):
|
|
18
|
+
"""AudioInput represents a component that can capture audio.
|
|
19
|
+
|
|
20
|
+
This acts as an abstract base class for any drivers representing specific
|
|
21
|
+
audio input implementations. This cannot be used on its own. If the ``__init__()`` function is
|
|
22
|
+
overridden, it must call the ``super().__init__()`` function.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
API: Final = API( # pyright: ignore [reportIncompatibleVariableOverride]
|
|
26
|
+
RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT, "audio_input"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
@dataclass
|
|
30
|
+
class Properties:
|
|
31
|
+
channel_count: int
|
|
32
|
+
latency: timedelta
|
|
33
|
+
sample_rate: int
|
|
34
|
+
sample_size: int
|
|
35
|
+
is_big_endian: bool
|
|
36
|
+
is_float: bool
|
|
37
|
+
is_interleaved: bool
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def proto(self) -> PropertiesResponse:
|
|
41
|
+
latency = Duration()
|
|
42
|
+
latency.FromTimedelta(self.latency)
|
|
43
|
+
return PropertiesResponse(
|
|
44
|
+
channel_count=self.channel_count,
|
|
45
|
+
latency=latency,
|
|
46
|
+
sample_rate=self.sample_rate,
|
|
47
|
+
sample_size=self.sample_size,
|
|
48
|
+
is_big_endian=self.is_big_endian,
|
|
49
|
+
is_float=self.is_float,
|
|
50
|
+
is_interleaved=self.is_interleaved,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_proto(cls, proto: PropertiesResponse) -> Self:
|
|
55
|
+
return cls(
|
|
56
|
+
channel_count=proto.channel_count,
|
|
57
|
+
latency=proto.latency.ToTimedelta(),
|
|
58
|
+
sample_rate=proto.sample_rate,
|
|
59
|
+
sample_size=proto.sample_size,
|
|
60
|
+
is_big_endian=proto.is_big_endian,
|
|
61
|
+
is_float=proto.is_float,
|
|
62
|
+
is_interleaved=proto.is_interleaved,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
@abc.abstractmethod
|
|
66
|
+
async def stream(self, *, timeout: Optional[float] = None, **kwargs) -> AudioStream:
|
|
67
|
+
"""Stream audio samples from the audio input of the underlying robot
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
Stream[Audio]: The stream of audio chunks
|
|
71
|
+
"""
|
|
72
|
+
...
|
|
73
|
+
|
|
74
|
+
@abc.abstractmethod
|
|
75
|
+
async def get_properties(self, *, timeout: Optional[float] = None, **kwargs) -> Properties:
|
|
76
|
+
"""Get the properties of the audio input of the underlying robot
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
Properties: The audio input properties
|
|
80
|
+
"""
|
|
81
|
+
...
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from typing import Any, AsyncIterator, Dict, List, Mapping, Optional, Union
|
|
2
|
+
|
|
3
|
+
from grpclib.client import Channel
|
|
4
|
+
|
|
5
|
+
from viam.media.audio import Audio
|
|
6
|
+
from viam.proto.common import DoCommandRequest, DoCommandResponse, Geometry
|
|
7
|
+
from viam.proto.component.audioinput import (
|
|
8
|
+
AudioInputServiceStub,
|
|
9
|
+
ChunksRequest,
|
|
10
|
+
ChunksResponse,
|
|
11
|
+
PropertiesRequest,
|
|
12
|
+
PropertiesResponse,
|
|
13
|
+
SampleFormat,
|
|
14
|
+
)
|
|
15
|
+
from viam.resource.rpc_client_base import ReconfigurableResourceRPCClientBase
|
|
16
|
+
from viam.streams import Stream, StreamWithIterator
|
|
17
|
+
from viam.utils import ValueTypes, dict_to_struct, get_geometries, struct_to_dict
|
|
18
|
+
|
|
19
|
+
from .audio_input import AudioInput
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class AudioInputClient(AudioInput, ReconfigurableResourceRPCClientBase):
|
|
23
|
+
"""
|
|
24
|
+
gRPC client for the AudioInput component.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(self, name: str, channel: Channel):
|
|
28
|
+
self.channel = channel
|
|
29
|
+
self.client = AudioInputServiceStub(channel)
|
|
30
|
+
super().__init__(name)
|
|
31
|
+
|
|
32
|
+
async def stream(self, *, timeout: Optional[float] = None, **kwargs) -> Stream[Audio]:
|
|
33
|
+
async def read() -> AsyncIterator[Audio]:
|
|
34
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
35
|
+
async with self.client.Chunks.open(timeout=timeout, metadata=md) as chunks_stream:
|
|
36
|
+
await chunks_stream.send_message(
|
|
37
|
+
ChunksRequest(name=self.name, sample_format=SampleFormat.SAMPLE_FORMAT_FLOAT32_INTERLEAVED), end=True
|
|
38
|
+
)
|
|
39
|
+
response: Union[ChunksResponse, None] = await chunks_stream.recv_message()
|
|
40
|
+
if not response:
|
|
41
|
+
await chunks_stream.recv_trailing_metadata() # causes us to throw appropriate gRPC error.
|
|
42
|
+
raise TypeError("Response cannot be empty") # we should never get here, but for typechecking
|
|
43
|
+
assert response.HasField("info")
|
|
44
|
+
info = response.info
|
|
45
|
+
|
|
46
|
+
while True:
|
|
47
|
+
response = await chunks_stream.recv_message()
|
|
48
|
+
if response is None:
|
|
49
|
+
break
|
|
50
|
+
assert response.HasField("chunk")
|
|
51
|
+
audio = Audio(info=info, chunk=response.chunk)
|
|
52
|
+
yield audio
|
|
53
|
+
|
|
54
|
+
return StreamWithIterator(read())
|
|
55
|
+
|
|
56
|
+
async def get_properties(self, *, timeout: Optional[float] = None, **kwargs) -> AudioInput.Properties:
|
|
57
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
58
|
+
request = PropertiesRequest(name=self.name)
|
|
59
|
+
response: PropertiesResponse = await self.client.Properties(request, timeout=timeout, metadata=md)
|
|
60
|
+
return AudioInput.Properties.from_proto(response)
|
|
61
|
+
|
|
62
|
+
async def do_command(self, command: Mapping[str, ValueTypes], *, timeout: Optional[float] = None, **kwargs) -> Mapping[str, ValueTypes]:
|
|
63
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
64
|
+
request = DoCommandRequest(name=self.name, command=dict_to_struct(command))
|
|
65
|
+
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout, metadata=md)
|
|
66
|
+
return struct_to_dict(response.result)
|
|
67
|
+
|
|
68
|
+
async def get_geometries(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> List[Geometry]:
|
|
69
|
+
md = kwargs.get("metadata", self.Metadata())
|
|
70
|
+
return await get_geometries(self.client, self.name, extra, timeout, md)
|