standardbots 2.0.0.dev1763155352__tar.gz → 2.0.0.dev1763765170__tar.gz

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.
Files changed (18) hide show
  1. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/PKG-INFO +1 -1
  2. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/setup.py +1 -1
  3. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/standardbots/auto_generated/apis.py +49 -0
  4. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/standardbots/auto_generated/models.py +75 -0
  5. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/standardbots.egg-info/PKG-INFO +1 -1
  6. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/README.md +0 -0
  7. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/setup.cfg +0 -0
  8. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/standardbots/__init__.py +0 -0
  9. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/standardbots/auto_generated/__init__.py +0 -0
  10. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/standardbots.egg-info/SOURCES.txt +0 -0
  11. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/standardbots.egg-info/dependency_links.txt +0 -0
  12. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/standardbots.egg-info/requires.txt +0 -0
  13. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/standardbots.egg-info/top_level.txt +0 -0
  14. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/tests/fixtures/__init__.py +0 -0
  15. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/tests/fixtures/client_fixt.py +0 -0
  16. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/tests/fixtures/robot_fixt.py +0 -0
  17. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/tests/fixtures/routines_fixt.py +0 -0
  18. {standardbots-2.0.0.dev1763155352 → standardbots-2.0.0.dev1763765170}/tests/test_apis.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: standardbots
3
- Version: 2.0.0.dev1763155352
3
+ Version: 2.0.0.dev1763765170
4
4
  Summary: Standard Bots RO1 Robotics API
5
5
  Home-page:
6
6
  Author: Standard Bots Support
@@ -13,7 +13,7 @@
13
13
  from setuptools import setup, find_packages # noqa: H301
14
14
 
15
15
  NAME = "standardbots"
16
- VERSION = "2.0.0-dev1763155352"
16
+ VERSION = "2.0.0-dev1763765170"
17
17
  # To install the library, run the following
18
18
  #
19
19
  # python setup.py install
@@ -1914,6 +1914,55 @@ class Camera:
1914
1914
  )
1915
1915
  parsed = None
1916
1916
 
1917
+ is_user_error = response.status >= 400 and response.status <= 500
1918
+ is_unavailable = response.status == 503
1919
+ if parsed is None and (is_user_error or is_unavailable):
1920
+ parsed = models.parse_error_response(json.loads(response.data))
1921
+
1922
+ return Response(
1923
+ parsed,
1924
+ response.status,
1925
+ response
1926
+ )
1927
+ except urllib3.exceptions.MaxRetryError:
1928
+ return Response(
1929
+ models.ErrorResponse(
1930
+ error=models.ErrorEnum.InternalServerError,
1931
+ message="Connection Refused"
1932
+ ),
1933
+ 503,
1934
+ None
1935
+ )
1936
+ def get_camera_frame(
1937
+ self,
1938
+ camera_id: str,
1939
+ stream_name: str,
1940
+ ) -> Response[
1941
+ Union[
1942
+ models.CameraFrameResponse,
1943
+ models.ErrorResponse,
1944
+ None
1945
+ ],
1946
+ models.CameraFrameResponse
1947
+ ]:
1948
+ """
1949
+ Retrieve the latest frame from a specific camera by camera ID using the messenger GetFrame method. Returns a JSON object containing the frame as a base64 string in JPEG format, along with frame metadata including timestamp, camera ID, and stream name.
1950
+ """
1951
+ path = "/api/v1/camera/{camera_id}/frame"
1952
+ path = path.replace("{camera_id}", str(camera_id))
1953
+ try:
1954
+ response = self._request_manager.request(
1955
+ "GET",
1956
+ path,
1957
+ headers=self._request_manager.json_headers(),
1958
+ fields={
1959
+ "stream_name": models.serialize_str(stream_name),
1960
+ }
1961
+ )
1962
+ parsed = None
1963
+ if response.status == 200:
1964
+ parsed = models.parse_camera_frame_response(json.loads(response.data))
1965
+
1917
1966
  is_user_error = response.status >= 400 and response.status <= 500
1918
1967
  is_unavailable = response.status == 503
