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,146 @@
|
|
|
1
|
+
from grpclib.server import Stream
|
|
2
|
+
|
|
3
|
+
from viam.media.video import CameraMimeType, ViamImage
|
|
4
|
+
from viam.proto.common import DoCommandRequest, DoCommandResponse
|
|
5
|
+
from viam.proto.component.camera import Image
|
|
6
|
+
from viam.proto.service.vision import (
|
|
7
|
+
CaptureAllFromCameraRequest,
|
|
8
|
+
CaptureAllFromCameraResponse,
|
|
9
|
+
GetClassificationsFromCameraRequest,
|
|
10
|
+
GetClassificationsFromCameraResponse,
|
|
11
|
+
GetClassificationsRequest,
|
|
12
|
+
GetClassificationsResponse,
|
|
13
|
+
GetDetectionsFromCameraRequest,
|
|
14
|
+
GetDetectionsFromCameraResponse,
|
|
15
|
+
GetDetectionsRequest,
|
|
16
|
+
GetDetectionsResponse,
|
|
17
|
+
GetObjectPointCloudsRequest,
|
|
18
|
+
GetObjectPointCloudsResponse,
|
|
19
|
+
GetPropertiesRequest,
|
|
20
|
+
GetPropertiesResponse,
|
|
21
|
+
UnimplementedVisionServiceBase,
|
|
22
|
+
)
|
|
23
|
+
from viam.resource.rpc_service_base import ResourceRPCServiceBase
|
|
24
|
+
from viam.utils import dict_to_struct, struct_to_dict
|
|
25
|
+
|
|
26
|
+
from .vision import Vision
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class VisionRPCService(UnimplementedVisionServiceBase, ResourceRPCServiceBase):
|
|
30
|
+
"""
|
|
31
|
+
gRPC service for a Vision service
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
RESOURCE_TYPE = Vision
|
|
35
|
+
|
|
36
|
+
async def CaptureAllFromCamera(self, stream: Stream[CaptureAllFromCameraRequest, CaptureAllFromCameraResponse]) -> None:
|
|
37
|
+
request = await stream.recv_message()
|
|
38
|
+
assert request is not None
|
|
39
|
+
vision = self.get_resource(request.name)
|
|
40
|
+
extra = struct_to_dict(request.extra)
|
|
41
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
42
|
+
result = await vision.capture_all_from_camera(
|
|
43
|
+
request.camera_name,
|
|
44
|
+
return_image=request.return_image,
|
|
45
|
+
return_classifications=request.return_classifications,
|
|
46
|
+
return_detections=request.return_detections,
|
|
47
|
+
return_object_point_clouds=request.return_object_point_clouds,
|
|
48
|
+
extra=extra,
|
|
49
|
+
timeout=timeout,
|
|
50
|
+
)
|
|
51
|
+
img = None
|
|
52
|
+
if result.image is not None:
|
|
53
|
+
fmt = result.image.mime_type.to_proto()
|
|
54
|
+
img_bytes = result.image.data
|
|
55
|
+
img = Image(source_name=request.camera_name, format=fmt, image=img_bytes)
|
|
56
|
+
response = CaptureAllFromCameraResponse(
|
|
57
|
+
image=img,
|
|
58
|
+
detections=result.detections,
|
|
59
|
+
classifications=result.classifications,
|
|
60
|
+
objects=result.objects,
|
|
61
|
+
extra=dict_to_struct(result.extra if result.extra else {}),
|
|
62
|
+
)
|
|
63
|
+
await stream.send_message(response)
|
|
64
|
+
|
|
65
|
+
async def GetDetectionsFromCamera(self, stream: Stream[GetDetectionsFromCameraRequest, GetDetectionsFromCameraResponse]) -> None:
|
|
66
|
+
request = await stream.recv_message()
|
|
67
|
+
assert request is not None
|
|
68
|
+
vision = self.get_resource(request.name)
|
|
69
|
+
extra = struct_to_dict(request.extra)
|
|
70
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
71
|
+
result = await vision.get_detections_from_camera(request.camera_name, extra=extra, timeout=timeout)
|
|
72
|
+
response = GetDetectionsFromCameraResponse(detections=result)
|
|
73
|
+
await stream.send_message(response)
|
|
74
|
+
|
|
75
|
+
async def GetDetections(self, stream: Stream[GetDetectionsRequest, GetDetectionsResponse]) -> None:
|
|
76
|
+
request = await stream.recv_message()
|
|
77
|
+
assert request is not None
|
|
78
|
+
vision = self.get_resource(request.name)
|
|
79
|
+
extra = struct_to_dict(request.extra)
|
|
80
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
81
|
+
|
|
82
|
+
mime_type = CameraMimeType.from_string(request.mime_type)
|
|
83
|
+
image = ViamImage(request.image, mime_type)
|
|
84
|
+
|
|
85
|
+
result = await vision.get_detections(image, extra=extra, timeout=timeout)
|
|
86
|
+
response = GetDetectionsResponse(detections=result)
|
|
87
|
+
await stream.send_message(response)
|
|
88
|
+
|
|
89
|
+
async def GetClassificationsFromCamera(
|
|
90
|
+
self, stream: Stream[GetClassificationsFromCameraRequest, GetClassificationsFromCameraResponse]
|
|
91
|
+
) -> None:
|
|
92
|
+
request = await stream.recv_message()
|
|
93
|
+
assert request is not None
|
|
94
|
+
vision = self.get_resource(request.name)
|
|
95
|
+
extra = struct_to_dict(request.extra)
|
|
96
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
97
|
+
result = await vision.get_classifications_from_camera(request.camera_name, request.n, extra=extra, timeout=timeout)
|
|
98
|
+
response = GetClassificationsFromCameraResponse(classifications=result)
|
|
99
|
+
await stream.send_message(response)
|
|
100
|
+
|
|
101
|
+
async def GetClassifications(self, stream: Stream[GetClassificationsRequest, GetClassificationsResponse]) -> None:
|
|
102
|
+
request = await stream.recv_message()
|
|
103
|
+
assert request is not None
|
|
104
|
+
vision = self.get_resource(request.name)
|
|
105
|
+
extra = struct_to_dict(request.extra)
|
|
106
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
107
|
+
|
|
108
|
+
mime_type = CameraMimeType.from_string(request.mime_type)
|
|
109
|
+
image = ViamImage(request.image, mime_type)
|
|
110
|
+
|
|
111
|
+
result = await vision.get_classifications(image, request.n, extra=extra, timeout=timeout)
|
|
112
|
+
response = GetClassificationsResponse(classifications=result)
|
|
113
|
+
await stream.send_message(response)
|
|
114
|
+
|
|
115
|
+
async def GetObjectPointClouds(self, stream: Stream[GetObjectPointCloudsRequest, GetObjectPointCloudsResponse]) -> None:
|
|
116
|
+
request = await stream.recv_message()
|
|
117
|
+
assert request is not None
|
|
118
|
+
vision = self.get_resource(request.name)
|
|
119
|
+
extra = struct_to_dict(request.extra)
|
|
120
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
121
|
+
result = await vision.get_object_point_clouds(request.camera_name, extra=extra, timeout=timeout)
|
|
122
|
+
response = GetObjectPointCloudsResponse(mime_type=CameraMimeType.PCD.value, objects=result)
|
|
123
|
+
await stream.send_message(response)
|
|
124
|
+
|
|
125
|
+
async def GetProperties(self, stream: Stream[GetPropertiesRequest, GetPropertiesResponse]) -> None:
|
|
126
|
+
request = await stream.recv_message()
|
|
127
|
+
assert request is not None
|
|
128
|
+
name = request.name
|
|
129
|
+
vision = self.get_resource(name)
|
|
130
|
+
extra = struct_to_dict(request.extra)
|
|
131
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
132
|
+
properties = await vision.get_properties(extra=extra, timeout=timeout)
|
|
133
|
+
response = GetPropertiesResponse(
|
|
134
|
+
classifications_supported=properties.classifications_supported,
|
|
135
|
+
detections_supported=properties.detections_supported,
|
|
136
|
+
object_point_clouds_supported=properties.object_point_clouds_supported,
|
|
137
|
+
)
|
|
138
|
+
await stream.send_message(response)
|
|
139
|
+
|
|
140
|
+
async def DoCommand(self, stream: Stream[DoCommandRequest, DoCommandResponse]) -> None:
|
|
141
|
+
request = await stream.recv_message()
|
|
142
|
+
assert request is not None
|
|
143
|
+
vision = self.get_resource(request.name)
|
|
144
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
145
|
+
result = await vision.do_command(struct_to_dict(request.command), timeout=timeout)
|
|
146
|
+
await stream.send_message(DoCommandResponse(result=dict_to_struct(result)))
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
import sys
|
|
3
|
+
from typing import Final, List, Mapping, Optional
|
|
4
|
+
|
|
5
|
+
from viam.media.video import ViamImage
|
|
6
|
+
from viam.proto.common import PointCloudObject
|
|
7
|
+
from viam.proto.service.vision import Classification, Detection, GetPropertiesResponse
|
|
8
|
+
from viam.resource.types import API, RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_SERVICE
|
|
9
|
+
from viam.utils import ValueTypes
|
|
10
|
+
|
|
11
|
+
from ..service_base import ServiceBase
|
|
12
|
+
|
|
13
|
+
if sys.version_info >= (3, 10):
|
|
14
|
+
from typing import TypeAlias
|
|
15
|
+
else:
|
|
16
|
+
from typing_extensions import TypeAlias
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class CaptureAllResult:
|
|
20
|
+
"""
|
|
21
|
+
CaptureAllResult represents the collection of things that you have requested from the
|
|
22
|
+
CaptureAllFromCamera method. This is used most often for visualization purposes, since normally,
|
|
23
|
+
returning the image on every call to a classifier/detector/etc would be costly and unnecessary.
|
|
24
|
+
The default result for each field is None rather than the empty list to distinguish between
|
|
25
|
+
"there was no request for the classifier/detector to return a result" vs.
|
|
26
|
+
"the classifier/detector was requested, but there were no results".
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def __init__(
|
|
30
|
+
self,
|
|
31
|
+
image: Optional[ViamImage] = None,
|
|
32
|
+
classifications: Optional[List[Classification]] = None,
|
|
33
|
+
detections: Optional[List[Detection]] = None,
|
|
34
|
+
objects: Optional[List[PointCloudObject]] = None,
|
|
35
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
36
|
+
):
|
|
37
|
+
"""
|
|
38
|
+
Args:
|
|
39
|
+
image (ViamImage|None): The image from the GetImage request of the camera, if it was requested.
|
|
40
|
+
classifications (List[Classification]|None): The classifications from GetClassifications, if it was requested.
|
|
41
|
+
detections (List[Detection]|None): The detections from GetDetections, if it was requested.
|
|
42
|
+
objects (List[PointCloudObject]|None): the object point clouds from GetObjectPointClouds, if it was requested.
|
|
43
|
+
extra (dict): A catch all structure, usually for metadata, that a module writer might want to return. Default empty.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
None
|
|
47
|
+
"""
|
|
48
|
+
self.image = image
|
|
49
|
+
self.classifications = classifications
|
|
50
|
+
self.detections = detections
|
|
51
|
+
self.objects = objects
|
|
52
|
+
self.extra = extra
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class Vision(ServiceBase):
|
|
56
|
+
"""
|
|
57
|
+
Vision represents a Vision service.
|
|
58
|
+
|
|
59
|
+
This acts as an abstract base class for any drivers representing specific
|
|
60
|
+
vision implementations. This cannot be used on its own. If the ``__init__()`` function is
|
|
61
|
+
overridden, it must call the ``super().__init__()`` function.
|
|
62
|
+
|
|
63
|
+
For more information, see `Computer Vision service <https://docs.viam.com/dev/reference/apis/services/vision/>`_.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
API: Final = API( # pyright: ignore [reportIncompatibleVariableOverride]
|
|
67
|
+
RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_SERVICE, "vision"
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
Properties: "TypeAlias" = GetPropertiesResponse
|
|
71
|
+
"""
|
|
72
|
+
Properties is a class that states what features are supported on the associated vision service.
|
|
73
|
+
Currently, these are the following properties:
|
|
74
|
+
- classifications_supported (bool): GetClassifications and GetClassificationsFromCamera are implemented.
|
|
75
|
+
- detections_supported (bool): GetDetections and GetDetectionsFromCamera are implemented.
|
|
76
|
+
- object_point_clouds_supported (bool): GetObjectPointClouds is implemented.
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
@abc.abstractmethod
|
|
80
|
+
async def capture_all_from_camera(
|
|
81
|
+
self,
|
|
82
|
+
camera_name: str,
|
|
83
|
+
return_image: bool = False,
|
|
84
|
+
return_classifications: bool = False,
|
|
85
|
+
return_detections: bool = False,
|
|
86
|
+
return_object_point_clouds: bool = False,
|
|
87
|
+
*,
|
|
88
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
89
|
+
timeout: Optional[float] = None,
|
|
90
|
+
) -> CaptureAllResult:
|
|
91
|
+
"""Get the next image, detections, classifications, and objects all together,
|
|
92
|
+
given a camera name. Used for visualization.
|
|
93
|
+
|
|
94
|
+
::
|
|
95
|
+
|
|
96
|
+
my_detector = VisionClient.from_robot(machine, "my_detector")
|
|
97
|
+
|
|
98
|
+
# Get the captured data for a camera
|
|
99
|
+
result = await my_detector.capture_all_from_camera(
|
|
100
|
+
"my_camera",
|
|
101
|
+
return_image=True,
|
|
102
|
+
return_detections=True,
|
|
103
|
+
)
|
|
104
|
+
image = result.image
|
|
105
|
+
detections = result.detections
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
camera_name (str): The name of the camera to use for detection
|
|
109
|
+
return_image (bool): Ask the vision service to return the camera's latest image
|
|
110
|
+
return_classifications (bool): Ask the vision service to return its latest classifications
|
|
111
|
+
return_detections (bool): Ask the vision service to return its latest detections
|
|
112
|
+
return_object_point_clouds (bool): Ask the vision service to return its latest 3D segmentations
|
|
113
|
+
|
|
114
|
+
Returns:
|
|
115
|
+
vision.CaptureAllResult: A class that stores all potential returns from the vision service.
|
|
116
|
+
It can return the image from the camera along with its associated detections, classifications,
|
|
117
|
+
and objects, as well as any extra info the model may provide.
|
|
118
|
+
|
|
119
|
+
For more information, see `Computer Vision service <https://docs.viam.com/dev/reference/apis/services/vision/#captureallfromcamera>`_.
|
|
120
|
+
"""
|
|
121
|
+
...
|
|
122
|
+
|
|
123
|
+
@abc.abstractmethod
|
|
124
|
+
async def get_detections_from_camera(
|
|
125
|
+
self,
|
|
126
|
+
camera_name: str,
|
|
127
|
+
*,
|
|
128
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
129
|
+
timeout: Optional[float] = None,
|
|
130
|
+
) -> List[Detection]:
|
|
131
|
+
"""Get a list of detections in the next image given a camera and a detector
|
|
132
|
+
|
|
133
|
+
::
|
|
134
|
+
|
|
135
|
+
my_detector = VisionClient.from_robot(robot=machine, "my_detector")
|
|
136
|
+
|
|
137
|
+
# Get detections for the next image from the specified camera
|
|
138
|
+
detections = await my_detector.get_detections_from_camera("my_camera")
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
camera_name (str): The name of the camera to use for detection
|
|
142
|
+
|
|
143
|
+
Raises:
|
|
144
|
+
ViamError: Raised if given an image without a specified width and height
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
List[viam.proto.service.vision.Detection]: A list of 2D bounding boxes, their labels, and the
|
|
148
|
+
confidence score of the labels, around the found objects in the next 2D image
|
|
149
|
+
from the given camera, with the given detector applied to it.
|
|
150
|
+
|
|
151
|
+
For more information, see `Computer Vision service <https://docs.viam.com/dev/reference/apis/services/vision/#getdetectionsfromcamera>`_.
|
|
152
|
+
"""
|
|
153
|
+
...
|
|
154
|
+
|
|
155
|
+
@abc.abstractmethod
|
|
156
|
+
async def get_detections(
|
|
157
|
+
self,
|
|
158
|
+
image: ViamImage,
|
|
159
|
+
*,
|
|
160
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
161
|
+
timeout: Optional[float] = None,
|
|
162
|
+
) -> List[Detection]:
|
|
163
|
+
"""Get a list of detections in the given image using the specified detector
|
|
164
|
+
|
|
165
|
+
::
|
|
166
|
+
|
|
167
|
+
my_camera = Camera.from_robot(robot=machine, "my_camera")
|
|
168
|
+
my_detector = VisionClient.from_robot(robot=machine, "my_detector")
|
|
169
|
+
|
|
170
|
+
# Get an image from the camera
|
|
171
|
+
img = await my_camera.get_image()
|
|
172
|
+
|
|
173
|
+
# Get detections for that image
|
|
174
|
+
detections = await my_detector.get_detections(img)
|
|
175
|
+
|
|
176
|
+
Args:
|
|
177
|
+
image (ViamImage): The image to get detections for
|
|
178
|
+
|
|
179
|
+
Raises:
|
|
180
|
+
ViamError: Raised if given an image without a specified width and height
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
List[viam.proto.service.vision.Detection]: A list of 2D bounding boxes, their labels, and the
|
|
184
|
+
confidence score of the labels, around the found objects in the next 2D image
|
|
185
|
+
from the given camera, with the given detector applied to it.
|
|
186
|
+
|
|
187
|
+
For more information, see `Computer Vision service <https://docs.viam.com/dev/reference/apis/services/vision/#getdetections>`_.
|
|
188
|
+
"""
|
|
189
|
+
...
|
|
190
|
+
|
|
191
|
+
@abc.abstractmethod
|
|
192
|
+
async def get_classifications_from_camera(
|
|
193
|
+
self,
|
|
194
|
+
camera_name: str,
|
|
195
|
+
count: int,
|
|
196
|
+
*,
|
|
197
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
198
|
+
timeout: Optional[float] = None,
|
|
199
|
+
) -> List[Classification]:
|
|
200
|
+
"""Get a list of classifications in the next image given a camera and a classifier
|
|
201
|
+
|
|
202
|
+
::
|
|
203
|
+
|
|
204
|
+
my_classifier = VisionClient.from_robot(robot=machine, "my_classifier")
|
|
205
|
+
|
|
206
|
+
# Get the 2 classifications with the highest confidence scores for the next image from the camera
|
|
207
|
+
classifications = await my_classifier.get_classifications_from_camera(
|
|
208
|
+
"my_camera", 2)
|
|
209
|
+
|
|
210
|
+
Args:
|
|
211
|
+
camera_name (str): The name of the camera to use for detection
|
|
212
|
+
count (int): The number of classifications desired
|
|
213
|
+
|
|
214
|
+
returns:
|
|
215
|
+
List[viam.proto.service.vision.Classification]: The list of Classifications
|
|
216
|
+
|
|
217
|
+
For more information, see `Computer Vision service <https://docs.viam.com/dev/reference/apis/services/vision/#getclassificationsfromcamera>`_.
|
|
218
|
+
"""
|
|
219
|
+
...
|
|
220
|
+
|
|
221
|
+
@abc.abstractmethod
|
|
222
|
+
async def get_classifications(
|
|
223
|
+
self,
|
|
224
|
+
image: ViamImage,
|
|
225
|
+
count: int,
|
|
226
|
+
*,
|
|
227
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
228
|
+
timeout: Optional[float] = None,
|
|
229
|
+
) -> List[Classification]:
|
|
230
|
+
"""Get a list of classifications in the given image using the specified classifier
|
|
231
|
+
|
|
232
|
+
::
|
|
233
|
+
|
|
234
|
+
my_camera = Camera.from_robot(robot=machine, "my_camera")
|
|
235
|
+
my_classifier = VisionClient.from_robot(robot=machine, "my_classifier")
|
|
236
|
+
|
|
237
|
+
# Get an image from the camera
|
|
238
|
+
img = await my_camera.get_image()
|
|
239
|
+
|
|
240
|
+
# Get the 2 classifications with the highest confidence scores for the image
|
|
241
|
+
classifications = await my_classifier.get_classifications(img, 2)
|
|
242
|
+
|
|
243
|
+
Args:
|
|
244
|
+
image (ViamImage): The image to get detections for
|
|
245
|
+
count (int): The number of classifications desired
|
|
246
|
+
|
|
247
|
+
Returns:
|
|
248
|
+
List[viam.proto.service.vision.Classification]: The list of Classifications
|
|
249
|
+
|
|
250
|
+
For more information, see `Computer Vision service <https://docs.viam.com/dev/reference/apis/services/vision/#getclassifications>`_.
|
|
251
|
+
"""
|
|
252
|
+
...
|
|
253
|
+
|
|
254
|
+
@abc.abstractmethod
|
|
255
|
+
async def get_object_point_clouds(
|
|
256
|
+
self,
|
|
257
|
+
camera_name: str,
|
|
258
|
+
*,
|
|
259
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
260
|
+
timeout: Optional[float] = None,
|
|
261
|
+
) -> List[PointCloudObject]:
|
|
262
|
+
"""
|
|
263
|
+
Returns a list of the 3D point cloud objects and associated metadata in the latest
|
|
264
|
+
picture obtained from the specified 3D camera (using the specified segmenter).
|
|
265
|
+
|
|
266
|
+
To deserialize the returned information into a numpy array, use the Open3D library.
|
|
267
|
+
|
|
268
|
+
::
|
|
269
|
+
|
|
270
|
+
import numpy as np
|
|
271
|
+
import open3d as o3d
|
|
272
|
+
|
|
273
|
+
my_segmenter = VisionClient.from_robot(robot=machine, "my_segmenter")
|
|
274
|
+
# Get the objects from the camera output
|
|
275
|
+
objects = await my_segmenter.get_object_point_clouds("my_camera")
|
|
276
|
+
# write the first object point cloud into a temporary file
|
|
277
|
+
with open("/tmp/pointcloud_data.pcd", "wb") as f:
|
|
278
|
+
f.write(objects[0].point_cloud)
|
|
279
|
+
pcd = o3d.io.read_point_cloud("/tmp/pointcloud_data.pcd")
|
|
280
|
+
points = np.asarray(pcd.points)
|
|
281
|
+
|
|
282
|
+
Args:
|
|
283
|
+
camera_name (str): The name of the camera
|
|
284
|
+
|
|
285
|
+
Returns:
|
|
286
|
+
List[viam.proto.common.PointCloudObject]: The pointcloud objects with metadata
|
|
287
|
+
|
|
288
|
+
For more information, see `Computer Vision service <https://docs.viam.com/dev/reference/apis/services/vision/#getobjectpointclouds>`_.
|
|
289
|
+
"""
|
|
290
|
+
...
|
|
291
|
+
|
|
292
|
+
@abc.abstractmethod
|
|
293
|
+
async def get_properties(
|
|
294
|
+
self,
|
|
295
|
+
*,
|
|
296
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
297
|
+
timeout: Optional[float] = None,
|
|
298
|
+
) -> Properties:
|
|
299
|
+
"""
|
|
300
|
+
Get info about what vision methods the vision service provides. Currently returns boolean values that
|
|
301
|
+
state whether the service implements the classification, detection, and/or 3D object segmentation methods.
|
|
302
|
+
|
|
303
|
+
::
|
|
304
|
+
|
|
305
|
+
my_detector = VisionClient.from_robot(robot=machine, "my_detector")
|
|
306
|
+
properties = await my_detector.get_properties()
|
|
307
|
+
detections_supported = properties.detections_supported
|
|
308
|
+
classifications_supported = properties.classifications_supported
|
|
309
|
+
|
|
310
|
+
Returns:
|
|
311
|
+
Properties: The properties of the vision service
|
|
312
|
+
|
|
313
|
+
For more information, see `Computer Vision service <https://docs.viam.com/dev/reference/apis/services/vision/#getproperties>`_.
|
|
314
|
+
"""
|
|
315
|
+
...
|