viam-sdk 0.3.0__py3-none-linux_armv6l.whl → 0.66.0__py3-none-linux_armv6l.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of viam-sdk might be problematic. Click here for more details.
- viam/__init__.py +29 -2
- viam/app/_logs.py +34 -0
- viam/app/app_client.py +2696 -0
- viam/app/billing_client.py +185 -0
- viam/app/data_client.py +2231 -0
- viam/app/ml_training_client.py +249 -0
- viam/app/provisioning_client.py +93 -0
- viam/app/viam_client.py +275 -0
- viam/components/arm/__init__.py +3 -26
- viam/components/arm/arm.py +123 -8
- viam/components/arm/client.py +37 -24
- viam/components/arm/service.py +35 -32
- viam/components/audio_in/__init__.py +24 -0
- viam/components/audio_in/audio_in.py +74 -0
- viam/components/audio_in/client.py +76 -0
- viam/components/audio_in/service.py +83 -0
- viam/components/audio_out/__init__.py +21 -0
- viam/components/audio_out/audio_out.py +72 -0
- viam/components/audio_out/client.py +67 -0
- viam/components/audio_out/service.py +63 -0
- viam/components/base/__init__.py +6 -11
- viam/components/base/base.py +134 -8
- viam/components/base/client.py +51 -23
- viam/components/base/service.py +33 -30
- viam/components/board/__init__.py +3 -12
- viam/components/board/board.py +247 -91
- viam/components/board/client.py +149 -83
- viam/components/board/service.py +63 -33
- viam/components/button/__init__.py +10 -0
- viam/components/button/button.py +41 -0
- viam/components/button/client.py +52 -0
- viam/components/button/service.py +46 -0
- viam/components/camera/__init__.py +3 -3
- viam/components/camera/camera.py +62 -27
- viam/components/camera/client.py +59 -27
- viam/components/camera/service.py +42 -65
- viam/components/component_base.py +28 -5
- viam/components/encoder/__init__.py +1 -1
- viam/components/encoder/client.py +25 -14
- viam/components/encoder/encoder.py +48 -10
- viam/components/encoder/service.py +14 -18
- viam/components/gantry/__init__.py +1 -13
- viam/components/gantry/client.py +80 -25
- viam/components/gantry/gantry.py +123 -9
- viam/components/gantry/service.py +51 -29
- viam/components/generic/__init__.py +1 -1
- viam/components/generic/client.py +21 -8
- viam/components/generic/generic.py +10 -2
- viam/components/generic/service.py +12 -7
- viam/components/gripper/__init__.py +3 -13
- viam/components/gripper/client.py +69 -21
- viam/components/gripper/gripper.py +123 -3
- viam/components/gripper/service.py +44 -22
- viam/components/input/__init__.py +1 -14
- viam/components/input/client.py +55 -23
- viam/components/input/input.py +106 -3
- viam/components/input/service.py +16 -21
- viam/components/motor/__init__.py +1 -21
- viam/components/motor/client.py +56 -33
- viam/components/motor/motor.py +127 -4
- viam/components/motor/service.py +33 -44
- viam/components/movement_sensor/__init__.py +1 -1
- viam/components/movement_sensor/client.py +102 -45
- viam/components/movement_sensor/movement_sensor.py +130 -61
- viam/components/movement_sensor/service.py +38 -41
- viam/components/pose_tracker/__init__.py +1 -1
- viam/components/pose_tracker/client.py +18 -7
- viam/components/pose_tracker/pose_tracker.py +4 -2
- viam/components/pose_tracker/service.py +12 -10
- viam/components/power_sensor/__init__.py +17 -0
- viam/components/power_sensor/client.py +86 -0
- viam/components/power_sensor/power_sensor.py +104 -0
- viam/components/power_sensor/service.py +72 -0
- viam/components/sensor/__init__.py +2 -1
- viam/components/sensor/client.py +26 -10
- viam/components/sensor/sensor.py +22 -4
- viam/components/sensor/service.py +20 -11
- viam/components/servo/__init__.py +1 -13
- viam/components/servo/client.py +47 -21
- viam/components/servo/service.py +15 -22
- viam/components/servo/servo.py +61 -2
- viam/components/switch/__init__.py +10 -0
- viam/components/switch/client.py +83 -0
- viam/components/switch/service.py +72 -0
- viam/components/switch/switch.py +98 -0
- viam/errors.py +10 -0
- viam/gen/app/agent/v1/agent_grpc.py +29 -0
- viam/gen/app/agent/v1/agent_pb2.py +47 -0
- viam/gen/app/agent/v1/agent_pb2.pyi +280 -0
- viam/gen/app/cloudslam/v1/__init__.py +0 -0
- viam/gen/app/cloudslam/v1/cloud_slam_grpc.py +70 -0
- viam/gen/app/cloudslam/v1/cloud_slam_pb2.py +54 -0
- viam/gen/app/cloudslam/v1/cloud_slam_pb2.pyi +384 -0
- viam/gen/app/data/v1/data_grpc.py +197 -8
- viam/gen/app/data/v1/data_pb2.py +238 -99
- viam/gen/app/data/v1/data_pb2.pyi +1222 -259
- viam/gen/app/datapipelines/__init__.py +0 -0
- viam/gen/app/datapipelines/v1/__init__.py +0 -0
- viam/gen/app/datapipelines/v1/data_pipelines_grpc.py +84 -0
- viam/gen/app/datapipelines/v1/data_pipelines_pb2.py +57 -0
- viam/gen/app/datapipelines/v1/data_pipelines_pb2.pyi +387 -0
- viam/gen/app/dataset/__init__.py +0 -0
- viam/gen/app/dataset/v1/__init__.py +0 -0
- viam/gen/app/dataset/v1/dataset_grpc.py +68 -0
- viam/gen/app/dataset/v1/dataset_pb2.py +44 -0
- viam/gen/app/dataset/v1/dataset_pb2.pyi +214 -0
- viam/gen/app/datasync/v1/data_sync_grpc.py +21 -4
- viam/gen/app/datasync/v1/data_sync_pb2.py +62 -128
- viam/gen/app/datasync/v1/data_sync_pb2.pyi +156 -199
- viam/gen/app/mlinference/__init__.py +0 -0
- viam/gen/app/mlinference/v1/__init__.py +0 -0
- viam/gen/app/mlinference/v1/ml_inference_grpc.py +28 -0
- viam/gen/app/mlinference/v1/ml_inference_pb2.py +23 -0
- viam/gen/app/mlinference/v1/ml_inference_pb2.pyi +63 -0
- viam/gen/app/mltraining/v1/ml_training_grpc.py +51 -3
- viam/gen/app/mltraining/v1/ml_training_pb2.py +135 -58
- viam/gen/app/mltraining/v1/ml_training_pb2.pyi +328 -39
- viam/gen/app/packages/v1/packages_grpc.py +15 -1
- viam/gen/app/packages/v1/packages_pb2.py +44 -64
- viam/gen/app/packages/v1/packages_pb2.pyi +75 -85
- viam/gen/app/v1/app_grpc.py +644 -3
- viam/gen/app/v1/app_pb2.py +695 -295
- viam/gen/app/v1/app_pb2.pyi +4488 -635
- viam/gen/app/v1/billing_grpc.py +53 -11
- viam/gen/app/v1/billing_pb2.py +94 -39
- viam/gen/app/v1/billing_pb2.pyi +391 -191
- viam/gen/app/v1/end_user_grpc.py +59 -0
- viam/gen/app/v1/end_user_pb2.py +55 -0
- viam/gen/app/v1/end_user_pb2.pyi +181 -0
- viam/gen/app/v1/robot_grpc.py +16 -1
- viam/gen/app/v1/robot_pb2.py +122 -94
- viam/gen/app/v1/robot_pb2.pyi +463 -123
- viam/gen/common/v1/common_pb2.py +87 -58
- viam/gen/common/v1/common_pb2.pyi +456 -149
- viam/gen/component/arm/v1/arm_grpc.py +58 -2
- viam/gen/component/arm/v1/arm_pb2.py +68 -51
- viam/gen/component/arm/v1/arm_pb2.pyi +108 -42
- viam/gen/component/audioin/__init__.py +0 -0
- viam/gen/component/audioin/v1/__init__.py +0 -0
- viam/gen/component/audioin/v1/audioin_grpc.py +54 -0
- viam/gen/component/audioin/v1/audioin_pb2.py +34 -0
- viam/gen/component/audioin/v1/audioin_pb2.pyi +94 -0
- viam/gen/component/audioinput/v1/audioinput_grpc.py +25 -2
- viam/gen/component/audioinput/v1/audioinput_pb2.py +36 -31
- viam/gen/component/audioinput/v1/audioinput_pb2.pyi +22 -22
- viam/gen/component/audioout/__init__.py +0 -0
- viam/gen/component/audioout/v1/__init__.py +0 -0
- viam/gen/component/audioout/v1/audioout_grpc.py +54 -0
- viam/gen/component/audioout/v1/audioout_pb2.py +32 -0
- viam/gen/component/audioout/v1/audioout_pb2.pyi +47 -0
- viam/gen/component/base/v1/base_grpc.py +42 -2
- viam/gen/component/base/v1/base_pb2.py +58 -47
- viam/gen/component/base/v1/base_pb2.pyi +65 -30
- viam/gen/component/board/v1/board_grpc.py +59 -7
- viam/gen/component/board/v1/board_pb2.py +94 -73
- viam/gen/component/board/v1/board_pb2.pyi +165 -68
- viam/gen/component/button/__init__.py +0 -0
- viam/gen/component/button/v1/__init__.py +0 -0
- viam/gen/component/button/v1/button_grpc.py +38 -0
- viam/gen/component/button/v1/button_pb2.py +28 -0
- viam/gen/component/button/v1/button_pb2.pyi +39 -0
- viam/gen/component/camera/v1/camera_grpc.py +38 -2
- viam/gen/component/camera/v1/camera_pb2.py +60 -43
- viam/gen/component/camera/v1/camera_pb2.pyi +191 -37
- viam/gen/component/encoder/v1/encoder_grpc.py +25 -2
- viam/gen/component/encoder/v1/encoder_pb2.py +36 -31
- viam/gen/component/encoder/v1/encoder_pb2.pyi +15 -15
- viam/gen/component/gantry/v1/gantry_grpc.py +47 -2
- viam/gen/component/gantry/v1/gantry_pb2.py +56 -43
- viam/gen/component/gantry/v1/gantry_pb2.pyi +67 -31
- viam/gen/component/generic/v1/generic_grpc.py +16 -2
- viam/gen/component/generic/v1/generic_pb2.py +16 -11
- viam/gen/component/gripper/v1/gripper_grpc.py +44 -2
- viam/gen/component/gripper/v1/gripper_pb2.py +48 -35
- viam/gen/component/gripper/v1/gripper_pb2.pyi +62 -24
- viam/gen/component/inputcontroller/v1/input_controller_grpc.py +28 -2
- viam/gen/component/inputcontroller/v1/input_controller_pb2.py +46 -41
- viam/gen/component/inputcontroller/v1/input_controller_pb2.pyi +32 -36
- viam/gen/component/motor/v1/motor_grpc.py +51 -2
- viam/gen/component/motor/v1/motor_pb2.py +78 -67
- viam/gen/component/motor/v1/motor_pb2.pyi +75 -46
- viam/gen/component/movementsensor/v1/movementsensor_grpc.py +48 -2
- viam/gen/component/movementsensor/v1/movementsensor_pb2.py +70 -63
- viam/gen/component/movementsensor/v1/movementsensor_pb2.pyi +84 -57
- viam/gen/component/posetracker/v1/pose_tracker_grpc.py +19 -2
- viam/gen/component/posetracker/v1/pose_tracker_pb2.py +26 -21
- viam/gen/component/posetracker/v1/pose_tracker_pb2.pyi +9 -13
- viam/gen/component/powersensor/__init__.py +0 -0
- viam/gen/component/powersensor/v1/__init__.py +0 -0
- viam/gen/component/powersensor/v1/powersensor_grpc.py +62 -0
- viam/gen/component/powersensor/v1/powersensor_pb2.py +42 -0
- viam/gen/component/powersensor/v1/powersensor_pb2.pyi +124 -0
- viam/gen/component/sensor/v1/sensor_grpc.py +21 -5
- viam/gen/component/sensor/v1/sensor_pb2.py +18 -22
- viam/gen/component/sensor/v1/sensor_pb2.pyi +1 -69
- viam/gen/component/servo/v1/servo_grpc.py +28 -2
- viam/gen/component/servo/v1/servo_pb2.py +42 -37
- viam/gen/component/servo/v1/servo_pb2.pyi +22 -26
- viam/gen/component/switch/__init__.py +0 -0
- viam/gen/component/switch/v1/__init__.py +0 -0
- viam/gen/component/switch/v1/switch_grpc.py +54 -0
- viam/gen/component/switch/v1/switch_pb2.py +40 -0
- viam/gen/component/switch/v1/switch_pb2.pyi +116 -0
- viam/gen/component/testecho/v1/testecho_grpc.py +15 -0
- viam/gen/component/testecho/v1/testecho_pb2.py +29 -26
- viam/gen/component/testecho/v1/testecho_pb2.pyi +16 -20
- viam/gen/module/v1/module_grpc.py +18 -0
- viam/gen/module/v1/module_pb2.py +36 -33
- viam/gen/module/v1/module_pb2.pyi +39 -34
- viam/gen/opentelemetry/__init__.py +0 -0
- viam/gen/opentelemetry/proto/__init__.py +0 -0
- viam/gen/opentelemetry/proto/common/__init__.py +0 -0
- viam/gen/opentelemetry/proto/common/v1/__init__.py +0 -0
- viam/gen/opentelemetry/proto/common/v1/common_grpc.py +0 -0
- viam/gen/opentelemetry/proto/common/v1/common_pb2.py +27 -0
- viam/gen/opentelemetry/proto/common/v1/common_pb2.pyi +208 -0
- viam/gen/opentelemetry/proto/resource/__init__.py +0 -0
- viam/gen/opentelemetry/proto/resource/v1/__init__.py +0 -0
- viam/gen/opentelemetry/proto/resource/v1/resource_grpc.py +0 -0
- viam/gen/opentelemetry/proto/resource/v1/resource_pb2.py +18 -0
- viam/gen/opentelemetry/proto/resource/v1/resource_pb2.pyi +59 -0
- viam/gen/opentelemetry/proto/trace/__init__.py +0 -0
- viam/gen/opentelemetry/proto/trace/v1/__init__.py +0 -0
- viam/gen/opentelemetry/proto/trace/v1/trace_grpc.py +0 -0
- viam/gen/opentelemetry/proto/trace/v1/trace_pb2.py +37 -0
- viam/gen/opentelemetry/proto/trace/v1/trace_pb2.pyi +402 -0
- viam/gen/proto/rpc/examples/echo/v1/echo_grpc.py +12 -0
- viam/gen/proto/rpc/examples/echo/v1/echo_pb2.py +25 -22
- viam/gen/proto/rpc/examples/echo/v1/echo_pb2.pyi +13 -17
- viam/gen/proto/rpc/examples/echoresource/v1/echoresource_grpc.py +12 -0
- viam/gen/proto/rpc/examples/echoresource/v1/echoresource_pb2.py +23 -20
- viam/gen/proto/rpc/examples/echoresource/v1/echoresource_pb2.pyi +13 -17
- viam/gen/proto/rpc/v1/auth_grpc.py +11 -0
- viam/gen/proto/rpc/v1/auth_pb2.py +27 -24
- viam/gen/proto/rpc/v1/auth_pb2.pyi +12 -16
- viam/gen/proto/rpc/webrtc/v1/grpc_pb2.py +35 -32
- viam/gen/proto/rpc/webrtc/v1/grpc_pb2.pyi +37 -41
- viam/gen/proto/rpc/webrtc/v1/signaling_grpc.py +15 -0
- viam/gen/proto/rpc/webrtc/v1/signaling_pb2.py +62 -57
- viam/gen/proto/rpc/webrtc/v1/signaling_pb2.pyi +78 -69
- viam/gen/provisioning/__init__.py +0 -0
- viam/gen/provisioning/v1/__init__.py +0 -0
- viam/gen/provisioning/v1/provisioning_grpc.py +59 -0
- viam/gen/provisioning/v1/provisioning_pb2.py +45 -0
- viam/gen/provisioning/v1/provisioning_pb2.pyi +229 -0
- viam/gen/robot/v1/robot_grpc.py +144 -15
- viam/gen/robot/v1/robot_pb2.py +193 -119
- viam/gen/robot/v1/robot_pb2.pyi +565 -137
- viam/gen/service/datamanager/v1/data_manager_grpc.py +20 -2
- viam/gen/service/datamanager/v1/data_manager_pb2.py +27 -17
- viam/gen/service/datamanager/v1/data_manager_pb2.pyi +52 -10
- viam/gen/service/discovery/__init__.py +0 -0
- viam/gen/service/discovery/v1/__init__.py +0 -0
- viam/gen/service/discovery/v1/discovery_grpc.py +39 -0
- viam/gen/service/discovery/v1/discovery_pb2.py +29 -0
- viam/gen/service/discovery/v1/discovery_pb2.pyi +51 -0
- viam/gen/service/generic/__init__.py +0 -0
- viam/gen/service/generic/v1/__init__.py +0 -0
- viam/gen/service/generic/v1/generic_grpc.py +29 -0
- viam/gen/service/generic/v1/generic_pb2.py +21 -0
- viam/gen/service/generic/v1/generic_pb2.pyi +6 -0
- viam/gen/service/mlmodel/v1/mlmodel_grpc.py +9 -0
- viam/gen/service/mlmodel/v1/mlmodel_pb2.py +76 -29
- viam/gen/service/mlmodel/v1/mlmodel_pb2.pyi +307 -28
- viam/gen/service/motion/v1/motion_grpc.py +42 -4
- viam/gen/service/motion/v1/motion_pb2.py +119 -51
- viam/gen/service/motion/v1/motion_pb2.pyi +595 -120
- viam/gen/service/navigation/v1/navigation_grpc.py +49 -1
- viam/gen/service/navigation/v1/navigation_pb2.py +76 -51
- viam/gen/service/navigation/v1/navigation_pb2.pyi +188 -33
- viam/gen/service/sensors/v1/sensors_grpc.py +12 -0
- viam/gen/service/sensors/v1/sensors_pb2.py +60 -29
- viam/gen/service/sensors/v1/sensors_pb2.pyi +18 -21
- viam/gen/service/shell/v1/shell_grpc.py +27 -1
- viam/gen/service/shell/v1/shell_pb2.py +37 -15
- viam/gen/service/shell/v1/shell_pb2.pyi +260 -7
- viam/gen/service/slam/v1/slam_grpc.py +24 -2
- viam/gen/service/slam/v1/slam_pb2.py +44 -30
- viam/gen/service/slam/v1/slam_pb2.pyi +128 -27
- viam/gen/service/video/__init__.py +0 -0
- viam/gen/service/video/v1/__init__.py +0 -0
- viam/gen/service/video/v1/video_grpc.py +39 -0
- viam/gen/service/video/v1/video_pb2.py +29 -0
- viam/gen/service/video/v1/video_pb2.pyi +72 -0
- viam/gen/service/vision/v1/vision_grpc.py +39 -1
- viam/gen/service/vision/v1/vision_pb2.py +61 -45
- viam/gen/service/vision/v1/vision_pb2.pyi +180 -41
- viam/gen/service/worldstatestore/__init__.py +0 -0
- viam/gen/service/worldstatestore/v1/__init__.py +0 -0
- viam/gen/service/worldstatestore/v1/world_state_store_grpc.py +55 -0
- viam/gen/service/worldstatestore/v1/world_state_store_pb2.py +39 -0
- viam/gen/service/worldstatestore/v1/world_state_store_pb2.pyi +171 -0
- viam/gen/stream/__init__.py +0 -0
- viam/gen/stream/v1/__init__.py +0 -0
- viam/gen/stream/v1/stream_grpc.py +59 -0
- viam/gen/stream/v1/stream_pb2.py +39 -0
- viam/gen/stream/v1/stream_pb2.pyi +161 -0
- viam/gen/tagger/v1/tagger_pb2.py +9 -8
- viam/logging.py +160 -17
- viam/media/__init__.py +0 -9
- viam/media/audio.py +22 -10
- viam/media/utils/__init__.py +0 -0
- viam/media/utils/pil/__init__.py +55 -0
- viam/media/{viam_rgba_plugin.py → utils/pil/viam_rgba_plugin.py} +10 -16
- viam/media/viam_rgba.py +10 -0
- viam/media/video.py +197 -73
- viam/module/module.py +191 -44
- viam/module/resource_data_consumer.py +41 -0
- viam/module/service.py +9 -1
- viam/module/types.py +4 -5
- viam/operations.py +4 -3
- viam/proto/app/__init__.py +361 -5
- viam/proto/app/agent/__init__.py +28 -0
- viam/proto/app/billing.py +51 -27
- viam/proto/app/cloudslam/__init__.py +48 -0
- viam/proto/app/data/__init__.py +103 -17
- viam/proto/app/datapipelines/__init__.py +56 -0
- viam/proto/app/dataset/__init__.py +40 -0
- viam/proto/app/datasync/__init__.py +11 -5
- viam/proto/app/end_user.py +34 -0
- viam/proto/app/mlinference/__init__.py +15 -0
- viam/proto/app/mltraining/__init__.py +25 -1
- viam/proto/app/packages/__init__.py +3 -3
- viam/proto/app/robot.py +19 -1
- viam/proto/common/__init__.py +35 -8
- viam/proto/component/arm/__init__.py +9 -1
- viam/proto/component/audioin/__init__.py +16 -0
- viam/proto/component/audioinput/__init__.py +3 -1
- viam/proto/component/audioout/__init__.py +15 -0
- viam/proto/component/base/__init__.py +7 -1
- viam/proto/component/board/__init__.py +13 -5
- viam/proto/component/button/__init__.py +15 -0
- viam/proto/component/camera/__init__.py +9 -1
- viam/proto/component/encoder/__init__.py +3 -1
- viam/proto/component/gantry/__init__.py +7 -1
- viam/proto/component/generic/__init__.py +3 -1
- viam/proto/component/gripper/__init__.py +7 -1
- viam/proto/component/inputcontroller/__init__.py +7 -1
- viam/proto/component/motor/__init__.py +7 -1
- viam/proto/component/movementsensor/__init__.py +7 -1
- viam/proto/component/posetracker/__init__.py +7 -1
- viam/proto/component/powersensor/__init__.py +30 -0
- viam/proto/component/sensor/__init__.py +3 -4
- viam/proto/component/servo/__init__.py +3 -1
- viam/proto/component/switch/__init__.py +26 -0
- viam/proto/component/testecho/__init__.py +3 -1
- viam/proto/module/__init__.py +3 -1
- viam/proto/opentelemetry/__init__.py +0 -0
- viam/proto/opentelemetry/proto/__init__.py +0 -0
- viam/proto/opentelemetry/proto/common/__init__.py +15 -0
- viam/proto/opentelemetry/proto/resource/__init__.py +10 -0
- viam/proto/opentelemetry/proto/trace/__init__.py +15 -0
- viam/proto/provisioning/__init__.py +42 -0
- viam/proto/robot/__init__.py +57 -9
- viam/proto/rpc/auth.py +11 -1
- viam/proto/rpc/examples/echo/__init__.py +3 -1
- viam/proto/rpc/examples/echoresource/__init__.py +7 -1
- viam/proto/rpc/webrtc/grpc.py +3 -1
- viam/proto/rpc/webrtc/signaling.py +5 -1
- viam/proto/service/datamanager/__init__.py +15 -2
- viam/proto/service/discovery/__init__.py +15 -0
- viam/proto/service/generic/__init__.py +12 -0
- viam/proto/service/mlmodel/__init__.py +27 -1
- viam/proto/service/motion/__init__.py +35 -5
- viam/proto/service/navigation/__init__.py +19 -1
- viam/proto/service/sensors/__init__.py +3 -1
- viam/proto/service/shell/__init__.py +25 -2
- viam/proto/service/slam/__init__.py +13 -1
- viam/proto/service/video/__init__.py +15 -0
- viam/proto/service/vision/__init__.py +11 -1
- viam/proto/service/worldstatestore/__init__.py +32 -0
- viam/proto/stream/__init__.py +36 -0
- viam/py.typed +0 -0
- viam/resource/base.py +45 -8
- viam/resource/easy_resource.py +149 -0
- viam/resource/manager.py +35 -14
- viam/resource/registry.py +40 -52
- viam/resource/rpc_client_base.py +33 -1
- viam/resource/rpc_service_base.py +15 -8
- viam/resource/types.py +39 -26
- viam/robot/client.py +458 -91
- viam/robot/service.py +13 -107
- viam/rpc/dial.py +133 -15
- viam/rpc/libviam_rust_utils.so +0 -0
- viam/rpc/server.py +59 -15
- viam/rpc/types.py +2 -4
- viam/services/discovery/__init__.py +12 -0
- viam/services/discovery/client.py +55 -0
- viam/services/discovery/discovery.py +52 -0
- viam/services/discovery/service.py +43 -0
- viam/services/generic/__init__.py +18 -0
- viam/services/generic/client.py +58 -0
- viam/services/generic/generic.py +58 -0
- viam/services/generic/service.py +29 -0
- viam/services/mlmodel/__init__.py +15 -1
- viam/services/mlmodel/client.py +20 -15
- viam/services/mlmodel/mlmodel.py +44 -7
- viam/services/mlmodel/service.py +9 -13
- viam/services/mlmodel/utils.py +101 -0
- viam/services/motion/__init__.py +15 -3
- viam/services/motion/client.py +109 -150
- viam/services/motion/motion.py +380 -0
- viam/services/motion/service.py +132 -0
- viam/services/navigation/__init__.py +11 -0
- viam/services/navigation/client.py +99 -0
- viam/services/navigation/navigation.py +250 -0
- viam/services/navigation/service.py +137 -0
- viam/services/service_base.py +43 -4
- viam/services/service_client_base.py +4 -4
- viam/services/slam/__init__.py +4 -1
- viam/services/slam/client.py +21 -11
- viam/services/slam/service.py +16 -19
- viam/services/slam/slam.py +66 -5
- viam/services/vision/__init__.py +8 -0
- viam/services/vision/client.py +115 -111
- viam/services/vision/service.py +143 -0
- viam/services/vision/vision.py +317 -0
- viam/services/worldstatestore/__init__.py +18 -0
- viam/services/worldstatestore/client.py +94 -0
- viam/services/worldstatestore/service.py +55 -0
- viam/services/worldstatestore/worldstatestore.py +90 -0
- viam/sessions_client.py +254 -0
- viam/streams.py +44 -0
- viam/utils.py +143 -15
- viam/version_metadata.py +4 -0
- viam_sdk-0.66.0.dist-info/METADATA +157 -0
- viam_sdk-0.66.0.dist-info/RECORD +531 -0
- {viam_sdk-0.3.0.dist-info → viam_sdk-0.66.0.dist-info}/WHEEL +1 -1
- viam/components/audio_input/__init__.py +0 -18
- viam/components/audio_input/audio_input.py +0 -79
- viam/components/audio_input/client.py +0 -60
- viam/components/audio_input/service.py +0 -118
- viam/components/types.py +0 -5
- viam/gen/app/model/v1/model_grpc.py +0 -39
- viam/gen/app/model/v1/model_pb2.py +0 -71
- viam/gen/app/model/v1/model_pb2.pyi +0 -285
- viam/gen/proto/rpc/examples/fileupload/v1/fileupload_grpc.py +0 -21
- viam/gen/proto/rpc/examples/fileupload/v1/fileupload_pb2.py +0 -18
- viam/gen/proto/rpc/examples/fileupload/v1/fileupload_pb2.pyi +0 -49
- viam/media/media.py +0 -53
- viam/proto/app/model/__init__.py +0 -40
- viam/proto/rpc/examples/fileupload/__init__.py +0 -13
- viam/services/sensors/__init__.py +0 -5
- viam/services/sensors/client.py +0 -63
- viam_sdk-0.3.0.dist-info/LICENSE +0 -202
- viam_sdk-0.3.0.dist-info/METADATA +0 -122
- viam_sdk-0.3.0.dist-info/RECORD +0 -372
- /viam/{gen/app/model → app}/__init__.py +0 -0
- /viam/gen/app/{model/v1 → agent}/__init__.py +0 -0
- /viam/gen/{proto/rpc/examples/fileupload → app/agent/v1}/__init__.py +0 -0
- /viam/gen/{proto/rpc/examples/fileupload/v1 → app/cloudslam}/__init__.py +0 -0
- /LICENSE → /viam_sdk-0.66.0.dist-info/licenses/LICENSE +0 -0
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
import sys
|
|
3
|
+
from typing import Any, Final, Mapping, Optional, Sequence
|
|
4
|
+
|
|
5
|
+
if sys.version_info >= (3, 10):
|
|
6
|
+
from typing import TypeAlias
|
|
7
|
+
else:
|
|
8
|
+
from typing_extensions import TypeAlias
|
|
9
|
+
|
|
10
|
+
from viam.proto.common import GeoGeometry, Geometry, GeoPoint, Pose, PoseInFrame, Transform, WorldState
|
|
11
|
+
from viam.proto.service.motion import Constraints, GetPlanResponse, MotionConfiguration, PlanStatusWithID
|
|
12
|
+
from viam.resource.types import API, RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_SERVICE
|
|
13
|
+
from viam.utils import ValueTypes
|
|
14
|
+
|
|
15
|
+
from ..service_base import ServiceBase
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Motion(ServiceBase):
|
|
19
|
+
"""Motion is a Viam service that coordinates motion planning across all of the components in a given robot.
|
|
20
|
+
|
|
21
|
+
The motion planning service calculates a valid path that avoids self collision by default. If additional constraints are supplied in the
|
|
22
|
+
``world_state`` message, the motion planning service will also account for those.
|
|
23
|
+
|
|
24
|
+
For more information, see `Motion service <https://docs.viam.com/dev/reference/apis/services/motion/>`_.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
Plan: "TypeAlias" = GetPlanResponse
|
|
28
|
+
|
|
29
|
+
API: Final = API( # pyright: ignore [reportIncompatibleVariableOverride]
|
|
30
|
+
RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_SERVICE, "motion"
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
@abc.abstractmethod
|
|
34
|
+
async def move(
|
|
35
|
+
self,
|
|
36
|
+
component_name: str,
|
|
37
|
+
destination: PoseInFrame,
|
|
38
|
+
world_state: Optional[WorldState] = None,
|
|
39
|
+
constraints: Optional[Constraints] = None,
|
|
40
|
+
*,
|
|
41
|
+
extra: Optional[Mapping[str, Any]] = None,
|
|
42
|
+
timeout: Optional[float] = None,
|
|
43
|
+
) -> bool:
|
|
44
|
+
"""Plan and execute a movement to move the component specified to its goal destination.
|
|
45
|
+
|
|
46
|
+
Note: Frames designated with respect to components can also be used as the ``component_name`` when calling for a move. This
|
|
47
|
+
technique allows for planning and moving the frame itself to the ``destination``.
|
|
48
|
+
To do so, simply pass in a string into ``component_name``. Ex::
|
|
49
|
+
|
|
50
|
+
success = await MotionServiceClient.move("externalFrame", ...)
|
|
51
|
+
|
|
52
|
+
::
|
|
53
|
+
|
|
54
|
+
motion = MotionClient.from_robot(robot=machine, name="builtin")
|
|
55
|
+
|
|
56
|
+
# Assumes "my_gripper" on the machine
|
|
57
|
+
gripper_name = "my_gripper"
|
|
58
|
+
my_frame = "my_gripper_offset"
|
|
59
|
+
|
|
60
|
+
goal_pose = Pose(x=0, y=0, z=300, o_x=0, o_y=0, o_z=1, theta=0)
|
|
61
|
+
|
|
62
|
+
# Move the gripper
|
|
63
|
+
moved = await motion.move(component_name=gripper_name,
|
|
64
|
+
destination=PoseInFrame(reference_frame="myFrame",
|
|
65
|
+
pose=goal_pose),
|
|
66
|
+
world_state=worldState,
|
|
67
|
+
constraints={},
|
|
68
|
+
extra={})
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
component_name (str): Name of a component on a given robot.
|
|
72
|
+
destination (viam.proto.common.PoseInFrame): The destination to move to, expressed as a ``Pose`` and the frame in which it was
|
|
73
|
+
observed.
|
|
74
|
+
world_state (viam.proto.common.WorldState): When supplied, the motion service will create a plan that obeys any constraints
|
|
75
|
+
expressed in the WorldState message.
|
|
76
|
+
constraints (viam.proto.service.motion.Constraints): When supplied, the motion service will create a plan that obeys any
|
|
77
|
+
specified constraints. These can include:
|
|
78
|
+
- LinearConstraint: Specifies that the component being moved should move linearly relative to its goal.
|
|
79
|
+
- OrientationConstraint: Specifies that the component being moved will not deviate its orientation beyond some threshold
|
|
80
|
+
relative to the goal.
|
|
81
|
+
- CollisionSpecification: Used to selectively apply obstacle avoidance to specific parts of the robot.
|
|
82
|
+
- PseudolinearConstraint: Specifies that the component being moved should not deviate from the straight-line path to their
|
|
83
|
+
goal by more than a factor proportional to the distance from start to goal. For example, if a component is moving 100mm,
|
|
84
|
+
then a LineToleranceFactor of 1.0 means that the component will remain within a 100mm radius of the straight-line
|
|
85
|
+
start-goal path.
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
bool: Whether the move was successful.
|
|
89
|
+
|
|
90
|
+
For more information, see `Motion service <https://docs.viam.com/dev/reference/apis/services/motion/#move>`_.
|
|
91
|
+
"""
|
|
92
|
+
...
|
|
93
|
+
|
|
94
|
+
@abc.abstractmethod
|
|
95
|
+
async def move_on_globe(
|
|
96
|
+
self,
|
|
97
|
+
component_name: str,
|
|
98
|
+
destination: GeoPoint,
|
|
99
|
+
movement_sensor_name: str,
|
|
100
|
+
obstacles: Optional[Sequence[GeoGeometry]] = None,
|
|
101
|
+
heading: Optional[float] = None,
|
|
102
|
+
configuration: Optional[MotionConfiguration] = None,
|
|
103
|
+
*,
|
|
104
|
+
bounding_regions: Optional[Sequence[GeoGeometry]] = None,
|
|
105
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
106
|
+
timeout: Optional[float] = None,
|
|
107
|
+
) -> str:
|
|
108
|
+
"""Move a component to a specific latitude and longitude, using a ``MovementSensor`` to check the location.
|
|
109
|
+
|
|
110
|
+
``move_on_globe()`` is non blocking, meaning the motion service will move the component to the destination
|
|
111
|
+
GPS point after ``move_on_globe()`` returns.
|
|
112
|
+
|
|
113
|
+
Each successful ``move_on_globe()`` call returns a unique ExecutionID which you can use to identify all plans
|
|
114
|
+
generated during the ``move_on_globe()`` call.
|
|
115
|
+
|
|
116
|
+
You can monitor the progress of the ``move_on_globe()`` call by querying ``get_plan()`` and ``list_plan_statuses()``.
|
|
117
|
+
|
|
118
|
+
::
|
|
119
|
+
|
|
120
|
+
motion = MotionClient.from_robot(robot=machine, name="builtin")
|
|
121
|
+
|
|
122
|
+
# Get the names of the base and movement sensor
|
|
123
|
+
my_base_name = "my_base"
|
|
124
|
+
mvmnt_sensor_name = "my_movement_sensor"
|
|
125
|
+
# Define a destination GeoPoint at the GPS coordinates [0, 0]
|
|
126
|
+
my_destination = movement_sensor.GeoPoint(latitude=0, longitude=0)
|
|
127
|
+
|
|
128
|
+
# Move the base component to the designated geographic location, as reported by the movement sensor
|
|
129
|
+
execution_id = await motion.move_on_globe(
|
|
130
|
+
component_name=my_base_name,
|
|
131
|
+
destination=my_destination,
|
|
132
|
+
movement_sensor_name=mvmnt_sensor_name)
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
component_name (str): The name of the base to move.
|
|
136
|
+
destination (GeoPoint): The location of the component's destination, represented in geographic notation as a
|
|
137
|
+
GeoPoint (lat, lng).
|
|
138
|
+
movement_sensor_name (str): The name of the movement sensor that you want to use to check
|
|
139
|
+
the machine's location.
|
|
140
|
+
obstacles (Optional[Sequence[GeoGeometry]]): Obstacles to consider when planning the motion of the component,
|
|
141
|
+
with each represented as a GeoGeometry. Default: None
|
|
142
|
+
heading (Optional[float]): The compass heading, in degrees, that the machine's movement sensor should report
|
|
143
|
+
at the destination point. Range: [0-360) 0: North, 90: East, 180: South, 270: West. Default: None
|
|
144
|
+
configuration (Optional[MotionConfiguration]): The configuration you want to set across this machine for this
|
|
145
|
+
motion service. This parameter and each of its fields are optional.
|
|
146
|
+
|
|
147
|
+
- obstacle_detectors (Sequence[ObstacleDetector]): The names of each vision service and camera resource pair
|
|
148
|
+
you want to use for transient obstacle avoidance.
|
|
149
|
+
|
|
150
|
+
- position_polling_frequency_hz (float): The frequency in Hz to poll the position of the machine.
|
|
151
|
+
- obstacle_polling_frequency_hz (float): The frequency in Hz to poll the vision service for new obstacles.
|
|
152
|
+
- plan_deviation_m (float): The distance in meters that the machine can deviate from the motion plan.
|
|
153
|
+
- linear_m_per_sec (float): Linear velocity this machine should target when moving.
|
|
154
|
+
- angular_degs_per_sec (float): Angular velocity this machine should target when turning.
|
|
155
|
+
bounding_regions (Optional[Sequence[GeoGeometry]]): Set of obstacles which the robot must remain within while navigating
|
|
156
|
+
extra (Optional[Dict[str, Any]]): Extra options to pass to the underlying RPC call.
|
|
157
|
+
timeout (Optional[float]): An option to set how long to wait (in seconds) before calling a time-out and closing
|
|
158
|
+
the underlying RPC call.
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
str: ExecutionID of the ``move_on_globe()`` call, which can be used to track execution progress.
|
|
163
|
+
|
|
164
|
+
For more information, see `Motion service <https://docs.viam.com/dev/reference/apis/services/motion/#moveonglobe>`_.
|
|
165
|
+
"""
|
|
166
|
+
...
|
|
167
|
+
|
|
168
|
+
@abc.abstractmethod
|
|
169
|
+
async def move_on_map(
|
|
170
|
+
self,
|
|
171
|
+
component_name: str,
|
|
172
|
+
destination: Pose,
|
|
173
|
+
slam_service_name: str,
|
|
174
|
+
configuration: Optional[MotionConfiguration] = None,
|
|
175
|
+
obstacles: Optional[Sequence[Geometry]] = None,
|
|
176
|
+
*,
|
|
177
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
178
|
+
timeout: Optional[float] = None,
|
|
179
|
+
) -> str:
|
|
180
|
+
"""
|
|
181
|
+
Move a component to a specific pose, using a ``SlamService`` for the SLAM map, using a ``SLAM Service`` to check the location.
|
|
182
|
+
|
|
183
|
+
``move_on_map()`` is non blocking, meaning the motion service will move the component to the destination
|
|
184
|
+
Pose point after ``move_on_map()`` returns.
|
|
185
|
+
|
|
186
|
+
Each successful ``move_on_map()`` call returns a unique ExecutionID which you can use to identify all plans
|
|
187
|
+
generated during the ``move_on_map()`` call.
|
|
188
|
+
|
|
189
|
+
You can monitor the progress of the ``move_on_map()`` call by querying ``get_plan()`` and ``list_plan_statuses()``.
|
|
190
|
+
|
|
191
|
+
::
|
|
192
|
+
|
|
193
|
+
motion = MotionClient.from_robot(robot=machine, name="builtin")
|
|
194
|
+
|
|
195
|
+
# Get the names of the base component and SLAM service
|
|
196
|
+
my_base_name = "my_base"
|
|
197
|
+
my_slam_service_name = "my_slam_service"
|
|
198
|
+
|
|
199
|
+
# Define a destination pose with respect to the origin of the map from the SLAM service "my_slam_service"
|
|
200
|
+
my_pose = Pose(y=10)
|
|
201
|
+
|
|
202
|
+
# Move the base component to the destination pose of Y=10, a location of
|
|
203
|
+
# (0, 10, 0) in respect to the origin of the map
|
|
204
|
+
execution_id = await motion.move_on_map(component_name=my_base_name,
|
|
205
|
+
destination=my_pose,
|
|
206
|
+
slam_service_name=my_slam_service_name)
|
|
207
|
+
|
|
208
|
+
Args:
|
|
209
|
+
component_name (str): The name of the base to move.
|
|
210
|
+
destination (Pose): The destination, which can be any Pose with respect to the SLAM map's origin.
|
|
211
|
+
slam_service_name (str): The name of the SLAM service from which the SLAM map is requested.
|
|
212
|
+
configuration (Optional[MotionConfiguration]): The configuration you want to set across this machine for this motion service.
|
|
213
|
+
This parameter and each of its fields are optional.
|
|
214
|
+
|
|
215
|
+
- obstacle_detectors (Sequence[ObstacleDetector]): The names of each vision service and camera resource pair you want to use
|
|
216
|
+
for transient obstacle avoidance.
|
|
217
|
+
|
|
218
|
+
- position_polling_frequency_hz (float): The frequency in hz to poll the position of the machine.
|
|
219
|
+
- obstacle_polling_frequency_hz (float): The frequency in hz to poll the vision service for new obstacles.
|
|
220
|
+
- plan_deviation_m (float): The distance in meters that the machine can deviate from the motion plan.
|
|
221
|
+
- linear_m_per_sec (float): Linear velocity this machine should target when moving.
|
|
222
|
+
- angular_degs_per_sec (float): Angular velocity this machine should target when turning.
|
|
223
|
+
obstacles (Optional[Sequence[Geometry]]): Obstacles to be considered for motion planning.
|
|
224
|
+
extra (Optional[Dict[str, Any]]): Extra options to pass to the underlying RPC call.
|
|
225
|
+
timeout (Optional[float]): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying
|
|
226
|
+
RPC call.
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
str: ExecutionID of the ``move_on_map()`` call, which can be used to track execution progress.
|
|
230
|
+
|
|
231
|
+
For more information, see `Motion service <https://docs.viam.com/dev/reference/apis/services/motion/#moveonmap>`_.
|
|
232
|
+
"""
|
|
233
|
+
...
|
|
234
|
+
|
|
235
|
+
@abc.abstractmethod
|
|
236
|
+
async def stop_plan(
|
|
237
|
+
self,
|
|
238
|
+
component_name: str,
|
|
239
|
+
*,
|
|
240
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
241
|
+
timeout: Optional[float] = None,
|
|
242
|
+
):
|
|
243
|
+
"""Stop a component being moved by an in progress ``move_on_globe()`` or ``move_on_map()`` call.
|
|
244
|
+
|
|
245
|
+
::
|
|
246
|
+
|
|
247
|
+
motion = MotionClient.from_robot(robot=machine, name="builtin")
|
|
248
|
+
|
|
249
|
+
# Assuming a `move_on_globe()` started the execution
|
|
250
|
+
# Stop the base component which was instructed to move by `move_on_globe()`
|
|
251
|
+
# or `move_on_map()`
|
|
252
|
+
my_base_name = "my_base"
|
|
253
|
+
await motion.stop_plan(component_name=mvmnt_sensor)
|
|
254
|
+
|
|
255
|
+
Args:
|
|
256
|
+
component_name (str): The component to stop
|
|
257
|
+
|
|
258
|
+
For more information, see `Motion service <https://docs.viam.com/dev/reference/apis/services/motion/#stopplan>`_.
|
|
259
|
+
"""
|
|
260
|
+
...
|
|
261
|
+
|
|
262
|
+
@abc.abstractmethod
|
|
263
|
+
async def get_plan(
|
|
264
|
+
self,
|
|
265
|
+
component_name: str,
|
|
266
|
+
last_plan_only: bool = False,
|
|
267
|
+
execution_id: Optional[str] = None,
|
|
268
|
+
*,
|
|
269
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
270
|
+
timeout: Optional[float] = None,
|
|
271
|
+
) -> Plan:
|
|
272
|
+
"""By default: returns the plan history of the most recent ``move_on_globe()`` or ``move_on_map()`` call to move a component.
|
|
273
|
+
|
|
274
|
+
The plan history for executions before the most recent can be requested by providing an ExecutionID in the request.
|
|
275
|
+
|
|
276
|
+
Returns a result if both of the following conditions are met:
|
|
277
|
+
|
|
278
|
+
- the execution (call to ``move_on_globe()`` or ``move_on_map()``) is still executing **or** changed state within the last 24 hours
|
|
279
|
+
- the robot has not reinitialized
|
|
280
|
+
|
|
281
|
+
Plans never change.
|
|
282
|
+
|
|
283
|
+
Replans always create new plans.
|
|
284
|
+
|
|
285
|
+
Replans share the ExecutionID of the previously executing plan.
|
|
286
|
+
|
|
287
|
+
All repeated fields are in time ascending order.
|
|
288
|
+
|
|
289
|
+
::
|
|
290
|
+
|
|
291
|
+
motion = MotionClient.from_robot(robot=machine, name="builtin")
|
|
292
|
+
my_base_name = "my_base"
|
|
293
|
+
# Get the plan(s) of the base component which was instructed to move by `MoveOnGlobe()` or `MoveOnMap()`
|
|
294
|
+
resp = await motion.get_plan(component_name=my_base_name)
|
|
295
|
+
|
|
296
|
+
Args:
|
|
297
|
+
component_name (str): The component to stop
|
|
298
|
+
last_plan_only (Optional[bool]): If supplied, the response will only return the last plan for the component / execution.
|
|
299
|
+
execution_id (Optional[str]): If supplied, the response will only return plans with the provided execution_id.
|
|
300
|
+
|
|
301
|
+
Returns:
|
|
302
|
+
``GetPlanResponse`` (GetPlanResponse): The current PlanWithStatus & replan history which matches the request
|
|
303
|
+
|
|
304
|
+
For more information, see `Motion service <https://docs.viam.com/dev/reference/apis/services/motion/#getplan>`_.
|
|
305
|
+
"""
|
|
306
|
+
...
|
|
307
|
+
|
|
308
|
+
@abc.abstractmethod
|
|
309
|
+
async def list_plan_statuses(
|
|
310
|
+
self,
|
|
311
|
+
only_active_plans: bool = False,
|
|
312
|
+
*,
|
|
313
|
+
extra: Optional[Mapping[str, ValueTypes]] = None,
|
|
314
|
+
timeout: Optional[float] = None,
|
|
315
|
+
) -> Sequence[PlanStatusWithID]:
|
|
316
|
+
"""Returns the statuses of plans created by `move_on_globe()` or ``move_on_map()`` calls that meet at least one of the following
|
|
317
|
+
conditions since the motion service initialized:
|
|
318
|
+
|
|
319
|
+
- the plan's status is in progress
|
|
320
|
+
- the plan's status changed state within the last 24 hours
|
|
321
|
+
|
|
322
|
+
All repeated fields are in chronological order.
|
|
323
|
+
|
|
324
|
+
::
|
|
325
|
+
|
|
326
|
+
motion = MotionClient.from_robot(robot=machine, name="builtin")
|
|
327
|
+
# List the plan statuses of the motion service within the TTL
|
|
328
|
+
resp = await motion.list_plan_statuses()
|
|
329
|
+
|
|
330
|
+
Args:
|
|
331
|
+
only_active_plans (Optional[bool]): If supplied, the response will filter out any plans that are not executing.
|
|
332
|
+
|
|
333
|
+
Returns:
|
|
334
|
+
``ListPlanStatusesResponse`` (ListPlanStatusesResponse): List of last known statuses with the
|
|
335
|
+
associated IDs of all plans within the TTL ordered by timestamp in ascending order.
|
|
336
|
+
|
|
337
|
+
For more information, see `Motion service <https://docs.viam.com/dev/reference/apis/services/motion/#listplanstatuses>`_.
|
|
338
|
+
"""
|
|
339
|
+
...
|
|
340
|
+
|
|
341
|
+
@abc.abstractmethod
|
|
342
|
+
async def get_pose(
|
|
343
|
+
self,
|
|
344
|
+
component_name: str,
|
|
345
|
+
destination_frame: str,
|
|
346
|
+
supplemental_transforms: Optional[Sequence[Transform]] = None,
|
|
347
|
+
*,
|
|
348
|
+
extra: Optional[Mapping[str, Any]] = None,
|
|
349
|
+
timeout: Optional[float] = None,
|
|
350
|
+
) -> PoseInFrame:
|
|
351
|
+
"""
|
|
352
|
+
Get the Pose and observer frame for any given component on a robot.
|
|
353
|
+
|
|
354
|
+
::
|
|
355
|
+
|
|
356
|
+
# Note that the example uses the ``Gripper`` class, but any component class that inherits from ``ComponentBase`` will work
|
|
357
|
+
# (``Arm``, ``Base``, etc).
|
|
358
|
+
|
|
359
|
+
from viam.components.gripper import Gripper
|
|
360
|
+
from viam.services.motion import MotionClient
|
|
361
|
+
|
|
362
|
+
# Assume that the connect function is written and will return a valid machine.
|
|
363
|
+
machine = await connect()
|
|
364
|
+
|
|
365
|
+
motion = MotionClient.from_robot(robot=machine, name="builtin")
|
|
366
|
+
gripperPoseInWorld = await motion.get_pose(component_name="my_gripper",
|
|
367
|
+
destination_frame="world")
|
|
368
|
+
|
|
369
|
+
Args:
|
|
370
|
+
component_name (str): Name of a component on a robot.
|
|
371
|
+
destination_frame (str): Name of the desired reference frame.
|
|
372
|
+
supplemental_transforms (Optional[List[viam.proto.common.Transform]]): Transforms used to augment the robot's frame while
|
|
373
|
+
calculating pose.
|
|
374
|
+
|
|
375
|
+
Returns:
|
|
376
|
+
``Pose`` (PoseInFrame): Pose of the given component and the frame in which it was observed.
|
|
377
|
+
|
|
378
|
+
For more information, see `Motion service <https://docs.viam.com/dev/reference/apis/services/motion/#getpose>`_.
|
|
379
|
+
"""
|
|
380
|
+
...
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
from grpclib.server import Stream
|
|
2
|
+
|
|
3
|
+
from viam.proto.common import DoCommandRequest, DoCommandResponse
|
|
4
|
+
from viam.proto.service.motion import (
|
|
5
|
+
GetPlanRequest,
|
|
6
|
+
GetPlanResponse,
|
|
7
|
+
GetPoseRequest,
|
|
8
|
+
GetPoseResponse,
|
|
9
|
+
ListPlanStatusesRequest,
|
|
10
|
+
ListPlanStatusesResponse,
|
|
11
|
+
MoveOnGlobeRequest,
|
|
12
|
+
MoveOnGlobeResponse,
|
|
13
|
+
MoveOnMapRequest,
|
|
14
|
+
MoveOnMapResponse,
|
|
15
|
+
MoveRequest,
|
|
16
|
+
MoveResponse,
|
|
17
|
+
StopPlanRequest,
|
|
18
|
+
StopPlanResponse,
|
|
19
|
+
UnimplementedMotionServiceBase,
|
|
20
|
+
)
|
|
21
|
+
from viam.resource.rpc_service_base import ResourceRPCServiceBase
|
|
22
|
+
from viam.utils import dict_to_struct, struct_to_dict
|
|
23
|
+
|
|
24
|
+
from .motion import Motion
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class MotionRPCService(UnimplementedMotionServiceBase, ResourceRPCServiceBase[Motion]):
|
|
28
|
+
RESOURCE_TYPE = Motion
|
|
29
|
+
|
|
30
|
+
async def Move(self, stream: Stream[MoveRequest, MoveResponse]) -> None:
|
|
31
|
+
request = await stream.recv_message()
|
|
32
|
+
assert request is not None
|
|
33
|
+
service = self.get_resource(request.name)
|
|
34
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
35
|
+
result = await service.move(
|
|
36
|
+
request.component_name,
|
|
37
|
+
request.destination,
|
|
38
|
+
request.world_state,
|
|
39
|
+
request.constraints,
|
|
40
|
+
extra=struct_to_dict(request.extra),
|
|
41
|
+
timeout=timeout,
|
|
42
|
+
)
|
|
43
|
+
response = MoveResponse(success=result)
|
|
44
|
+
await stream.send_message(response)
|
|
45
|
+
|
|
46
|
+
async def MoveOnMap(self, stream: Stream[MoveOnMapRequest, MoveOnMapResponse]) -> None:
|
|
47
|
+
request = await stream.recv_message()
|
|
48
|
+
assert request is not None
|
|
49
|
+
service = self.get_resource(request.name)
|
|
50
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
51
|
+
result = await service.move_on_map(
|
|
52
|
+
request.component_name,
|
|
53
|
+
request.destination,
|
|
54
|
+
request.slam_service_name,
|
|
55
|
+
request.motion_configuration,
|
|
56
|
+
request.obstacles,
|
|
57
|
+
extra=struct_to_dict(request.extra),
|
|
58
|
+
timeout=timeout,
|
|
59
|
+
)
|
|
60
|
+
response = MoveOnMapResponse(execution_id=result)
|
|
61
|
+
await stream.send_message(response)
|
|
62
|
+
|
|
63
|
+
async def MoveOnGlobe(self, stream: Stream[MoveOnGlobeRequest, MoveOnGlobeResponse]) -> None:
|
|
64
|
+
request = await stream.recv_message()
|
|
65
|
+
assert request is not None
|
|
66
|
+
service = self.get_resource(request.name)
|
|
67
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
68
|
+
result = await service.move_on_globe(
|
|
69
|
+
request.component_name,
|
|
70
|
+
request.destination,
|
|
71
|
+
request.movement_sensor_name,
|
|
72
|
+
request.obstacles,
|
|
73
|
+
request.heading,
|
|
74
|
+
request.motion_configuration,
|
|
75
|
+
bounding_regions=request.bounding_regions,
|
|
76
|
+
extra=struct_to_dict(request.extra),
|
|
77
|
+
timeout=timeout,
|
|
78
|
+
)
|
|
79
|
+
response = MoveOnGlobeResponse(execution_id=result)
|
|
80
|
+
await stream.send_message(response)
|
|
81
|
+
|
|
82
|
+
async def GetPose(self, stream: Stream[GetPoseRequest, GetPoseResponse]) -> None:
|
|
83
|
+
request = await stream.recv_message()
|
|
84
|
+
assert request is not None
|
|
85
|
+
service = self.get_resource(request.name)
|
|
86
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
87
|
+
result = await service.get_pose(
|
|
88
|
+
request.component_name,
|
|
89
|
+
request.destination_frame,
|
|
90
|
+
request.supplemental_transforms,
|
|
91
|
+
extra=struct_to_dict(request.extra),
|
|
92
|
+
timeout=timeout,
|
|
93
|
+
)
|
|
94
|
+
response = GetPoseResponse(pose=result)
|
|
95
|
+
await stream.send_message(response)
|
|
96
|
+
|
|
97
|
+
async def StopPlan(self, stream: Stream[StopPlanRequest, StopPlanResponse]) -> None:
|
|
98
|
+
request = await stream.recv_message()
|
|
99
|
+
assert request is not None
|
|
100
|
+
service = self.get_resource(request.name)
|
|
101
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
102
|
+
await service.stop_plan(request.component_name, extra=struct_to_dict(request.extra), timeout=timeout)
|
|
103
|
+
response = StopPlanResponse()
|
|
104
|
+
await stream.send_message(response)
|
|
105
|
+
|
|
106
|
+
async def ListPlanStatuses(self, stream: Stream[ListPlanStatusesRequest, ListPlanStatusesResponse]) -> None:
|
|
107
|
+
request = await stream.recv_message()
|
|
108
|
+
assert request is not None
|
|
109
|
+
service = self.get_resource(request.name)
|
|
110
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
111
|
+
result = await service.list_plan_statuses(request.only_active_plans, extra=struct_to_dict(request.extra), timeout=timeout)
|
|
112
|
+
response = ListPlanStatusesResponse(plan_statuses_with_ids=result)
|
|
113
|
+
await stream.send_message(response)
|
|
114
|
+
|
|
115
|
+
async def GetPlan(self, stream: Stream[GetPlanRequest, GetPlanResponse]) -> None:
|
|
116
|
+
request = await stream.recv_message()
|
|
117
|
+
assert request is not None
|
|
118
|
+
service = self.get_resource(request.name)
|
|
119
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
120
|
+
result = await service.get_plan(
|
|
121
|
+
request.component_name, request.last_plan_only, request.execution_id, extra=struct_to_dict(request.extra), timeout=timeout
|
|
122
|
+
)
|
|
123
|
+
await stream.send_message(result)
|
|
124
|
+
|
|
125
|
+
async def DoCommand(self, stream: Stream[DoCommandRequest, DoCommandResponse]) -> None:
|
|
126
|
+
request = await stream.recv_message()
|
|
127
|
+
assert request is not None
|
|
128
|
+
service = self.get_resource(request.name)
|
|
129
|
+
timeout = stream.deadline.time_remaining() if stream.deadline else None
|
|
130
|
+
result = await service.do_command(struct_to_dict(request.command), timeout=timeout, metadata=stream.metadata)
|
|
131
|
+
response = DoCommandResponse(result=dict_to_struct(result))
|
|
132
|
+
await stream.send_message(response)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from viam.proto.common import GeoGeometry, GeoPoint
|
|
2
|
+
from viam.proto.service.navigation import MapType, Mode, Path, Waypoint
|
|
3
|
+
from viam.resource.registry import Registry, ResourceRegistration
|
|
4
|
+
|
|
5
|
+
from .client import NavigationClient
|
|
6
|
+
from .navigation import Navigation
|
|
7
|
+
from .service import NavigationRPCService
|
|
8
|
+
|
|
9
|
+
__all__ = ["GeoPoint", "GeoGeometry", "NavigationClient", "Navigation", "Waypoint", "Mode", "Path", "MapType"]
|
|
10
|
+
|
|
11
|
+
Registry.register_api(ResourceRegistration(Navigation, NavigationRPCService, lambda name, channel: NavigationClient(name, channel)))
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
from typing import List, Mapping, Optional
|
|
2
|
+
|
|
3
|
+
from grpclib.client import Channel
|
|
4
|
+
|
|
5
|
+
from viam.proto.common import DoCommandRequest, DoCommandResponse
|
|
6
|
+
from viam.proto.service.navigation import (
|
|
7
|
+
AddWaypointRequest,
|
|
8
|
+
GetLocationRequest,
|
|
9
|
+
GetLocationResponse,
|
|
10
|
+
GetModeRequest,
|
|
11
|
+
GetModeResponse,
|
|
12
|
+
GetObstaclesRequest,
|
|
13
|
+
GetObstaclesResponse,
|
|
14
|
+
GetPathsRequest,
|
|
15
|
+
GetPathsResponse,
|
|
16
|
+
GetPropertiesRequest,
|
|
17
|
+
GetPropertiesResponse,
|
|
18
|
+
GetWaypointsRequest,
|
|
19
|
+
GetWaypointsResponse,
|
|
20
|
+
NavigationServiceStub,
|
|
21
|
+
Path,
|
|
22
|
+
RemoveWaypointRequest,
|
|
23
|
+
SetModeRequest,
|
|
24
|
+
)
|
|
25
|
+
from viam.resource.rpc_client_base import ReconfigurableResourceRPCClientBase
|
|
26
|
+
from viam.utils import ValueTypes, dict_to_struct, struct_to_dict
|
|
27
|
+
|
|
28
|
+
from . import GeoGeometry, GeoPoint, MapType, Mode, Waypoint
|
|
29
|
+
from .navigation import Navigation
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class NavigationClient(Navigation, ReconfigurableResourceRPCClientBase):
|
|
33
|
+
"""
|
|
34
|
+
Connect to the NavigationService, which allows the robot to navigate to specified locations.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
client: NavigationServiceStub
|
|
38
|
+
|
|
39
|
+
def __init__(self, name: str, channel: Channel):
|
|
40
|
+
self.channel = channel
|
|
41
|
+
self.client = NavigationServiceStub(channel)
|
|
42
|
+
super().__init__(name)
|
|
43
|
+
|
|
44
|
+
async def get_paths(self, *, timeout: Optional[float] = None, **kwargs) -> List[Path]:
|
|
45
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
46
|
+
request = GetPathsRequest(name=self.name)
|
|
47
|
+
response: GetPathsResponse = await self.client.GetPaths(request, timeout=timeout, metadata=md)
|
|
48
|
+
return list(response.paths)
|
|
49
|
+
|
|
50
|
+
async def get_location(self, *, timeout: Optional[float] = None, **kwargs) -> GeoPoint:
|
|
51
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
52
|
+
request = GetLocationRequest(name=self.name)
|
|
53
|
+
response: GetLocationResponse = await self.client.GetLocation(request, timeout=timeout, metadata=md)
|
|
54
|
+
return response.location
|
|
55
|
+
|
|
56
|
+
async def get_obstacles(self, *, timeout: Optional[float] = None, **kwargs) -> List[GeoGeometry]:
|
|
57
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
58
|
+
request = GetObstaclesRequest(name=self.name)
|
|
59
|
+
response: GetObstaclesResponse = await self.client.GetObstacles(request, timeout=timeout, metadata=md)
|
|
60
|
+
return list(response.obstacles)
|
|
61
|
+
|
|
62
|
+
async def get_waypoints(self, *, timeout: Optional[float] = None, **kwargs) -> List[Waypoint]:
|
|
63
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
64
|
+
request = GetWaypointsRequest(name=self.name)
|
|
65
|
+
response: GetWaypointsResponse = await self.client.GetWaypoints(request, timeout=timeout, metadata=md)
|
|
66
|
+
return list(response.waypoints)
|
|
67
|
+
|
|
68
|
+
async def add_waypoint(self, point: GeoPoint, *, timeout: Optional[float] = None, **kwargs):
|
|
69
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
70
|
+
request = AddWaypointRequest(name=self.name, location=point)
|
|
71
|
+
await self.client.AddWaypoint(request, timeout=timeout, metadata=md)
|
|
72
|
+
|
|
73
|
+
async def remove_waypoint(self, id: str, *, timeout: Optional[float] = None, **kwargs):
|
|
74
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
75
|
+
request = RemoveWaypointRequest(name=self.name, id=id)
|
|
76
|
+
await self.client.RemoveWaypoint(request, timeout=timeout, metadata=md)
|
|
77
|
+
|
|
78
|
+
async def get_mode(self, *, timeout: Optional[float] = None, **kwargs) -> Mode.ValueType:
|
|
79
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
80
|
+
request = GetModeRequest(name=self.name)
|
|
81
|
+
response: GetModeResponse = await self.client.GetMode(request, timeout=timeout, metadata=md)
|
|
82
|
+
return response.mode
|
|
83
|
+
|
|
84
|
+
async def set_mode(self, mode: Mode.ValueType, *, timeout: Optional[float] = None, **kwargs):
|
|
85
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
86
|
+
request = SetModeRequest(name=self.name, mode=mode)
|
|
87
|
+
await self.client.SetMode(request, timeout=timeout, metadata=md)
|
|
88
|
+
|
|
89
|
+
async def get_properties(self, *, timeout: Optional[float] = None, **kwargs) -> MapType.ValueType:
|
|
90
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
91
|
+
request = GetPropertiesRequest(name=self.name)
|
|
92
|
+
response: GetPropertiesResponse = await self.client.GetProperties(request, timeout=timeout, metadata=md)
|
|
93
|
+
return response.map_type
|
|
94
|
+
|
|
95
|
+
async def do_command(self, command: Mapping[str, ValueTypes], *, timeout: Optional[float] = None, **kwargs) -> Mapping[str, ValueTypes]:
|
|
96
|
+
md = kwargs.get("metadata", self.Metadata()).proto
|
|
97
|
+
request = DoCommandRequest(name=self.name, command=dict_to_struct(command))
|
|
98
|
+
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout, metadata=md)
|
|
99
|
+
return struct_to_dict(response.result)
|