standardbots 2.20240212.14__tar.gz → 2.20240212.16__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.
Potentially problematic release.
This version of standardbots might be problematic. Click here for more details.
- {standardbots-2.20240212.14 → standardbots-2.20240212.16}/PKG-INFO +1 -1
- {standardbots-2.20240212.14 → standardbots-2.20240212.16}/setup.py +1 -1
- {standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots/auto_generated/apis.py +160 -0
- {standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots/auto_generated/models.py +436 -3
- {standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots.egg-info/PKG-INFO +1 -1
- {standardbots-2.20240212.14 → standardbots-2.20240212.16}/setup.cfg +0 -0
- {standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots/__init__.py +0 -0
- {standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots/auto_generated/__init__.py +0 -0
- {standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots.egg-info/SOURCES.txt +0 -0
- {standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots.egg-info/dependency_links.txt +0 -0
- {standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots.egg-info/requires.txt +0 -0
- {standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots.egg-info/top_level.txt +0 -0
{standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots/auto_generated/apis.py
RENAMED
|
@@ -117,6 +117,28 @@ class Default:
|
|
|
117
117
|
)
|
|
118
118
|
)
|
|
119
119
|
|
|
120
|
+
def dh_ag_grip(
|
|
121
|
+
self,
|
|
122
|
+
target_diameter: float,
|
|
123
|
+
target_force: float | None,
|
|
124
|
+
target_speed: float | None,
|
|
125
|
+
):
|
|
126
|
+
"""
|
|
127
|
+
Control the DH AG gripper.
|
|
128
|
+
Args:
|
|
129
|
+
- target_diameter: 0.0 - 1.0
|
|
130
|
+
- target_force: 0.2 - 1.0
|
|
131
|
+
- target_speed: 0.01 - 1.0
|
|
132
|
+
"""
|
|
133
|
+
return self.control_gripper(
|
|
134
|
+
body=models.GripperCommandRequest(
|
|
135
|
+
kind=models.GripperKindEnum.DhAg,
|
|
136
|
+
dh_ag=models.DHAGGripperCommandRequest(
|
|
137
|
+
target_diameter, target_force, target_speed
|
|
138
|
+
),
|
|
139
|
+
),
|
|
140
|
+
)
|
|
141
|
+
|
|
120
142
|
|
|
121
143
|
def control_gripper(
|
|
122
144
|
self,
|
|
@@ -525,6 +547,142 @@ class Movement:
|
|
|
525
547
|
self.brakes = Movement.Brakes(request_manager)
|
|
526
548
|
self.position = Movement.Position(request_manager)
|
|
527
549
|
|
|
550
|
+
class Camera:
|
|
551
|
+
_request_manager: RequestManager
|
|
552
|
+
class Data:
|
|
553
|
+
def __init__(self, request_manager: RequestManager):
|
|
554
|
+
self._request_manager = request_manager
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
def get_color_frame(
|
|
558
|
+
self,
|
|
559
|
+
body: models.CameraFrameRequest,
|
|
560
|
+
) -> Response[
|
|
561
|
+
None,
|
|
562
|
+
None
|
|
563
|
+
]:
|
|
564
|
+
"""
|
|
565
|
+
Retrieve the latest RGB frame from the camera.
|
|
566
|
+
"""
|
|
567
|
+
path = "/api/v1/camera/frame/rgb"
|
|
568
|
+
response = self._request_manager.request(
|
|
569
|
+
"GET",
|
|
570
|
+
path,
|
|
571
|
+
headers=self._request_manager.json_headers(),
|
|
572
|
+
body=json.dumps(models.serialize_camera_frame_request(body)),
|
|
573
|
+
)
|
|
574
|
+
parsed = None
|
|
575
|
+
|
|
576
|
+
is_user_error = response.status >= 400 and response.status < 500
|
|
577
|
+
is_unavailable = response.status == 503
|
|
578
|
+
if parsed is None and (is_user_error or is_unavailable):
|
|
579
|
+
parsed = models.parse_error_response(json.loads(response.data))
|
|
580
|
+
|
|
581
|
+
return Response(
|
|
582
|
+
parsed,
|
|
583
|
+
response.status,
|
|
584
|
+
response
|
|
585
|
+
)
|
|
586
|
+
|
|
587
|
+
def get_camera_intrinsics_color(
|
|
588
|
+
self,
|
|
589
|
+
) -> Response[
|
|
590
|
+
None,
|
|
591
|
+
None
|
|
592
|
+
]:
|
|
593
|
+
"""
|
|
594
|
+
Retrieve the intrinsic parameters for the color camera.
|
|
595
|
+
"""
|
|
596
|
+
path = "/api/v1/camera/intrinsics/rgb"
|
|
597
|
+
response = self._request_manager.request(
|
|
598
|
+
"GET",
|
|
599
|
+
path,
|
|
600
|
+
headers=self._request_manager.json_headers(),
|
|
601
|
+
)
|
|
602
|
+
parsed = None
|
|
603
|
+
|
|
604
|
+
is_user_error = response.status >= 400 and response.status < 500
|
|
605
|
+
is_unavailable = response.status == 503
|
|
606
|
+
if parsed is None and (is_user_error or is_unavailable):
|
|
607
|
+
parsed = models.parse_error_response(json.loads(response.data))
|
|
608
|
+
|
|
609
|
+
return Response(
|
|
610
|
+
parsed,
|
|
611
|
+
response.status,
|
|
612
|
+
response
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
def get_camera_stream(
|
|
616
|
+
self,
|
|
617
|
+
) -> Response[
|
|
618
|
+
None,
|
|
619
|
+
None
|
|
620
|
+
]:
|
|
621
|
+
"""
|
|
622
|
+
Retrieve the latest RGB frame from the camera.
|
|
623
|
+
"""
|
|
624
|
+
path = "/api/v1/camera/stream"
|
|
625
|
+
response = self._request_manager.request(
|
|
626
|
+
"GET",
|
|
627
|
+
path,
|
|
628
|
+
headers=self._request_manager.json_headers(),
|
|
629
|
+
)
|
|
630
|
+
parsed = None
|
|
631
|
+
|
|
632
|
+
is_user_error = response.status >= 400 and response.status < 500
|
|
633
|
+
is_unavailable = response.status == 503
|
|
634
|
+
if parsed is None and (is_user_error or is_unavailable):
|
|
635
|
+
parsed = models.parse_error_response(json.loads(response.data))
|
|
636
|
+
|
|
637
|
+
return Response(
|
|
638
|
+
parsed,
|
|
639
|
+
response.status,
|
|
640
|
+
response
|
|
641
|
+
)
|
|
642
|
+
|
|
643
|
+
class Settings:
|
|
644
|
+
def __init__(self, request_manager: RequestManager):
|
|
645
|
+
self._request_manager = request_manager
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
def set_camera_settings(
|
|
649
|
+
self,
|
|
650
|
+
body: models.CameraSettings,
|
|
651
|
+
) -> Response[
|
|
652
|
+
None,
|
|
653
|
+
None
|
|
654
|
+
]:
|
|
655
|
+
"""
|
|
656
|
+
Set the camera settings.
|
|
657
|
+
"""
|
|
658
|
+
path = "/api/v1/camera/settings"
|
|
659
|
+
response = self._request_manager.request(
|
|
660
|
+
"POST",
|
|
661
|
+
path,
|
|
662
|
+
headers=self._request_manager.json_headers(),
|
|
663
|
+
body=json.dumps(models.serialize_camera_settings(body)),
|
|
664
|
+
)
|
|
665
|
+
parsed = None
|
|
666
|
+
|
|
667
|
+
is_user_error = response.status >= 400 and response.status < 500
|
|
668
|
+
is_unavailable = response.status == 503
|
|
669
|
+
if parsed is None and (is_user_error or is_unavailable):
|
|
670
|
+
parsed = models.parse_error_response(json.loads(response.data))
|
|
671
|
+
|
|
672
|
+
return Response(
|
|
673
|
+
parsed,
|
|
674
|
+
response.status,
|
|
675
|
+
response
|
|
676
|
+
)
|
|
677
|
+
|
|
678
|
+
data: Data
|
|
679
|
+
settings: Settings
|
|
680
|
+
|
|
681
|
+
def __init__(self, request_manager: RequestManager):
|
|
682
|
+
self._request_manager = request_manager
|
|
683
|
+
self.data = Camera.Data(request_manager)
|
|
684
|
+
self.settings = Camera.Settings(request_manager)
|
|
685
|
+
|
|
528
686
|
class RoutineEditor:
|
|
529
687
|
_request_manager: RequestManager
|
|
530
688
|
class Routines:
|
|
@@ -916,6 +1074,7 @@ class StandardBotsRobot(Default):
|
|
|
916
1074
|
RobotKind = RobotKind
|
|
917
1075
|
|
|
918
1076
|
movement: Movement
|
|
1077
|
+
camera: Camera
|
|
919
1078
|
routine_editor: RoutineEditor
|
|
920
1079
|
status: Status
|
|
921
1080
|
def __init__(
|
|
@@ -932,6 +1091,7 @@ class StandardBotsRobot(Default):
|
|
|
932
1091
|
robot_kind=RobotKind(robot_kind),
|
|
933
1092
|
))
|
|
934
1093
|
self.movement = Movement(self._request_manager)
|
|
1094
|
+
self.camera = Camera(self._request_manager)
|
|
935
1095
|
self.routine_editor = RoutineEditor(self._request_manager)
|
|
936
1096
|
self.status = Status(self._request_manager)
|
|
937
1097
|
|
{standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots/auto_generated/models.py
RENAMED
|
@@ -236,6 +236,337 @@ def parse_brakes_state_enum(data: object) -> BrakesStateEnum:
|
|
|
236
236
|
def serialize_brakes_state_enum(data: Union[BrakesStateEnum, str]) -> object:
|
|
237
237
|
return BrakesStateEnum(data).value
|
|
238
238
|
|
|
239
|
+
@dataclass
|
|
240
|
+
class CameraIntrinsics:
|
|
241
|
+
"""Intrinsic parameters of the camera."""
|
|
242
|
+
width: Union[float, None] = None
|
|
243
|
+
height: Union[float, None] = None
|
|
244
|
+
fx: Union[float, None] = None
|
|
245
|
+
fy: Union[float, None] = None
|
|
246
|
+
ppx: Union[float, None] = None
|
|
247
|
+
ppy: Union[float, None] = None
|
|
248
|
+
error: Union[int, None] = None
|
|
249
|
+
|
|
250
|
+
def validate_width(self, value: float) -> Tuple[bool, str]:
|
|
251
|
+
if value is None:
|
|
252
|
+
return [True, ""]
|
|
253
|
+
|
|
254
|
+
if not isinstance(value, float):
|
|
255
|
+
return [False, "width must be of type float for CameraIntrinsics, got " + type(value).__name__]
|
|
256
|
+
|
|
257
|
+
return [True, ""]
|
|
258
|
+
|
|
259
|
+
def validate_height(self, value: float) -> Tuple[bool, str]:
|
|
260
|
+
if value is None:
|
|
261
|
+
return [True, ""]
|
|
262
|
+
|
|
263
|
+
if not isinstance(value, float):
|
|
264
|
+
return [False, "height must be of type float for CameraIntrinsics, got " + type(value).__name__]
|
|
265
|
+
|
|
266
|
+
return [True, ""]
|
|
267
|
+
|
|
268
|
+
def validate_fx(self, value: float) -> Tuple[bool, str]:
|
|
269
|
+
if value is None:
|
|
270
|
+
return [True, ""]
|
|
271
|
+
|
|
272
|
+
if not isinstance(value, float):
|
|
273
|
+
return [False, "fx must be of type float for CameraIntrinsics, got " + type(value).__name__]
|
|
274
|
+
|
|
275
|
+
return [True, ""]
|
|
276
|
+
|
|
277
|
+
def validate_fy(self, value: float) -> Tuple[bool, str]:
|
|
278
|
+
if value is None:
|
|
279
|
+
return [True, ""]
|
|
280
|
+
|
|
281
|
+
if not isinstance(value, float):
|
|
282
|
+
return [False, "fy must be of type float for CameraIntrinsics, got " + type(value).__name__]
|
|
283
|
+
|
|
284
|
+
return [True, ""]
|
|
285
|
+
|
|
286
|
+
def validate_ppx(self, value: float) -> Tuple[bool, str]:
|
|
287
|
+
if value is None:
|
|
288
|
+
return [True, ""]
|
|
289
|
+
|
|
290
|
+
if not isinstance(value, float):
|
|
291
|
+
return [False, "ppx must be of type float for CameraIntrinsics, got " + type(value).__name__]
|
|
292
|
+
|
|
293
|
+
return [True, ""]
|
|
294
|
+
|
|
295
|
+
def validate_ppy(self, value: float) -> Tuple[bool, str]:
|
|
296
|
+
if value is None:
|
|
297
|
+
return [True, ""]
|
|
298
|
+
|
|
299
|
+
if not isinstance(value, float):
|
|
300
|
+
return [False, "ppy must be of type float for CameraIntrinsics, got " + type(value).__name__]
|
|
301
|
+
|
|
302
|
+
return [True, ""]
|
|
303
|
+
|
|
304
|
+
def validate_error(self, value: int) -> Tuple[bool, str]:
|
|
305
|
+
if value is None:
|
|
306
|
+
return [True, ""]
|
|
307
|
+
|
|
308
|
+
if not isinstance(value, int):
|
|
309
|
+
return [False, "error must be of type int for CameraIntrinsics, got " + type(value).__name__]
|
|
310
|
+
|
|
311
|
+
return [True, ""]
|
|
312
|
+
|
|
313
|
+
def __post_init__(self):
|
|
314
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
315
|
+
is_valid, error_str = self.validate_width(self.width)
|
|
316
|
+
if not is_valid:
|
|
317
|
+
raise TypeError(error_str)
|
|
318
|
+
is_valid, error_str = self.validate_height(self.height)
|
|
319
|
+
if not is_valid:
|
|
320
|
+
raise TypeError(error_str)
|
|
321
|
+
is_valid, error_str = self.validate_fx(self.fx)
|
|
322
|
+
if not is_valid:
|
|
323
|
+
raise TypeError(error_str)
|
|
324
|
+
is_valid, error_str = self.validate_fy(self.fy)
|
|
325
|
+
if not is_valid:
|
|
326
|
+
raise TypeError(error_str)
|
|
327
|
+
is_valid, error_str = self.validate_ppx(self.ppx)
|
|
328
|
+
if not is_valid:
|
|
329
|
+
raise TypeError(error_str)
|
|
330
|
+
is_valid, error_str = self.validate_ppy(self.ppy)
|
|
331
|
+
if not is_valid:
|
|
332
|
+
raise TypeError(error_str)
|
|
333
|
+
is_valid, error_str = self.validate_error(self.error)
|
|
334
|
+
if not is_valid:
|
|
335
|
+
raise TypeError(error_str)
|
|
336
|
+
|
|
337
|
+
def parse_camera_intrinsics(data: object):
|
|
338
|
+
return CameraIntrinsics(
|
|
339
|
+
width=parse_f_64(data["width"]) if "width" in data else None,
|
|
340
|
+
height=parse_f_64(data["height"]) if "height" in data else None,
|
|
341
|
+
fx=parse_f_64(data["fx"]) if "fx" in data else None,
|
|
342
|
+
fy=parse_f_64(data["fy"]) if "fy" in data else None,
|
|
343
|
+
ppx=parse_f_64(data["ppx"]) if "ppx" in data else None,
|
|
344
|
+
ppy=parse_f_64(data["ppy"]) if "ppy" in data else None,
|
|
345
|
+
error=parse_i_8(data["error"]) if "error" in data else None,
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
def serialize_camera_intrinsics(data: CameraIntrinsics) -> object:
|
|
349
|
+
return {
|
|
350
|
+
"width": None if data.width is None else serialize_f_64(data.width),
|
|
351
|
+
"height": None if data.height is None else serialize_f_64(data.height),
|
|
352
|
+
"fx": None if data.fx is None else serialize_f_64(data.fx),
|
|
353
|
+
"fy": None if data.fy is None else serialize_f_64(data.fy),
|
|
354
|
+
"ppx": None if data.ppx is None else serialize_f_64(data.ppx),
|
|
355
|
+
"ppy": None if data.ppy is None else serialize_f_64(data.ppy),
|
|
356
|
+
"error": None if data.error is None else serialize_i_8(data.error),
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
@dataclass
|
|
360
|
+
class CameraSettings:
|
|
361
|
+
"""Settings for the camera."""
|
|
362
|
+
brightness: Union[int, None] = None
|
|
363
|
+
contrast: Union[int, None] = None
|
|
364
|
+
exposure: Union[int, None] = None
|
|
365
|
+
sharpness: Union[int, None] = None
|
|
366
|
+
hue: Union[int, None] = None
|
|
367
|
+
whiteBalance: Union[int, None] = None
|
|
368
|
+
autoWhiteBalance: Union[bool, None] = None
|
|
369
|
+
|
|
370
|
+
def validate_brightness(self, value: int) -> Tuple[bool, str]:
|
|
371
|
+
if value is None:
|
|
372
|
+
return [True, ""]
|
|
373
|
+
|
|
374
|
+
if not isinstance(value, int):
|
|
375
|
+
return [False, "brightness must be of type int for CameraSettings, got " + type(value).__name__]
|
|
376
|
+
|
|
377
|
+
return [True, ""]
|
|
378
|
+
|
|
379
|
+
def validate_contrast(self, value: int) -> Tuple[bool, str]:
|
|
380
|
+
if value is None:
|
|
381
|
+
return [True, ""]
|
|
382
|
+
|
|
383
|
+
if not isinstance(value, int):
|
|
384
|
+
return [False, "contrast must be of type int for CameraSettings, got " + type(value).__name__]
|
|
385
|
+
|
|
386
|
+
return [True, ""]
|
|
387
|
+
|
|
388
|
+
def validate_exposure(self, value: int) -> Tuple[bool, str]:
|
|
389
|
+
if value is None:
|
|
390
|
+
return [True, ""]
|
|
391
|
+
|
|
392
|
+
if not isinstance(value, int):
|
|
393
|
+
return [False, "exposure must be of type int for CameraSettings, got " + type(value).__name__]
|
|
394
|
+
|
|
395
|
+
return [True, ""]
|
|
396
|
+
|
|
397
|
+
def validate_sharpness(self, value: int) -> Tuple[bool, str]:
|
|
398
|
+
if value is None:
|
|
399
|
+
return [True, ""]
|
|
400
|
+
|
|
401
|
+
if not isinstance(value, int):
|
|
402
|
+
return [False, "sharpness must be of type int for CameraSettings, got " + type(value).__name__]
|
|
403
|
+
|
|
404
|
+
return [True, ""]
|
|
405
|
+
|
|
406
|
+
def validate_hue(self, value: int) -> Tuple[bool, str]:
|
|
407
|
+
if value is None:
|
|
408
|
+
return [True, ""]
|
|
409
|
+
|
|
410
|
+
if not isinstance(value, int):
|
|
411
|
+
return [False, "hue must be of type int for CameraSettings, got " + type(value).__name__]
|
|
412
|
+
|
|
413
|
+
return [True, ""]
|
|
414
|
+
|
|
415
|
+
def validate_whiteBalance(self, value: int) -> Tuple[bool, str]:
|
|
416
|
+
if value is None:
|
|
417
|
+
return [True, ""]
|
|
418
|
+
|
|
419
|
+
if not isinstance(value, int):
|
|
420
|
+
return [False, "whiteBalance must be of type int for CameraSettings, got " + type(value).__name__]
|
|
421
|
+
|
|
422
|
+
return [True, ""]
|
|
423
|
+
|
|
424
|
+
def validate_autoWhiteBalance(self, value: bool) -> Tuple[bool, str]:
|
|
425
|
+
if value is None:
|
|
426
|
+
return [True, ""]
|
|
427
|
+
|
|
428
|
+
if not isinstance(value, bool):
|
|
429
|
+
return [False, "autoWhiteBalance must be of type bool for CameraSettings, got " + type(value).__name__]
|
|
430
|
+
|
|
431
|
+
return [True, ""]
|
|
432
|
+
|
|
433
|
+
def __post_init__(self):
|
|
434
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
435
|
+
is_valid, error_str = self.validate_brightness(self.brightness)
|
|
436
|
+
if not is_valid:
|
|
437
|
+
raise TypeError(error_str)
|
|
438
|
+
is_valid, error_str = self.validate_contrast(self.contrast)
|
|
439
|
+
if not is_valid:
|
|
440
|
+
raise TypeError(error_str)
|
|
441
|
+
is_valid, error_str = self.validate_exposure(self.exposure)
|
|
442
|
+
if not is_valid:
|
|
443
|
+
raise TypeError(error_str)
|
|
444
|
+
is_valid, error_str = self.validate_sharpness(self.sharpness)
|
|
445
|
+
if not is_valid:
|
|
446
|
+
raise TypeError(error_str)
|
|
447
|
+
is_valid, error_str = self.validate_hue(self.hue)
|
|
448
|
+
if not is_valid:
|
|
449
|
+
raise TypeError(error_str)
|
|
450
|
+
is_valid, error_str = self.validate_whiteBalance(self.whiteBalance)
|
|
451
|
+
if not is_valid:
|
|
452
|
+
raise TypeError(error_str)
|
|
453
|
+
is_valid, error_str = self.validate_autoWhiteBalance(self.autoWhiteBalance)
|
|
454
|
+
if not is_valid:
|
|
455
|
+
raise TypeError(error_str)
|
|
456
|
+
|
|
457
|
+
def parse_camera_settings(data: object):
|
|
458
|
+
return CameraSettings(
|
|
459
|
+
brightness=parse_i_16(data["brightness"]) if "brightness" in data else None,
|
|
460
|
+
contrast=parse_i_16(data["contrast"]) if "contrast" in data else None,
|
|
461
|
+
exposure=parse_i_16(data["exposure"]) if "exposure" in data else None,
|
|
462
|
+
sharpness=parse_i_16(data["sharpness"]) if "sharpness" in data else None,
|
|
463
|
+
hue=parse_i_16(data["hue"]) if "hue" in data else None,
|
|
464
|
+
whiteBalance=parse_i_16(data["whiteBalance"]) if "whiteBalance" in data else None,
|
|
465
|
+
autoWhiteBalance=parse_bool(data["autoWhiteBalance"]) if "autoWhiteBalance" in data else None,
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
def serialize_camera_settings(data: CameraSettings) -> object:
|
|
469
|
+
return {
|
|
470
|
+
"brightness": None if data.brightness is None else serialize_i_16(data.brightness),
|
|
471
|
+
"contrast": None if data.contrast is None else serialize_i_16(data.contrast),
|
|
472
|
+
"exposure": None if data.exposure is None else serialize_i_16(data.exposure),
|
|
473
|
+
"sharpness": None if data.sharpness is None else serialize_i_16(data.sharpness),
|
|
474
|
+
"hue": None if data.hue is None else serialize_i_16(data.hue),
|
|
475
|
+
"whiteBalance": None if data.whiteBalance is None else serialize_i_16(data.whiteBalance),
|
|
476
|
+
"autoWhiteBalance": None if data.autoWhiteBalance is None else serialize_bool(data.autoWhiteBalance),
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
@dataclass
|
|
480
|
+
class DHAGGripperCommandRequest:
|
|
481
|
+
"""Control the DH AG gripper (end effector) of the robot
|
|
482
|
+
"""
|
|
483
|
+
target_diameter: Union[float, None] = None
|
|
484
|
+
target_force: Union[float, None] = None
|
|
485
|
+
target_speed: Union[float, None] = None
|
|
486
|
+
|
|
487
|
+
def validate_target_diameter(self, value: float) -> Tuple[bool, str]:
|
|
488
|
+
if value is None:
|
|
489
|
+
return [False, "target_diameter is required for DHAGGripperCommandRequest"]
|
|
490
|
+
|
|
491
|
+
if not isinstance(value, float):
|
|
492
|
+
return [False, "target_diameter must be of type float for DHAGGripperCommandRequest, got " + type(value).__name__]
|
|
493
|
+
|
|
494
|
+
return [True, ""]
|
|
495
|
+
|
|
496
|
+
def validate_target_force(self, value: float) -> Tuple[bool, str]:
|
|
497
|
+
if value is None:
|
|
498
|
+
return [True, ""]
|
|
499
|
+
|
|
500
|
+
if not isinstance(value, float):
|
|
501
|
+
return [False, "target_force must be of type float for DHAGGripperCommandRequest, got " + type(value).__name__]
|
|
502
|
+
|
|
503
|
+
return [True, ""]
|
|
504
|
+
|
|
505
|
+
def validate_target_speed(self, value: float) -> Tuple[bool, str]:
|
|
506
|
+
if value is None:
|
|
507
|
+
return [True, ""]
|
|
508
|
+
|
|
509
|
+
if not isinstance(value, float):
|
|
510
|
+
return [False, "target_speed must be of type float for DHAGGripperCommandRequest, got " + type(value).__name__]
|
|
511
|
+
|
|
512
|
+
return [True, ""]
|
|
513
|
+
|
|
514
|
+
def __post_init__(self):
|
|
515
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
516
|
+
is_valid, error_str = self.validate_target_diameter(self.target_diameter)
|
|
517
|
+
if not is_valid:
|
|
518
|
+
raise TypeError(error_str)
|
|
519
|
+
is_valid, error_str = self.validate_target_force(self.target_force)
|
|
520
|
+
if not is_valid:
|
|
521
|
+
raise TypeError(error_str)
|
|
522
|
+
is_valid, error_str = self.validate_target_speed(self.target_speed)
|
|
523
|
+
if not is_valid:
|
|
524
|
+
raise TypeError(error_str)
|
|
525
|
+
|
|
526
|
+
def parse_dhag_gripper_command_request(data: object):
|
|
527
|
+
return DHAGGripperCommandRequest(
|
|
528
|
+
target_diameter=parse_f_64(data["target_diameter"]) if "target_diameter" in data else None,
|
|
529
|
+
target_force=parse_f_64(data["target_force"]) if "target_force" in data else None,
|
|
530
|
+
target_speed=parse_f_64(data["target_speed"]) if "target_speed" in data else None,
|
|
531
|
+
)
|
|
532
|
+
|
|
533
|
+
def serialize_dhag_gripper_command_request(data: DHAGGripperCommandRequest) -> object:
|
|
534
|
+
return {
|
|
535
|
+
"target_diameter": serialize_f_64(data.target_diameter),
|
|
536
|
+
"target_force": None if data.target_force is None else serialize_f_64(data.target_force),
|
|
537
|
+
"target_speed": None if data.target_speed is None else serialize_f_64(data.target_speed),
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
@dataclass
|
|
541
|
+
class DHAGGripperConfiguration:
|
|
542
|
+
"""Configuration for DH AG Gripper"""
|
|
543
|
+
diameter: Union[float, None] = None
|
|
544
|
+
|
|
545
|
+
def validate_diameter(self, value: float) -> Tuple[bool, str]:
|
|
546
|
+
if value is None:
|
|
547
|
+
return [False, "diameter is required for DHAGGripperConfiguration"]
|
|
548
|
+
|
|
549
|
+
if not isinstance(value, float):
|
|
550
|
+
return [False, "diameter must be of type float for DHAGGripperConfiguration, got " + type(value).__name__]
|
|
551
|
+
|
|
552
|
+
return [True, ""]
|
|
553
|
+
|
|
554
|
+
def __post_init__(self):
|
|
555
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
556
|
+
is_valid, error_str = self.validate_diameter(self.diameter)
|
|
557
|
+
if not is_valid:
|
|
558
|
+
raise TypeError(error_str)
|
|
559
|
+
|
|
560
|
+
def parse_dhag_gripper_configuration(data: object):
|
|
561
|
+
return DHAGGripperConfiguration(
|
|
562
|
+
diameter=parse_f_64(data["diameter"]) if "diameter" in data else None,
|
|
563
|
+
)
|
|
564
|
+
|
|
565
|
+
def serialize_dhag_gripper_configuration(data: DHAGGripperConfiguration) -> object:
|
|
566
|
+
return {
|
|
567
|
+
"diameter": serialize_f_64(data.diameter),
|
|
568
|
+
}
|
|
569
|
+
|
|
239
570
|
@dataclass
|
|
240
571
|
class EngageEmergencyStopRequest:
|
|
241
572
|
"""Engage Emergency Stop. This will immediately stop the robot and prevent it from moving until the robot is unbraked.
|
|
@@ -348,6 +679,16 @@ class ErrorEnum(Enum):
|
|
|
348
679
|
"""No matching equipment found"""
|
|
349
680
|
ServiceInitializing = "service_initializing"
|
|
350
681
|
"""The service is unavailable while initializing"""
|
|
682
|
+
CameraDisconnected = "camera_disconnected"
|
|
683
|
+
"""Camera service running, but no camera is connected"""
|
|
684
|
+
SettingsValidationError = "settings_validation_error"
|
|
685
|
+
"""Camera settings validation failed"""
|
|
686
|
+
SettingsTimeout = "settings_timeout"
|
|
687
|
+
"""Camera settings timed out"""
|
|
688
|
+
InternalServerError = "internal_server_error"
|
|
689
|
+
"""Internal server error occurred"""
|
|
690
|
+
NotFound = "not_found"
|
|
691
|
+
"""Requested resource not found"""
|
|
351
692
|
|
|
352
693
|
def parse_error_enum(data: object) -> ErrorEnum:
|
|
353
694
|
return ErrorEnum(data)
|
|
@@ -372,6 +713,8 @@ class GripperKindEnum(Enum):
|
|
|
372
713
|
"""An OnRobot 2FG7 Gripper is connected"""
|
|
373
714
|
Onrobot3Fg15 = "onrobot_3fg15"
|
|
374
715
|
"""An OnRobot 3FG15 Gripper is connected"""
|
|
716
|
+
DhAg = "dh_ag"
|
|
717
|
+
"""A DH AG Gripper is connected"""
|
|
375
718
|
NoneConnected = "none_connected"
|
|
376
719
|
"""No gripper is connected"""
|
|
377
720
|
|
|
@@ -847,6 +1190,66 @@ def serialize_brakes_state(data: BrakesState) -> object:
|
|
|
847
1190
|
"state": serialize_brakes_state_enum(data.state),
|
|
848
1191
|
}
|
|
849
1192
|
|
|
1193
|
+
@dataclass
|
|
1194
|
+
class CameraIntrinsicsResponse:
|
|
1195
|
+
"""Response with intrinsic parameters of the camera."""
|
|
1196
|
+
intrinsics: Union[CameraIntrinsics, None] = None
|
|
1197
|
+
|
|
1198
|
+
def validate_intrinsics(self, value: CameraIntrinsics) -> Tuple[bool, str]:
|
|
1199
|
+
if value is None:
|
|
1200
|
+
return [True, ""]
|
|
1201
|
+
|
|
1202
|
+
if not isinstance(value, CameraIntrinsics):
|
|
1203
|
+
return [False, "intrinsics must be of type CameraIntrinsics for CameraIntrinsicsResponse, got " + type(value).__name__]
|
|
1204
|
+
|
|
1205
|
+
return [True, ""]
|
|
1206
|
+
|
|
1207
|
+
def __post_init__(self):
|
|
1208
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1209
|
+
is_valid, error_str = self.validate_intrinsics(self.intrinsics)
|
|
1210
|
+
if not is_valid:
|
|
1211
|
+
raise TypeError(error_str)
|
|
1212
|
+
|
|
1213
|
+
def parse_camera_intrinsics_response(data: object):
|
|
1214
|
+
return CameraIntrinsicsResponse(
|
|
1215
|
+
intrinsics=parse_camera_intrinsics(data["intrinsics"]) if "intrinsics" in data else None,
|
|
1216
|
+
)
|
|
1217
|
+
|
|
1218
|
+
def serialize_camera_intrinsics_response(data: CameraIntrinsicsResponse) -> object:
|
|
1219
|
+
return {
|
|
1220
|
+
"intrinsics": None if data.intrinsics is None else serialize_camera_intrinsics(data.intrinsics),
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
@dataclass
|
|
1224
|
+
class CameraFrameRequest:
|
|
1225
|
+
"""Request for a single camera frame."""
|
|
1226
|
+
camera_settings: Union[CameraSettings, None] = None
|
|
1227
|
+
|
|
1228
|
+
def validate_camera_settings(self, value: CameraSettings) -> Tuple[bool, str]:
|
|
1229
|
+
if value is None:
|
|
1230
|
+
return [True, ""]
|
|
1231
|
+
|
|
1232
|
+
if not isinstance(value, CameraSettings):
|
|
1233
|
+
return [False, "camera_settings must be of type CameraSettings for CameraFrameRequest, got " + type(value).__name__]
|
|
1234
|
+
|
|
1235
|
+
return [True, ""]
|
|
1236
|
+
|
|
1237
|
+
def __post_init__(self):
|
|
1238
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1239
|
+
is_valid, error_str = self.validate_camera_settings(self.camera_settings)
|
|
1240
|
+
if not is_valid:
|
|
1241
|
+
raise TypeError(error_str)
|
|
1242
|
+
|
|
1243
|
+
def parse_camera_frame_request(data: object):
|
|
1244
|
+
return CameraFrameRequest(
|
|
1245
|
+
camera_settings=parse_camera_settings(data["camera_settings"]) if "camera_settings" in data else None,
|
|
1246
|
+
)
|
|
1247
|
+
|
|
1248
|
+
def serialize_camera_frame_request(data: CameraFrameRequest) -> object:
|
|
1249
|
+
return {
|
|
1250
|
+
"camera_settings": None if data.camera_settings is None else serialize_camera_settings(data.camera_settings),
|
|
1251
|
+
}
|
|
1252
|
+
|
|
850
1253
|
EnvironmentVariablesList = List[EnvironmentVariable]
|
|
851
1254
|
|
|
852
1255
|
def parse_environment_variables_list(data: object) -> EnvironmentVariablesList:
|
|
@@ -865,7 +1268,7 @@ class ErrorResponse:
|
|
|
865
1268
|
if value is None:
|
|
866
1269
|
return [False, "error is required for ErrorResponse"]
|
|
867
1270
|
|
|
868
|
-
if not ((isinstance(value, str) and ErrorEnum in ['authorization_required', 'routine_must_be_running', 'api_control_required', 'robot_brakes_disengage_failed', 'robot_brakes_engage_failed', 'request_failed_validation', 'brakes_must_be_engaged', 'brakes_must_be_disengaged', 'equipment_no_matching', 'service_initializing']) or isinstance(value, ErrorEnum)):
|
|
1271
|
+
if not ((isinstance(value, str) and ErrorEnum in ['authorization_required', 'routine_must_be_running', 'api_control_required', 'robot_brakes_disengage_failed', 'robot_brakes_engage_failed', 'request_failed_validation', 'brakes_must_be_engaged', 'brakes_must_be_disengaged', 'equipment_no_matching', 'service_initializing', 'camera_disconnected', 'settings_validation_error', 'settings_timeout', 'internal_server_error', 'not_found']) or isinstance(value, ErrorEnum)):
|
|
869
1272
|
return [False, "error must be of type ErrorEnum for ErrorResponse, got " + type(value).__name__]
|
|
870
1273
|
|
|
871
1274
|
return [True, ""]
|
|
@@ -950,30 +1353,45 @@ def serialize_force_unit(data: ForceUnit) -> object:
|
|
|
950
1353
|
class GripperConfiguration:
|
|
951
1354
|
"""Configuration of gripper, also known as End Effector"""
|
|
952
1355
|
kind: Union[GripperKindEnum, None] = None
|
|
1356
|
+
dh_ag: Union[DHAGGripperConfiguration, None] = None
|
|
953
1357
|
|
|
954
1358
|
def validate_kind(self, value: GripperKindEnum) -> Tuple[bool, str]:
|
|
955
1359
|
if value is None:
|
|
956
1360
|
return [False, "kind is required for GripperConfiguration"]
|
|
957
1361
|
|
|
958
|
-
if not ((isinstance(value, str) and GripperKindEnum in ['onrobot_2fg7', 'onrobot_3fg15', 'none_connected']) or isinstance(value, GripperKindEnum)):
|
|
1362
|
+
if not ((isinstance(value, str) and GripperKindEnum in ['onrobot_2fg7', 'onrobot_3fg15', 'dh_ag', 'none_connected']) or isinstance(value, GripperKindEnum)):
|
|
959
1363
|
return [False, "kind must be of type GripperKindEnum for GripperConfiguration, got " + type(value).__name__]
|
|
960
1364
|
|
|
961
1365
|
return [True, ""]
|
|
962
1366
|
|
|
1367
|
+
def validate_dh_ag(self, value: DHAGGripperConfiguration) -> Tuple[bool, str]:
|
|
1368
|
+
if value is None:
|
|
1369
|
+
return [True, ""]
|
|
1370
|
+
|
|
1371
|
+
if not isinstance(value, DHAGGripperConfiguration):
|
|
1372
|
+
return [False, "dh_ag must be of type DHAGGripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
1373
|
+
|
|
1374
|
+
return [True, ""]
|
|
1375
|
+
|
|
963
1376
|
def __post_init__(self):
|
|
964
1377
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
965
1378
|
is_valid, error_str = self.validate_kind(self.kind)
|
|
966
1379
|
if not is_valid:
|
|
967
1380
|
raise TypeError(error_str)
|
|
1381
|
+
is_valid, error_str = self.validate_dh_ag(self.dh_ag)
|
|
1382
|
+
if not is_valid:
|
|
1383
|
+
raise TypeError(error_str)
|
|
968
1384
|
|
|
969
1385
|
def parse_gripper_configuration(data: object):
|
|
970
1386
|
return GripperConfiguration(
|
|
971
1387
|
kind=parse_gripper_kind_enum(data["kind"]) if "kind" in data else None,
|
|
1388
|
+
dh_ag=parse_dhag_gripper_configuration(data["dh_ag"]) if "dh_ag" in data else None,
|
|
972
1389
|
)
|
|
973
1390
|
|
|
974
1391
|
def serialize_gripper_configuration(data: GripperConfiguration) -> object:
|
|
975
1392
|
return {
|
|
976
1393
|
"kind": serialize_gripper_kind_enum(data.kind),
|
|
1394
|
+
"dh_ag": None if data.dh_ag is None else serialize_dhag_gripper_configuration(data.dh_ag),
|
|
977
1395
|
}
|
|
978
1396
|
|
|
979
1397
|
@dataclass
|
|
@@ -1717,12 +2135,13 @@ class GripperCommandRequest:
|
|
|
1717
2135
|
kind: Union[GripperKindEnum, None] = None
|
|
1718
2136
|
onrobot_2fg7: Union[OnRobot2FG7GripperCommandRequest, None] = None
|
|
1719
2137
|
onrobot_3fg15: Union[OnRobot3FG15GripperCommandRequest, None] = None
|
|
2138
|
+
dh_ag: Union[DHAGGripperCommandRequest, None] = None
|
|
1720
2139
|
|
|
1721
2140
|
def validate_kind(self, value: GripperKindEnum) -> Tuple[bool, str]:
|
|
1722
2141
|
if value is None:
|
|
1723
2142
|
return [False, "kind is required for GripperCommandRequest"]
|
|
1724
2143
|
|
|
1725
|
-
if not ((isinstance(value, str) and GripperKindEnum in ['onrobot_2fg7', 'onrobot_3fg15', 'none_connected']) or isinstance(value, GripperKindEnum)):
|
|
2144
|
+
if not ((isinstance(value, str) and GripperKindEnum in ['onrobot_2fg7', 'onrobot_3fg15', 'dh_ag', 'none_connected']) or isinstance(value, GripperKindEnum)):
|
|
1726
2145
|
return [False, "kind must be of type GripperKindEnum for GripperCommandRequest, got " + type(value).__name__]
|
|
1727
2146
|
|
|
1728
2147
|
return [True, ""]
|
|
@@ -1745,6 +2164,15 @@ class GripperCommandRequest:
|
|
|
1745
2164
|
|
|
1746
2165
|
return [True, ""]
|
|
1747
2166
|
|
|
2167
|
+
def validate_dh_ag(self, value: DHAGGripperCommandRequest) -> Tuple[bool, str]:
|
|
2168
|
+
if value is None:
|
|
2169
|
+
return [True, ""]
|
|
2170
|
+
|
|
2171
|
+
if not isinstance(value, DHAGGripperCommandRequest):
|
|
2172
|
+
return [False, "dh_ag must be of type DHAGGripperCommandRequest for GripperCommandRequest, got " + type(value).__name__]
|
|
2173
|
+
|
|
2174
|
+
return [True, ""]
|
|
2175
|
+
|
|
1748
2176
|
def __post_init__(self):
|
|
1749
2177
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1750
2178
|
is_valid, error_str = self.validate_kind(self.kind)
|
|
@@ -1756,12 +2184,16 @@ class GripperCommandRequest:
|
|
|
1756
2184
|
is_valid, error_str = self.validate_onrobot_3fg15(self.onrobot_3fg15)
|
|
1757
2185
|
if not is_valid:
|
|
1758
2186
|
raise TypeError(error_str)
|
|
2187
|
+
is_valid, error_str = self.validate_dh_ag(self.dh_ag)
|
|
2188
|
+
if not is_valid:
|
|
2189
|
+
raise TypeError(error_str)
|
|
1759
2190
|
|
|
1760
2191
|
def parse_gripper_command_request(data: object):
|
|
1761
2192
|
return GripperCommandRequest(
|
|
1762
2193
|
kind=parse_gripper_kind_enum(data["kind"]) if "kind" in data else None,
|
|
1763
2194
|
onrobot_2fg7=parse_on_robot_2_fg_7_gripper_command_request(data["onrobot_2fg7"]) if "onrobot_2fg7" in data else None,
|
|
1764
2195
|
onrobot_3fg15=parse_on_robot_3_fg_15_gripper_command_request(data["onrobot_3fg15"]) if "onrobot_3fg15" in data else None,
|
|
2196
|
+
dh_ag=parse_dhag_gripper_command_request(data["dh_ag"]) if "dh_ag" in data else None,
|
|
1765
2197
|
)
|
|
1766
2198
|
|
|
1767
2199
|
def serialize_gripper_command_request(data: GripperCommandRequest) -> object:
|
|
@@ -1769,6 +2201,7 @@ def serialize_gripper_command_request(data: GripperCommandRequest) -> object:
|
|
|
1769
2201
|
"kind": serialize_gripper_kind_enum(data.kind),
|
|
1770
2202
|
"onrobot_2fg7": None if data.onrobot_2fg7 is None else serialize_on_robot_2_fg_7_gripper_command_request(data.onrobot_2fg7),
|
|
1771
2203
|
"onrobot_3fg15": None if data.onrobot_3fg15 is None else serialize_on_robot_3_fg_15_gripper_command_request(data.onrobot_3fg15),
|
|
2204
|
+
"dh_ag": None if data.dh_ag is None else serialize_dhag_gripper_command_request(data.dh_ag),
|
|
1772
2205
|
}
|
|
1773
2206
|
|
|
1774
2207
|
@dataclass
|
|
File without changes
|
|
File without changes
|
{standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots/auto_generated/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots.egg-info/requires.txt
RENAMED
|
File without changes
|
{standardbots-2.20240212.14 → standardbots-2.20240212.16}/standardbots.egg-info/top_level.txt
RENAMED
|
File without changes
|