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.

Files changed (452) hide show
  1. viam/__init__.py +29 -2
  2. viam/app/_logs.py +34 -0
  3. viam/app/app_client.py +2696 -0
  4. viam/app/billing_client.py +185 -0
  5. viam/app/data_client.py +2231 -0
  6. viam/app/ml_training_client.py +249 -0
  7. viam/app/provisioning_client.py +93 -0
  8. viam/app/viam_client.py +275 -0
  9. viam/components/arm/__init__.py +3 -26
  10. viam/components/arm/arm.py +123 -8
  11. viam/components/arm/client.py +37 -24
  12. viam/components/arm/service.py +35 -32
  13. viam/components/audio_in/__init__.py +24 -0
  14. viam/components/audio_in/audio_in.py +74 -0
  15. viam/components/audio_in/client.py +76 -0
  16. viam/components/audio_in/service.py +83 -0
  17. viam/components/audio_out/__init__.py +21 -0
  18. viam/components/audio_out/audio_out.py +72 -0
  19. viam/components/audio_out/client.py +67 -0
  20. viam/components/audio_out/service.py +63 -0
  21. viam/components/base/__init__.py +6 -11
  22. viam/components/base/base.py +134 -8
  23. viam/components/base/client.py +51 -23
  24. viam/components/base/service.py +33 -30
  25. viam/components/board/__init__.py +3 -12
  26. viam/components/board/board.py +247 -91
  27. viam/components/board/client.py +149 -83
  28. viam/components/board/service.py +63 -33
  29. viam/components/button/__init__.py +10 -0
  30. viam/components/button/button.py +41 -0
  31. viam/components/button/client.py +52 -0
  32. viam/components/button/service.py +46 -0
  33. viam/components/camera/__init__.py +3 -3
  34. viam/components/camera/camera.py +62 -27
  35. viam/components/camera/client.py +59 -27
  36. viam/components/camera/service.py +42 -65
  37. viam/components/component_base.py +28 -5
  38. viam/components/encoder/__init__.py +1 -1
  39. viam/components/encoder/client.py +25 -14
  40. viam/components/encoder/encoder.py +48 -10
  41. viam/components/encoder/service.py +14 -18
  42. viam/components/gantry/__init__.py +1 -13
  43. viam/components/gantry/client.py +80 -25
  44. viam/components/gantry/gantry.py +123 -9
  45. viam/components/gantry/service.py +51 -29
  46. viam/components/generic/__init__.py +1 -1
  47. viam/components/generic/client.py +21 -8
  48. viam/components/generic/generic.py +10 -2
  49. viam/components/generic/service.py +12 -7
  50. viam/components/gripper/__init__.py +3 -13
  51. viam/components/gripper/client.py +69 -21
  52. viam/components/gripper/gripper.py +123 -3
  53. viam/components/gripper/service.py +44 -22
  54. viam/components/input/__init__.py +1 -14
  55. viam/components/input/client.py +55 -23
  56. viam/components/input/input.py +106 -3
  57. viam/components/input/service.py +16 -21
  58. viam/components/motor/__init__.py +1 -21
  59. viam/components/motor/client.py +56 -33
  60. viam/components/motor/motor.py +127 -4
  61. viam/components/motor/service.py +33 -44
  62. viam/components/movement_sensor/__init__.py +1 -1
  63. viam/components/movement_sensor/client.py +102 -45
  64. viam/components/movement_sensor/movement_sensor.py +130 -61
  65. viam/components/movement_sensor/service.py +38 -41
  66. viam/components/pose_tracker/__init__.py +1 -1
  67. viam/components/pose_tracker/client.py +18 -7
  68. viam/components/pose_tracker/pose_tracker.py +4 -2
  69. viam/components/pose_tracker/service.py +12 -10
  70. viam/components/power_sensor/__init__.py +17 -0
  71. viam/components/power_sensor/client.py +86 -0
  72. viam/components/power_sensor/power_sensor.py +104 -0
  73. viam/components/power_sensor/service.py +72 -0
  74. viam/components/sensor/__init__.py +2 -1
  75. viam/components/sensor/client.py +26 -10
  76. viam/components/sensor/sensor.py +22 -4
  77. viam/components/sensor/service.py +20 -11
  78. viam/components/servo/__init__.py +1 -13
  79. viam/components/servo/client.py +47 -21
  80. viam/components/servo/service.py +15 -22
  81. viam/components/servo/servo.py +61 -2
  82. viam/components/switch/__init__.py +10 -0
  83. viam/components/switch/client.py +83 -0
  84. viam/components/switch/service.py +72 -0
  85. viam/components/switch/switch.py +98 -0
  86. viam/errors.py +10 -0
  87. viam/gen/app/agent/v1/agent_grpc.py +29 -0
  88. viam/gen/app/agent/v1/agent_pb2.py +47 -0
  89. viam/gen/app/agent/v1/agent_pb2.pyi +280 -0
  90. viam/gen/app/cloudslam/v1/__init__.py +0 -0
  91. viam/gen/app/cloudslam/v1/cloud_slam_grpc.py +70 -0
  92. viam/gen/app/cloudslam/v1/cloud_slam_pb2.py +54 -0
  93. viam/gen/app/cloudslam/v1/cloud_slam_pb2.pyi +384 -0
  94. viam/gen/app/data/v1/data_grpc.py +197 -8
  95. viam/gen/app/data/v1/data_pb2.py +238 -99
  96. viam/gen/app/data/v1/data_pb2.pyi +1222 -259
  97. viam/gen/app/datapipelines/__init__.py +0 -0
  98. viam/gen/app/datapipelines/v1/__init__.py +0 -0
  99. viam/gen/app/datapipelines/v1/data_pipelines_grpc.py +84 -0
  100. viam/gen/app/datapipelines/v1/data_pipelines_pb2.py +57 -0
  101. viam/gen/app/datapipelines/v1/data_pipelines_pb2.pyi +387 -0
  102. viam/gen/app/dataset/__init__.py +0 -0
  103. viam/gen/app/dataset/v1/__init__.py +0 -0
  104. viam/gen/app/dataset/v1/dataset_grpc.py +68 -0
  105. viam/gen/app/dataset/v1/dataset_pb2.py +44 -0
  106. viam/gen/app/dataset/v1/dataset_pb2.pyi +214 -0
  107. viam/gen/app/datasync/v1/data_sync_grpc.py +21 -4
  108. viam/gen/app/datasync/v1/data_sync_pb2.py +62 -128
  109. viam/gen/app/datasync/v1/data_sync_pb2.pyi +156 -199
  110. viam/gen/app/mlinference/__init__.py +0 -0
  111. viam/gen/app/mlinference/v1/__init__.py +0 -0
  112. viam/gen/app/mlinference/v1/ml_inference_grpc.py +28 -0
  113. viam/gen/app/mlinference/v1/ml_inference_pb2.py +23 -0
  114. viam/gen/app/mlinference/v1/ml_inference_pb2.pyi +63 -0
  115. viam/gen/app/mltraining/v1/ml_training_grpc.py +51 -3
  116. viam/gen/app/mltraining/v1/ml_training_pb2.py +135 -58
  117. viam/gen/app/mltraining/v1/ml_training_pb2.pyi +328 -39
  118. viam/gen/app/packages/v1/packages_grpc.py +15 -1
  119. viam/gen/app/packages/v1/packages_pb2.py +44 -64
  120. viam/gen/app/packages/v1/packages_pb2.pyi +75 -85
  121. viam/gen/app/v1/app_grpc.py +644 -3
  122. viam/gen/app/v1/app_pb2.py +695 -295
  123. viam/gen/app/v1/app_pb2.pyi +4488 -635
  124. viam/gen/app/v1/billing_grpc.py +53 -11
  125. viam/gen/app/v1/billing_pb2.py +94 -39
  126. viam/gen/app/v1/billing_pb2.pyi +391 -191
  127. viam/gen/app/v1/end_user_grpc.py +59 -0
  128. viam/gen/app/v1/end_user_pb2.py +55 -0
  129. viam/gen/app/v1/end_user_pb2.pyi +181 -0
  130. viam/gen/app/v1/robot_grpc.py +16 -1
  131. viam/gen/app/v1/robot_pb2.py +122 -94
  132. viam/gen/app/v1/robot_pb2.pyi +463 -123
  133. viam/gen/common/v1/common_pb2.py +87 -58
  134. viam/gen/common/v1/common_pb2.pyi +456 -149
  135. viam/gen/component/arm/v1/arm_grpc.py +58 -2
  136. viam/gen/component/arm/v1/arm_pb2.py +68 -51
  137. viam/gen/component/arm/v1/arm_pb2.pyi +108 -42
  138. viam/gen/component/audioin/__init__.py +0 -0
  139. viam/gen/component/audioin/v1/__init__.py +0 -0
  140. viam/gen/component/audioin/v1/audioin_grpc.py +54 -0
  141. viam/gen/component/audioin/v1/audioin_pb2.py +34 -0
  142. viam/gen/component/audioin/v1/audioin_pb2.pyi +94 -0
  143. viam/gen/component/audioinput/v1/audioinput_grpc.py +25 -2
  144. viam/gen/component/audioinput/v1/audioinput_pb2.py +36 -31
  145. viam/gen/component/audioinput/v1/audioinput_pb2.pyi +22 -22
  146. viam/gen/component/audioout/__init__.py +0 -0
  147. viam/gen/component/audioout/v1/__init__.py +0 -0
  148. viam/gen/component/audioout/v1/audioout_grpc.py +54 -0
  149. viam/gen/component/audioout/v1/audioout_pb2.py +32 -0
  150. viam/gen/component/audioout/v1/audioout_pb2.pyi +47 -0
  151. viam/gen/component/base/v1/base_grpc.py +42 -2
  152. viam/gen/component/base/v1/base_pb2.py +58 -47
  153. viam/gen/component/base/v1/base_pb2.pyi +65 -30
  154. viam/gen/component/board/v1/board_grpc.py +59 -7
  155. viam/gen/component/board/v1/board_pb2.py +94 -73
  156. viam/gen/component/board/v1/board_pb2.pyi +165 -68
  157. viam/gen/component/button/__init__.py +0 -0
  158. viam/gen/component/button/v1/__init__.py +0 -0
  159. viam/gen/component/button/v1/button_grpc.py +38 -0
  160. viam/gen/component/button/v1/button_pb2.py +28 -0
  161. viam/gen/component/button/v1/button_pb2.pyi +39 -0
  162. viam/gen/component/camera/v1/camera_grpc.py +38 -2
  163. viam/gen/component/camera/v1/camera_pb2.py +60 -43
  164. viam/gen/component/camera/v1/camera_pb2.pyi +191 -37
  165. viam/gen/component/encoder/v1/encoder_grpc.py +25 -2
  166. viam/gen/component/encoder/v1/encoder_pb2.py +36 -31
  167. viam/gen/component/encoder/v1/encoder_pb2.pyi +15 -15
  168. viam/gen/component/gantry/v1/gantry_grpc.py +47 -2
  169. viam/gen/component/gantry/v1/gantry_pb2.py +56 -43
  170. viam/gen/component/gantry/v1/gantry_pb2.pyi +67 -31
  171. viam/gen/component/generic/v1/generic_grpc.py +16 -2
  172. viam/gen/component/generic/v1/generic_pb2.py +16 -11
  173. viam/gen/component/gripper/v1/gripper_grpc.py +44 -2
  174. viam/gen/component/gripper/v1/gripper_pb2.py +48 -35
  175. viam/gen/component/gripper/v1/gripper_pb2.pyi +62 -24
  176. viam/gen/component/inputcontroller/v1/input_controller_grpc.py +28 -2
  177. viam/gen/component/inputcontroller/v1/input_controller_pb2.py +46 -41
  178. viam/gen/component/inputcontroller/v1/input_controller_pb2.pyi +32 -36
  179. viam/gen/component/motor/v1/motor_grpc.py +51 -2
  180. viam/gen/component/motor/v1/motor_pb2.py +78 -67
  181. viam/gen/component/motor/v1/motor_pb2.pyi +75 -46
  182. viam/gen/component/movementsensor/v1/movementsensor_grpc.py +48 -2
  183. viam/gen/component/movementsensor/v1/movementsensor_pb2.py +70 -63
  184. viam/gen/component/movementsensor/v1/movementsensor_pb2.pyi +84 -57
  185. viam/gen/component/posetracker/v1/pose_tracker_grpc.py +19 -2
  186. viam/gen/component/posetracker/v1/pose_tracker_pb2.py +26 -21
  187. viam/gen/component/posetracker/v1/pose_tracker_pb2.pyi +9 -13
  188. viam/gen/component/powersensor/__init__.py +0 -0
  189. viam/gen/component/powersensor/v1/__init__.py +0 -0
  190. viam/gen/component/powersensor/v1/powersensor_grpc.py +62 -0
  191. viam/gen/component/powersensor/v1/powersensor_pb2.py +42 -0
  192. viam/gen/component/powersensor/v1/powersensor_pb2.pyi +124 -0
  193. viam/gen/component/sensor/v1/sensor_grpc.py +21 -5
  194. viam/gen/component/sensor/v1/sensor_pb2.py +18 -22
  195. viam/gen/component/sensor/v1/sensor_pb2.pyi +1 -69
  196. viam/gen/component/servo/v1/servo_grpc.py +28 -2
  197. viam/gen/component/servo/v1/servo_pb2.py +42 -37
  198. viam/gen/component/servo/v1/servo_pb2.pyi +22 -26
  199. viam/gen/component/switch/__init__.py +0 -0
  200. viam/gen/component/switch/v1/__init__.py +0 -0
  201. viam/gen/component/switch/v1/switch_grpc.py +54 -0
  202. viam/gen/component/switch/v1/switch_pb2.py +40 -0
  203. viam/gen/component/switch/v1/switch_pb2.pyi +116 -0
  204. viam/gen/component/testecho/v1/testecho_grpc.py +15 -0
  205. viam/gen/component/testecho/v1/testecho_pb2.py +29 -26
  206. viam/gen/component/testecho/v1/testecho_pb2.pyi +16 -20
  207. viam/gen/module/v1/module_grpc.py +18 -0
  208. viam/gen/module/v1/module_pb2.py +36 -33
  209. viam/gen/module/v1/module_pb2.pyi +39 -34
  210. viam/gen/opentelemetry/__init__.py +0 -0
  211. viam/gen/opentelemetry/proto/__init__.py +0 -0
  212. viam/gen/opentelemetry/proto/common/__init__.py +0 -0
  213. viam/gen/opentelemetry/proto/common/v1/__init__.py +0 -0
  214. viam/gen/opentelemetry/proto/common/v1/common_grpc.py +0 -0
  215. viam/gen/opentelemetry/proto/common/v1/common_pb2.py +27 -0
  216. viam/gen/opentelemetry/proto/common/v1/common_pb2.pyi +208 -0
  217. viam/gen/opentelemetry/proto/resource/__init__.py +0 -0
  218. viam/gen/opentelemetry/proto/resource/v1/__init__.py +0 -0
  219. viam/gen/opentelemetry/proto/resource/v1/resource_grpc.py +0 -0
  220. viam/gen/opentelemetry/proto/resource/v1/resource_pb2.py +18 -0
  221. viam/gen/opentelemetry/proto/resource/v1/resource_pb2.pyi +59 -0
  222. viam/gen/opentelemetry/proto/trace/__init__.py +0 -0
  223. viam/gen/opentelemetry/proto/trace/v1/__init__.py +0 -0
  224. viam/gen/opentelemetry/proto/trace/v1/trace_grpc.py +0 -0
  225. viam/gen/opentelemetry/proto/trace/v1/trace_pb2.py +37 -0
  226. viam/gen/opentelemetry/proto/trace/v1/trace_pb2.pyi +402 -0
  227. viam/gen/proto/rpc/examples/echo/v1/echo_grpc.py +12 -0
  228. viam/gen/proto/rpc/examples/echo/v1/echo_pb2.py +25 -22
  229. viam/gen/proto/rpc/examples/echo/v1/echo_pb2.pyi +13 -17
  230. viam/gen/proto/rpc/examples/echoresource/v1/echoresource_grpc.py +12 -0
  231. viam/gen/proto/rpc/examples/echoresource/v1/echoresource_pb2.py +23 -20
  232. viam/gen/proto/rpc/examples/echoresource/v1/echoresource_pb2.pyi +13 -17
  233. viam/gen/proto/rpc/v1/auth_grpc.py +11 -0
  234. viam/gen/proto/rpc/v1/auth_pb2.py +27 -24
  235. viam/gen/proto/rpc/v1/auth_pb2.pyi +12 -16
  236. viam/gen/proto/rpc/webrtc/v1/grpc_pb2.py +35 -32
  237. viam/gen/proto/rpc/webrtc/v1/grpc_pb2.pyi +37 -41
  238. viam/gen/proto/rpc/webrtc/v1/signaling_grpc.py +15 -0
  239. viam/gen/proto/rpc/webrtc/v1/signaling_pb2.py +62 -57
  240. viam/gen/proto/rpc/webrtc/v1/signaling_pb2.pyi +78 -69
  241. viam/gen/provisioning/__init__.py +0 -0
  242. viam/gen/provisioning/v1/__init__.py +0 -0
  243. viam/gen/provisioning/v1/provisioning_grpc.py +59 -0
  244. viam/gen/provisioning/v1/provisioning_pb2.py +45 -0
  245. viam/gen/provisioning/v1/provisioning_pb2.pyi +229 -0
  246. viam/gen/robot/v1/robot_grpc.py +144 -15
  247. viam/gen/robot/v1/robot_pb2.py +193 -119
  248. viam/gen/robot/v1/robot_pb2.pyi +565 -137
  249. viam/gen/service/datamanager/v1/data_manager_grpc.py +20 -2
  250. viam/gen/service/datamanager/v1/data_manager_pb2.py +27 -17
  251. viam/gen/service/datamanager/v1/data_manager_pb2.pyi +52 -10
  252. viam/gen/service/discovery/__init__.py +0 -0
  253. viam/gen/service/discovery/v1/__init__.py +0 -0
  254. viam/gen/service/discovery/v1/discovery_grpc.py +39 -0
  255. viam/gen/service/discovery/v1/discovery_pb2.py +29 -0
  256. viam/gen/service/discovery/v1/discovery_pb2.pyi +51 -0
  257. viam/gen/service/generic/__init__.py +0 -0
  258. viam/gen/service/generic/v1/__init__.py +0 -0
  259. viam/gen/service/generic/v1/generic_grpc.py +29 -0
  260. viam/gen/service/generic/v1/generic_pb2.py +21 -0
  261. viam/gen/service/generic/v1/generic_pb2.pyi +6 -0
  262. viam/gen/service/mlmodel/v1/mlmodel_grpc.py +9 -0
  263. viam/gen/service/mlmodel/v1/mlmodel_pb2.py +76 -29
  264. viam/gen/service/mlmodel/v1/mlmodel_pb2.pyi +307 -28
  265. viam/gen/service/motion/v1/motion_grpc.py +42 -4
  266. viam/gen/service/motion/v1/motion_pb2.py +119 -51
  267. viam/gen/service/motion/v1/motion_pb2.pyi +595 -120
  268. viam/gen/service/navigation/v1/navigation_grpc.py +49 -1
  269. viam/gen/service/navigation/v1/navigation_pb2.py +76 -51
  270. viam/gen/service/navigation/v1/navigation_pb2.pyi +188 -33
  271. viam/gen/service/sensors/v1/sensors_grpc.py +12 -0
  272. viam/gen/service/sensors/v1/sensors_pb2.py +60 -29
  273. viam/gen/service/sensors/v1/sensors_pb2.pyi +18 -21
  274. viam/gen/service/shell/v1/shell_grpc.py +27 -1
  275. viam/gen/service/shell/v1/shell_pb2.py +37 -15
  276. viam/gen/service/shell/v1/shell_pb2.pyi +260 -7
  277. viam/gen/service/slam/v1/slam_grpc.py +24 -2
  278. viam/gen/service/slam/v1/slam_pb2.py +44 -30
  279. viam/gen/service/slam/v1/slam_pb2.pyi +128 -27
  280. viam/gen/service/video/__init__.py +0 -0
  281. viam/gen/service/video/v1/__init__.py +0 -0
  282. viam/gen/service/video/v1/video_grpc.py +39 -0
  283. viam/gen/service/video/v1/video_pb2.py +29 -0
  284. viam/gen/service/video/v1/video_pb2.pyi +72 -0
  285. viam/gen/service/vision/v1/vision_grpc.py +39 -1
  286. viam/gen/service/vision/v1/vision_pb2.py +61 -45
  287. viam/gen/service/vision/v1/vision_pb2.pyi +180 -41
  288. viam/gen/service/worldstatestore/__init__.py +0 -0
  289. viam/gen/service/worldstatestore/v1/__init__.py +0 -0
  290. viam/gen/service/worldstatestore/v1/world_state_store_grpc.py +55 -0
  291. viam/gen/service/worldstatestore/v1/world_state_store_pb2.py +39 -0
  292. viam/gen/service/worldstatestore/v1/world_state_store_pb2.pyi +171 -0
  293. viam/gen/stream/__init__.py +0 -0
  294. viam/gen/stream/v1/__init__.py +0 -0
  295. viam/gen/stream/v1/stream_grpc.py +59 -0
  296. viam/gen/stream/v1/stream_pb2.py +39 -0
  297. viam/gen/stream/v1/stream_pb2.pyi +161 -0
  298. viam/gen/tagger/v1/tagger_pb2.py +9 -8
  299. viam/logging.py +160 -17
  300. viam/media/__init__.py +0 -9
  301. viam/media/audio.py +22 -10
  302. viam/media/utils/__init__.py +0 -0
  303. viam/media/utils/pil/__init__.py +55 -0
  304. viam/media/{viam_rgba_plugin.py → utils/pil/viam_rgba_plugin.py} +10 -16
  305. viam/media/viam_rgba.py +10 -0
  306. viam/media/video.py +197 -73
  307. viam/module/module.py +191 -44
  308. viam/module/resource_data_consumer.py +41 -0
  309. viam/module/service.py +9 -1
  310. viam/module/types.py +4 -5
  311. viam/operations.py +4 -3
  312. viam/proto/app/__init__.py +361 -5
  313. viam/proto/app/agent/__init__.py +28 -0
  314. viam/proto/app/billing.py +51 -27
  315. viam/proto/app/cloudslam/__init__.py +48 -0
  316. viam/proto/app/data/__init__.py +103 -17
  317. viam/proto/app/datapipelines/__init__.py +56 -0
  318. viam/proto/app/dataset/__init__.py +40 -0
  319. viam/proto/app/datasync/__init__.py +11 -5
  320. viam/proto/app/end_user.py +34 -0
  321. viam/proto/app/mlinference/__init__.py +15 -0
  322. viam/proto/app/mltraining/__init__.py +25 -1
  323. viam/proto/app/packages/__init__.py +3 -3
  324. viam/proto/app/robot.py +19 -1
  325. viam/proto/common/__init__.py +35 -8
  326. viam/proto/component/arm/__init__.py +9 -1
  327. viam/proto/component/audioin/__init__.py +16 -0
  328. viam/proto/component/audioinput/__init__.py +3 -1
  329. viam/proto/component/audioout/__init__.py +15 -0
  330. viam/proto/component/base/__init__.py +7 -1
  331. viam/proto/component/board/__init__.py +13 -5
  332. viam/proto/component/button/__init__.py +15 -0
  333. viam/proto/component/camera/__init__.py +9 -1
  334. viam/proto/component/encoder/__init__.py +3 -1
  335. viam/proto/component/gantry/__init__.py +7 -1
  336. viam/proto/component/generic/__init__.py +3 -1
  337. viam/proto/component/gripper/__init__.py +7 -1
  338. viam/proto/component/inputcontroller/__init__.py +7 -1
  339. viam/proto/component/motor/__init__.py +7 -1
  340. viam/proto/component/movementsensor/__init__.py +7 -1
  341. viam/proto/component/posetracker/__init__.py +7 -1
  342. viam/proto/component/powersensor/__init__.py +30 -0
  343. viam/proto/component/sensor/__init__.py +3 -4
  344. viam/proto/component/servo/__init__.py +3 -1
  345. viam/proto/component/switch/__init__.py +26 -0
  346. viam/proto/component/testecho/__init__.py +3 -1
  347. viam/proto/module/__init__.py +3 -1
  348. viam/proto/opentelemetry/__init__.py +0 -0
  349. viam/proto/opentelemetry/proto/__init__.py +0 -0
  350. viam/proto/opentelemetry/proto/common/__init__.py +15 -0
  351. viam/proto/opentelemetry/proto/resource/__init__.py +10 -0
  352. viam/proto/opentelemetry/proto/trace/__init__.py +15 -0
  353. viam/proto/provisioning/__init__.py +42 -0
  354. viam/proto/robot/__init__.py +57 -9
  355. viam/proto/rpc/auth.py +11 -1
  356. viam/proto/rpc/examples/echo/__init__.py +3 -1
  357. viam/proto/rpc/examples/echoresource/__init__.py +7 -1
  358. viam/proto/rpc/webrtc/grpc.py +3 -1
  359. viam/proto/rpc/webrtc/signaling.py +5 -1
  360. viam/proto/service/datamanager/__init__.py +15 -2
  361. viam/proto/service/discovery/__init__.py +15 -0
  362. viam/proto/service/generic/__init__.py +12 -0
  363. viam/proto/service/mlmodel/__init__.py +27 -1
  364. viam/proto/service/motion/__init__.py +35 -5
  365. viam/proto/service/navigation/__init__.py +19 -1
  366. viam/proto/service/sensors/__init__.py +3 -1
  367. viam/proto/service/shell/__init__.py +25 -2
  368. viam/proto/service/slam/__init__.py +13 -1
  369. viam/proto/service/video/__init__.py +15 -0
  370. viam/proto/service/vision/__init__.py +11 -1
  371. viam/proto/service/worldstatestore/__init__.py +32 -0
  372. viam/proto/stream/__init__.py +36 -0
  373. viam/py.typed +0 -0
  374. viam/resource/base.py +45 -8
  375. viam/resource/easy_resource.py +149 -0
  376. viam/resource/manager.py +35 -14
  377. viam/resource/registry.py +40 -52
  378. viam/resource/rpc_client_base.py +33 -1
  379. viam/resource/rpc_service_base.py +15 -8
  380. viam/resource/types.py +39 -26
  381. viam/robot/client.py +458 -91
  382. viam/robot/service.py +13 -107
  383. viam/rpc/dial.py +133 -15
  384. viam/rpc/libviam_rust_utils.so +0 -0
  385. viam/rpc/server.py +59 -15
  386. viam/rpc/types.py +2 -4
  387. viam/services/discovery/__init__.py +12 -0
  388. viam/services/discovery/client.py +55 -0
  389. viam/services/discovery/discovery.py +52 -0
  390. viam/services/discovery/service.py +43 -0
  391. viam/services/generic/__init__.py +18 -0
  392. viam/services/generic/client.py +58 -0
  393. viam/services/generic/generic.py +58 -0
  394. viam/services/generic/service.py +29 -0
  395. viam/services/mlmodel/__init__.py +15 -1
  396. viam/services/mlmodel/client.py +20 -15
  397. viam/services/mlmodel/mlmodel.py +44 -7
  398. viam/services/mlmodel/service.py +9 -13
  399. viam/services/mlmodel/utils.py +101 -0
  400. viam/services/motion/__init__.py +15 -3
  401. viam/services/motion/client.py +109 -150
  402. viam/services/motion/motion.py +380 -0
  403. viam/services/motion/service.py +132 -0
  404. viam/services/navigation/__init__.py +11 -0
  405. viam/services/navigation/client.py +99 -0
  406. viam/services/navigation/navigation.py +250 -0
  407. viam/services/navigation/service.py +137 -0
  408. viam/services/service_base.py +43 -4
  409. viam/services/service_client_base.py +4 -4
  410. viam/services/slam/__init__.py +4 -1
  411. viam/services/slam/client.py +21 -11
  412. viam/services/slam/service.py +16 -19
  413. viam/services/slam/slam.py +66 -5
  414. viam/services/vision/__init__.py +8 -0
  415. viam/services/vision/client.py +115 -111
  416. viam/services/vision/service.py +143 -0
  417. viam/services/vision/vision.py +317 -0
  418. viam/services/worldstatestore/__init__.py +18 -0
  419. viam/services/worldstatestore/client.py +94 -0
  420. viam/services/worldstatestore/service.py +55 -0
  421. viam/services/worldstatestore/worldstatestore.py +90 -0
  422. viam/sessions_client.py +254 -0
  423. viam/streams.py +44 -0
  424. viam/utils.py +143 -15
  425. viam/version_metadata.py +4 -0
  426. viam_sdk-0.66.0.dist-info/METADATA +157 -0
  427. viam_sdk-0.66.0.dist-info/RECORD +531 -0
  428. {viam_sdk-0.3.0.dist-info → viam_sdk-0.66.0.dist-info}/WHEEL +1 -1
  429. viam/components/audio_input/__init__.py +0 -18
  430. viam/components/audio_input/audio_input.py +0 -79
  431. viam/components/audio_input/client.py +0 -60
  432. viam/components/audio_input/service.py +0 -118
  433. viam/components/types.py +0 -5
  434. viam/gen/app/model/v1/model_grpc.py +0 -39
  435. viam/gen/app/model/v1/model_pb2.py +0 -71
  436. viam/gen/app/model/v1/model_pb2.pyi +0 -285
  437. viam/gen/proto/rpc/examples/fileupload/v1/fileupload_grpc.py +0 -21
  438. viam/gen/proto/rpc/examples/fileupload/v1/fileupload_pb2.py +0 -18
  439. viam/gen/proto/rpc/examples/fileupload/v1/fileupload_pb2.pyi +0 -49
  440. viam/media/media.py +0 -53
  441. viam/proto/app/model/__init__.py +0 -40
  442. viam/proto/rpc/examples/fileupload/__init__.py +0 -13
  443. viam/services/sensors/__init__.py +0 -5
  444. viam/services/sensors/client.py +0 -63
  445. viam_sdk-0.3.0.dist-info/LICENSE +0 -202
  446. viam_sdk-0.3.0.dist-info/METADATA +0 -122
  447. viam_sdk-0.3.0.dist-info/RECORD +0 -372
  448. /viam/{gen/app/model → app}/__init__.py +0 -0
  449. /viam/gen/app/{model/v1 → agent}/__init__.py +0 -0
  450. /viam/gen/{proto/rpc/examples/fileupload → app/agent/v1}/__init__.py +0 -0
  451. /viam/gen/{proto/rpc/examples/fileupload/v1 → app/cloudslam}/__init__.py +0 -0
  452. /LICENSE → /viam_sdk-0.66.0.dist-info/licenses/LICENSE +0 -0