1919
1968
  if parsed is None and (is_user_error or is_unavailable):
@@ -387,6 +387,81 @@ def serialize_camera_configuration(data: CameraConfiguration) -> object:
387
387
  "height": None if data.height is None else serialize_u_32(data.height),
388
388
  }
389
389
 
390
+ @dataclass
391
+ class CameraFrameResponse:
392
+ """Response containing a camera frame and associated metadata."""
393
+ imageData: Union[str, None] = None
394
+ timestamp: Union[str, None] = None
395
+ camera_id: Union[str, None] = None
396
+ stream_name: Union[str, None] = None
397
+
398
+ def validate_imageData(self, value: str) -> Tuple[bool, str]:
399
+ if value is None:
400
+ return [True, ""]
401
+
402
+ if not isinstance(value, str):
403
+ return [False, "imageData must be of type str for CameraFrameResponse, got " + type(value).__name__]
404
+
405
+ return [True, ""]
406
+
407
+ def validate_timestamp(self, value: str) -> Tuple[bool, str]:
408
+ if value is None:
409
+ return [True, ""]
410
+
411
+ if not isinstance(value, str):
412
+ return [False, "timestamp must be of type str for CameraFrameResponse, got " + type(value).__name__]
413
+
414
+ return [True, ""]
415
+
416
+ def validate_camera_id(self, value: str) -> Tuple[bool, str]:
417
+ if value is None:
418
+ return [True, ""]
419
+
420
+ if not isinstance(value, str):
421
+ return [False, "camera_id must be of type str for CameraFrameResponse, got " + type(value).__name__]
422
+
423
+ return [True, ""]
424
+
425
+ def validate_stream_name(self, value: str) -> Tuple[bool, str]:
426
+ if value is None:
427
+ return [True, ""]
428
+
429
+ if not isinstance(value, str):
430
+ return [False, "stream_name must be of type str for CameraFrameResponse, got " + type(value).__name__]
431
+
432
+ return [True, ""]
433
+
434
+ def __post_init__(self):
435
+ # Type check incoming model - raise error if invalid (required or wrong type)
436
+ is_valid, error_str = self.validate_imageData(self.imageData)
437
+ if not is_valid:
438
+ raise TypeError(error_str)
439
+ is_valid, error_str = self.validate_timestamp(self.timestamp)
440
+ if not is_valid:
441
+ raise TypeError(error_str)
442
+ is_valid, error_str = self.validate_camera_id(self.camera_id)
443
+ if not is_valid:
444
+ raise TypeError(error_str)
445
+ is_valid, error_str = self.validate_stream_name(self.stream_name)
446
+ if not is_valid:
447
+ raise TypeError(error_str)
448
+
449
+ def parse_camera_frame_response(data: object):
450
+ return CameraFrameResponse(
451
+ imageData=parse_str(data["imageData"]) if "imageData" in data and data.get("imageData") is not None else None,
452
+ timestamp=parse_str(data["timestamp"]) if "timestamp" in data and data.get("timestamp") is not None else None,
453
+ camera_id=parse_str(data["camera_id"]) if "camera_id" in data and data.get("camera_id") is not None else None,
454
+ stream_name=parse_str(data["stream_name"]) if "stream_name" in data and data.get("stream_name") is not None else None,
455
+ )
456
+
457
+ def serialize_camera_frame_response(data: CameraFrameResponse) -> object:
458
+ return {
459
+ "imageData": None if data.imageData is None else serialize_str(data.imageData),
460
+ "timestamp": None if data.timestamp is None else serialize_str(data.timestamp),
461
+ "camera_id": None if data.camera_id is None else serialize_str(data.camera_id),
462
+ "stream_name": None if data.stream_name is None else serialize_str(data.stream_name),
463
+ }
464
+
390
465
  @dataclass
391
466
  class CameraIntrinsics:
392
467
  """Intrinsic parameters of the camera."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: standardbots
3
- Version: 2.0.0.dev1763155352
3
+ Version: 2.0.0.dev1763765170
4
4
  Summary: Standard Bots RO1 Robotics API
5
5
  Home-page:
6
6
  Author: Standard Bots Support