@@ -0,0 +1,249 @@
1
+ from typing import List, Mapping, Optional
2
+
3
+ from grpclib.client import Channel
4
+
5
+ from viam import logging
6
+ from viam.proto.app.mltraining import (
7
+ CancelTrainingJobRequest,
8
+ DeleteCompletedTrainingJobRequest,
9
+ GetTrainingJobRequest,
10
+ GetTrainingJobResponse,
11
+ ListTrainingJobsRequest,
12
+ ListTrainingJobsResponse,
13
+ MLTrainingServiceStub,
14
+ ModelType,
15
+ SubmitCustomTrainingJobRequest,
16
+ SubmitCustomTrainingJobResponse,
17
+ SubmitTrainingJobRequest,
18
+ SubmitTrainingJobResponse,
19
+ TrainingJobMetadata,
20
+ TrainingStatus,
21
+ )
22
+
23
+ LOGGER = logging.getLogger(__name__)
24
+
25
+
26
+ class MLTrainingClient:
27
+ """gRPC client for working with ML training jobs.
28
+
29
+ Constructor is used by `ViamClient` to instantiate relevant service stubs.
30
+ Calls to `MLTrainingClient` methods should be made through `ViamClient`.
31
+
32
+ Establish a Connection::
33
+
34
+ import asyncio
35
+
36
+ from viam.rpc.dial import DialOptions, Credentials
37
+ from viam.app.viam_client import ViamClient
38
+
39
+
40
+ async def connect() -> ViamClient:
41
+ # Replace "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
42
+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
43
+ return await ViamClient.create_from_dial_options(dial_options)
44
+
45
+
46
+ async def main():
47
+
48
+ # Make a ViamClient
49
+ async with await connect() as viam_client:
50
+ # Instantiate an MLTrainingClient to run ML training client API methods on
51
+ ml_training_client = viam_client.ml_training_client
52
+
53
+ if __name__ == '__main__':
54
+ asyncio.run(main())
55
+
56
+ For more information, see `ML Training Client API <https://docs.viam.com/dev/reference/apis/ml-training-client/>`_.
57
+ """
58
+
59
+ def __init__(self, channel: Channel, metadata: Mapping[str, str]):
60
+ """Create a `MLTrainingClient` that maintains a connection to app.
61
+
62
+ Args:
63
+ channel (grpclib.client.Channel): Connection to app.
64
+ metadata (Mapping[str, str]): Required authorization token to send requests to app.
65
+
66
+ For more information, see `ML Training Client API <https://docs.viam.com/dev/reference/apis/ml-training-client/>`_.
67
+ """
68
+ self._metadata = metadata
69
+ self._ml_training_client = MLTrainingServiceStub(channel)
70
+ self._channel = channel
71
+
72
+ async def submit_training_job(
73
+ self,
74
+ org_id: str,
75
+ dataset_id: str,
76
+ model_name: str,
77
+ model_version: str,
78
+ model_type: ModelType.ValueType,
79
+ tags: List[str],
80
+ ) -> str:
81
+ """Submit a training job.
82
+
83
+ ::
84
+
85
+ from viam.proto.app.mltraining import ModelType
86
+
87
+ job_id = await ml_training_client.submit_training_job(
88
+ org_id="<organization-id>",
89
+ dataset_id="<dataset-id>",
90
+ model_name="<your-model-name>",
91
+ model_version="1",
92
+ model_type=ModelType.MODEL_TYPE_SINGLE_LABEL_CLASSIFICATION,
93
+ tags=["tag1", "tag2"]
94
+ )
95
+
96
+ Args:
97
+ org_id (str): the ID of the org to submit the training job to.
98
+ dataset_id (str): the ID of the dataset to train the model on.
99
+ model_name (str): the model name.
100
+ model_version (str): the model version.
101
+ model_type (ModelType.ValueType): the model type.
102
+ tags (List[str]): the labels to train the model on.
103
+
104
+ Returns:
105
+ str: the ID of the training job.
106
+
107
+ For more information, see `ML Training Client API <https://docs.viam.com/dev/reference/apis/ml-training-client/#submittrainingjob>`_.
108
+ """
109
+
110
+ request = SubmitTrainingJobRequest(
111
+ dataset_id=dataset_id,
112
+ organization_id=org_id,
113
+ model_name=model_name,
114
+ model_version=model_version,
115
+ model_type=model_type,
116
+ tags=tags,
117
+ )
118
+ response: SubmitTrainingJobResponse = await self._ml_training_client.SubmitTrainingJob(request, metadata=self._metadata)
119
+ return response.id
120
+
121
+ async def submit_custom_training_job(
122
+ self, org_id: str, dataset_id: str, registry_item_id: str, registry_item_version: str, model_name: str, model_version: str
123
+ ) -> str:
124
+ """Submit a custom training job.
125
+
126
+ ::
127
+
128
+ job_id = await ml_training_client.submit_custom_training_job(
129
+ org_id="<organization-id>",
130
+ dataset_id="<dataset-id>",
131
+ registry_item_id="viam:classification-tflite",
132
+ registry_item_version="2024-08-13T12-11-54",
133
+ model_name="<your-model-name>",
134
+ model_version="1"
135
+ )
136
+
137
+ Args:
138
+ org_id (str): the ID of the org to submit the training job to.
139
+ dataset_id (str): the ID of the dataset to train the model on.
140
+ registry_item_id (str): the ID of the training script from the registry.
141
+ registry_item_version (str): the version of the training script from the registry.
142
+ model_name (str): the model name.
143
+ model_version (str): the model version.
144
+
145
+ Returns:
146
+ str: the ID of the training job.
147
+
148
+ For more information, see `ML Training Client API <https://docs.viam.com/dev/reference/apis/ml-training-client/#submitcustomtrainingjob>`_.
149
+ """
150
+
151
+ request = SubmitCustomTrainingJobRequest(
152
+ dataset_id=dataset_id,
153
+ registry_item_id=registry_item_id,
154
+ registry_item_version=registry_item_version,
155
+ organization_id=org_id,
156
+ model_name=model_name,
157
+ model_version=model_version,
158
+ )
159
+ response: SubmitCustomTrainingJobResponse = await self._ml_training_client.SubmitCustomTrainingJob(request, metadata=self._metadata)
160
+ return response.id
161
+
162
+ async def get_training_job(self, id: str) -> TrainingJobMetadata:
163
+ """Gets training job data.
164
+
165
+ ::
166
+
167
+ job_metadata = await ml_training_client.get_training_job(
168
+ id="<job-id>")
169
+
170
+ Args:
171
+ id (str): the ID of the requested training job.
172
+
173
+ Returns:
174
+ viam.proto.app.mltraining.TrainingJobMetadata: the training job data.
175
+
176
+ For more information, see `ML Training Client API <https://docs.viam.com/dev/reference/apis/ml-training-client/#gettrainingjob>`_.
177
+ """
178
+
179
+ request = GetTrainingJobRequest(id=id)
180
+ response: GetTrainingJobResponse = await self._ml_training_client.GetTrainingJob(request, metadata=self._metadata)
181
+
182
+ return response.metadata
183
+
184
+ async def list_training_jobs(
185
+ self,
186
+ org_id: str,
187
+ training_status: Optional[TrainingStatus.ValueType] = None,
188
+ ) -> List[TrainingJobMetadata]:
189
+ """Returns training job data for all jobs within an org.
190
+
191
+ ::
192
+
193
+ jobs_metadata = await ml_training_client.list_training_jobs(
194
+ org_id="<org-id>")
195
+
196
+ first_job_id = jobs_metadata[1].id
197
+
198
+ Args:
199
+ org_id (str): the ID of the org to request training job data from.
200
+ training_status (Optional[TrainingStatus]): the status to filter the training jobs list by.
201
+ If unspecified, all training jobs will be returned.
202
+
203
+ Returns:
204
+ List[viam.proto.app.mltraining.TrainingJobMetadata]: the list of training job data.
205
+
206
+ For more information, see `ML Training Client API <https://docs.viam.com/dev/reference/apis/ml-training-client/#listtrainingjobs>`_.
207
+ """
208
+
209
+ training_status = training_status if training_status else TrainingStatus.TRAINING_STATUS_UNSPECIFIED
210
+ request = ListTrainingJobsRequest(organization_id=org_id, status=training_status)
211
+ response: ListTrainingJobsResponse = await self._ml_training_client.ListTrainingJobs(request, metadata=self._metadata)
212
+
213
+ return list(response.jobs)
214
+
215
+ async def cancel_training_job(self, id: str) -> None:
216
+ """Cancels the specified training job.
217
+
218
+ ::
219
+
220
+ await ml_training_client.cancel_training_job(
221
+ id="<job-id>")
222
+
223
+ Args:
224
+ id (str): the ID of the job to cancel.
225
+
226
+ Raises:
227
+ GRPCError: if no training job exists with the given ID.
228
+
229
+ For more information, see `ML Training Client API <https://docs.viam.com/dev/reference/apis/ml-training-client/#canceltrainingjob>`_.
230
+ """
231
+
232
+ request = CancelTrainingJobRequest(id=id)
233
+ await self._ml_training_client.CancelTrainingJob(request, metadata=self._metadata)
234
+
235
+ async def delete_completed_training_job(self, id: str) -> None:
236
+ """Delete a completed training job from the database, whether the job succeeded or failed.
237
+
238
+ ::
239
+
240
+ await ml_training_client.delete_completed_training_job(
241
+ id="<job-id>")
242
+
243
+ Args:
244
+ id (str): the ID of the training job to delete.
245
+
246
+ For more information, see `ML Training Client API <https://docs.viam.com/dev/reference/apis/ml-training-client/#deletecompletedtrainingjob>`_.
247
+ """
248
+ request = DeleteCompletedTrainingJobRequest(id=id)
249
+ await self._ml_training_client.DeleteCompletedTrainingJob(request, metadata=self._metadata)
@@ -0,0 +1,93 @@
1
+ from typing import List, Mapping, Optional
2
+
3
+ from grpclib.client import Channel
4
+
5
+ from viam import logging
6
+ from viam.proto.provisioning import (
7
+ CloudConfig,
8
+ GetNetworkListRequest,
9
+ GetNetworkListResponse,
10
+ GetSmartMachineStatusRequest,
11
+ GetSmartMachineStatusResponse,
12
+ NetworkInfo,
13
+ ProvisioningServiceStub,
14
+ SetNetworkCredentialsRequest,
15
+ SetSmartMachineCredentialsRequest,
16
+ )
17
+
18
+ LOGGER = logging.getLogger(__name__)
19
+
20
+
21
+ class ProvisioningClient:
22
+ """gRPC client for getting and setting smart machine info.
23
+
24
+ Constructor is used by `ViamClient` to instantiate relevant service stubs. Calls to
25
+ `ProvisioningClient` methods should be made through `ViamClient`.
26
+
27
+ Establish a connection::
28
+
29
+ import asyncio
30
+
31
+ from viam.rpc.dial import DialOptions, Credentials
32
+ from viam.app.viam_client import ViamClient
33
+
34
+
35
+ async def connect() -> ViamClient:
36
+ # Replace "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
37
+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
38
+ return await ViamClient.create_from_dial_options(dial_options)
39
+
40
+
41
+ async def main():
42
+
43
+ # Make a ViamClient
44
+ async with await connect() as viam_client:
45
+ # Instantiate a ProvisioningClient to run provisioning client API methods on
46
+ provisioning_client = viam_client.provisioning_client
47
+
48
+ if __name__ == '__main__':
49
+ asyncio.run(main())
50
+
51
+ """
52
+
53
+ def __init__(self, channel: Channel, metadata: Mapping[str, str]):
54
+ """Create a `ProvisioningClient` that maintains a connection to app.
55
+
56
+ Args:
57
+ channel (grpclib.client.Channel): Connection to app.
58
+ metadata (Mapping[str, str]): Required authorization token to send requests to app.
59
+ """
60
+ self._metadata = metadata
61
+ self._provisioning_client = ProvisioningServiceStub(channel)
62
+ self._channel = channel
63
+
64
+ _provisioning_client: ProvisioningServiceStub
65
+ _metadata: Mapping[str, str]
66
+ _channel: Channel
67
+
68
+ async def get_network_list(self) -> List[NetworkInfo]:
69
+ """Returns list of networks that are visible to the Smart Machine."""
70
+ request = GetNetworkListRequest()
71
+ resp: GetNetworkListResponse = await self._provisioning_client.GetNetworkList(request, metadata=self._metadata)
72
+ return list(resp.networks)
73
+
74
+ async def get_smart_machine_status(self) -> GetSmartMachineStatusResponse:
75
+ """Returns the status of the smart machine."""
76
+ request = GetSmartMachineStatusRequest()
77
+ return await self._provisioning_client.GetSmartMachineStatus(request, metadata=self._metadata)
78
+
79
+ async def set_network_credentials(self, network_type: str, ssid: str, psk: str) -> None:
80
+ """Sets the network credentials of the Smart Machine.
81
+
82
+ Args:
83
+ network_type (str): The type of the network.
84
+ ssid (str): The SSID of the network.
85
+ psk (str): The network's passkey.
86
+ """
87
+
88
+ request = SetNetworkCredentialsRequest(type=network_type, ssid=ssid, psk=psk)
89
+ await self._provisioning_client.SetNetworkCredentials(request, metadata=self._metadata)
90
+
91
+ async def set_smart_machine_credentials(self, cloud_config: Optional[CloudConfig] = None) -> None:
92
+ request = SetSmartMachineCredentialsRequest(cloud=cloud_config)
93
+ await self._provisioning_client.SetSmartMachineCredentials(request, metadata=self._metadata)
@@ -0,0 +1,275 @@
1
+ import os
2
+ from typing import Any, Mapping, Optional
3
+
4
+ from grpclib.client import Channel
5
+ from typing_extensions import Self
6
+
7
+ from viam import logging
8
+ from viam.app.app_client import AppClient
9
+ from viam.app.billing_client import BillingClient
10
+ from viam.app.data_client import DataClient
11
+ from viam.app.ml_training_client import MLTrainingClient
12
+ from viam.app.provisioning_client import ProvisioningClient
13
+ from viam.robot.client import RobotClient
14
+ from viam.rpc.dial import Credentials, DialOptions, _dial_app, _get_access_token
15
+
16
+ LOGGER = logging.getLogger(__name__)
17
+
18
+
19
+ class ViamClient:
20
+ """gRPC client for all communication and interaction with app.
21
+
22
+ `ViamClient` class for creating and managing specialized client instances.
23
+ There are currently 2 ways to instantiate a `ViamClient` object::
24
+
25
+ ViamClient.create_from_dial_options(...)
26
+ ViamClient.create_from_env_vars()
27
+ """
28
+
29
+ @classmethod
30
+ async def create_from_env_vars(cls, dial_options: Optional[DialOptions] = None, app_url: Optional[str] = None) -> Self:
31
+ """Create `ViamClient` using credentials set in the environment as `VIAM_API_KEY` and `VIAM_API_KEY_ID`.
32
+
33
+ ::
34
+
35
+ client = await ViamClient.create_from_env_vars()
36
+
37
+ Args:
38
+ dial_options (Optional[viam.rpc.dial.DialOptions]): Options for authorization and connection to app.
39
+ If not provided, default options will be selected. Note that `creds` and `auth_entity`
40
+ fields will be overwritten by the values set by a module.
41
+ app_url: (Optional[str]): URL of app. Uses app.viam.com if not specified.
42
+
43
+ Raises:
44
+ ValueError: If there are no env vars set by the module, or if they are set improperly
45
+
46
+ """
47
+ dial_options = dial_options if dial_options else DialOptions()
48
+ api_key = os.environ.get("VIAM_API_KEY")
49
+ if api_key is None:
50
+ raise ValueError("api key cannot be None")
51
+ api_key_id = os.environ.get("VIAM_API_KEY_ID")
52
+ if api_key_id is None:
53
+ raise ValueError("api key ID cannot be None")
54
+ credentials = Credentials(type="api-key", payload=api_key)
55
+ dial_options.credentials = credentials
56
+ dial_options.auth_entity = api_key_id
57
+
58
+ return await cls.create_from_dial_options(dial_options, app_url)
59
+
60
+ @classmethod
61
+ async def create_from_dial_options(cls, dial_options: DialOptions, app_url: Optional[str] = None) -> Self:
62
+ """Create `ViamClient` that establishes a connection to Viam.
63
+
64
+ ::
65
+
66
+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
67
+ client = await ViamClient.create_from_dial_options(dial_options)
68
+
69
+ Args:
70
+ dial_options (viam.rpc.dial.DialOptions): Required information for authorization and connection to app.
71
+ `creds` and `auth_entity` fields are required.
72
+ app_url: (Optional[str]): URL of app. Uses app.viam.com if not specified.
73
+
74
+ Raises:
75
+ ValueError: If the input parameters are missing a required field or simply invalid.
76
+
77
+ Returns:
78
+ Self: The `ViamClient`.
79
+ """
80
+ if dial_options.credentials is None:
81
+ raise ValueError("dial_options.credentials cannot be None.")
82
+ if dial_options.credentials.type == "robot-secret":
83
+ raise ValueError("dial_options.credentials.type cannot be 'robot-secret'")
84
+ if dial_options.auth_entity is None:
85
+ raise ValueError("dial_options.auth_entity cannot be None.")
86
+
87
+ self = cls()
88
+ self._dial_options = dial_options
89
+ if app_url is None:
90
+ app_url = "app.viam.com"
91
+ self._channel = await _dial_app(app_url)
92
+ access_token = await _get_access_token(self._channel, dial_options.auth_entity, dial_options)
93
+ self._metadata = {"authorization": f"Bearer {access_token}"}
94
+ return self
95
+
96
+ _channel: Channel
97
+ _metadata: Mapping[str, str]
98
+ _closed: bool = False
99
+ _dial_options: DialOptions
100
+
101
+ @property
102
+ def data_client(self) -> DataClient:
103
+ """Instantiate and return a `DataClient` object used to make `data` and `data_sync` method calls.
104
+ To use the `DataClient`, you must first instantiate a `ViamClient`.
105
+
106
+ ::
107
+
108
+ async def connect() -> ViamClient:
109
+ # Replace "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
110
+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
111
+ return await ViamClient.create_from_dial_options(dial_options)
112
+
113
+ async def main():
114
+ viam_client = await connect()
115
+
116
+ # Instantiate a DataClient to run data client API methods on
117
+ data_client = viam_client.data_client
118
+ """
119
+ return DataClient(self._channel, self._metadata)
120
+
121
+ @property
122
+ def app_client(self) -> AppClient:
123
+ """Instantiate and return an `AppClient` used to make `app` method calls.
124
+ To use the `AppClient`, you must first instantiate a `ViamClient`.
125
+
126
+ ::
127
+
128
+ async def connect() -> ViamClient:
129
+ # Replace "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
130
+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
131
+ return await ViamClient.create_from_dial_options(dial_options)
132
+
133
+
134
+ async def main():
135
+ viam_client = await connect()
136
+
137
+ # Instantiate an AppClient called "fleet" to run fleet management API methods on
138
+ fleet = viam_client.app_client
139
+ """
140
+ return AppClient(self._channel, self._metadata)
141
+
142
+ @property
143
+ def ml_training_client(self) -> MLTrainingClient:
144
+ """Instantiate and return a `MLTrainingClient` used to make `ml_training` method calls.
145
+ To use the `MLTrainingClient`, you must first instantiate a `ViamClient`.
146
+
147
+ ::
148
+
149
+ async def connect() -> ViamClient:
150
+ # Replace "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
151
+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
152
+ return await ViamClient.create_from_dial_options(dial_options)
153
+
154
+
155
+ async def main():
156
+ viam_client = await connect()
157
+
158
+ # Instantiate an MLTrainingClient to run ML training client API methods on
159
+ ml_training_client = viam_client.ml_training_client
160
+ """
161
+ return MLTrainingClient(self._channel, self._metadata)
162
+
163
+ @property
164
+ def billing_client(self) -> BillingClient:
165
+ """Instantiate and return a `BillingClient` used to make `billing` method calls.
166
+ To use the `BillingClient`, you must first instantiate a `ViamClient`.
167
+
168
+ ::
169
+
170
+ async def connect() -> ViamClient:
171
+ # Replace "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
172
+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
173
+ return await ViamClient.create_from_dial_options(dial_options)
174
+
175
+
176
+ async def main():
177
+ viam_client = await connect()
178
+
179
+ # Instantiate a BillingClient to run billing client API methods on
180
+ billing_client = viam_client.billing_client
181
+ """
182
+
183
+ return BillingClient(self._channel, self._metadata)
184
+
185
+ @property
186
+ def provisioning_client(self) -> ProvisioningClient:
187
+ """Instantiate and return a `ProvisioningClient` used to make `provisioning` method calls.
188
+ To use the `ProvisioningClient`, you must first instantiate a `ViamClient`.
189
+
190
+ ::
191
+
192
+ async def connect() -> ViamClient:
193
+ # Replace "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
194
+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
195
+ return await ViamClient.create_from_dial_options(dial_options)
196
+
197
+
198
+ async def main():
199
+ viam_client = await connect()
200
+
201
+ # Instantiate a ProvisioningClient to run provisioning API methods on
202
+ provisioning_client = viam_client.provisioning_client
203
+ """
204
+ return ProvisioningClient(self._channel, self._metadata)
205
+
206
+ async def __aenter__(self) -> "ViamClient":
207
+ """A ViamClient can act as an asynchronous context manager. It will do nothing special when
208
+ the context is entered.
209
+ """
210
+ return self
211
+
212
+ async def __aexit__(self, exc_type: Optional[type], exc_value: Optional[BaseException], traceback: Optional[Any]) -> None:
213
+ """A ViamClient can act as an asynchronous context manager. It will close itself when
214
+ the context is exited.
215
+
216
+ ::
217
+
218
+ async with ViamClient.create_from_dial_options(...) as client:
219
+ await do_something_with(client)
220
+ # client is closed here
221
+ """
222
+ self.close()
223
+
224
+ def close(self) -> None:
225
+ """Close opened channels used for the various service stubs initialized."""
226
+ if self._closed:
227
+ LOGGER.debug("ViamClient is already closed.")
228
+ return
229
+ LOGGER.debug("Closing gRPC channel to app.")
230
+ self._channel.close()
231
+ self._closed = True
232
+
233
+ async def connect_to_machine(self, *, address: Optional[str] = None, id: Optional[str] = None) -> RobotClient:
234
+ """Connect to a machine using existing credentials.
235
+
236
+ A connection can be attempted using either the machine's address or its ID.
237
+ If both an address and ID are provided, the address will take precedence and the ID will be ignored.
238
+
239
+ ::
240
+
241
+ async def connect() -> ViamClient:
242
+ # Replace "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
243
+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
244
+ return await ViamClient.create_from_dial_options(dial_options)
245
+
246
+
247
+ async def main():
248
+ viam_client = await connect()
249
+
250
+ # Connect to a machine and obtain a RobotClient
251
+ # Replace "<MACHINE_ADDRESS>" (including brackets) with your machine's connection address
252
+ machine = await viam_client.connect_to_machine(address="<MACHINE_ADDRESS>")
253
+
254
+ Args:
255
+ address (Optional[str]): The address (FQDN) of the machine. Defaults to None.
256
+ id (Optional[str]): The ID (as a UUID) of the machine. Defaults to None.
257
+
258
+ Raises:
259
+ ValueError: If neither an address nor ID is provided.
260
+
261
+ Returns:
262
+ RobotClient: The active connection to the machine.
263
+ """
264
+ if address is None and id is None:
265
+ raise ValueError("Either a machine address or ID must be provided")
266
+
267
+ if id is not None and address is None:
268
+ parts = await self.app_client.get_robot_parts(id)
269
+ main_part = next(p for p in parts if p.main_part)
270
+ address = main_part.fqdn
271
+
272
+ opts = RobotClient.Options(dial_options=self._dial_options)
273
+
274
+ assert address is not None
275
+ return await RobotClient.at_address(address, opts)
@@ -1,11 +1,6 @@
1
- import asyncio
2
-
3
- from viam.proto.common import Pose
1
+ from viam.proto.common import KinematicsFileFormat, Pose
4
2
  from viam.proto.component.arm import JointPositions
5
- from viam.proto.component.arm import Status as ArmStatus
6
- from viam.proto.robot import Status
7
3
  from viam.resource.registry import Registry, ResourceRegistration
8
- from viam.utils import message_to_struct
9
4
 
10
5
  from .arm import Arm
11
6
  from .client import ArmClient
@@ -14,26 +9,8 @@ from .service import ArmRPCService
14
9
  __all__ = [
15
10
  "Arm",
16
11
  "JointPositions",
12
+ "KinematicsFileFormat",
17
13
  "Pose",
18
14
  ]
19
15
 
20
-
21
- async def create_status(component: Arm) -> Status:
22
- (
23
- end_position,
24
- joint_positions,
25
- is_moving,
26
- ) = await asyncio.gather(
27
- component.get_end_position(),
28
- component.get_joint_positions(),
29
- component.is_moving(),
30
- )
31
- s = ArmStatus(
32
- end_position=end_position,
33
- joint_positions=joint_positions,
34
- is_moving=is_moving,
35
- )
36
- return Status(name=Arm.get_resource_name(component.name), status=message_to_struct(s))
37
-
38
-
39
- Registry.register_subtype(ResourceRegistration(Arm, ArmRPCService, lambda name, channel: ArmClient(name, channel), create_status))
16
+ Registry.register_api(ResourceRegistration(Arm, ArmRPCService, lambda name, channel: ArmClient(name, channel)))