standardbots 2.20240212.11__py3-none-any.whl → 2.20241003.41__py3-none-any.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 standardbots might be problematic. Click here for more details.
- standardbots/auto_generated/__init__.py +1 -0
- standardbots/auto_generated/apis.py +675 -12
- standardbots/auto_generated/models.py +3209 -595
- standardbots-2.20241003.41.dist-info/METADATA +22 -0
- standardbots-2.20241003.41.dist-info/RECORD +8 -0
- {standardbots-2.20240212.11.dist-info → standardbots-2.20241003.41.dist-info}/WHEEL +1 -1
- standardbots-2.20240212.11.dist-info/METADATA +0 -15
- standardbots-2.20240212.11.dist-info/RECORD +0 -8
- {standardbots-2.20240212.11.dist-info → standardbots-2.20241003.41.dist-info}/top_level.txt +0 -0
|
@@ -237,977 +237,3034 @@ def serialize_brakes_state_enum(data: Union[BrakesStateEnum, str]) -> object:
|
|
|
237
237
|
return BrakesStateEnum(data).value
|
|
238
238
|
|
|
239
239
|
@dataclass
|
|
240
|
-
class
|
|
241
|
-
"""
|
|
242
|
-
|
|
243
|
-
|
|
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, ""]
|
|
244
253
|
|
|
245
|
-
|
|
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]:
|
|
246
260
|
if value is None:
|
|
247
261
|
return [True, ""]
|
|
248
262
|
|
|
249
|
-
if not isinstance(value,
|
|
250
|
-
return [False, "
|
|
263
|
+
if not isinstance(value, float):
|
|
264
|
+
return [False, "height must be of type float for CameraIntrinsics, got " + type(value).__name__]
|
|
251
265
|
|
|
252
266
|
return [True, ""]
|
|
253
267
|
|
|
254
|
-
def
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if not is_valid:
|
|
258
|
-
raise TypeError(error_str)
|
|
268
|
+
def validate_fx(self, value: float) -> Tuple[bool, str]:
|
|
269
|
+
if value is None:
|
|
270
|
+
return [True, ""]
|
|
259
271
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
reason=parse_str(data["reason"]) if "reason" in data else None,
|
|
263
|
-
)
|
|
272
|
+
if not isinstance(value, float):
|
|
273
|
+
return [False, "fx must be of type float for CameraIntrinsics, got " + type(value).__name__]
|
|
264
274
|
|
|
265
|
-
|
|
266
|
-
return {
|
|
267
|
-
"reason": None if data.reason is None else serialize_str(data.reason),
|
|
268
|
-
}
|
|
275
|
+
return [True, ""]
|
|
269
276
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
id: Union[str, None] = None
|
|
274
|
-
name: Union[str, None] = None
|
|
275
|
-
value: Union[str, None] = None
|
|
277
|
+
def validate_fy(self, value: float) -> Tuple[bool, str]:
|
|
278
|
+
if value is None:
|
|
279
|
+
return [True, ""]
|
|
276
280
|
|
|
277
|
-
|
|
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]:
|
|
278
287
|
if value is None:
|
|
279
|
-
return [
|
|
288
|
+
return [True, ""]
|
|
280
289
|
|
|
281
|
-
if not isinstance(value,
|
|
282
|
-
return [False, "
|
|
290
|
+
if not isinstance(value, float):
|
|
291
|
+
return [False, "ppx must be of type float for CameraIntrinsics, got " + type(value).__name__]
|
|
283
292
|
|
|
284
293
|
return [True, ""]
|
|
285
294
|
|
|
286
|
-
def
|
|
295
|
+
def validate_ppy(self, value: float) -> Tuple[bool, str]:
|
|
287
296
|
if value is None:
|
|
288
297
|
return [True, ""]
|
|
289
298
|
|
|
290
|
-
if not isinstance(value,
|
|
291
|
-
return [False, "
|
|
299
|
+
if not isinstance(value, float):
|
|
300
|
+
return [False, "ppy must be of type float for CameraIntrinsics, got " + type(value).__name__]
|
|
292
301
|
|
|
293
302
|
return [True, ""]
|
|
294
303
|
|
|
295
|
-
def
|
|
304
|
+
def validate_error(self, value: int) -> Tuple[bool, str]:
|
|
296
305
|
if value is None:
|
|
297
306
|
return [True, ""]
|
|
298
307
|
|
|
299
|
-
if not isinstance(value,
|
|
300
|
-
return [False, "
|
|
308
|
+
if not isinstance(value, int):
|
|
309
|
+
return [False, "error must be of type int for CameraIntrinsics, got " + type(value).__name__]
|
|
301
310
|
|
|
302
311
|
return [True, ""]
|
|
303
312
|
|
|
304
313
|
def __post_init__(self):
|
|
305
314
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
306
|
-
is_valid, error_str = self.
|
|
315
|
+
is_valid, error_str = self.validate_width(self.width)
|
|
307
316
|
if not is_valid:
|
|
308
317
|
raise TypeError(error_str)
|
|
309
|
-
is_valid, error_str = self.
|
|
318
|
+
is_valid, error_str = self.validate_height(self.height)
|
|
310
319
|
if not is_valid:
|
|
311
320
|
raise TypeError(error_str)
|
|
312
|
-
is_valid, error_str = self.
|
|
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)
|
|
313
334
|
if not is_valid:
|
|
314
335
|
raise TypeError(error_str)
|
|
315
336
|
|
|
316
|
-
def
|
|
317
|
-
return
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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,
|
|
321
346
|
)
|
|
322
347
|
|
|
323
|
-
def
|
|
348
|
+
def serialize_camera_intrinsics(data: CameraIntrinsics) -> object:
|
|
324
349
|
return {
|
|
325
|
-
"
|
|
326
|
-
"
|
|
327
|
-
"
|
|
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),
|
|
328
357
|
}
|
|
329
358
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
"""
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
"""Brakes must be_engaged"""
|
|
345
|
-
BrakesMustBeDisengaged = "brakes_must_be_disengaged"
|
|
346
|
-
"""Brakes must be disengaged"""
|
|
347
|
-
EquipmentNoMatching = "equipment_no_matching"
|
|
348
|
-
"""No matching equipment found"""
|
|
349
|
-
ServiceInitializing = "service_initializing"
|
|
350
|
-
"""The service is unavailable while initializing"""
|
|
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, ""]
|
|
351
373
|
|
|
352
|
-
|
|
353
|
-
|
|
374
|
+
if not isinstance(value, int):
|
|
375
|
+
return [False, "brightness must be of type int for CameraSettings, got " + type(value).__name__]
|
|
354
376
|
|
|
355
|
-
|
|
356
|
-
return ErrorEnum(data).value
|
|
377
|
+
return [True, ""]
|
|
357
378
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
Pounds = "pounds"
|
|
362
|
-
"""Enum Pounds = `pounds`"""
|
|
379
|
+
def validate_contrast(self, value: int) -> Tuple[bool, str]:
|
|
380
|
+
if value is None:
|
|
381
|
+
return [True, ""]
|
|
363
382
|
|
|
364
|
-
|
|
365
|
-
|
|
383
|
+
if not isinstance(value, int):
|
|
384
|
+
return [False, "contrast must be of type int for CameraSettings, got " + type(value).__name__]
|
|
366
385
|
|
|
367
|
-
|
|
368
|
-
return ForceUnitKind(data).value
|
|
386
|
+
return [True, ""]
|
|
369
387
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
Onrobot3Fg15 = "onrobot_3fg15"
|
|
374
|
-
"""An OnRobot 3FG15 Gripper is connected"""
|
|
375
|
-
NoneConnected = "none_connected"
|
|
376
|
-
"""No gripper is connected"""
|
|
388
|
+
def validate_exposure(self, value: int) -> Tuple[bool, str]:
|
|
389
|
+
if value is None:
|
|
390
|
+
return [True, ""]
|
|
377
391
|
|
|
378
|
-
|
|
379
|
-
|
|
392
|
+
if not isinstance(value, int):
|
|
393
|
+
return [False, "exposure must be of type int for CameraSettings, got " + type(value).__name__]
|
|
380
394
|
|
|
381
|
-
|
|
382
|
-
return GripperKindEnum(data).value
|
|
395
|
+
return [True, ""]
|
|
383
396
|
|
|
384
|
-
|
|
397
|
+
def validate_sharpness(self, value: int) -> Tuple[bool, str]:
|
|
398
|
+
if value is None:
|
|
399
|
+
return [True, ""]
|
|
385
400
|
|
|
386
|
-
|
|
387
|
-
|
|
401
|
+
if not isinstance(value, int):
|
|
402
|
+
return [False, "sharpness must be of type int for CameraSettings, got " + type(value).__name__]
|
|
388
403
|
|
|
389
|
-
|
|
390
|
-
return [serialize_f_64(data[0]),serialize_f_64(data[1]),serialize_f_64(data[2]),serialize_f_64(data[3]),serialize_f_64(data[4]),serialize_f_64(data[5]),]
|
|
404
|
+
return [True, ""]
|
|
391
405
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
Outward = "outward"
|
|
396
|
-
"""Grip gripper outward to grip. Measure grip position based on exterior of gripper fingers and interior of object"""
|
|
406
|
+
def validate_hue(self, value: int) -> Tuple[bool, str]:
|
|
407
|
+
if value is None:
|
|
408
|
+
return [True, ""]
|
|
397
409
|
|
|
398
|
-
|
|
399
|
-
|
|
410
|
+
if not isinstance(value, int):
|
|
411
|
+
return [False, "hue must be of type int for CameraSettings, got " + type(value).__name__]
|
|
400
412
|
|
|
401
|
-
|
|
402
|
-
return LinearGripDirectionEnum(data).value
|
|
413
|
+
return [True, ""]
|
|
403
414
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
Centimeters = "centimeters"
|
|
408
|
-
"""Enum Centimeters = `centimeters`"""
|
|
409
|
-
Meters = "meters"
|
|
410
|
-
"""Enum Meters = `meters`"""
|
|
411
|
-
Inches = "inches"
|
|
412
|
-
"""Enum Inches = `inches`"""
|
|
413
|
-
Feet = "feet"
|
|
414
|
-
"""Enum Feet = `feet`"""
|
|
415
|
+
def validate_whiteBalance(self, value: int) -> Tuple[bool, str]:
|
|
416
|
+
if value is None:
|
|
417
|
+
return [True, ""]
|
|
415
418
|
|
|
416
|
-
|
|
417
|
-
|
|
419
|
+
if not isinstance(value, int):
|
|
420
|
+
return [False, "whiteBalance must be of type int for CameraSettings, got " + type(value).__name__]
|
|
418
421
|
|
|
419
|
-
|
|
420
|
-
return LinearUnitKind(data).value
|
|
422
|
+
return [True, ""]
|
|
421
423
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
ForceGrip = "force_grip"
|
|
426
|
-
"""Grip with target force"""
|
|
424
|
+
def validate_autoWhiteBalance(self, value: bool) -> Tuple[bool, str]:
|
|
425
|
+
if value is None:
|
|
426
|
+
return [True, ""]
|
|
427
427
|
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
if not isinstance(value, bool):
|
|
429
|
+
return [False, "autoWhiteBalance must be of type bool for CameraSettings, got " + type(value).__name__]
|
|
430
430
|
|
|
431
|
-
|
|
432
|
-
return OnRobot2FG7ControlKindEnum(data).value
|
|
431
|
+
return [True, ""]
|
|
433
432
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
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)
|
|
441
456
|
|
|
442
|
-
def
|
|
443
|
-
return
|
|
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
|
+
)
|
|
444
467
|
|
|
445
|
-
def
|
|
446
|
-
return
|
|
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
|
+
}
|
|
447
478
|
|
|
448
|
-
class
|
|
449
|
-
|
|
450
|
-
"""Enum
|
|
479
|
+
class ConnectionStatus(Enum):
|
|
480
|
+
Connected = "connected"
|
|
481
|
+
"""Enum Connected = `connected`"""
|
|
482
|
+
Disconnected = "disconnected"
|
|
483
|
+
"""Enum Disconnected = `disconnected`"""
|
|
484
|
+
Ready = "ready"
|
|
485
|
+
"""Enum Ready = `ready`"""
|
|
451
486
|
|
|
452
|
-
def
|
|
453
|
-
return
|
|
487
|
+
def parse_connection_status(data: object) -> ConnectionStatus:
|
|
488
|
+
return ConnectionStatus(data)
|
|
454
489
|
|
|
455
|
-
def
|
|
456
|
-
return
|
|
490
|
+
def serialize_connection_status(data: Union[ConnectionStatus, str]) -> object:
|
|
491
|
+
return ConnectionStatus(data).value
|
|
457
492
|
|
|
458
493
|
@dataclass
|
|
459
|
-
class
|
|
460
|
-
"""
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
494
|
+
class DHAGGripperCommandRequest:
|
|
495
|
+
"""Control the DH AG gripper (end effector) of the robot
|
|
496
|
+
"""
|
|
497
|
+
target_diameter: Union[float, None] = None
|
|
498
|
+
target_force: Union[float, None] = None
|
|
499
|
+
target_speed: Union[float, None] = None
|
|
464
500
|
|
|
465
|
-
def
|
|
501
|
+
def validate_target_diameter(self, value: float) -> Tuple[bool, str]:
|
|
466
502
|
if value is None:
|
|
467
|
-
return [
|
|
503
|
+
return [False, "target_diameter is required for DHAGGripperCommandRequest"]
|
|
468
504
|
|
|
469
|
-
if not isinstance(value,
|
|
470
|
-
return [False, "
|
|
505
|
+
if not isinstance(value, float):
|
|
506
|
+
return [False, "target_diameter must be of type float for DHAGGripperCommandRequest, got " + type(value).__name__]
|
|
471
507
|
|
|
472
508
|
return [True, ""]
|
|
473
509
|
|
|
474
|
-
def
|
|
510
|
+
def validate_target_force(self, value: float) -> Tuple[bool, str]:
|
|
475
511
|
if value is None:
|
|
476
512
|
return [True, ""]
|
|
477
513
|
|
|
478
|
-
if not isinstance(value,
|
|
479
|
-
return [False, "
|
|
514
|
+
if not isinstance(value, float):
|
|
515
|
+
return [False, "target_force must be of type float for DHAGGripperCommandRequest, got " + type(value).__name__]
|
|
480
516
|
|
|
481
517
|
return [True, ""]
|
|
482
518
|
|
|
483
|
-
def
|
|
519
|
+
def validate_target_speed(self, value: float) -> Tuple[bool, str]:
|
|
484
520
|
if value is None:
|
|
485
521
|
return [True, ""]
|
|
486
522
|
|
|
487
|
-
if not isinstance(value,
|
|
488
|
-
return [False, "
|
|
523
|
+
if not isinstance(value, float):
|
|
524
|
+
return [False, "target_speed must be of type float for DHAGGripperCommandRequest, got " + type(value).__name__]
|
|
489
525
|
|
|
490
526
|
return [True, ""]
|
|
491
527
|
|
|
492
528
|
def __post_init__(self):
|
|
493
529
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
494
|
-
is_valid, error_str = self.
|
|
530
|
+
is_valid, error_str = self.validate_target_diameter(self.target_diameter)
|
|
495
531
|
if not is_valid:
|
|
496
532
|
raise TypeError(error_str)
|
|
497
|
-
is_valid, error_str = self.
|
|
533
|
+
is_valid, error_str = self.validate_target_force(self.target_force)
|
|
498
534
|
if not is_valid:
|
|
499
535
|
raise TypeError(error_str)
|
|
500
|
-
is_valid, error_str = self.
|
|
536
|
+
is_valid, error_str = self.validate_target_speed(self.target_speed)
|
|
501
537
|
if not is_valid:
|
|
502
538
|
raise TypeError(error_str)
|
|
503
539
|
|
|
504
|
-
def
|
|
505
|
-
return
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
540
|
+
def parse_dhag_gripper_command_request(data: object):
|
|
541
|
+
return DHAGGripperCommandRequest(
|
|
542
|
+
target_diameter=parse_f_64(data["target_diameter"]) if "target_diameter" in data else None,
|
|
543
|
+
target_force=parse_f_64(data["target_force"]) if "target_force" in data else None,
|
|
544
|
+
target_speed=parse_f_64(data["target_speed"]) if "target_speed" in data else None,
|
|
509
545
|
)
|
|
510
546
|
|
|
511
|
-
def
|
|
547
|
+
def serialize_dhag_gripper_command_request(data: DHAGGripperCommandRequest) -> object:
|
|
512
548
|
return {
|
|
513
|
-
"
|
|
514
|
-
"
|
|
515
|
-
"
|
|
549
|
+
"target_diameter": serialize_f_64(data.target_diameter),
|
|
550
|
+
"target_force": None if data.target_force is None else serialize_f_64(data.target_force),
|
|
551
|
+
"target_speed": None if data.target_speed is None else serialize_f_64(data.target_speed),
|
|
516
552
|
}
|
|
517
553
|
|
|
518
554
|
@dataclass
|
|
519
|
-
class
|
|
520
|
-
"""
|
|
521
|
-
|
|
522
|
-
name: Union[str, None] = None
|
|
523
|
-
|
|
524
|
-
def validate_id(self, value: str) -> Tuple[bool, str]:
|
|
525
|
-
if value is None:
|
|
526
|
-
return [True, ""]
|
|
527
|
-
|
|
528
|
-
if not isinstance(value, str):
|
|
529
|
-
return [False, "id must be of type str for Plane, got " + type(value).__name__]
|
|
530
|
-
|
|
531
|
-
return [True, ""]
|
|
555
|
+
class DHAGGripperConfiguration:
|
|
556
|
+
"""Configuration for DH AG Gripper"""
|
|
557
|
+
diameter: Union[float, None] = None
|
|
532
558
|
|
|
533
|
-
def
|
|
559
|
+
def validate_diameter(self, value: float) -> Tuple[bool, str]:
|
|
534
560
|
if value is None:
|
|
535
|
-
return [
|
|
561
|
+
return [False, "diameter is required for DHAGGripperConfiguration"]
|
|
536
562
|
|
|
537
|
-
if not isinstance(value,
|
|
538
|
-
return [False, "
|
|
563
|
+
if not isinstance(value, float):
|
|
564
|
+
return [False, "diameter must be of type float for DHAGGripperConfiguration, got " + type(value).__name__]
|
|
539
565
|
|
|
540
566
|
return [True, ""]
|
|
541
567
|
|
|
542
568
|
def __post_init__(self):
|
|
543
569
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
544
|
-
is_valid, error_str = self.
|
|
545
|
-
if not is_valid:
|
|
546
|
-
raise TypeError(error_str)
|
|
547
|
-
is_valid, error_str = self.validate_name(self.name)
|
|
570
|
+
is_valid, error_str = self.validate_diameter(self.diameter)
|
|
548
571
|
if not is_valid:
|
|
549
572
|
raise TypeError(error_str)
|
|
550
573
|
|
|
551
|
-
def
|
|
552
|
-
return
|
|
553
|
-
|
|
554
|
-
name=parse_str(data["name"]) if "name" in data else None,
|
|
574
|
+
def parse_dhag_gripper_configuration(data: object):
|
|
575
|
+
return DHAGGripperConfiguration(
|
|
576
|
+
diameter=parse_f_64(data["diameter"]) if "diameter" in data else None,
|
|
555
577
|
)
|
|
556
578
|
|
|
557
|
-
def
|
|
579
|
+
def serialize_dhag_gripper_configuration(data: DHAGGripperConfiguration) -> object:
|
|
558
580
|
return {
|
|
559
|
-
"
|
|
560
|
-
"name": None if data.name is None else serialize_str(data.name),
|
|
581
|
+
"diameter": serialize_f_64(data.diameter),
|
|
561
582
|
}
|
|
562
583
|
|
|
563
584
|
@dataclass
|
|
564
|
-
class
|
|
565
|
-
"""
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
def validate_x(self, value: float) -> Tuple[bool, str]:
|
|
572
|
-
if value is None:
|
|
573
|
-
return [True, ""]
|
|
574
|
-
|
|
575
|
-
if not isinstance(value, float):
|
|
576
|
-
return [False, "x must be of type float for Quaternion, got " + type(value).__name__]
|
|
577
|
-
|
|
578
|
-
return [True, ""]
|
|
585
|
+
class DHCGIGripperCommandRequest:
|
|
586
|
+
"""Control the DH CGI gripper (end effector) of the robot
|
|
587
|
+
"""
|
|
588
|
+
target_diameter: Union[float, None] = None
|
|
589
|
+
target_force: Union[float, None] = None
|
|
590
|
+
target_speed: Union[float, None] = None
|
|
579
591
|
|
|
580
|
-
def
|
|
592
|
+
def validate_target_diameter(self, value: float) -> Tuple[bool, str]:
|
|
581
593
|
if value is None:
|
|
582
|
-
return [
|
|
594
|
+
return [False, "target_diameter is required for DHCGIGripperCommandRequest"]
|
|
583
595
|
|
|
584
596
|
if not isinstance(value, float):
|
|
585
|
-
return [False, "
|
|
597
|
+
return [False, "target_diameter must be of type float for DHCGIGripperCommandRequest, got " + type(value).__name__]
|
|
586
598
|
|
|
587
599
|
return [True, ""]
|
|
588
600
|
|
|
589
|
-
def
|
|
601
|
+
def validate_target_force(self, value: float) -> Tuple[bool, str]:
|
|
590
602
|
if value is None:
|
|
591
603
|
return [True, ""]
|
|
592
604
|
|
|
593
605
|
if not isinstance(value, float):
|
|
594
|
-
return [False, "
|
|
606
|
+
return [False, "target_force must be of type float for DHCGIGripperCommandRequest, got " + type(value).__name__]
|
|
595
607
|
|
|
596
608
|
return [True, ""]
|
|
597
609
|
|
|
598
|
-
def
|
|
610
|
+
def validate_target_speed(self, value: float) -> Tuple[bool, str]:
|
|
599
611
|
if value is None:
|
|
600
612
|
return [True, ""]
|
|
601
613
|
|
|
602
614
|
if not isinstance(value, float):
|
|
603
|
-
return [False, "
|
|
615
|
+
return [False, "target_speed must be of type float for DHCGIGripperCommandRequest, got " + type(value).__name__]
|
|
604
616
|
|
|
605
617
|
return [True, ""]
|
|
606
618
|
|
|
607
619
|
def __post_init__(self):
|
|
608
620
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
609
|
-
is_valid, error_str = self.
|
|
610
|
-
if not is_valid:
|
|
611
|
-
raise TypeError(error_str)
|
|
612
|
-
is_valid, error_str = self.validate_y(self.y)
|
|
621
|
+
is_valid, error_str = self.validate_target_diameter(self.target_diameter)
|
|
613
622
|
if not is_valid:
|
|
614
623
|
raise TypeError(error_str)
|
|
615
|
-
is_valid, error_str = self.
|
|
624
|
+
is_valid, error_str = self.validate_target_force(self.target_force)
|
|
616
625
|
if not is_valid:
|
|
617
626
|
raise TypeError(error_str)
|
|
618
|
-
is_valid, error_str = self.
|
|
627
|
+
is_valid, error_str = self.validate_target_speed(self.target_speed)
|
|
619
628
|
if not is_valid:
|
|
620
629
|
raise TypeError(error_str)
|
|
621
630
|
|
|
622
|
-
def
|
|
623
|
-
return
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
w=parse_f_64(data["w"]) if "w" in data else None,
|
|
631
|
+
def parse_dhcgi_gripper_command_request(data: object):
|
|
632
|
+
return DHCGIGripperCommandRequest(
|
|
633
|
+
target_diameter=parse_f_64(data["target_diameter"]) if "target_diameter" in data else None,
|
|
634
|
+
target_force=parse_f_64(data["target_force"]) if "target_force" in data else None,
|
|
635
|
+
target_speed=parse_f_64(data["target_speed"]) if "target_speed" in data else None,
|
|
628
636
|
)
|
|
629
637
|
|
|
630
|
-
def
|
|
631
|
-
return {
|
|
632
|
-
"x": None if data.x is None else serialize_f_64(data.x),
|
|
633
|
-
"y": None if data.y is None else serialize_f_64(data.y),
|
|
634
|
-
"z": None if data.z is None else serialize_f_64(data.z),
|
|
635
|
-
"w": None if data.w is None else serialize_f_64(data.w),
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
class RobotControlModeEnum(Enum):
|
|
639
|
-
Api = "api"
|
|
640
|
-
"""The robot is controlled via the Standard Bots Robot API (this API)"""
|
|
641
|
-
RoutineEditor = "routine_editor"
|
|
642
|
-
"""The robot is controlled via the Routine Editor UI"""
|
|
643
|
-
|
|
644
|
-
def parse_robot_control_mode_enum(data: object) -> RobotControlModeEnum:
|
|
645
|
-
return RobotControlModeEnum(data)
|
|
646
|
-
|
|
647
|
-
def serialize_robot_control_mode_enum(data: Union[RobotControlModeEnum, str]) -> object:
|
|
648
|
-
return RobotControlModeEnum(data).value
|
|
649
|
-
|
|
650
|
-
RoutineVariablesStateMap = Dict[str, str]
|
|
651
|
-
|
|
652
|
-
def parse_routine_variables_state_map(data: object) -> RoutineVariablesStateMap:
|
|
653
|
-
return {
|
|
654
|
-
parse_str(key): parse_str(value) for key, value in data.items()
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
def serialize_routine_variables_state_map(data: RoutineVariablesStateMap) -> object:
|
|
638
|
+
def serialize_dhcgi_gripper_command_request(data: DHCGIGripperCommandRequest) -> object:
|
|
658
639
|
return {
|
|
659
|
-
|
|
640
|
+
"target_diameter": serialize_f_64(data.target_diameter),
|
|
641
|
+
"target_force": None if data.target_force is None else serialize_f_64(data.target_force),
|
|
642
|
+
"target_speed": None if data.target_speed is None else serialize_f_64(data.target_speed),
|
|
660
643
|
}
|
|
661
644
|
|
|
662
645
|
@dataclass
|
|
663
|
-
class
|
|
664
|
-
"""
|
|
665
|
-
|
|
646
|
+
class DHCGIGripperConfiguration:
|
|
647
|
+
"""Configuration for DH CGI Gripper"""
|
|
648
|
+
diameter: Union[float, None] = None
|
|
666
649
|
|
|
667
|
-
def
|
|
650
|
+
def validate_diameter(self, value: float) -> Tuple[bool, str]:
|
|
668
651
|
if value is None:
|
|
669
|
-
return [
|
|
652
|
+
return [False, "diameter is required for DHCGIGripperConfiguration"]
|
|
670
653
|
|
|
671
|
-
if not isinstance(value,
|
|
672
|
-
return [False, "
|
|
654
|
+
if not isinstance(value, float):
|
|
655
|
+
return [False, "diameter must be of type float for DHCGIGripperConfiguration, got " + type(value).__name__]
|
|
673
656
|
|
|
674
657
|
return [True, ""]
|
|
675
658
|
|
|
676
659
|
def __post_init__(self):
|
|
677
660
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
678
|
-
is_valid, error_str = self.
|
|
661
|
+
is_valid, error_str = self.validate_diameter(self.diameter)
|
|
679
662
|
if not is_valid:
|
|
680
663
|
raise TypeError(error_str)
|
|
681
664
|
|
|
682
|
-
def
|
|
683
|
-
return
|
|
684
|
-
|
|
665
|
+
def parse_dhcgi_gripper_configuration(data: object):
|
|
666
|
+
return DHCGIGripperConfiguration(
|
|
667
|
+
diameter=parse_f_64(data["diameter"]) if "diameter" in data else None,
|
|
685
668
|
)
|
|
686
669
|
|
|
687
|
-
def
|
|
670
|
+
def serialize_dhcgi_gripper_configuration(data: DHCGIGripperConfiguration) -> object:
|
|
688
671
|
return {
|
|
689
|
-
"
|
|
672
|
+
"diameter": serialize_f_64(data.diameter),
|
|
690
673
|
}
|
|
691
674
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
"""
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
675
|
+
@dataclass
|
|
676
|
+
class DHPGCGripperCommandRequest:
|
|
677
|
+
"""Control the DH PGC gripper (end effector) of the robot
|
|
678
|
+
"""
|
|
679
|
+
target_diameter: Union[float, None] = None
|
|
680
|
+
target_force: Union[float, None] = None
|
|
681
|
+
target_speed: Union[float, None] = None
|
|
699
682
|
|
|
700
|
-
def
|
|
701
|
-
|
|
683
|
+
def validate_target_diameter(self, value: float) -> Tuple[bool, str]:
|
|
684
|
+
if value is None:
|
|
685
|
+
return [False, "target_diameter is required for DHPGCGripperCommandRequest"]
|
|
702
686
|
|
|
703
|
-
|
|
704
|
-
|
|
687
|
+
if not isinstance(value, float):
|
|
688
|
+
return [False, "target_diameter must be of type float for DHPGCGripperCommandRequest, got " + type(value).__name__]
|
|
705
689
|
|
|
706
|
-
|
|
707
|
-
class StatusVersionData:
|
|
708
|
-
"""Version Data"""
|
|
709
|
-
id: Union[str, None] = None
|
|
710
|
-
name: Union[str, None] = None
|
|
690
|
+
return [True, ""]
|
|
711
691
|
|
|
712
|
-
def
|
|
692
|
+
def validate_target_force(self, value: float) -> Tuple[bool, str]:
|
|
713
693
|
if value is None:
|
|
714
694
|
return [True, ""]
|
|
715
695
|
|
|
716
|
-
if not isinstance(value,
|
|
717
|
-
return [False, "
|
|
696
|
+
if not isinstance(value, float):
|
|
697
|
+
return [False, "target_force must be of type float for DHPGCGripperCommandRequest, got " + type(value).__name__]
|
|
718
698
|
|
|
719
699
|
return [True, ""]
|
|
720
700
|
|
|
721
|
-
def
|
|
701
|
+
def validate_target_speed(self, value: float) -> Tuple[bool, str]:
|
|
722
702
|
if value is None:
|
|
723
703
|
return [True, ""]
|
|
724
704
|
|
|
725
|
-
if not isinstance(value,
|
|
726
|
-
return [False, "
|
|
705
|
+
if not isinstance(value, float):
|
|
706
|
+
return [False, "target_speed must be of type float for DHPGCGripperCommandRequest, got " + type(value).__name__]
|
|
727
707
|
|
|
728
708
|
return [True, ""]
|
|
729
709
|
|
|
730
710
|
def __post_init__(self):
|
|
731
711
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
732
|
-
is_valid, error_str = self.
|
|
712
|
+
is_valid, error_str = self.validate_target_diameter(self.target_diameter)
|
|
733
713
|
if not is_valid:
|
|
734
714
|
raise TypeError(error_str)
|
|
735
|
-
is_valid, error_str = self.
|
|
715
|
+
is_valid, error_str = self.validate_target_force(self.target_force)
|
|
716
|
+
if not is_valid:
|
|
717
|
+
raise TypeError(error_str)
|
|
718
|
+
is_valid, error_str = self.validate_target_speed(self.target_speed)
|
|
736
719
|
if not is_valid:
|
|
737
720
|
raise TypeError(error_str)
|
|
738
721
|
|
|
739
|
-
def
|
|
740
|
-
return
|
|
741
|
-
|
|
742
|
-
|
|
722
|
+
def parse_dhpgc_gripper_command_request(data: object):
|
|
723
|
+
return DHPGCGripperCommandRequest(
|
|
724
|
+
target_diameter=parse_f_64(data["target_diameter"]) if "target_diameter" in data else None,
|
|
725
|
+
target_force=parse_f_64(data["target_force"]) if "target_force" in data else None,
|
|
726
|
+
target_speed=parse_f_64(data["target_speed"]) if "target_speed" in data else None,
|
|
743
727
|
)
|
|
744
728
|
|
|
745
|
-
def
|
|
729
|
+
def serialize_dhpgc_gripper_command_request(data: DHPGCGripperCommandRequest) -> object:
|
|
746
730
|
return {
|
|
747
|
-
"
|
|
748
|
-
"
|
|
731
|
+
"target_diameter": serialize_f_64(data.target_diameter),
|
|
732
|
+
"target_force": None if data.target_force is None else serialize_f_64(data.target_force),
|
|
733
|
+
"target_speed": None if data.target_speed is None else serialize_f_64(data.target_speed),
|
|
749
734
|
}
|
|
750
735
|
|
|
751
736
|
@dataclass
|
|
752
|
-
class
|
|
753
|
-
"""
|
|
754
|
-
|
|
755
|
-
reason: Union[str, None] = None
|
|
756
|
-
internal_reason: Union[str, None] = None
|
|
757
|
-
|
|
758
|
-
def validate_kind(self, value: ArmPositionUpdateFailureEventKind) -> Tuple[bool, str]:
|
|
759
|
-
if value is None:
|
|
760
|
-
return [False, "kind is required for ArmPositionUpdateFailureEvent"]
|
|
737
|
+
class DHPGCGripperConfiguration:
|
|
738
|
+
"""Configuration for DH PGC Gripper"""
|
|
739
|
+
diameter: Union[float, None] = None
|
|
761
740
|
|
|
762
|
-
|
|
763
|
-
return [False, "kind must be of type ArmPositionUpdateFailureEventKind for ArmPositionUpdateFailureEvent, got " + type(value).__name__]
|
|
764
|
-
|
|
765
|
-
return [True, ""]
|
|
766
|
-
|
|
767
|
-
def validate_reason(self, value: str) -> Tuple[bool, str]:
|
|
768
|
-
if value is None:
|
|
769
|
-
return [False, "reason is required for ArmPositionUpdateFailureEvent"]
|
|
770
|
-
|
|
771
|
-
if not isinstance(value, str):
|
|
772
|
-
return [False, "reason must be of type str for ArmPositionUpdateFailureEvent, got " + type(value).__name__]
|
|
773
|
-
|
|
774
|
-
return [True, ""]
|
|
775
|
-
|
|
776
|
-
def validate_internal_reason(self, value: str) -> Tuple[bool, str]:
|
|
741
|
+
def validate_diameter(self, value: float) -> Tuple[bool, str]:
|
|
777
742
|
if value is None:
|
|
778
|
-
return [
|
|
743
|
+
return [False, "diameter is required for DHPGCGripperConfiguration"]
|
|
779
744
|
|
|
780
|
-
if not isinstance(value,
|
|
781
|
-
return [False, "
|
|
745
|
+
if not isinstance(value, float):
|
|
746
|
+
return [False, "diameter must be of type float for DHPGCGripperConfiguration, got " + type(value).__name__]
|
|
782
747
|
|
|
783
748
|
return [True, ""]
|
|
784
749
|
|
|
785
750
|
def __post_init__(self):
|
|
786
751
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
787
|
-
is_valid, error_str = self.
|
|
788
|
-
if not is_valid:
|
|
789
|
-
raise TypeError(error_str)
|
|
790
|
-
is_valid, error_str = self.validate_reason(self.reason)
|
|
791
|
-
if not is_valid:
|
|
792
|
-
raise TypeError(error_str)
|
|
793
|
-
is_valid, error_str = self.validate_internal_reason(self.internal_reason)
|
|
752
|
+
is_valid, error_str = self.validate_diameter(self.diameter)
|
|
794
753
|
if not is_valid:
|
|
795
754
|
raise TypeError(error_str)
|
|
796
755
|
|
|
797
|
-
def
|
|
798
|
-
return
|
|
799
|
-
|
|
800
|
-
reason=parse_str(data["reason"]) if "reason" in data else None,
|
|
801
|
-
internal_reason=parse_str(data["internal_reason"]) if "internal_reason" in data else None,
|
|
756
|
+
def parse_dhpgc_gripper_configuration(data: object):
|
|
757
|
+
return DHPGCGripperConfiguration(
|
|
758
|
+
diameter=parse_f_64(data["diameter"]) if "diameter" in data else None,
|
|
802
759
|
)
|
|
803
760
|
|
|
804
|
-
def
|
|
761
|
+
def serialize_dhpgc_gripper_configuration(data: DHPGCGripperConfiguration) -> object:
|
|
805
762
|
return {
|
|
806
|
-
"
|
|
807
|
-
"reason": serialize_str(data.reason),
|
|
808
|
-
"internal_reason": None if data.internal_reason is None else serialize_str(data.internal_reason),
|
|
763
|
+
"diameter": serialize_f_64(data.diameter),
|
|
809
764
|
}
|
|
810
765
|
|
|
811
|
-
ArmPositionUpdateRequestResponseEventStreamSubscriptionsList = List[ArmPositionUpdateRequestResponseEventStreamSubscriptionKindEnum]
|
|
812
|
-
|
|
813
|
-
def parse_arm_position_update_request_response_event_stream_subscriptions_list(data: object) -> ArmPositionUpdateRequestResponseEventStreamSubscriptionsList:
|
|
814
|
-
return [parse_arm_position_update_request_response_event_stream_subscription_kind_enum(item) for item in data]
|
|
815
|
-
|
|
816
|
-
def serialize_arm_position_update_request_response_event_stream_subscriptions_list(data: ArmPositionUpdateRequestResponseEventStreamSubscriptionsList) -> List[object]:
|
|
817
|
-
return [serialize_arm_position_update_request_response_event_stream_subscription_kind_enum(item) for item in data]
|
|
818
|
-
|
|
819
766
|
@dataclass
|
|
820
|
-
class
|
|
821
|
-
"""
|
|
767
|
+
class EngageEmergencyStopRequest:
|
|
768
|
+
"""Engage Emergency Stop. This will immediately stop the robot and prevent it from moving until the robot is unbraked.
|
|
822
769
|
"""
|
|
823
|
-
|
|
770
|
+
reason: Union[str, None] = None
|
|
824
771
|
|
|
825
|
-
def
|
|
772
|
+
def validate_reason(self, value: str) -> Tuple[bool, str]:
|
|
826
773
|
if value is None:
|
|
827
|
-
return [
|
|
774
|
+
return [True, ""]
|
|
828
775
|
|
|
829
|
-
if not
|
|
830
|
-
return [False, "
|
|
776
|
+
if not isinstance(value, str):
|
|
777
|
+
return [False, "reason must be of type str for EngageEmergencyStopRequest, got " + type(value).__name__]
|
|
831
778
|
|
|
832
779
|
return [True, ""]
|
|
833
780
|
|
|
834
781
|
def __post_init__(self):
|
|
835
782
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
836
|
-
is_valid, error_str = self.
|
|
783
|
+
is_valid, error_str = self.validate_reason(self.reason)
|
|
837
784
|
if not is_valid:
|
|
838
785
|
raise TypeError(error_str)
|
|
839
786
|
|
|
840
|
-
def
|
|
841
|
-
return
|
|
842
|
-
|
|
787
|
+
def parse_engage_emergency_stop_request(data: object):
|
|
788
|
+
return EngageEmergencyStopRequest(
|
|
789
|
+
reason=parse_str(data["reason"]) if "reason" in data else None,
|
|
843
790
|
)
|
|
844
791
|
|
|
845
|
-
def
|
|
792
|
+
def serialize_engage_emergency_stop_request(data: EngageEmergencyStopRequest) -> object:
|
|
846
793
|
return {
|
|
847
|
-
"
|
|
794
|
+
"reason": None if data.reason is None else serialize_str(data.reason),
|
|
848
795
|
}
|
|
849
796
|
|
|
850
|
-
EnvironmentVariablesList = List[EnvironmentVariable]
|
|
851
|
-
|
|
852
|
-
def parse_environment_variables_list(data: object) -> EnvironmentVariablesList:
|
|
853
|
-
return [parse_environment_variable(item) for item in data]
|
|
854
|
-
|
|
855
|
-
def serialize_environment_variables_list(data: EnvironmentVariablesList) -> List[object]:
|
|
856
|
-
return [serialize_environment_variable(item) for item in data]
|
|
857
|
-
|
|
858
797
|
@dataclass
|
|
859
|
-
class
|
|
860
|
-
"""
|
|
861
|
-
|
|
862
|
-
|
|
798
|
+
class EnvironmentVariable:
|
|
799
|
+
"""Environment variables for a routine"""
|
|
800
|
+
id: Union[str, None] = None
|
|
801
|
+
name: Union[str, None] = None
|
|
802
|
+
value: Union[str, None] = None
|
|
863
803
|
|
|
864
|
-
def
|
|
804
|
+
def validate_id(self, value: str) -> Tuple[bool, str]:
|
|
865
805
|
if value is None:
|
|
866
|
-
return [False, "
|
|
806
|
+
return [False, "id is required for EnvironmentVariable"]
|
|
867
807
|
|
|
868
|
-
if not
|
|
869
|
-
return [False, "
|
|
808
|
+
if not isinstance(value, str):
|
|
809
|
+
return [False, "id must be of type str for EnvironmentVariable, got " + type(value).__name__]
|
|
870
810
|
|
|
871
811
|
return [True, ""]
|
|
872
812
|
|
|
873
|
-
def
|
|
813
|
+
def validate_name(self, value: str) -> Tuple[bool, str]:
|
|
874
814
|
if value is None:
|
|
875
|
-
return [
|
|
815
|
+
return [True, ""]
|
|
816
|
+
|
|
817
|
+
if not isinstance(value, str):
|
|
818
|
+
return [False, "name must be of type str for EnvironmentVariable, got " + type(value).__name__]
|
|
819
|
+
|
|
820
|
+
return [True, ""]
|
|
821
|
+
|
|
822
|
+
def validate_value(self, value: str) -> Tuple[bool, str]:
|
|
823
|
+
if value is None:
|
|
824
|
+
return [True, ""]
|
|
825
|
+
|
|
826
|
+
if not isinstance(value, str):
|
|
827
|
+
return [False, "value must be of type str for EnvironmentVariable, got " + type(value).__name__]
|
|
828
|
+
|
|
829
|
+
return [True, ""]
|
|
830
|
+
|
|
831
|
+
def __post_init__(self):
|
|
832
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
833
|
+
is_valid, error_str = self.validate_id(self.id)
|
|
834
|
+
if not is_valid:
|
|
835
|
+
raise TypeError(error_str)
|
|
836
|
+
is_valid, error_str = self.validate_name(self.name)
|
|
837
|
+
if not is_valid:
|
|
838
|
+
raise TypeError(error_str)
|
|
839
|
+
is_valid, error_str = self.validate_value(self.value)
|
|
840
|
+
if not is_valid:
|
|
841
|
+
raise TypeError(error_str)
|
|
842
|
+
|
|
843
|
+
def parse_environment_variable(data: object):
|
|
844
|
+
return EnvironmentVariable(
|
|
845
|
+
id=parse_str(data["id"]) if "id" in data else None,
|
|
846
|
+
name=parse_str(data["name"]) if "name" in data else None,
|
|
847
|
+
value=parse_str(data["value"]) if "value" in data else None,
|
|
848
|
+
)
|
|
849
|
+
|
|
850
|
+
def serialize_environment_variable(data: EnvironmentVariable) -> object:
|
|
851
|
+
return {
|
|
852
|
+
"id": serialize_str(data.id),
|
|
853
|
+
"name": None if data.name is None else serialize_str(data.name),
|
|
854
|
+
"value": None if data.value is None else serialize_str(data.value),
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
class ErrorEnum(Enum):
|
|
858
|
+
AuthorizationRequired = "authorization_required"
|
|
859
|
+
"""Authorization required to access this resource"""
|
|
860
|
+
RoutineMustBeRunning = "routine_must_be_running"
|
|
861
|
+
"""Routine must be running"""
|
|
862
|
+
ApiControlRequired = "api_control_required"
|
|
863
|
+
"""API control required"""
|
|
864
|
+
RobotBrakesDisengageFailed = "robot_brakes_disengage_failed"
|
|
865
|
+
"""Robot brakes disengage failed"""
|
|
866
|
+
RobotBrakesEngageFailed = "robot_brakes_engage_failed"
|
|
867
|
+
"""Robot brakes engage failed"""
|
|
868
|
+
RequestFailedValidation = "request_failed_validation"
|
|
869
|
+
"""Request failed validation"""
|
|
870
|
+
RobotNotIdle = "robot_not_idle"
|
|
871
|
+
"""Robot must be idle"""
|
|
872
|
+
BrakesMustBeEngaged = "brakes_must_be_engaged"
|
|
873
|
+
"""Brakes must be_engaged"""
|
|
874
|
+
BrakesMustBeDisengaged = "brakes_must_be_disengaged"
|
|
875
|
+
"""Brakes must be disengaged"""
|
|
876
|
+
EquipmentNoMatching = "equipment_no_matching"
|
|
877
|
+
"""No matching equipment found"""
|
|
878
|
+
ServiceInitializing = "service_initializing"
|
|
879
|
+
"""The service is unavailable while initializing"""
|
|
880
|
+
CameraDisconnected = "camera_disconnected"
|
|
881
|
+
"""Camera service running, but no camera is connected"""
|
|
882
|
+
SettingsValidationError = "settings_validation_error"
|
|
883
|
+
"""Camera settings validation failed"""
|
|
884
|
+
SettingsTimeout = "settings_timeout"
|
|
885
|
+
"""Camera settings timed out"""
|
|
886
|
+
InternalServerError = "internal_server_error"
|
|
887
|
+
"""Internal server error occurred"""
|
|
888
|
+
RecoveryError = "recovery_error"
|
|
889
|
+
"""Recovery error occurred"""
|
|
890
|
+
NotFound = "not_found"
|
|
891
|
+
"""Requested resource not found"""
|
|
892
|
+
InvalidSpaceSpecified = "invalid_space_specified"
|
|
893
|
+
"""Space specified was invalid or not found"""
|
|
894
|
+
|
|
895
|
+
def parse_error_enum(data: object) -> ErrorEnum:
|
|
896
|
+
return ErrorEnum(data)
|
|
897
|
+
|
|
898
|
+
def serialize_error_enum(data: Union[ErrorEnum, str]) -> object:
|
|
899
|
+
return ErrorEnum(data).value
|
|
900
|
+
|
|
901
|
+
class ForceUnitKind(Enum):
|
|
902
|
+
Newtons = "newtons"
|
|
903
|
+
"""Enum Newtons = `newtons`"""
|
|
904
|
+
Pounds = "pounds"
|
|
905
|
+
"""Enum Pounds = `pounds`"""
|
|
906
|
+
|
|
907
|
+
def parse_force_unit_kind(data: object) -> ForceUnitKind:
|
|
908
|
+
return ForceUnitKind(data)
|
|
909
|
+
|
|
910
|
+
def serialize_force_unit_kind(data: Union[ForceUnitKind, str]) -> object:
|
|
911
|
+
return ForceUnitKind(data).value
|
|
912
|
+
|
|
913
|
+
class GripperKindEnum(Enum):
|
|
914
|
+
Onrobot2Fg7 = "onrobot_2fg7"
|
|
915
|
+
"""An OnRobot 2FG7 Gripper is connected"""
|
|
916
|
+
Onrobot2Fg14 = "onrobot_2fg14"
|
|
917
|
+
"""An OnRobot 2FG14 Gripper is connected"""
|
|
918
|
+
Onrobot3Fg15 = "onrobot_3fg15"
|
|
919
|
+
"""An OnRobot 3FG15 Gripper is connected"""
|
|
920
|
+
OnrobotScrewdriver = "onrobot_screwdriver"
|
|
921
|
+
"""An OnRobot Screwdriver is connected"""
|
|
922
|
+
DhAg = "dh_ag"
|
|
923
|
+
"""A DH AG Gripper is connected"""
|
|
924
|
+
DhPgc = "dh_pgc"
|
|
925
|
+
"""A DH PGC Gripper is connected"""
|
|
926
|
+
DhCgi = "dh_cgi"
|
|
927
|
+
"""A DH CGI Gripper is connected"""
|
|
928
|
+
SchunkEgx = "schunk_egx"
|
|
929
|
+
"""A Schunk EGU / EGK Gripper is connected"""
|
|
930
|
+
NoneConnected = "none_connected"
|
|
931
|
+
"""No gripper is connected"""
|
|
932
|
+
|
|
933
|
+
def parse_gripper_kind_enum(data: object) -> GripperKindEnum:
|
|
934
|
+
return GripperKindEnum(data)
|
|
935
|
+
|
|
936
|
+
def serialize_gripper_kind_enum(data: Union[GripperKindEnum, str]) -> object:
|
|
937
|
+
return GripperKindEnum(data).value
|
|
938
|
+
|
|
939
|
+
IOStateMap = Dict[str, str]
|
|
940
|
+
|
|
941
|
+
def parse_io_state_map(data: object) -> IOStateMap:
|
|
942
|
+
return {
|
|
943
|
+
parse_str(key): parse_str(value) for key, value in data.items()
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
def serialize_io_state_map(data: IOStateMap) -> object:
|
|
947
|
+
return {
|
|
948
|
+
serialize_str(key): serialize_str(value) for key, value in data.items()
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
JointRotations = Tuple[float,float,float,float,float,float,]
|
|
952
|
+
|
|
953
|
+
def parse_joint_rotations(data: object) -> JointRotations:
|
|
954
|
+
return (parse_f_64(data[0]),parse_f_64(data[1]),parse_f_64(data[2]),parse_f_64(data[3]),parse_f_64(data[4]),parse_f_64(data[5]),)
|
|
955
|
+
|
|
956
|
+
def serialize_joint_rotations(data: JointRotations) -> object:
|
|
957
|
+
return [serialize_f_64(data[0]),serialize_f_64(data[1]),serialize_f_64(data[2]),serialize_f_64(data[3]),serialize_f_64(data[4]),serialize_f_64(data[5]),]
|
|
958
|
+
|
|
959
|
+
class LinearGripDirectionEnum(Enum):
|
|
960
|
+
Inward = "inward"
|
|
961
|
+
"""Move gripper inward to grip. Measure grip position based on interior of gripper fingers and exterior of object"""
|
|
962
|
+
Outward = "outward"
|
|
963
|
+
"""Grip gripper outward to grip. Measure grip position based on exterior of gripper fingers and interior of object"""
|
|
964
|
+
|
|
965
|
+
def parse_linear_grip_direction_enum(data: object) -> LinearGripDirectionEnum:
|
|
966
|
+
return LinearGripDirectionEnum(data)
|
|
967
|
+
|
|
968
|
+
def serialize_linear_grip_direction_enum(data: Union[LinearGripDirectionEnum, str]) -> object:
|
|
969
|
+
return LinearGripDirectionEnum(data).value
|
|
970
|
+
|
|
971
|
+
class LinearUnitKind(Enum):
|
|
972
|
+
Millimeters = "millimeters"
|
|
973
|
+
"""Enum Millimeters = `millimeters`"""
|
|
974
|
+
Centimeters = "centimeters"
|
|
975
|
+
"""Enum Centimeters = `centimeters`"""
|
|
976
|
+
Meters = "meters"
|
|
977
|
+
"""Enum Meters = `meters`"""
|
|
978
|
+
Inches = "inches"
|
|
979
|
+
"""Enum Inches = `inches`"""
|
|
980
|
+
Feet = "feet"
|
|
981
|
+
"""Enum Feet = `feet`"""
|
|
982
|
+
|
|
983
|
+
def parse_linear_unit_kind(data: object) -> LinearUnitKind:
|
|
984
|
+
return LinearUnitKind(data)
|
|
985
|
+
|
|
986
|
+
def serialize_linear_unit_kind(data: Union[LinearUnitKind, str]) -> object:
|
|
987
|
+
return LinearUnitKind(data).value
|
|
988
|
+
|
|
989
|
+
class OnRobot2FG14ControlKindEnum(Enum):
|
|
990
|
+
Move = "move"
|
|
991
|
+
"""Move gripper to target grip width"""
|
|
992
|
+
ForceGrip = "force_grip"
|
|
993
|
+
"""Grip with target force"""
|
|
994
|
+
|
|
995
|
+
def parse_on_robot_2_fg_14_control_kind_enum(data: object) -> OnRobot2FG14ControlKindEnum:
|
|
996
|
+
return OnRobot2FG14ControlKindEnum(data)
|
|
997
|
+
|
|
998
|
+
def serialize_on_robot_2_fg_14_control_kind_enum(data: Union[OnRobot2FG14ControlKindEnum, str]) -> object:
|
|
999
|
+
return OnRobot2FG14ControlKindEnum(data).value
|
|
1000
|
+
|
|
1001
|
+
class OnRobot2FG7ControlKindEnum(Enum):
|
|
1002
|
+
Move = "move"
|
|
1003
|
+
"""Move gripper to target grip width"""
|
|
1004
|
+
ForceGrip = "force_grip"
|
|
1005
|
+
"""Grip with target force"""
|
|
1006
|
+
|
|
1007
|
+
def parse_on_robot_2_fg_7_control_kind_enum(data: object) -> OnRobot2FG7ControlKindEnum:
|
|
1008
|
+
return OnRobot2FG7ControlKindEnum(data)
|
|
1009
|
+
|
|
1010
|
+
def serialize_on_robot_2_fg_7_control_kind_enum(data: Union[OnRobot2FG7ControlKindEnum, str]) -> object:
|
|
1011
|
+
return OnRobot2FG7ControlKindEnum(data).value
|
|
1012
|
+
|
|
1013
|
+
class OnRobot3FG15ControlKindEnum(Enum):
|
|
1014
|
+
Move = "move"
|
|
1015
|
+
"""Move gripper to target grip diameter"""
|
|
1016
|
+
ForceGrip = "force_grip"
|
|
1017
|
+
"""Grip with target force"""
|
|
1018
|
+
FlexibleForceGrip = "flexible_force_grip"
|
|
1019
|
+
"""Grip with target force"""
|
|
1020
|
+
|
|
1021
|
+
def parse_on_robot_3_fg_15_control_kind_enum(data: object) -> OnRobot3FG15ControlKindEnum:
|
|
1022
|
+
return OnRobot3FG15ControlKindEnum(data)
|
|
1023
|
+
|
|
1024
|
+
def serialize_on_robot_3_fg_15_control_kind_enum(data: Union[OnRobot3FG15ControlKindEnum, str]) -> object:
|
|
1025
|
+
return OnRobot3FG15ControlKindEnum(data).value
|
|
1026
|
+
|
|
1027
|
+
class OnRobotGripKindEnum(Enum):
|
|
1028
|
+
Inward = "inward"
|
|
1029
|
+
"""Enum Inward = `inward`"""
|
|
1030
|
+
Outward = "outward"
|
|
1031
|
+
"""Enum Outward = `outward`"""
|
|
1032
|
+
|
|
1033
|
+
def parse_on_robot_grip_kind_enum(data: object) -> OnRobotGripKindEnum:
|
|
1034
|
+
return OnRobotGripKindEnum(data)
|
|
1035
|
+
|
|
1036
|
+
def serialize_on_robot_grip_kind_enum(data: Union[OnRobotGripKindEnum, str]) -> object:
|
|
1037
|
+
return OnRobotGripKindEnum(data).value
|
|
1038
|
+
|
|
1039
|
+
@dataclass
|
|
1040
|
+
class OnRobotScrewdriverConfiguration:
|
|
1041
|
+
"""Configuration for OnRobot Screwdriver"""
|
|
1042
|
+
status: Union[int, None] = None
|
|
1043
|
+
error: Union[str, None] = None
|
|
1044
|
+
busy: Union[bool, None] = None
|
|
1045
|
+
additional_results: Union[int, None] = None
|
|
1046
|
+
current_torque: Union[float, None] = None
|
|
1047
|
+
shank_position: Union[float, None] = None
|
|
1048
|
+
torque_angle_gradient: Union[float, None] = None
|
|
1049
|
+
achieved_torque: Union[float, None] = None
|
|
1050
|
+
target_force: Union[float, None] = None
|
|
1051
|
+
target_torque: Union[float, None] = None
|
|
1052
|
+
quick_changer_version: Union[int, None] = None
|
|
1053
|
+
uncalibrated_error: Union[bool, None] = None
|
|
1054
|
+
|
|
1055
|
+
def validate_status(self, value: int) -> Tuple[bool, str]:
|
|
1056
|
+
if value is None:
|
|
1057
|
+
return [True, ""]
|
|
1058
|
+
|
|
1059
|
+
if not isinstance(value, int):
|
|
1060
|
+
return [False, "status must be of type int for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1061
|
+
|
|
1062
|
+
return [True, ""]
|
|
1063
|
+
|
|
1064
|
+
def validate_error(self, value: str) -> Tuple[bool, str]:
|
|
1065
|
+
if value is None:
|
|
1066
|
+
return [True, ""]
|
|
1067
|
+
|
|
1068
|
+
if not isinstance(value, str):
|
|
1069
|
+
return [False, "error must be of type str for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1070
|
+
|
|
1071
|
+
return [True, ""]
|
|
1072
|
+
|
|
1073
|
+
def validate_busy(self, value: bool) -> Tuple[bool, str]:
|
|
1074
|
+
if value is None:
|
|
1075
|
+
return [True, ""]
|
|
1076
|
+
|
|
1077
|
+
if not isinstance(value, bool):
|
|
1078
|
+
return [False, "busy must be of type bool for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1079
|
+
|
|
1080
|
+
return [True, ""]
|
|
1081
|
+
|
|
1082
|
+
def validate_additional_results(self, value: int) -> Tuple[bool, str]:
|
|
1083
|
+
if value is None:
|
|
1084
|
+
return [True, ""]
|
|
1085
|
+
|
|
1086
|
+
if not isinstance(value, int):
|
|
1087
|
+
return [False, "additional_results must be of type int for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1088
|
+
|
|
1089
|
+
return [True, ""]
|
|
1090
|
+
|
|
1091
|
+
def validate_current_torque(self, value: float) -> Tuple[bool, str]:
|
|
1092
|
+
if value is None:
|
|
1093
|
+
return [True, ""]
|
|
1094
|
+
|
|
1095
|
+
if not isinstance(value, float):
|
|
1096
|
+
return [False, "current_torque must be of type float for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1097
|
+
|
|
1098
|
+
return [True, ""]
|
|
1099
|
+
|
|
1100
|
+
def validate_shank_position(self, value: float) -> Tuple[bool, str]:
|
|
1101
|
+
if value is None:
|
|
1102
|
+
return [True, ""]
|
|
1103
|
+
|
|
1104
|
+
if not isinstance(value, float):
|
|
1105
|
+
return [False, "shank_position must be of type float for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1106
|
+
|
|
1107
|
+
return [True, ""]
|
|
1108
|
+
|
|
1109
|
+
def validate_torque_angle_gradient(self, value: float) -> Tuple[bool, str]:
|
|
1110
|
+
if value is None:
|
|
1111
|
+
return [True, ""]
|
|
1112
|
+
|
|
1113
|
+
if not isinstance(value, float):
|
|
1114
|
+
return [False, "torque_angle_gradient must be of type float for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1115
|
+
|
|
1116
|
+
return [True, ""]
|
|
1117
|
+
|
|
1118
|
+
def validate_achieved_torque(self, value: float) -> Tuple[bool, str]:
|
|
1119
|
+
if value is None:
|
|
1120
|
+
return [True, ""]
|
|
1121
|
+
|
|
1122
|
+
if not isinstance(value, float):
|
|
1123
|
+
return [False, "achieved_torque must be of type float for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1124
|
+
|
|
1125
|
+
return [True, ""]
|
|
1126
|
+
|
|
1127
|
+
def validate_target_force(self, value: float) -> Tuple[bool, str]:
|
|
1128
|
+
if value is None:
|
|
1129
|
+
return [True, ""]
|
|
1130
|
+
|
|
1131
|
+
if not isinstance(value, float):
|
|
1132
|
+
return [False, "target_force must be of type float for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1133
|
+
|
|
1134
|
+
return [True, ""]
|
|
1135
|
+
|
|
1136
|
+
def validate_target_torque(self, value: float) -> Tuple[bool, str]:
|
|
1137
|
+
if value is None:
|
|
1138
|
+
return [True, ""]
|
|
1139
|
+
|
|
1140
|
+
if not isinstance(value, float):
|
|
1141
|
+
return [False, "target_torque must be of type float for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1142
|
+
|
|
1143
|
+
return [True, ""]
|
|
1144
|
+
|
|
1145
|
+
def validate_quick_changer_version(self, value: int) -> Tuple[bool, str]:
|
|
1146
|
+
if value is None:
|
|
1147
|
+
return [True, ""]
|
|
1148
|
+
|
|
1149
|
+
if not isinstance(value, int):
|
|
1150
|
+
return [False, "quick_changer_version must be of type int for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1151
|
+
|
|
1152
|
+
return [True, ""]
|
|
1153
|
+
|
|
1154
|
+
def validate_uncalibrated_error(self, value: bool) -> Tuple[bool, str]:
|
|
1155
|
+
if value is None:
|
|
1156
|
+
return [True, ""]
|
|
1157
|
+
|
|
1158
|
+
if not isinstance(value, bool):
|
|
1159
|
+
return [False, "uncalibrated_error must be of type bool for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1160
|
+
|
|
1161
|
+
return [True, ""]
|
|
1162
|
+
|
|
1163
|
+
def __post_init__(self):
|
|
1164
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1165
|
+
is_valid, error_str = self.validate_status(self.status)
|
|
1166
|
+
if not is_valid:
|
|
1167
|
+
raise TypeError(error_str)
|
|
1168
|
+
is_valid, error_str = self.validate_error(self.error)
|
|
1169
|
+
if not is_valid:
|
|
1170
|
+
raise TypeError(error_str)
|
|
1171
|
+
is_valid, error_str = self.validate_busy(self.busy)
|
|
1172
|
+
if not is_valid:
|
|
1173
|
+
raise TypeError(error_str)
|
|
1174
|
+
is_valid, error_str = self.validate_additional_results(self.additional_results)
|
|
1175
|
+
if not is_valid:
|
|
1176
|
+
raise TypeError(error_str)
|
|
1177
|
+
is_valid, error_str = self.validate_current_torque(self.current_torque)
|
|
1178
|
+
if not is_valid:
|
|
1179
|
+
raise TypeError(error_str)
|
|
1180
|
+
is_valid, error_str = self.validate_shank_position(self.shank_position)
|
|
1181
|
+
if not is_valid:
|
|
1182
|
+
raise TypeError(error_str)
|
|
1183
|
+
is_valid, error_str = self.validate_torque_angle_gradient(self.torque_angle_gradient)
|
|
1184
|
+
if not is_valid:
|
|
1185
|
+
raise TypeError(error_str)
|
|
1186
|
+
is_valid, error_str = self.validate_achieved_torque(self.achieved_torque)
|
|
1187
|
+
if not is_valid:
|
|
1188
|
+
raise TypeError(error_str)
|
|
1189
|
+
is_valid, error_str = self.validate_target_force(self.target_force)
|
|
1190
|
+
if not is_valid:
|
|
1191
|
+
raise TypeError(error_str)
|
|
1192
|
+
is_valid, error_str = self.validate_target_torque(self.target_torque)
|
|
1193
|
+
if not is_valid:
|
|
1194
|
+
raise TypeError(error_str)
|
|
1195
|
+
is_valid, error_str = self.validate_quick_changer_version(self.quick_changer_version)
|
|
1196
|
+
if not is_valid:
|
|
1197
|
+
raise TypeError(error_str)
|
|
1198
|
+
is_valid, error_str = self.validate_uncalibrated_error(self.uncalibrated_error)
|
|
1199
|
+
if not is_valid:
|
|
1200
|
+
raise TypeError(error_str)
|
|
1201
|
+
|
|
1202
|
+
def parse_on_robot_screwdriver_configuration(data: object):
|
|
1203
|
+
return OnRobotScrewdriverConfiguration(
|
|
1204
|
+
status=parse_i_32(data["status"]) if "status" in data else None,
|
|
1205
|
+
error=parse_str(data["error"]) if "error" in data else None,
|
|
1206
|
+
busy=parse_bool(data["busy"]) if "busy" in data else None,
|
|
1207
|
+
additional_results=parse_i_32(data["additional_results"]) if "additional_results" in data else None,
|
|
1208
|
+
current_torque=parse_f_64(data["current_torque"]) if "current_torque" in data else None,
|
|
1209
|
+
shank_position=parse_f_64(data["shank_position"]) if "shank_position" in data else None,
|
|
1210
|
+
torque_angle_gradient=parse_f_64(data["torque_angle_gradient"]) if "torque_angle_gradient" in data else None,
|
|
1211
|
+
achieved_torque=parse_f_64(data["achieved_torque"]) if "achieved_torque" in data else None,
|
|
1212
|
+
target_force=parse_f_64(data["target_force"]) if "target_force" in data else None,
|
|
1213
|
+
target_torque=parse_f_64(data["target_torque"]) if "target_torque" in data else None,
|
|
1214
|
+
quick_changer_version=parse_i_32(data["quick_changer_version"]) if "quick_changer_version" in data else None,
|
|
1215
|
+
uncalibrated_error=parse_bool(data["uncalibrated_error"]) if "uncalibrated_error" in data else None,
|
|
1216
|
+
)
|
|
1217
|
+
|
|
1218
|
+
def serialize_on_robot_screwdriver_configuration(data: OnRobotScrewdriverConfiguration) -> object:
|
|
1219
|
+
return {
|
|
1220
|
+
"status": None if data.status is None else serialize_i_32(data.status),
|
|
1221
|
+
"error": None if data.error is None else serialize_str(data.error),
|
|
1222
|
+
"busy": None if data.busy is None else serialize_bool(data.busy),
|
|
1223
|
+
"additional_results": None if data.additional_results is None else serialize_i_32(data.additional_results),
|
|
1224
|
+
"current_torque": None if data.current_torque is None else serialize_f_64(data.current_torque),
|
|
1225
|
+
"shank_position": None if data.shank_position is None else serialize_f_64(data.shank_position),
|
|
1226
|
+
"torque_angle_gradient": None if data.torque_angle_gradient is None else serialize_f_64(data.torque_angle_gradient),
|
|
1227
|
+
"achieved_torque": None if data.achieved_torque is None else serialize_f_64(data.achieved_torque),
|
|
1228
|
+
"target_force": None if data.target_force is None else serialize_f_64(data.target_force),
|
|
1229
|
+
"target_torque": None if data.target_torque is None else serialize_f_64(data.target_torque),
|
|
1230
|
+
"quick_changer_version": None if data.quick_changer_version is None else serialize_i_32(data.quick_changer_version),
|
|
1231
|
+
"uncalibrated_error": None if data.uncalibrated_error is None else serialize_bool(data.uncalibrated_error),
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
class OrientationKindEnum(Enum):
|
|
1235
|
+
Quaternion = "quaternion"
|
|
1236
|
+
"""Enum Quaternion = `quaternion`"""
|
|
1237
|
+
|
|
1238
|
+
def parse_orientation_kind_enum(data: object) -> OrientationKindEnum:
|
|
1239
|
+
return OrientationKindEnum(data)
|
|
1240
|
+
|
|
1241
|
+
def serialize_orientation_kind_enum(data: Union[OrientationKindEnum, str]) -> object:
|
|
1242
|
+
return OrientationKindEnum(data).value
|
|
1243
|
+
|
|
1244
|
+
@dataclass
|
|
1245
|
+
class Pagination:
|
|
1246
|
+
"""Common Pagination Metadata"""
|
|
1247
|
+
total: Union[int, None] = None
|
|
1248
|
+
limit: Union[int, None] = None
|
|
1249
|
+
offset: Union[int, None] = None
|
|
1250
|
+
|
|
1251
|
+
def validate_total(self, value: int) -> Tuple[bool, str]:
|
|
1252
|
+
if value is None:
|
|
1253
|
+
return [True, ""]
|
|
1254
|
+
|
|
1255
|
+
if not isinstance(value, int):
|
|
1256
|
+
return [False, "total must be of type int for Pagination, got " + type(value).__name__]
|
|
1257
|
+
|
|
1258
|
+
return [True, ""]
|
|
1259
|
+
|
|
1260
|
+
def validate_limit(self, value: int) -> Tuple[bool, str]:
|
|
1261
|
+
if value is None:
|
|
1262
|
+
return [True, ""]
|
|
1263
|
+
|
|
1264
|
+
if not isinstance(value, int):
|
|
1265
|
+
return [False, "limit must be of type int for Pagination, got " + type(value).__name__]
|
|
1266
|
+
|
|
1267
|
+
return [True, ""]
|
|
1268
|
+
|
|
1269
|
+
def validate_offset(self, value: int) -> Tuple[bool, str]:
|
|
1270
|
+
if value is None:
|
|
1271
|
+
return [True, ""]
|
|
1272
|
+
|
|
1273
|
+
if not isinstance(value, int):
|
|
1274
|
+
return [False, "offset must be of type int for Pagination, got " + type(value).__name__]
|
|
1275
|
+
|
|
1276
|
+
return [True, ""]
|
|
1277
|
+
|
|
1278
|
+
def __post_init__(self):
|
|
1279
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1280
|
+
is_valid, error_str = self.validate_total(self.total)
|
|
1281
|
+
if not is_valid:
|
|
1282
|
+
raise TypeError(error_str)
|
|
1283
|
+
is_valid, error_str = self.validate_limit(self.limit)
|
|
1284
|
+
if not is_valid:
|
|
1285
|
+
raise TypeError(error_str)
|
|
1286
|
+
is_valid, error_str = self.validate_offset(self.offset)
|
|
1287
|
+
if not is_valid:
|
|
1288
|
+
raise TypeError(error_str)
|
|
1289
|
+
|
|
1290
|
+
def parse_pagination(data: object):
|
|
1291
|
+
return Pagination(
|
|
1292
|
+
total=parse_i_64(data["total"]) if "total" in data else None,
|
|
1293
|
+
limit=parse_i_64(data["limit"]) if "limit" in data else None,
|
|
1294
|
+
offset=parse_i_64(data["offset"]) if "offset" in data else None,
|
|
1295
|
+
)
|
|
1296
|
+
|
|
1297
|
+
def serialize_pagination(data: Pagination) -> object:
|
|
1298
|
+
return {
|
|
1299
|
+
"total": None if data.total is None else serialize_i_64(data.total),
|
|
1300
|
+
"limit": None if data.limit is None else serialize_i_64(data.limit),
|
|
1301
|
+
"offset": None if data.offset is None else serialize_i_64(data.offset),
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
@dataclass
|
|
1305
|
+
class Plane:
|
|
1306
|
+
"""Plane in 3D space"""
|
|
1307
|
+
id: Union[str, None] = None
|
|
1308
|
+
name: Union[str, None] = None
|
|
1309
|
+
|
|
1310
|
+
def validate_id(self, value: str) -> Tuple[bool, str]:
|
|
1311
|
+
if value is None:
|
|
1312
|
+
return [True, ""]
|
|
1313
|
+
|
|
1314
|
+
if not isinstance(value, str):
|
|
1315
|
+
return [False, "id must be of type str for Plane, got " + type(value).__name__]
|
|
1316
|
+
|
|
1317
|
+
return [True, ""]
|
|
1318
|
+
|
|
1319
|
+
def validate_name(self, value: str) -> Tuple[bool, str]:
|
|
1320
|
+
if value is None:
|
|
1321
|
+
return [True, ""]
|
|
1322
|
+
|
|
1323
|
+
if not isinstance(value, str):
|
|
1324
|
+
return [False, "name must be of type str for Plane, got " + type(value).__name__]
|
|
1325
|
+
|
|
1326
|
+
return [True, ""]
|
|
1327
|
+
|
|
1328
|
+
def __post_init__(self):
|
|
1329
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1330
|
+
is_valid, error_str = self.validate_id(self.id)
|
|
1331
|
+
if not is_valid:
|
|
1332
|
+
raise TypeError(error_str)
|
|
1333
|
+
is_valid, error_str = self.validate_name(self.name)
|
|
1334
|
+
if not is_valid:
|
|
1335
|
+
raise TypeError(error_str)
|
|
1336
|
+
|
|
1337
|
+
def parse_plane(data: object):
|
|
1338
|
+
return Plane(
|
|
1339
|
+
id=parse_str(data["id"]) if "id" in data else None,
|
|
1340
|
+
name=parse_str(data["name"]) if "name" in data else None,
|
|
1341
|
+
)
|
|
1342
|
+
|
|
1343
|
+
def serialize_plane(data: Plane) -> object:
|
|
1344
|
+
return {
|
|
1345
|
+
"id": None if data.id is None else serialize_str(data.id),
|
|
1346
|
+
"name": None if data.name is None else serialize_str(data.name),
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
@dataclass
|
|
1350
|
+
class Quaternion:
|
|
1351
|
+
"""Quaternion orientation"""
|
|
1352
|
+
x: Union[float, None] = None
|
|
1353
|
+
y: Union[float, None] = None
|
|
1354
|
+
z: Union[float, None] = None
|
|
1355
|
+
w: Union[float, None] = None
|
|
1356
|
+
|
|
1357
|
+
def validate_x(self, value: float) -> Tuple[bool, str]:
|
|
1358
|
+
if value is None:
|
|
1359
|
+
return [True, ""]
|
|
1360
|
+
|
|
1361
|
+
if not isinstance(value, float):
|
|
1362
|
+
return [False, "x must be of type float for Quaternion, got " + type(value).__name__]
|
|
1363
|
+
|
|
1364
|
+
return [True, ""]
|
|
1365
|
+
|
|
1366
|
+
def validate_y(self, value: float) -> Tuple[bool, str]:
|
|
1367
|
+
if value is None:
|
|
1368
|
+
return [True, ""]
|
|
1369
|
+
|
|
1370
|
+
if not isinstance(value, float):
|
|
1371
|
+
return [False, "y must be of type float for Quaternion, got " + type(value).__name__]
|
|
1372
|
+
|
|
1373
|
+
return [True, ""]
|
|
1374
|
+
|
|
1375
|
+
def validate_z(self, value: float) -> Tuple[bool, str]:
|
|
1376
|
+
if value is None:
|
|
1377
|
+
return [True, ""]
|
|
1378
|
+
|
|
1379
|
+
if not isinstance(value, float):
|
|
1380
|
+
return [False, "z must be of type float for Quaternion, got " + type(value).__name__]
|
|
1381
|
+
|
|
1382
|
+
return [True, ""]
|
|
1383
|
+
|
|
1384
|
+
def validate_w(self, value: float) -> Tuple[bool, str]:
|
|
1385
|
+
if value is None:
|
|
1386
|
+
return [True, ""]
|
|
1387
|
+
|
|
1388
|
+
if not isinstance(value, float):
|
|
1389
|
+
return [False, "w must be of type float for Quaternion, got " + type(value).__name__]
|
|
1390
|
+
|
|
1391
|
+
return [True, ""]
|
|
1392
|
+
|
|
1393
|
+
def __post_init__(self):
|
|
1394
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1395
|
+
is_valid, error_str = self.validate_x(self.x)
|
|
1396
|
+
if not is_valid:
|
|
1397
|
+
raise TypeError(error_str)
|
|
1398
|
+
is_valid, error_str = self.validate_y(self.y)
|
|
1399
|
+
if not is_valid:
|
|
1400
|
+
raise TypeError(error_str)
|
|
1401
|
+
is_valid, error_str = self.validate_z(self.z)
|
|
1402
|
+
if not is_valid:
|
|
1403
|
+
raise TypeError(error_str)
|
|
1404
|
+
is_valid, error_str = self.validate_w(self.w)
|
|
1405
|
+
if not is_valid:
|
|
1406
|
+
raise TypeError(error_str)
|
|
1407
|
+
|
|
1408
|
+
def parse_quaternion(data: object):
|
|
1409
|
+
return Quaternion(
|
|
1410
|
+
x=parse_f_64(data["x"]) if "x" in data else None,
|
|
1411
|
+
y=parse_f_64(data["y"]) if "y" in data else None,
|
|
1412
|
+
z=parse_f_64(data["z"]) if "z" in data else None,
|
|
1413
|
+
w=parse_f_64(data["w"]) if "w" in data else None,
|
|
1414
|
+
)
|
|
1415
|
+
|
|
1416
|
+
def serialize_quaternion(data: Quaternion) -> object:
|
|
1417
|
+
return {
|
|
1418
|
+
"x": None if data.x is None else serialize_f_64(data.x),
|
|
1419
|
+
"y": None if data.y is None else serialize_f_64(data.y),
|
|
1420
|
+
"z": None if data.z is None else serialize_f_64(data.z),
|
|
1421
|
+
"w": None if data.w is None else serialize_f_64(data.w),
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
class RecoveryTypeEnum(Enum):
|
|
1425
|
+
Recoverable = "Recoverable"
|
|
1426
|
+
"""Enum Recoverable = `Recoverable`"""
|
|
1427
|
+
NotRecoverable = "NotRecoverable"
|
|
1428
|
+
"""Enum NotRecoverable = `NotRecoverable`"""
|
|
1429
|
+
Restart = "Restart"
|
|
1430
|
+
"""Enum Restart = `Restart`"""
|
|
1431
|
+
GuidedMode = "GuidedMode"
|
|
1432
|
+
"""Enum GuidedMode = `GuidedMode`"""
|
|
1433
|
+
ManualRecoveryMode = "ManualRecoveryMode"
|
|
1434
|
+
"""Enum ManualRecoveryMode = `ManualRecoveryMode`"""
|
|
1435
|
+
|
|
1436
|
+
def parse_recovery_type_enum(data: object) -> RecoveryTypeEnum:
|
|
1437
|
+
return RecoveryTypeEnum(data)
|
|
1438
|
+
|
|
1439
|
+
def serialize_recovery_type_enum(data: Union[RecoveryTypeEnum, str]) -> object:
|
|
1440
|
+
return RecoveryTypeEnum(data).value
|
|
1441
|
+
|
|
1442
|
+
class RobotControlModeEnum(Enum):
|
|
1443
|
+
Api = "api"
|
|
1444
|
+
"""The robot is controlled via the Standard Bots Robot API (this API)"""
|
|
1445
|
+
RoutineEditor = "routine_editor"
|
|
1446
|
+
"""The robot is controlled via the Routine Editor UI"""
|
|
1447
|
+
|
|
1448
|
+
def parse_robot_control_mode_enum(data: object) -> RobotControlModeEnum:
|
|
1449
|
+
return RobotControlModeEnum(data)
|
|
1450
|
+
|
|
1451
|
+
def serialize_robot_control_mode_enum(data: Union[RobotControlModeEnum, str]) -> object:
|
|
1452
|
+
return RobotControlModeEnum(data).value
|
|
1453
|
+
|
|
1454
|
+
class RobotStatusEnum(Enum):
|
|
1455
|
+
Idle = "Idle"
|
|
1456
|
+
"""Enum Idle = `Idle`"""
|
|
1457
|
+
RunningAdHocCommand = "RunningAdHocCommand"
|
|
1458
|
+
"""Enum RunningAdHocCommand = `RunningAdHocCommand`"""
|
|
1459
|
+
RoutineRunning = "RoutineRunning"
|
|
1460
|
+
"""Enum RoutineRunning = `RoutineRunning`"""
|
|
1461
|
+
Antigravity = "Antigravity"
|
|
1462
|
+
"""Enum Antigravity = `Antigravity`"""
|
|
1463
|
+
AntigravitySlow = "AntigravitySlow"
|
|
1464
|
+
"""Enum AntigravitySlow = `AntigravitySlow`"""
|
|
1465
|
+
Failure = "Failure"
|
|
1466
|
+
"""Enum Failure = `Failure`"""
|
|
1467
|
+
Recovering = "Recovering"
|
|
1468
|
+
"""Enum Recovering = `Recovering`"""
|
|
1469
|
+
|
|
1470
|
+
def parse_robot_status_enum(data: object) -> RobotStatusEnum:
|
|
1471
|
+
return RobotStatusEnum(data)
|
|
1472
|
+
|
|
1473
|
+
def serialize_robot_status_enum(data: Union[RobotStatusEnum, str]) -> object:
|
|
1474
|
+
return RobotStatusEnum(data).value
|
|
1475
|
+
|
|
1476
|
+
class ROSControlStateEnum(Enum):
|
|
1477
|
+
Enabled = "enabled"
|
|
1478
|
+
"""ROS control is enabled."""
|
|
1479
|
+
Disabled = "disabled"
|
|
1480
|
+
"""ROS control is disabled."""
|
|
1481
|
+
|
|
1482
|
+
def parse_ros_control_state_enum(data: object) -> ROSControlStateEnum:
|
|
1483
|
+
return ROSControlStateEnum(data)
|
|
1484
|
+
|
|
1485
|
+
def serialize_ros_control_state_enum(data: Union[ROSControlStateEnum, str]) -> object:
|
|
1486
|
+
return ROSControlStateEnum(data).value
|
|
1487
|
+
|
|
1488
|
+
RoutineVariablesStateMap = Dict[str, str]
|
|
1489
|
+
|
|
1490
|
+
def parse_routine_variables_state_map(data: object) -> RoutineVariablesStateMap:
|
|
1491
|
+
return {
|
|
1492
|
+
parse_str(key): parse_str(value) for key, value in data.items()
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
def serialize_routine_variables_state_map(data: RoutineVariablesStateMap) -> object:
|
|
1496
|
+
return {
|
|
1497
|
+
serialize_str(key): serialize_str(value) for key, value in data.items()
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
@dataclass
|
|
1501
|
+
class RuntimeVariable:
|
|
1502
|
+
"""Runtime Variable state"""
|
|
1503
|
+
value: Union[str, None] = None
|
|
1504
|
+
|
|
1505
|
+
def validate_value(self, value: str) -> Tuple[bool, str]:
|
|
1506
|
+
if value is None:
|
|
1507
|
+
return [True, ""]
|
|
1508
|
+
|
|
1509
|
+
if not isinstance(value, str):
|
|
1510
|
+
return [False, "value must be of type str for RuntimeVariable, got " + type(value).__name__]
|
|
1511
|
+
|
|
1512
|
+
return [True, ""]
|
|
1513
|
+
|
|
1514
|
+
def __post_init__(self):
|
|
1515
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1516
|
+
is_valid, error_str = self.validate_value(self.value)
|
|
1517
|
+
if not is_valid:
|
|
1518
|
+
raise TypeError(error_str)
|
|
1519
|
+
|
|
1520
|
+
def parse_runtime_variable(data: object):
|
|
1521
|
+
return RuntimeVariable(
|
|
1522
|
+
value=parse_str(data["value"]) if "value" in data else None,
|
|
1523
|
+
)
|
|
1524
|
+
|
|
1525
|
+
def serialize_runtime_variable(data: RuntimeVariable) -> object:
|
|
1526
|
+
return {
|
|
1527
|
+
"value": None if data.value is None else serialize_str(data.value),
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
class SchunkEGxControlKindEnum(Enum):
|
|
1531
|
+
Move = "move"
|
|
1532
|
+
"""Move gripper to target grip diameter"""
|
|
1533
|
+
|
|
1534
|
+
def parse_schunk_e_gx_control_kind_enum(data: object) -> SchunkEGxControlKindEnum:
|
|
1535
|
+
return SchunkEGxControlKindEnum(data)
|
|
1536
|
+
|
|
1537
|
+
def serialize_schunk_e_gx_control_kind_enum(data: Union[SchunkEGxControlKindEnum, str]) -> object:
|
|
1538
|
+
return SchunkEGxControlKindEnum(data).value
|
|
1539
|
+
|
|
1540
|
+
SkillsList = List[str]
|
|
1541
|
+
|
|
1542
|
+
def parse_skills_list(data: object) -> SkillsList:
|
|
1543
|
+
return [parse_str(item) for item in data]
|
|
1544
|
+
|
|
1545
|
+
def serialize_skills_list(data: SkillsList) -> List[object]:
|
|
1546
|
+
return [serialize_str(item) for item in data]
|
|
1547
|
+
|
|
1548
|
+
@dataclass
|
|
1549
|
+
class SpeechToTextRequest:
|
|
1550
|
+
"""Request to convert speech to text."""
|
|
1551
|
+
encoded_audio_data: Union[str, None] = None
|
|
1552
|
+
|
|
1553
|
+
def validate_encoded_audio_data(self, value: str) -> Tuple[bool, str]:
|
|
1554
|
+
if value is None:
|
|
1555
|
+
return [True, ""]
|
|
1556
|
+
|
|
1557
|
+
if not isinstance(value, str):
|
|
1558
|
+
return [False, "encoded_audio_data must be of type str for SpeechToTextRequest, got " + type(value).__name__]
|
|
1559
|
+
|
|
1560
|
+
return [True, ""]
|
|
1561
|
+
|
|
1562
|
+
def __post_init__(self):
|
|
1563
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1564
|
+
is_valid, error_str = self.validate_encoded_audio_data(self.encoded_audio_data)
|
|
1565
|
+
if not is_valid:
|
|
1566
|
+
raise TypeError(error_str)
|
|
1567
|
+
|
|
1568
|
+
def parse_speech_to_text_request(data: object):
|
|
1569
|
+
return SpeechToTextRequest(
|
|
1570
|
+
encoded_audio_data=parse_str(data["encoded_audio_data"]) if "encoded_audio_data" in data else None,
|
|
1571
|
+
)
|
|
1572
|
+
|
|
1573
|
+
def serialize_speech_to_text_request(data: SpeechToTextRequest) -> object:
|
|
1574
|
+
return {
|
|
1575
|
+
"encoded_audio_data": None if data.encoded_audio_data is None else serialize_str(data.encoded_audio_data),
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
class StatusHealthEnum(Enum):
|
|
1579
|
+
Ok = "ok"
|
|
1580
|
+
"""Enum Ok = `ok`"""
|
|
1581
|
+
Warning = "warning"
|
|
1582
|
+
"""Enum Warning = `warning`"""
|
|
1583
|
+
Error = "error"
|
|
1584
|
+
"""Enum Error = `error`"""
|
|
1585
|
+
|
|
1586
|
+
def parse_status_health_enum(data: object) -> StatusHealthEnum:
|
|
1587
|
+
return StatusHealthEnum(data)
|
|
1588
|
+
|
|
1589
|
+
def serialize_status_health_enum(data: Union[StatusHealthEnum, str]) -> object:
|
|
1590
|
+
return StatusHealthEnum(data).value
|
|
1591
|
+
|
|
1592
|
+
@dataclass
|
|
1593
|
+
class StatusVersionData:
|
|
1594
|
+
"""Version Data"""
|
|
1595
|
+
id: Union[str, None] = None
|
|
1596
|
+
name: Union[str, None] = None
|
|
1597
|
+
|
|
1598
|
+
def validate_id(self, value: str) -> Tuple[bool, str]:
|
|
1599
|
+
if value is None:
|
|
1600
|
+
return [True, ""]
|
|
1601
|
+
|
|
1602
|
+
if not isinstance(value, str):
|
|
1603
|
+
return [False, "id must be of type str for StatusVersionData, got " + type(value).__name__]
|
|
1604
|
+
|
|
1605
|
+
return [True, ""]
|
|
1606
|
+
|
|
1607
|
+
def validate_name(self, value: str) -> Tuple[bool, str]:
|
|
1608
|
+
if value is None:
|
|
1609
|
+
return [True, ""]
|
|
1610
|
+
|
|
1611
|
+
if not isinstance(value, str):
|
|
1612
|
+
return [False, "name must be of type str for StatusVersionData, got " + type(value).__name__]
|
|
1613
|
+
|
|
1614
|
+
return [True, ""]
|
|
1615
|
+
|
|
1616
|
+
def __post_init__(self):
|
|
1617
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1618
|
+
is_valid, error_str = self.validate_id(self.id)
|
|
1619
|
+
if not is_valid:
|
|
1620
|
+
raise TypeError(error_str)
|
|
1621
|
+
is_valid, error_str = self.validate_name(self.name)
|
|
1622
|
+
if not is_valid:
|
|
1623
|
+
raise TypeError(error_str)
|
|
1624
|
+
|
|
1625
|
+
def parse_status_version_data(data: object):
|
|
1626
|
+
return StatusVersionData(
|
|
1627
|
+
id=parse_str(data["id"]) if "id" in data else None,
|
|
1628
|
+
name=parse_str(data["name"]) if "name" in data else None,
|
|
1629
|
+
)
|
|
1630
|
+
|
|
1631
|
+
def serialize_status_version_data(data: StatusVersionData) -> object:
|
|
1632
|
+
return {
|
|
1633
|
+
"id": None if data.id is None else serialize_str(data.id),
|
|
1634
|
+
"name": None if data.name is None else serialize_str(data.name),
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
@dataclass
|
|
1638
|
+
class TriggerFaultRequest:
|
|
1639
|
+
"""Request to trigger an user fault for routine.
|
|
1640
|
+
"""
|
|
1641
|
+
message: Union[str, None] = None
|
|
1642
|
+
isRecoverable: Union[bool, None] = None
|
|
1643
|
+
|
|
1644
|
+
def validate_message(self, value: str) -> Tuple[bool, str]:
|
|
1645
|
+
if value is None:
|
|
1646
|
+
return [True, ""]
|
|
1647
|
+
|
|
1648
|
+
if not isinstance(value, str):
|
|
1649
|
+
return [False, "message must be of type str for TriggerFaultRequest, got " + type(value).__name__]
|
|
1650
|
+
|
|
1651
|
+
return [True, ""]
|
|
1652
|
+
|
|
1653
|
+
def validate_isRecoverable(self, value: bool) -> Tuple[bool, str]:
|
|
1654
|
+
if value is None:
|
|
1655
|
+
return [True, ""]
|
|
1656
|
+
|
|
1657
|
+
if not isinstance(value, bool):
|
|
1658
|
+
return [False, "isRecoverable must be of type bool for TriggerFaultRequest, got " + type(value).__name__]
|
|
1659
|
+
|
|
1660
|
+
return [True, ""]
|
|
1661
|
+
|
|
1662
|
+
def __post_init__(self):
|
|
1663
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1664
|
+
is_valid, error_str = self.validate_message(self.message)
|
|
1665
|
+
if not is_valid:
|
|
1666
|
+
raise TypeError(error_str)
|
|
1667
|
+
is_valid, error_str = self.validate_isRecoverable(self.isRecoverable)
|
|
1668
|
+
if not is_valid:
|
|
1669
|
+
raise TypeError(error_str)
|
|
1670
|
+
|
|
1671
|
+
def parse_trigger_fault_request(data: object):
|
|
1672
|
+
return TriggerFaultRequest(
|
|
1673
|
+
message=parse_str(data["message"]) if "message" in data else None,
|
|
1674
|
+
isRecoverable=parse_bool(data["isRecoverable"]) if "isRecoverable" in data else None,
|
|
1675
|
+
)
|
|
1676
|
+
|
|
1677
|
+
def serialize_trigger_fault_request(data: TriggerFaultRequest) -> object:
|
|
1678
|
+
return {
|
|
1679
|
+
"message": None if data.message is None else serialize_str(data.message),
|
|
1680
|
+
"isRecoverable": None if data.isRecoverable is None else serialize_bool(data.isRecoverable),
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
@dataclass
|
|
1684
|
+
class ArmPositionUpdateFailureEvent:
|
|
1685
|
+
"""Move robot event when movement failed"""
|
|
1686
|
+
kind: Union[ArmPositionUpdateFailureEventKind, None] = None
|
|
1687
|
+
reason: Union[str, None] = None
|
|
1688
|
+
internal_reason: Union[str, None] = None
|
|
1689
|
+
|
|
1690
|
+
def validate_kind(self, value: ArmPositionUpdateFailureEventKind) -> Tuple[bool, str]:
|
|
1691
|
+
if value is None:
|
|
1692
|
+
return [False, "kind is required for ArmPositionUpdateFailureEvent"]
|
|
1693
|
+
|
|
1694
|
+
if not ((isinstance(value, str) and ArmPositionUpdateFailureEventKind in ['motion_failed_unknown_reason', 'motion_failed_collision']) or isinstance(value, ArmPositionUpdateFailureEventKind)):
|
|
1695
|
+
return [False, "kind must be of type ArmPositionUpdateFailureEventKind for ArmPositionUpdateFailureEvent, got " + type(value).__name__]
|
|
1696
|
+
|
|
1697
|
+
return [True, ""]
|
|
1698
|
+
|
|
1699
|
+
def validate_reason(self, value: str) -> Tuple[bool, str]:
|
|
1700
|
+
if value is None:
|
|
1701
|
+
return [False, "reason is required for ArmPositionUpdateFailureEvent"]
|
|
1702
|
+
|
|
1703
|
+
if not isinstance(value, str):
|
|
1704
|
+
return [False, "reason must be of type str for ArmPositionUpdateFailureEvent, got " + type(value).__name__]
|
|
1705
|
+
|
|
1706
|
+
return [True, ""]
|
|
1707
|
+
|
|
1708
|
+
def validate_internal_reason(self, value: str) -> Tuple[bool, str]:
|
|
1709
|
+
if value is None:
|
|
1710
|
+
return [True, ""]
|
|
1711
|
+
|
|
1712
|
+
if not isinstance(value, str):
|
|
1713
|
+
return [False, "internal_reason must be of type str for ArmPositionUpdateFailureEvent, got " + type(value).__name__]
|
|
1714
|
+
|
|
1715
|
+
return [True, ""]
|
|
1716
|
+
|
|
1717
|
+
def __post_init__(self):
|
|
1718
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1719
|
+
is_valid, error_str = self.validate_kind(self.kind)
|
|
1720
|
+
if not is_valid:
|
|
1721
|
+
raise TypeError(error_str)
|
|
1722
|
+
is_valid, error_str = self.validate_reason(self.reason)
|
|
1723
|
+
if not is_valid:
|
|
1724
|
+
raise TypeError(error_str)
|
|
1725
|
+
is_valid, error_str = self.validate_internal_reason(self.internal_reason)
|
|
1726
|
+
if not is_valid:
|
|
1727
|
+
raise TypeError(error_str)
|
|
1728
|
+
|
|
1729
|
+
def parse_arm_position_update_failure_event(data: object):
|
|
1730
|
+
return ArmPositionUpdateFailureEvent(
|
|
1731
|
+
kind=parse_arm_position_update_failure_event_kind(data["kind"]) if "kind" in data else None,
|
|
1732
|
+
reason=parse_str(data["reason"]) if "reason" in data else None,
|
|
1733
|
+
internal_reason=parse_str(data["internal_reason"]) if "internal_reason" in data else None,
|
|
1734
|
+
)
|
|
1735
|
+
|
|
1736
|
+
def serialize_arm_position_update_failure_event(data: ArmPositionUpdateFailureEvent) -> object:
|
|
1737
|
+
return {
|
|
1738
|
+
"kind": serialize_arm_position_update_failure_event_kind(data.kind),
|
|
1739
|
+
"reason": serialize_str(data.reason),
|
|
1740
|
+
"internal_reason": None if data.internal_reason is None else serialize_str(data.internal_reason),
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
ArmPositionUpdateRequestResponseEventStreamSubscriptionsList = List[ArmPositionUpdateRequestResponseEventStreamSubscriptionKindEnum]
|
|
1744
|
+
|
|
1745
|
+
def parse_arm_position_update_request_response_event_stream_subscriptions_list(data: object) -> ArmPositionUpdateRequestResponseEventStreamSubscriptionsList:
|
|
1746
|
+
return [parse_arm_position_update_request_response_event_stream_subscription_kind_enum(item) for item in data]
|
|
1747
|
+
|
|
1748
|
+
def serialize_arm_position_update_request_response_event_stream_subscriptions_list(data: ArmPositionUpdateRequestResponseEventStreamSubscriptionsList) -> List[object]:
|
|
1749
|
+
return [serialize_arm_position_update_request_response_event_stream_subscription_kind_enum(item) for item in data]
|
|
1750
|
+
|
|
1751
|
+
@dataclass
|
|
1752
|
+
class BrakesState:
|
|
1753
|
+
"""State of the robot joint brakes. Each joint contains a brake which can be engaged when the robot is at a standstill to prevent the robot from moving.
|
|
1754
|
+
"""
|
|
1755
|
+
state: Union[BrakesStateEnum, None] = None
|
|
1756
|
+
|
|
1757
|
+
def validate_state(self, value: BrakesStateEnum) -> Tuple[bool, str]:
|
|
1758
|
+
if value is None:
|
|
1759
|
+
return [False, "state is required for BrakesState"]
|
|
1760
|
+
|
|
1761
|
+
if not ((isinstance(value, str) and BrakesStateEnum in ['engaged', 'disengaged']) or isinstance(value, BrakesStateEnum)):
|
|
1762
|
+
return [False, "state must be of type BrakesStateEnum for BrakesState, got " + type(value).__name__]
|
|
1763
|
+
|
|
1764
|
+
return [True, ""]
|
|
1765
|
+
|
|
1766
|
+
def __post_init__(self):
|
|
1767
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1768
|
+
is_valid, error_str = self.validate_state(self.state)
|
|
1769
|
+
if not is_valid:
|
|
1770
|
+
raise TypeError(error_str)
|
|
1771
|
+
|
|
1772
|
+
def parse_brakes_state(data: object):
|
|
1773
|
+
return BrakesState(
|
|
1774
|
+
state=parse_brakes_state_enum(data["state"]) if "state" in data else None,
|
|
1775
|
+
)
|
|
1776
|
+
|
|
1777
|
+
def serialize_brakes_state(data: BrakesState) -> object:
|
|
1778
|
+
return {
|
|
1779
|
+
"state": serialize_brakes_state_enum(data.state),
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
@dataclass
|
|
1783
|
+
class CameraIntrinsicsResponse:
|
|
1784
|
+
"""Response with intrinsic parameters of the camera."""
|
|
1785
|
+
intrinsics: Union[CameraIntrinsics, None] = None
|
|
1786
|
+
|
|
1787
|
+
def validate_intrinsics(self, value: CameraIntrinsics) -> Tuple[bool, str]:
|
|
1788
|
+
if value is None:
|
|
1789
|
+
return [True, ""]
|
|
1790
|
+
|
|
1791
|
+
if not isinstance(value, CameraIntrinsics):
|
|
1792
|
+
return [False, "intrinsics must be of type CameraIntrinsics for CameraIntrinsicsResponse, got " + type(value).__name__]
|
|
1793
|
+
|
|
1794
|
+
return [True, ""]
|
|
1795
|
+
|
|
1796
|
+
def __post_init__(self):
|
|
1797
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1798
|
+
is_valid, error_str = self.validate_intrinsics(self.intrinsics)
|
|
1799
|
+
if not is_valid:
|
|
1800
|
+
raise TypeError(error_str)
|
|
1801
|
+
|
|
1802
|
+
def parse_camera_intrinsics_response(data: object):
|
|
1803
|
+
return CameraIntrinsicsResponse(
|
|
1804
|
+
intrinsics=parse_camera_intrinsics(data["intrinsics"]) if "intrinsics" in data else None,
|
|
1805
|
+
)
|
|
1806
|
+
|
|
1807
|
+
def serialize_camera_intrinsics_response(data: CameraIntrinsicsResponse) -> object:
|
|
1808
|
+
return {
|
|
1809
|
+
"intrinsics": None if data.intrinsics is None else serialize_camera_intrinsics(data.intrinsics),
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
@dataclass
|
|
1813
|
+
class CameraFrameRequest:
|
|
1814
|
+
"""Request for a single camera frame."""
|
|
1815
|
+
camera_settings: Union[CameraSettings, None] = None
|
|
1816
|
+
|
|
1817
|
+
def validate_camera_settings(self, value: CameraSettings) -> Tuple[bool, str]:
|
|
1818
|
+
if value is None:
|
|
1819
|
+
return [True, ""]
|
|
1820
|
+
|
|
1821
|
+
if not isinstance(value, CameraSettings):
|
|
1822
|
+
return [False, "camera_settings must be of type CameraSettings for CameraFrameRequest, got " + type(value).__name__]
|
|
1823
|
+
|
|
1824
|
+
return [True, ""]
|
|
1825
|
+
|
|
1826
|
+
def __post_init__(self):
|
|
1827
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1828
|
+
is_valid, error_str = self.validate_camera_settings(self.camera_settings)
|
|
1829
|
+
if not is_valid:
|
|
1830
|
+
raise TypeError(error_str)
|
|
1831
|
+
|
|
1832
|
+
def parse_camera_frame_request(data: object):
|
|
1833
|
+
return CameraFrameRequest(
|
|
1834
|
+
camera_settings=parse_camera_settings(data["camera_settings"]) if "camera_settings" in data else None,
|
|
1835
|
+
)
|
|
1836
|
+
|
|
1837
|
+
def serialize_camera_frame_request(data: CameraFrameRequest) -> object:
|
|
1838
|
+
return {
|
|
1839
|
+
"camera_settings": None if data.camera_settings is None else serialize_camera_settings(data.camera_settings),
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
@dataclass
|
|
1843
|
+
class JointState:
|
|
1844
|
+
"""State of a joint"""
|
|
1845
|
+
braked: Union[bool, None] = None
|
|
1846
|
+
connectionStatus: Union[ConnectionStatus, None] = None
|
|
1847
|
+
inCollision: Union[bool, None] = None
|
|
1848
|
+
disturbance: Union[float, None] = None
|
|
1849
|
+
|
|
1850
|
+
def validate_braked(self, value: bool) -> Tuple[bool, str]:
|
|
1851
|
+
if value is None:
|
|
1852
|
+
return [True, ""]
|
|
1853
|
+
|
|
1854
|
+
if not isinstance(value, bool):
|
|
1855
|
+
return [False, "braked must be of type bool for JointState, got " + type(value).__name__]
|
|
1856
|
+
|
|
1857
|
+
return [True, ""]
|
|
1858
|
+
|
|
1859
|
+
def validate_connectionStatus(self, value: ConnectionStatus) -> Tuple[bool, str]:
|
|
1860
|
+
if value is None:
|
|
1861
|
+
return [True, ""]
|
|
1862
|
+
|
|
1863
|
+
if not ((isinstance(value, str) and ConnectionStatus in ['connected', 'disconnected', 'ready']) or isinstance(value, ConnectionStatus)):
|
|
1864
|
+
return [False, "connectionStatus must be of type ConnectionStatus for JointState, got " + type(value).__name__]
|
|
1865
|
+
|
|
1866
|
+
return [True, ""]
|
|
1867
|
+
|
|
1868
|
+
def validate_inCollision(self, value: bool) -> Tuple[bool, str]:
|
|
1869
|
+
if value is None:
|
|
1870
|
+
return [True, ""]
|
|
1871
|
+
|
|
1872
|
+
if not isinstance(value, bool):
|
|
1873
|
+
return [False, "inCollision must be of type bool for JointState, got " + type(value).__name__]
|
|
1874
|
+
|
|
1875
|
+
return [True, ""]
|
|
1876
|
+
|
|
1877
|
+
def validate_disturbance(self, value: float) -> Tuple[bool, str]:
|
|
1878
|
+
if value is None:
|
|
1879
|
+
return [True, ""]
|
|
1880
|
+
|
|
1881
|
+
if not isinstance(value, float):
|
|
1882
|
+
return [False, "disturbance must be of type float for JointState, got " + type(value).__name__]
|
|
1883
|
+
|
|
1884
|
+
return [True, ""]
|
|
1885
|
+
|
|
1886
|
+
def __post_init__(self):
|
|
1887
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1888
|
+
is_valid, error_str = self.validate_braked(self.braked)
|
|
1889
|
+
if not is_valid:
|
|
1890
|
+
raise TypeError(error_str)
|
|
1891
|
+
is_valid, error_str = self.validate_connectionStatus(self.connectionStatus)
|
|
1892
|
+
if not is_valid:
|
|
1893
|
+
raise TypeError(error_str)
|
|
1894
|
+
is_valid, error_str = self.validate_inCollision(self.inCollision)
|
|
1895
|
+
if not is_valid:
|
|
1896
|
+
raise TypeError(error_str)
|
|
1897
|
+
is_valid, error_str = self.validate_disturbance(self.disturbance)
|
|
1898
|
+
if not is_valid:
|
|
1899
|
+
raise TypeError(error_str)
|
|
1900
|
+
|
|
1901
|
+
def parse_joint_state(data: object):
|
|
1902
|
+
return JointState(
|
|
1903
|
+
braked=parse_bool(data["braked"]) if "braked" in data else None,
|
|
1904
|
+
connectionStatus=parse_connection_status(data["connectionStatus"]) if "connectionStatus" in data else None,
|
|
1905
|
+
inCollision=parse_bool(data["inCollision"]) if "inCollision" in data else None,
|
|
1906
|
+
disturbance=parse_f_64(data["disturbance"]) if "disturbance" in data else None,
|
|
1907
|
+
)
|
|
1908
|
+
|
|
1909
|
+
def serialize_joint_state(data: JointState) -> object:
|
|
1910
|
+
return {
|
|
1911
|
+
"braked": None if data.braked is None else serialize_bool(data.braked),
|
|
1912
|
+
"connectionStatus": None if data.connectionStatus is None else serialize_connection_status(data.connectionStatus),
|
|
1913
|
+
"inCollision": None if data.inCollision is None else serialize_bool(data.inCollision),
|
|
1914
|
+
"disturbance": None if data.disturbance is None else serialize_f_64(data.disturbance),
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
EnvironmentVariablesList = List[EnvironmentVariable]
|
|
1918
|
+
|
|
1919
|
+
def parse_environment_variables_list(data: object) -> EnvironmentVariablesList:
|
|
1920
|
+
return [parse_environment_variable(item) for item in data]
|
|
1921
|
+
|
|
1922
|
+
def serialize_environment_variables_list(data: EnvironmentVariablesList) -> List[object]:
|
|
1923
|
+
return [serialize_environment_variable(item) for item in data]
|
|
1924
|
+
|
|
1925
|
+
@dataclass
|
|
1926
|
+
class ErrorResponse:
|
|
1927
|
+
"""Error Response"""
|
|
1928
|
+
error: Union[ErrorEnum, None] = None
|
|
1929
|
+
message: Union[str, None] = None
|
|
1930
|
+
|
|
1931
|
+
def validate_error(self, value: ErrorEnum) -> Tuple[bool, str]:
|
|
1932
|
+
if value is None:
|
|
1933
|
+
return [False, "error is required for ErrorResponse"]
|
|
1934
|
+
|
|
1935
|
+
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', 'robot_not_idle', 'brakes_must_be_engaged', 'brakes_must_be_disengaged', 'equipment_no_matching', 'service_initializing', 'camera_disconnected', 'settings_validation_error', 'settings_timeout', 'internal_server_error', 'recovery_error', 'not_found', 'invalid_space_specified']) or isinstance(value, ErrorEnum)):
|
|
1936
|
+
return [False, "error must be of type ErrorEnum for ErrorResponse, got " + type(value).__name__]
|
|
1937
|
+
|
|
1938
|
+
return [True, ""]
|
|
1939
|
+
|
|
1940
|
+
def validate_message(self, value: str) -> Tuple[bool, str]:
|
|
1941
|
+
if value is None:
|
|
1942
|
+
return [False, "message is required for ErrorResponse"]
|
|
1943
|
+
|
|
1944
|
+
if not isinstance(value, str):
|
|
1945
|
+
return [False, "message must be of type str for ErrorResponse, got " + type(value).__name__]
|
|
1946
|
+
|
|
1947
|
+
return [True, ""]
|
|
1948
|
+
|
|
1949
|
+
def __post_init__(self):
|
|
1950
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1951
|
+
is_valid, error_str = self.validate_error(self.error)
|
|
1952
|
+
if not is_valid:
|
|
1953
|
+
raise TypeError(error_str)
|
|
1954
|
+
is_valid, error_str = self.validate_message(self.message)
|
|
1955
|
+
if not is_valid:
|
|
1956
|
+
raise TypeError(error_str)
|
|
1957
|
+
|
|
1958
|
+
def parse_error_response(data: object):
|
|
1959
|
+
return ErrorResponse(
|
|
1960
|
+
error=parse_error_enum(data["error"]) if "error" in data else None,
|
|
1961
|
+
message=parse_str(data["message"]) if "message" in data else None,
|
|
1962
|
+
)
|
|
1963
|
+
|
|
1964
|
+
def serialize_error_response(data: ErrorResponse) -> object:
|
|
1965
|
+
return {
|
|
1966
|
+
"error": serialize_error_enum(data.error),
|
|
1967
|
+
"message": serialize_str(data.message),
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
@dataclass
|
|
1971
|
+
class ForceUnit:
|
|
1972
|
+
"""Reusable Abstraction for force units (eg force, torque)
|
|
1973
|
+
"""
|
|
1974
|
+
unit_kind: Union[ForceUnitKind, None] = None
|
|
1975
|
+
value: Union[float, None] = None
|
|
1976
|
+
|
|
1977
|
+
def validate_unit_kind(self, value: ForceUnitKind) -> Tuple[bool, str]:
|
|
1978
|
+
if value is None:
|
|
1979
|
+
return [False, "unit_kind is required for ForceUnit"]
|
|
1980
|
+
|
|
1981
|
+
if not ((isinstance(value, str) and ForceUnitKind in ['newtons', 'pounds']) or isinstance(value, ForceUnitKind)):
|
|
1982
|
+
return [False, "unit_kind must be of type ForceUnitKind for ForceUnit, got " + type(value).__name__]
|
|
1983
|
+
|
|
1984
|
+
return [True, ""]
|
|
1985
|
+
|
|
1986
|
+
def validate_value(self, value: float) -> Tuple[bool, str]:
|
|
1987
|
+
if value is None:
|
|
1988
|
+
return [True, ""]
|
|
1989
|
+
|
|
1990
|
+
if not isinstance(value, float):
|
|
1991
|
+
return [False, "value must be of type float for ForceUnit, got " + type(value).__name__]
|
|
1992
|
+
|
|
1993
|
+
return [True, ""]
|
|
1994
|
+
|
|
1995
|
+
def __post_init__(self):
|
|
1996
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1997
|
+
is_valid, error_str = self.validate_unit_kind(self.unit_kind)
|
|
1998
|
+
if not is_valid:
|
|
1999
|
+
raise TypeError(error_str)
|
|
2000
|
+
is_valid, error_str = self.validate_value(self.value)
|
|
2001
|
+
if not is_valid:
|
|
2002
|
+
raise TypeError(error_str)
|
|
2003
|
+
|
|
2004
|
+
def parse_force_unit(data: object):
|
|
2005
|
+
return ForceUnit(
|
|
2006
|
+
unit_kind=parse_force_unit_kind(data["unit_kind"]) if "unit_kind" in data else None,
|
|
2007
|
+
value=parse_f_64(data["value"]) if "value" in data else None,
|
|
2008
|
+
)
|
|
2009
|
+
|
|
2010
|
+
def serialize_force_unit(data: ForceUnit) -> object:
|
|
2011
|
+
return {
|
|
2012
|
+
"unit_kind": serialize_force_unit_kind(data.unit_kind),
|
|
2013
|
+
"value": None if data.value is None else serialize_f_64(data.value),
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
@dataclass
|
|
2017
|
+
class IOStateResponse:
|
|
2018
|
+
"""Response to a query for the current state of I/O."""
|
|
2019
|
+
state: Union[IOStateMap, None] = None
|
|
2020
|
+
|
|
2021
|
+
def validate_state(self, value: IOStateMap) -> Tuple[bool, str]:
|
|
2022
|
+
if value is None:
|
|
2023
|
+
return [True, ""]
|
|
2024
|
+
|
|
2025
|
+
if not (isinstance(value, dict) and all((isinstance(k, str) and isinstance(val, str)) for k, val in value.items())):
|
|
2026
|
+
return [False, "state must be of type IOStateMap for IOStateResponse, got " + type(value).__name__]
|
|
2027
|
+
|
|
2028
|
+
return [True, ""]
|
|
2029
|
+
|
|
2030
|
+
def __post_init__(self):
|
|
2031
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
2032
|
+
is_valid, error_str = self.validate_state(self.state)
|
|
2033
|
+
if not is_valid:
|
|
2034
|
+
raise TypeError(error_str)
|
|
2035
|
+
|
|
2036
|
+
def parse_io_state_response(data: object):
|
|
2037
|
+
return IOStateResponse(
|
|
2038
|
+
state=parse_io_state_map(data["state"]) if "state" in data else None,
|
|
2039
|
+
)
|
|
2040
|
+
|
|
2041
|
+
def serialize_io_state_response(data: IOStateResponse) -> object:
|
|
2042
|
+
return {
|
|
2043
|
+
"state": None if data.state is None else serialize_io_state_map(data.state),
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
@dataclass
|
|
2047
|
+
class IOStateUpdateRequest:
|
|
2048
|
+
"""Request to update the state of I/O for multiple ports."""
|
|
2049
|
+
state: Union[IOStateMap, None] = None
|
|
2050
|
+
|
|
2051
|
+
def validate_state(self, value: IOStateMap) -> Tuple[bool, str]:
|
|
2052
|
+
if value is None:
|
|
2053
|
+
return [True, ""]
|
|
2054
|
+
|
|
2055
|
+
if not (isinstance(value, dict) and all((isinstance(k, str) and isinstance(val, str)) for k, val in value.items())):
|
|
2056
|
+
return [False, "state must be of type IOStateMap for IOStateUpdateRequest, got " + type(value).__name__]
|
|
2057
|
+
|
|
2058
|
+
return [True, ""]
|
|
2059
|
+
|
|
2060
|
+
def __post_init__(self):
|
|
2061
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
2062
|
+
is_valid, error_str = self.validate_state(self.state)
|
|
2063
|
+
if not is_valid:
|
|
2064
|
+
raise TypeError(error_str)
|
|
2065
|
+
|
|
2066
|
+
def parse_io_state_update_request(data: object):
|
|
2067
|
+
return IOStateUpdateRequest(
|
|
2068
|
+
state=parse_io_state_map(data["state"]) if "state" in data else None,
|
|
2069
|
+
)
|
|
2070
|
+
|
|
2071
|
+
def serialize_io_state_update_request(data: IOStateUpdateRequest) -> object:
|
|
2072
|
+
return {
|
|
2073
|
+
"state": None if data.state is None else serialize_io_state_map(data.state),
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
@dataclass
|
|
2077
|
+
class ArmJointRotations:
|
|
2078
|
+
"""Rotational positions of arm joints"""
|
|
2079
|
+
joints: Union[JointRotations, None] = None
|
|
2080
|
+
|
|
2081
|
+
def validate_joints(self, value: JointRotations) -> Tuple[bool, str]:
|
|
2082
|
+
if value is None:
|
|
2083
|
+
return [False, "joints is required for ArmJointRotations"]
|
|
2084
|
+
|
|
2085
|
+
if not (isinstance(value, tuple) and len(value) == 6):
|
|
2086
|
+
return [False, "joints must be of type JointRotations for ArmJointRotations, got " + type(value).__name__]
|
|
2087
|
+
|
|
2088
|
+
return [True, ""]
|
|
2089
|
+
|
|
2090
|
+
def __post_init__(self):
|
|
2091
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
2092
|
+
is_valid, error_str = self.validate_joints(self.joints)
|
|
2093
|
+
if not is_valid:
|
|
2094
|
+
raise TypeError(error_str)
|
|
2095
|
+
|
|
2096
|
+
def parse_arm_joint_rotations(data: object):
|
|
2097
|
+
return ArmJointRotations(
|
|
2098
|
+
joints=parse_joint_rotations(data["joints"]) if "joints" in data else None,
|
|
2099
|
+
)
|
|
2100
|
+
|
|
2101
|
+
def serialize_arm_joint_rotations(data: ArmJointRotations) -> object:
|
|
2102
|
+
return {
|
|
2103
|
+
"joints": serialize_joint_rotations(data.joints),
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
@dataclass
|
|
2107
|
+
class LinearUnit:
|
|
2108
|
+
"""Reusable Abstraction for linear units (eg distance, position, offset)
|
|
2109
|
+
"""
|
|
2110
|
+
unit_kind: Union[LinearUnitKind, None] = None
|
|
2111
|
+
value: Union[float, None] = None
|
|
2112
|
+
|
|
2113
|
+
def validate_unit_kind(self, value: LinearUnitKind) -> Tuple[bool, str]:
|
|
2114
|
+
if value is None:
|
|
2115
|
+
return [False, "unit_kind is required for LinearUnit"]
|
|
2116
|
+
|
|
2117
|
+
if not ((isinstance(value, str) and LinearUnitKind in ['millimeters', 'centimeters', 'meters', 'inches', 'feet']) or isinstance(value, LinearUnitKind)):
|
|
2118
|
+
return [False, "unit_kind must be of type LinearUnitKind for LinearUnit, got " + type(value).__name__]
|
|
2119
|
+
|
|
2120
|
+
return [True, ""]
|
|
2121
|
+
|
|
2122
|
+
def validate_value(self, value: float) -> Tuple[bool, str]:
|
|
2123
|
+
if value is None:
|
|
2124
|
+
return [True, ""]
|
|
2125
|
+
|
|
2126
|
+
if not isinstance(value, float):
|
|
2127
|
+
return [False, "value must be of type float for LinearUnit, got " + type(value).__name__]
|
|
2128
|
+
|
|
2129
|
+
return [True, ""]
|
|
2130
|
+
|
|
2131
|
+
def __post_init__(self):
|
|
2132
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
2133
|
+
is_valid, error_str = self.validate_unit_kind(self.unit_kind)
|
|
2134
|
+
if not is_valid:
|
|
2135
|
+
raise TypeError(error_str)
|
|
2136
|
+
is_valid, error_str = self.validate_value(self.value)
|
|
2137
|
+
if not is_valid:
|
|
2138
|
+
raise TypeError(error_str)
|
|
2139
|
+
|
|
2140
|
+
def parse_linear_unit(data: object):
|
|
2141
|
+
return LinearUnit(
|
|
2142
|
+
unit_kind=parse_linear_unit_kind(data["unit_kind"]) if "unit_kind" in data else None,
|
|
2143
|
+
value=parse_f_64(data["value"]) if "value" in data else None,
|
|
2144
|
+
)
|
|
2145
|
+
|
|
2146
|
+
def serialize_linear_unit(data: LinearUnit) -> object:
|
|
2147
|
+
return {
|
|
2148
|
+
"unit_kind": serialize_linear_unit_kind(data.unit_kind),
|
|
2149
|
+
"value": None if data.value is None else serialize_f_64(data.value),
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
@dataclass
|
|
2153
|
+
class Position:
|
|
2154
|
+
"""Position of an object in 3D space. All empty values default to 0"""
|
|
2155
|
+
unit_kind: Union[LinearUnitKind, None] = None
|
|
2156
|
+
x: Union[float, None] = None
|
|
2157
|
+
y: Union[float, None] = None
|
|
2158
|
+
z: Union[float, None] = None
|
|
2159
|
+
|
|
2160
|
+
def validate_unit_kind(self, value: LinearUnitKind) -> Tuple[bool, str]:
|
|
2161
|
+
if value is None:
|
|
2162
|
+
return [True, ""]
|
|
2163
|
+
|
|
2164
|
+
if not ((isinstance(value, str) and LinearUnitKind in ['millimeters', 'centimeters', 'meters', 'inches', 'feet']) or isinstance(value, LinearUnitKind)):
|
|
2165
|
+
return [False, "unit_kind must be of type LinearUnitKind for Position, got " + type(value).__name__]
|
|
2166
|
+
|
|
2167
|
+
return [True, ""]
|
|
2168
|
+
|
|
2169
|
+
def validate_x(self, value: float) -> Tuple[bool, str]:
|
|
2170
|
+
if value is None:
|
|
2171
|
+
return [True, ""]
|
|
2172
|
+
|
|
2173
|
+
if not isinstance(value, float):
|
|
2174
|
+
return [False, "x must be of type float for Position, got " + type(value).__name__]
|
|
2175
|
+
|
|
2176
|
+
return [True, ""]
|
|
2177
|
+
|
|
2178
|
+
def validate_y(self, value: float) -> Tuple[bool, str]:
|
|
2179
|
+
if value is None:
|
|
2180
|
+
return [True, ""]
|
|
2181
|
+
|
|
2182
|
+
if not isinstance(value, float):
|
|
2183
|
+
return [False, "y must be of type float for Position, got " + type(value).__name__]
|
|
2184
|
+
|
|
2185
|
+
return [True, ""]
|
|
2186
|
+
|
|
2187
|
+
def validate_z(self, value: float) -> Tuple[bool, str]:
|
|
2188
|
+
if value is None:
|
|
2189
|
+
return [True, ""]
|
|
2190
|
+
|
|
2191
|
+
if not isinstance(value, float):
|
|
2192
|
+
return [False, "z must be of type float for Position, got " + type(value).__name__]
|
|
2193
|
+
|
|
2194
|
+
return [True, ""]
|
|
2195
|
+
|
|
2196
|
+
def __post_init__(self):
|
|
2197
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
2198
|
+
is_valid, error_str = self.validate_unit_kind(self.unit_kind)
|
|
2199
|
+
if not is_valid:
|
|
2200
|
+
raise TypeError(error_str)
|
|
2201
|
+
is_valid, error_str = self.validate_x(self.x)
|
|
2202
|
+
if not is_valid:
|
|
2203
|
+
raise TypeError(error_str)
|
|
2204
|
+
is_valid, error_str = self.validate_y(self.y)
|
|
2205
|
+
if not is_valid:
|
|
2206
|
+
raise TypeError(error_str)
|
|
2207
|
+
is_valid, error_str = self.validate_z(self.z)
|
|
2208
|
+
if not is_valid:
|
|
2209
|
+
raise TypeError(error_str)
|
|
2210
|
+
|
|
2211
|
+
def parse_position(data: object):
|
|
2212
|
+
return Position(
|
|
2213
|
+
unit_kind=parse_linear_unit_kind(data["unit_kind"]) if "unit_kind" in data else None,
|
|
2214
|
+
x=parse_f_64(data["x"]) if "x" in data else None,
|
|
2215
|
+
y=parse_f_64(data["y"]) if "y" in data else None,
|
|
2216
|
+
z=parse_f_64(data["z"]) if "z" in data else None,
|
|
2217
|
+
)
|
|
2218
|
+
|
|
2219
|
+
def serialize_position(data: Position) -> object:
|
|
2220
|
+
return {
|
|
2221
|
+
"unit_kind": None if data.unit_kind is None else serialize_linear_unit_kind(data.unit_kind),
|
|
2222
|
+
"x": None if data.x is None else serialize_f_64(data.x),
|
|
2223
|
+
"y": None if data.y is None else serialize_f_64(data.y),
|
|
2224
|
+
"z": None if data.z is None else serialize_f_64(data.z),
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
@dataclass
|
|
2228
|
+
class OnRobot2FG14GripperConfiguration:
|
|
2229
|
+
"""Configuration for OnRobot 2FG14 Gripper"""
|
|
2230
|
+
grip_kind: Union[OnRobotGripKindEnum, None] = None
|
|
2231
|
+
grip_detected: Union[bool, None] = None
|
|
2232
|
+
normalized_width_inner: Union[float, None] = None
|
|
2233
|
+
normalized_width_outer: Union[float, None] = None
|
|
2234
|
+
width_inner: Union[float, None] = None
|
|
2235
|
+
min_width_inner: Union[float, None] = None
|
|
2236
|
+
max_width_inner: Union[float, None] = None
|
|
2237
|
+
width_outer: Union[float, None] = None
|
|
2238
|
+
min_width_outer: Union[float, None] = None
|
|
2239
|
+
max_width_outer: Union[float, None] = None
|
|
2240
|
+
force: Union[float, None] = None
|
|
2241
|
+
max_force: Union[float, None] = None
|
|
2242
|
+
finger_mounting_position: Union[str, None] = None
|
|
2243
|
+
finger_offset: Union[float, None] = None
|
|
2244
|
+
finger_angle: Union[float, None] = None
|
|
2245
|
+
finger_length: Union[float, None] = None
|
|
2246
|
+
finger_height: Union[float, None] = None
|
|
2247
|
+
linear_sensor_error: Union[bool, None] = None
|
|
2248
|
+
uncalibrated_error: Union[bool, None] = None
|
|
2249
|
+
|
|
2250
|
+
def validate_grip_kind(self, value: OnRobotGripKindEnum) -> Tuple[bool, str]:
|
|
2251
|
+
if value is None:
|
|
2252
|
+
return [True, ""]
|
|
2253
|
+
|
|
2254
|
+
if not ((isinstance(value, str) and OnRobotGripKindEnum in ['inward', 'outward']) or isinstance(value, OnRobotGripKindEnum)):
|
|
2255
|
+
return [False, "grip_kind must be of type OnRobotGripKindEnum for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2256
|
+
|
|
2257
|
+
return [True, ""]
|
|
2258
|
+
|
|
2259
|
+
def validate_grip_detected(self, value: bool) -> Tuple[bool, str]:
|
|
2260
|
+
if value is None:
|
|
2261
|
+
return [True, ""]
|
|
2262
|
+
|
|
2263
|
+
if not isinstance(value, bool):
|
|
2264
|
+
return [False, "grip_detected must be of type bool for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2265
|
+
|
|
2266
|
+
return [True, ""]
|
|
2267
|
+
|
|
2268
|
+
def validate_normalized_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2269
|
+
if value is None:
|
|
2270
|
+
return [True, ""]
|
|
2271
|
+
|
|
2272
|
+
if not isinstance(value, float):
|
|
2273
|
+
return [False, "normalized_width_inner must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2274
|
+
|
|
2275
|
+
return [True, ""]
|
|
2276
|
+
|
|
2277
|
+
def validate_normalized_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2278
|
+
if value is None:
|
|
2279
|
+
return [True, ""]
|
|
2280
|
+
|
|
2281
|
+
if not isinstance(value, float):
|
|
2282
|
+
return [False, "normalized_width_outer must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2283
|
+
|
|
2284
|
+
return [True, ""]
|
|
2285
|
+
|
|
2286
|
+
def validate_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2287
|
+
if value is None:
|
|
2288
|
+
return [True, ""]
|
|
2289
|
+
|
|
2290
|
+
if not isinstance(value, float):
|
|
2291
|
+
return [False, "width_inner must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2292
|
+
|
|
2293
|
+
return [True, ""]
|
|
2294
|
+
|
|
2295
|
+
def validate_min_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2296
|
+
if value is None:
|
|
2297
|
+
return [True, ""]
|
|
2298
|
+
|
|
2299
|
+
if not isinstance(value, float):
|
|
2300
|
+
return [False, "min_width_inner must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2301
|
+
|
|
2302
|
+
return [True, ""]
|
|
2303
|
+
|
|
2304
|
+
def validate_max_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2305
|
+
if value is None:
|
|
2306
|
+
return [True, ""]
|
|
2307
|
+
|
|
2308
|
+
if not isinstance(value, float):
|
|
2309
|
+
return [False, "max_width_inner must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2310
|
+
|
|
2311
|
+
return [True, ""]
|
|
2312
|
+
|
|
2313
|
+
def validate_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2314
|
+
if value is None:
|
|
2315
|
+
return [True, ""]
|
|
2316
|
+
|
|
2317
|
+
if not isinstance(value, float):
|
|
2318
|
+
return [False, "width_outer must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2319
|
+
|
|
2320
|
+
return [True, ""]
|
|
2321
|
+
|
|
2322
|
+
def validate_min_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2323
|
+
if value is None:
|
|
2324
|
+
return [True, ""]
|
|
2325
|
+
|
|
2326
|
+
if not isinstance(value, float):
|
|
2327
|
+
return [False, "min_width_outer must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2328
|
+
|
|
2329
|
+
return [True, ""]
|
|
2330
|
+
|
|
2331
|
+
def validate_max_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2332
|
+
if value is None:
|
|
2333
|
+
return [True, ""]
|
|
2334
|
+
|
|
2335
|
+
if not isinstance(value, float):
|
|
2336
|
+
return [False, "max_width_outer must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2337
|
+
|
|
2338
|
+
return [True, ""]
|
|
2339
|
+
|
|
2340
|
+
def validate_force(self, value: float) -> Tuple[bool, str]:
|
|
2341
|
+
if value is None:
|
|
2342
|
+
return [True, ""]
|
|
2343
|
+
|
|
2344
|
+
if not isinstance(value, float):
|
|
2345
|
+
return [False, "force must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2346
|
+
|
|
2347
|
+
return [True, ""]
|
|
2348
|
+
|
|
2349
|
+
def validate_max_force(self, value: float) -> Tuple[bool, str]:
|
|
2350
|
+
if value is None:
|
|
2351
|
+
return [True, ""]
|
|
2352
|
+
|
|
2353
|
+
if not isinstance(value, float):
|
|
2354
|
+
return [False, "max_force must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2355
|
+
|
|
2356
|
+
return [True, ""]
|
|
2357
|
+
|
|
2358
|
+
def validate_finger_mounting_position(self, value: str) -> Tuple[bool, str]:
|
|
2359
|
+
if value is None:
|
|
2360
|
+
return [True, ""]
|
|
2361
|
+
|
|
2362
|
+
if not isinstance(value, str):
|
|
2363
|
+
return [False, "finger_mounting_position must be of type str for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2364
|
+
|
|
2365
|
+
return [True, ""]
|
|
2366
|
+
|
|
2367
|
+
def validate_finger_offset(self, value: float) -> Tuple[bool, str]:
|
|
2368
|
+
if value is None:
|
|
2369
|
+
return [True, ""]
|
|
2370
|
+
|
|
2371
|
+
if not isinstance(value, float):
|
|
2372
|
+
return [False, "finger_offset must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2373
|
+
|
|
2374
|
+
return [True, ""]
|
|
2375
|
+
|
|
2376
|
+
def validate_finger_angle(self, value: float) -> Tuple[bool, str]:
|
|
2377
|
+
if value is None:
|
|
2378
|
+
return [True, ""]
|
|
2379
|
+
|
|
2380
|
+
if not isinstance(value, float):
|
|
2381
|
+
return [False, "finger_angle must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2382
|
+
|
|
2383
|
+
return [True, ""]
|
|
2384
|
+
|
|
2385
|
+
def validate_finger_length(self, value: float) -> Tuple[bool, str]:
|
|
2386
|
+
if value is None:
|
|
2387
|
+
return [True, ""]
|
|
2388
|
+
|
|
2389
|
+
if not isinstance(value, float):
|
|
2390
|
+
return [False, "finger_length must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2391
|
+
|
|
2392
|
+
return [True, ""]
|
|
2393
|
+
|
|
2394
|
+
def validate_finger_height(self, value: float) -> Tuple[bool, str]:
|
|
2395
|
+
if value is None:
|
|
2396
|
+
return [True, ""]
|
|
2397
|
+
|
|
2398
|
+
if not isinstance(value, float):
|
|
2399
|
+
return [False, "finger_height must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2400
|
+
|
|
2401
|
+
return [True, ""]
|
|
2402
|
+
|
|
2403
|
+
def validate_linear_sensor_error(self, value: bool) -> Tuple[bool, str]:
|
|
2404
|
+
if value is None:
|
|
2405
|
+
return [True, ""]
|
|
2406
|
+
|
|
2407
|
+
if not isinstance(value, bool):
|
|
2408
|
+
return [False, "linear_sensor_error must be of type bool for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2409
|
+
|
|
2410
|
+
return [True, ""]
|
|
2411
|
+
|
|
2412
|
+
def validate_uncalibrated_error(self, value: bool) -> Tuple[bool, str]:
|
|
2413
|
+
if value is None:
|
|
2414
|
+
return [True, ""]
|
|
2415
|
+
|
|
2416
|
+
if not isinstance(value, bool):
|
|
2417
|
+
return [False, "uncalibrated_error must be of type bool for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2418
|
+
|
|
2419
|
+
return [True, ""]
|
|
2420
|
+
|
|
2421
|
+
def __post_init__(self):
|
|
2422
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
2423
|
+
is_valid, error_str = self.validate_grip_kind(self.grip_kind)
|
|
2424
|
+
if not is_valid:
|
|
2425
|
+
raise TypeError(error_str)
|
|
2426
|
+
is_valid, error_str = self.validate_grip_detected(self.grip_detected)
|
|
2427
|
+
if not is_valid:
|
|
2428
|
+
raise TypeError(error_str)
|
|
2429
|
+
is_valid, error_str = self.validate_normalized_width_inner(self.normalized_width_inner)
|
|
2430
|
+
if not is_valid:
|
|
2431
|
+
raise TypeError(error_str)
|
|
2432
|
+
is_valid, error_str = self.validate_normalized_width_outer(self.normalized_width_outer)
|
|
2433
|
+
if not is_valid:
|
|
2434
|
+
raise TypeError(error_str)
|
|
2435
|
+
is_valid, error_str = self.validate_width_inner(self.width_inner)
|
|
2436
|
+
if not is_valid:
|
|
2437
|
+
raise TypeError(error_str)
|
|
2438
|
+
is_valid, error_str = self.validate_min_width_inner(self.min_width_inner)
|
|
2439
|
+
if not is_valid:
|
|
2440
|
+
raise TypeError(error_str)
|
|
2441
|
+
is_valid, error_str = self.validate_max_width_inner(self.max_width_inner)
|
|
2442
|
+
if not is_valid:
|
|
2443
|
+
raise TypeError(error_str)
|
|
2444
|
+
is_valid, error_str = self.validate_width_outer(self.width_outer)
|
|
2445
|
+
if not is_valid:
|
|
2446
|
+
raise TypeError(error_str)
|
|
2447
|
+
is_valid, error_str = self.validate_min_width_outer(self.min_width_outer)
|
|
2448
|
+
if not is_valid:
|
|
2449
|
+
raise TypeError(error_str)
|
|
2450
|
+
is_valid, error_str = self.validate_max_width_outer(self.max_width_outer)
|
|
2451
|
+
if not is_valid:
|
|
2452
|
+
raise TypeError(error_str)
|
|
2453
|
+
is_valid, error_str = self.validate_force(self.force)
|
|
2454
|
+
if not is_valid:
|
|
2455
|
+
raise TypeError(error_str)
|
|
2456
|
+
is_valid, error_str = self.validate_max_force(self.max_force)
|
|
2457
|
+
if not is_valid:
|
|
2458
|
+
raise TypeError(error_str)
|
|
2459
|
+
is_valid, error_str = self.validate_finger_mounting_position(self.finger_mounting_position)
|
|
2460
|
+
if not is_valid:
|
|
2461
|
+
raise TypeError(error_str)
|
|
2462
|
+
is_valid, error_str = self.validate_finger_offset(self.finger_offset)
|
|
2463
|
+
if not is_valid:
|
|
2464
|
+
raise TypeError(error_str)
|
|
2465
|
+
is_valid, error_str = self.validate_finger_angle(self.finger_angle)
|
|
2466
|
+
if not is_valid:
|
|
2467
|
+
raise TypeError(error_str)
|
|
2468
|
+
is_valid, error_str = self.validate_finger_length(self.finger_length)
|
|
2469
|
+
if not is_valid:
|
|
2470
|
+
raise TypeError(error_str)
|
|
2471
|
+
is_valid, error_str = self.validate_finger_height(self.finger_height)
|
|
2472
|
+
if not is_valid:
|
|
2473
|
+
raise TypeError(error_str)
|
|
2474
|
+
is_valid, error_str = self.validate_linear_sensor_error(self.linear_sensor_error)
|
|
2475
|
+
if not is_valid:
|
|
2476
|
+
raise TypeError(error_str)
|
|
2477
|
+
is_valid, error_str = self.validate_uncalibrated_error(self.uncalibrated_error)
|
|
2478
|
+
if not is_valid:
|
|
2479
|
+
raise TypeError(error_str)
|
|
2480
|
+
|
|
2481
|
+
def parse_on_robot_2_fg_14_gripper_configuration(data: object):
|
|
2482
|
+
return OnRobot2FG14GripperConfiguration(
|
|
2483
|
+
grip_kind=parse_on_robot_grip_kind_enum(data["grip_kind"]) if "grip_kind" in data else None,
|
|
2484
|
+
grip_detected=parse_bool(data["grip_detected"]) if "grip_detected" in data else None,
|
|
2485
|
+
normalized_width_inner=parse_f_64(data["normalized_width_inner"]) if "normalized_width_inner" in data else None,
|
|
2486
|
+
normalized_width_outer=parse_f_64(data["normalized_width_outer"]) if "normalized_width_outer" in data else None,
|
|
2487
|
+
width_inner=parse_f_64(data["width_inner"]) if "width_inner" in data else None,
|
|
2488
|
+
min_width_inner=parse_f_64(data["min_width_inner"]) if "min_width_inner" in data else None,
|
|
2489
|
+
max_width_inner=parse_f_64(data["max_width_inner"]) if "max_width_inner" in data else None,
|
|
2490
|
+
width_outer=parse_f_64(data["width_outer"]) if "width_outer" in data else None,
|
|
2491
|
+
min_width_outer=parse_f_64(data["min_width_outer"]) if "min_width_outer" in data else None,
|
|
2492
|
+
max_width_outer=parse_f_64(data["max_width_outer"]) if "max_width_outer" in data else None,
|
|
2493
|
+
force=parse_f_64(data["force"]) if "force" in data else None,
|
|
2494
|
+
max_force=parse_f_64(data["max_force"]) if "max_force" in data else None,
|
|
2495
|
+
finger_mounting_position=parse_str(data["finger_mounting_position"]) if "finger_mounting_position" in data else None,
|
|
2496
|
+
finger_offset=parse_f_64(data["finger_offset"]) if "finger_offset" in data else None,
|
|
2497
|
+
finger_angle=parse_f_64(data["finger_angle"]) if "finger_angle" in data else None,
|
|
2498
|
+
finger_length=parse_f_64(data["finger_length"]) if "finger_length" in data else None,
|
|
2499
|
+
finger_height=parse_f_64(data["finger_height"]) if "finger_height" in data else None,
|
|
2500
|
+
linear_sensor_error=parse_bool(data["linear_sensor_error"]) if "linear_sensor_error" in data else None,
|
|
2501
|
+
uncalibrated_error=parse_bool(data["uncalibrated_error"]) if "uncalibrated_error" in data else None,
|
|
2502
|
+
)
|
|
2503
|
+
|
|
2504
|
+
def serialize_on_robot_2_fg_14_gripper_configuration(data: OnRobot2FG14GripperConfiguration) -> object:
|
|
2505
|
+
return {
|
|
2506
|
+
"grip_kind": None if data.grip_kind is None else serialize_on_robot_grip_kind_enum(data.grip_kind),
|
|
2507
|
+
"grip_detected": None if data.grip_detected is None else serialize_bool(data.grip_detected),
|
|
2508
|
+
"normalized_width_inner": None if data.normalized_width_inner is None else serialize_f_64(data.normalized_width_inner),
|
|
2509
|
+
"normalized_width_outer": None if data.normalized_width_outer is None else serialize_f_64(data.normalized_width_outer),
|
|
2510
|
+
"width_inner": None if data.width_inner is None else serialize_f_64(data.width_inner),
|
|
2511
|
+
"min_width_inner": None if data.min_width_inner is None else serialize_f_64(data.min_width_inner),
|
|
2512
|
+
"max_width_inner": None if data.max_width_inner is None else serialize_f_64(data.max_width_inner),
|
|
2513
|
+
"width_outer": None if data.width_outer is None else serialize_f_64(data.width_outer),
|
|
2514
|
+
"min_width_outer": None if data.min_width_outer is None else serialize_f_64(data.min_width_outer),
|
|
2515
|
+
"max_width_outer": None if data.max_width_outer is None else serialize_f_64(data.max_width_outer),
|
|
2516
|
+
"force": None if data.force is None else serialize_f_64(data.force),
|
|
2517
|
+
"max_force": None if data.max_force is None else serialize_f_64(data.max_force),
|
|
2518
|
+
"finger_mounting_position": None if data.finger_mounting_position is None else serialize_str(data.finger_mounting_position),
|
|
2519
|
+
"finger_offset": None if data.finger_offset is None else serialize_f_64(data.finger_offset),
|
|
2520
|
+
"finger_angle": None if data.finger_angle is None else serialize_f_64(data.finger_angle),
|
|
2521
|
+
"finger_length": None if data.finger_length is None else serialize_f_64(data.finger_length),
|
|
2522
|
+
"finger_height": None if data.finger_height is None else serialize_f_64(data.finger_height),
|
|
2523
|
+
"linear_sensor_error": None if data.linear_sensor_error is None else serialize_bool(data.linear_sensor_error),
|
|
2524
|
+
"uncalibrated_error": None if data.uncalibrated_error is None else serialize_bool(data.uncalibrated_error),
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2527
|
+
@dataclass
|
|
2528
|
+
class OnRobot2FG7GripperConfiguration:
|
|
2529
|
+
"""Configuration for OnRobot 2FG7 Gripper"""
|
|
2530
|
+
grip_kind: Union[OnRobotGripKindEnum, None] = None
|
|
2531
|
+
grip_detected: Union[bool, None] = None
|
|
2532
|
+
normalized_width_inner: Union[float, None] = None
|
|
2533
|
+
normalized_width_outer: Union[float, None] = None
|
|
2534
|
+
width_inner: Union[float, None] = None
|
|
2535
|
+
min_width_inner: Union[float, None] = None
|
|
2536
|
+
max_width_inner: Union[float, None] = None
|
|
2537
|
+
width_outer: Union[float, None] = None
|
|
2538
|
+
min_width_outer: Union[float, None] = None
|
|
2539
|
+
max_width_outer: Union[float, None] = None
|
|
2540
|
+
force: Union[float, None] = None
|
|
2541
|
+
max_force: Union[float, None] = None
|
|
2542
|
+
finger_mounting_position: Union[str, None] = None
|
|
2543
|
+
finger_offset: Union[float, None] = None
|
|
2544
|
+
finger_angle: Union[float, None] = None
|
|
2545
|
+
finger_length: Union[float, None] = None
|
|
2546
|
+
finger_height: Union[float, None] = None
|
|
2547
|
+
linear_sensor_error: Union[bool, None] = None
|
|
2548
|
+
uncalibrated_error: Union[bool, None] = None
|
|
2549
|
+
|
|
2550
|
+
def validate_grip_kind(self, value: OnRobotGripKindEnum) -> Tuple[bool, str]:
|
|
2551
|
+
if value is None:
|
|
2552
|
+
return [True, ""]
|
|
2553
|
+
|
|
2554
|
+
if not ((isinstance(value, str) and OnRobotGripKindEnum in ['inward', 'outward']) or isinstance(value, OnRobotGripKindEnum)):
|
|
2555
|
+
return [False, "grip_kind must be of type OnRobotGripKindEnum for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2556
|
+
|
|
2557
|
+
return [True, ""]
|
|
2558
|
+
|
|
2559
|
+
def validate_grip_detected(self, value: bool) -> Tuple[bool, str]:
|
|
2560
|
+
if value is None:
|
|
2561
|
+
return [True, ""]
|
|
2562
|
+
|
|
2563
|
+
if not isinstance(value, bool):
|
|
2564
|
+
return [False, "grip_detected must be of type bool for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2565
|
+
|
|
2566
|
+
return [True, ""]
|
|
2567
|
+
|
|
2568
|
+
def validate_normalized_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2569
|
+
if value is None:
|
|
2570
|
+
return [True, ""]
|
|
2571
|
+
|
|
2572
|
+
if not isinstance(value, float):
|
|
2573
|
+
return [False, "normalized_width_inner must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2574
|
+
|
|
2575
|
+
return [True, ""]
|
|
2576
|
+
|
|
2577
|
+
def validate_normalized_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2578
|
+
if value is None:
|
|
2579
|
+
return [True, ""]
|
|
2580
|
+
|
|
2581
|
+
if not isinstance(value, float):
|
|
2582
|
+
return [False, "normalized_width_outer must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2583
|
+
|
|
2584
|
+
return [True, ""]
|
|
2585
|
+
|
|
2586
|
+
def validate_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2587
|
+
if value is None:
|
|
2588
|
+
return [True, ""]
|
|
2589
|
+
|
|
2590
|
+
if not isinstance(value, float):
|
|
2591
|
+
return [False, "width_inner must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2592
|
+
|
|
2593
|
+
return [True, ""]
|
|
2594
|
+
|
|
2595
|
+
def validate_min_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2596
|
+
if value is None:
|
|
2597
|
+
return [True, ""]
|
|
2598
|
+
|
|
2599
|
+
if not isinstance(value, float):
|
|
2600
|
+
return [False, "min_width_inner must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2601
|
+
|
|
2602
|
+
return [True, ""]
|
|
2603
|
+
|
|
2604
|
+
def validate_max_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2605
|
+
if value is None:
|
|
2606
|
+
return [True, ""]
|
|
2607
|
+
|
|
2608
|
+
if not isinstance(value, float):
|
|
2609
|
+
return [False, "max_width_inner must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2610
|
+
|
|
2611
|
+
return [True, ""]
|
|
2612
|
+
|
|
2613
|
+
def validate_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2614
|
+
if value is None:
|
|
2615
|
+
return [True, ""]
|
|
2616
|
+
|
|
2617
|
+
if not isinstance(value, float):
|
|
2618
|
+
return [False, "width_outer must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2619
|
+
|
|
2620
|
+
return [True, ""]
|
|
2621
|
+
|
|
2622
|
+
def validate_min_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2623
|
+
if value is None:
|
|
2624
|
+
return [True, ""]
|
|
2625
|
+
|
|
2626
|
+
if not isinstance(value, float):
|
|
2627
|
+
return [False, "min_width_outer must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2628
|
+
|
|
2629
|
+
return [True, ""]
|
|
2630
|
+
|
|
2631
|
+
def validate_max_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2632
|
+
if value is None:
|
|
2633
|
+
return [True, ""]
|
|
2634
|
+
|
|
2635
|
+
if not isinstance(value, float):
|
|
2636
|
+
return [False, "max_width_outer must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2637
|
+
|
|
2638
|
+
return [True, ""]
|
|
2639
|
+
|
|
2640
|
+
def validate_force(self, value: float) -> Tuple[bool, str]:
|
|
2641
|
+
if value is None:
|
|
2642
|
+
return [True, ""]
|
|
2643
|
+
|
|
2644
|
+
if not isinstance(value, float):
|
|
2645
|
+
return [False, "force must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2646
|
+
|
|
2647
|
+
return [True, ""]
|
|
2648
|
+
|
|
2649
|
+
def validate_max_force(self, value: float) -> Tuple[bool, str]:
|
|
2650
|
+
if value is None:
|
|
2651
|
+
return [True, ""]
|
|
2652
|
+
|
|
2653
|
+
if not isinstance(value, float):
|
|
2654
|
+
return [False, "max_force must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2655
|
+
|
|
2656
|
+
return [True, ""]
|
|
2657
|
+
|
|
2658
|
+
def validate_finger_mounting_position(self, value: str) -> Tuple[bool, str]:
|
|
2659
|
+
if value is None:
|
|
2660
|
+
return [True, ""]
|
|
2661
|
+
|
|
2662
|
+
if not isinstance(value, str):
|
|
2663
|
+
return [False, "finger_mounting_position must be of type str for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2664
|
+
|
|
2665
|
+
return [True, ""]
|
|
2666
|
+
|
|
2667
|
+
def validate_finger_offset(self, value: float) -> Tuple[bool, str]:
|
|
2668
|
+
if value is None:
|
|
2669
|
+
return [True, ""]
|
|
2670
|
+
|
|
2671
|
+
if not isinstance(value, float):
|
|
2672
|
+
return [False, "finger_offset must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2673
|
+
|
|
2674
|
+
return [True, ""]
|
|
2675
|
+
|
|
2676
|
+
def validate_finger_angle(self, value: float) -> Tuple[bool, str]:
|
|
2677
|
+
if value is None:
|
|
2678
|
+
return [True, ""]
|
|
2679
|
+
|
|
2680
|
+
if not isinstance(value, float):
|
|
2681
|
+
return [False, "finger_angle must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2682
|
+
|
|
2683
|
+
return [True, ""]
|
|
2684
|
+
|
|
2685
|
+
def validate_finger_length(self, value: float) -> Tuple[bool, str]:
|
|
2686
|
+
if value is None:
|
|
2687
|
+
return [True, ""]
|
|
2688
|
+
|
|
2689
|
+
if not isinstance(value, float):
|
|
2690
|
+
return [False, "finger_length must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2691
|
+
|
|
2692
|
+
return [True, ""]
|
|
2693
|
+
|
|
2694
|
+
def validate_finger_height(self, value: float) -> Tuple[bool, str]:
|
|
2695
|
+
if value is None:
|
|
2696
|
+
return [True, ""]
|
|
2697
|
+
|
|
2698
|
+
if not isinstance(value, float):
|
|
2699
|
+
return [False, "finger_height must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2700
|
+
|
|
2701
|
+
return [True, ""]
|
|
2702
|
+
|
|
2703
|
+
def validate_linear_sensor_error(self, value: bool) -> Tuple[bool, str]:
|
|
2704
|
+
if value is None:
|
|
2705
|
+
return [True, ""]
|
|
2706
|
+
|
|
2707
|
+
if not isinstance(value, bool):
|
|
2708
|
+
return [False, "linear_sensor_error must be of type bool for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2709
|
+
|
|
2710
|
+
return [True, ""]
|
|
2711
|
+
|
|
2712
|
+
def validate_uncalibrated_error(self, value: bool) -> Tuple[bool, str]:
|
|
2713
|
+
if value is None:
|
|
2714
|
+
return [True, ""]
|
|
876
2715
|
|
|
877
|
-
if not isinstance(value,
|
|
878
|
-
return [False, "
|
|
2716
|
+
if not isinstance(value, bool):
|
|
2717
|
+
return [False, "uncalibrated_error must be of type bool for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
879
2718
|
|
|
880
2719
|
return [True, ""]
|
|
881
2720
|
|
|
882
2721
|
def __post_init__(self):
|
|
883
2722
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
884
|
-
is_valid, error_str = self.
|
|
2723
|
+
is_valid, error_str = self.validate_grip_kind(self.grip_kind)
|
|
885
2724
|
if not is_valid:
|
|
886
2725
|
raise TypeError(error_str)
|
|
887
|
-
is_valid, error_str = self.
|
|
2726
|
+
is_valid, error_str = self.validate_grip_detected(self.grip_detected)
|
|
2727
|
+
if not is_valid:
|
|
2728
|
+
raise TypeError(error_str)
|
|
2729
|
+
is_valid, error_str = self.validate_normalized_width_inner(self.normalized_width_inner)
|
|
2730
|
+
if not is_valid:
|
|
2731
|
+
raise TypeError(error_str)
|
|
2732
|
+
is_valid, error_str = self.validate_normalized_width_outer(self.normalized_width_outer)
|
|
2733
|
+
if not is_valid:
|
|
2734
|
+
raise TypeError(error_str)
|
|
2735
|
+
is_valid, error_str = self.validate_width_inner(self.width_inner)
|
|
2736
|
+
if not is_valid:
|
|
2737
|
+
raise TypeError(error_str)
|
|
2738
|
+
is_valid, error_str = self.validate_min_width_inner(self.min_width_inner)
|
|
2739
|
+
if not is_valid:
|
|
2740
|
+
raise TypeError(error_str)
|
|
2741
|
+
is_valid, error_str = self.validate_max_width_inner(self.max_width_inner)
|
|
2742
|
+
if not is_valid:
|
|
2743
|
+
raise TypeError(error_str)
|
|
2744
|
+
is_valid, error_str = self.validate_width_outer(self.width_outer)
|
|
2745
|
+
if not is_valid:
|
|
2746
|
+
raise TypeError(error_str)
|
|
2747
|
+
is_valid, error_str = self.validate_min_width_outer(self.min_width_outer)
|
|
2748
|
+
if not is_valid:
|
|
2749
|
+
raise TypeError(error_str)
|
|
2750
|
+
is_valid, error_str = self.validate_max_width_outer(self.max_width_outer)
|
|
2751
|
+
if not is_valid:
|
|
2752
|
+
raise TypeError(error_str)
|
|
2753
|
+
is_valid, error_str = self.validate_force(self.force)
|
|
2754
|
+
if not is_valid:
|
|
2755
|
+
raise TypeError(error_str)
|
|
2756
|
+
is_valid, error_str = self.validate_max_force(self.max_force)
|
|
2757
|
+
if not is_valid:
|
|
2758
|
+
raise TypeError(error_str)
|
|
2759
|
+
is_valid, error_str = self.validate_finger_mounting_position(self.finger_mounting_position)
|
|
2760
|
+
if not is_valid:
|
|
2761
|
+
raise TypeError(error_str)
|
|
2762
|
+
is_valid, error_str = self.validate_finger_offset(self.finger_offset)
|
|
2763
|
+
if not is_valid:
|
|
2764
|
+
raise TypeError(error_str)
|
|
2765
|
+
is_valid, error_str = self.validate_finger_angle(self.finger_angle)
|
|
2766
|
+
if not is_valid:
|
|
2767
|
+
raise TypeError(error_str)
|
|
2768
|
+
is_valid, error_str = self.validate_finger_length(self.finger_length)
|
|
2769
|
+
if not is_valid:
|
|
2770
|
+
raise TypeError(error_str)
|
|
2771
|
+
is_valid, error_str = self.validate_finger_height(self.finger_height)
|
|
2772
|
+
if not is_valid:
|
|
2773
|
+
raise TypeError(error_str)
|
|
2774
|
+
is_valid, error_str = self.validate_linear_sensor_error(self.linear_sensor_error)
|
|
2775
|
+
if not is_valid:
|
|
2776
|
+
raise TypeError(error_str)
|
|
2777
|
+
is_valid, error_str = self.validate_uncalibrated_error(self.uncalibrated_error)
|
|
888
2778
|
if not is_valid:
|
|
889
2779
|
raise TypeError(error_str)
|
|
890
2780
|
|
|
891
|
-
def
|
|
892
|
-
return
|
|
893
|
-
|
|
894
|
-
|
|
2781
|
+
def parse_on_robot_2_fg_7_gripper_configuration(data: object):
|
|
2782
|
+
return OnRobot2FG7GripperConfiguration(
|
|
2783
|
+
grip_kind=parse_on_robot_grip_kind_enum(data["grip_kind"]) if "grip_kind" in data else None,
|
|
2784
|
+
grip_detected=parse_bool(data["grip_detected"]) if "grip_detected" in data else None,
|
|
2785
|
+
normalized_width_inner=parse_f_64(data["normalized_width_inner"]) if "normalized_width_inner" in data else None,
|
|
2786
|
+
normalized_width_outer=parse_f_64(data["normalized_width_outer"]) if "normalized_width_outer" in data else None,
|
|
2787
|
+
width_inner=parse_f_64(data["width_inner"]) if "width_inner" in data else None,
|
|
2788
|
+
min_width_inner=parse_f_64(data["min_width_inner"]) if "min_width_inner" in data else None,
|
|
2789
|
+
max_width_inner=parse_f_64(data["max_width_inner"]) if "max_width_inner" in data else None,
|
|
2790
|
+
width_outer=parse_f_64(data["width_outer"]) if "width_outer" in data else None,
|
|
2791
|
+
min_width_outer=parse_f_64(data["min_width_outer"]) if "min_width_outer" in data else None,
|
|
2792
|
+
max_width_outer=parse_f_64(data["max_width_outer"]) if "max_width_outer" in data else None,
|
|
2793
|
+
force=parse_f_64(data["force"]) if "force" in data else None,
|
|
2794
|
+
max_force=parse_f_64(data["max_force"]) if "max_force" in data else None,
|
|
2795
|
+
finger_mounting_position=parse_str(data["finger_mounting_position"]) if "finger_mounting_position" in data else None,
|
|
2796
|
+
finger_offset=parse_f_64(data["finger_offset"]) if "finger_offset" in data else None,
|
|
2797
|
+
finger_angle=parse_f_64(data["finger_angle"]) if "finger_angle" in data else None,
|
|
2798
|
+
finger_length=parse_f_64(data["finger_length"]) if "finger_length" in data else None,
|
|
2799
|
+
finger_height=parse_f_64(data["finger_height"]) if "finger_height" in data else None,
|
|
2800
|
+
linear_sensor_error=parse_bool(data["linear_sensor_error"]) if "linear_sensor_error" in data else None,
|
|
2801
|
+
uncalibrated_error=parse_bool(data["uncalibrated_error"]) if "uncalibrated_error" in data else None,
|
|
895
2802
|
)
|
|
896
2803
|
|
|
897
|
-
def
|
|
2804
|
+
def serialize_on_robot_2_fg_7_gripper_configuration(data: OnRobot2FG7GripperConfiguration) -> object:
|
|
898
2805
|
return {
|
|
899
|
-
"
|
|
900
|
-
"
|
|
2806
|
+
"grip_kind": None if data.grip_kind is None else serialize_on_robot_grip_kind_enum(data.grip_kind),
|
|
2807
|
+
"grip_detected": None if data.grip_detected is None else serialize_bool(data.grip_detected),
|
|
2808
|
+
"normalized_width_inner": None if data.normalized_width_inner is None else serialize_f_64(data.normalized_width_inner),
|
|
2809
|
+
"normalized_width_outer": None if data.normalized_width_outer is None else serialize_f_64(data.normalized_width_outer),
|
|
2810
|
+
"width_inner": None if data.width_inner is None else serialize_f_64(data.width_inner),
|
|
2811
|
+
"min_width_inner": None if data.min_width_inner is None else serialize_f_64(data.min_width_inner),
|
|
2812
|
+
"max_width_inner": None if data.max_width_inner is None else serialize_f_64(data.max_width_inner),
|
|
2813
|
+
"width_outer": None if data.width_outer is None else serialize_f_64(data.width_outer),
|
|
2814
|
+
"min_width_outer": None if data.min_width_outer is None else serialize_f_64(data.min_width_outer),
|
|
2815
|
+
"max_width_outer": None if data.max_width_outer is None else serialize_f_64(data.max_width_outer),
|
|
2816
|
+
"force": None if data.force is None else serialize_f_64(data.force),
|
|
2817
|
+
"max_force": None if data.max_force is None else serialize_f_64(data.max_force),
|
|
2818
|
+
"finger_mounting_position": None if data.finger_mounting_position is None else serialize_str(data.finger_mounting_position),
|
|
2819
|
+
"finger_offset": None if data.finger_offset is None else serialize_f_64(data.finger_offset),
|
|
2820
|
+
"finger_angle": None if data.finger_angle is None else serialize_f_64(data.finger_angle),
|
|
2821
|
+
"finger_length": None if data.finger_length is None else serialize_f_64(data.finger_length),
|
|
2822
|
+
"finger_height": None if data.finger_height is None else serialize_f_64(data.finger_height),
|
|
2823
|
+
"linear_sensor_error": None if data.linear_sensor_error is None else serialize_bool(data.linear_sensor_error),
|
|
2824
|
+
"uncalibrated_error": None if data.uncalibrated_error is None else serialize_bool(data.uncalibrated_error),
|
|
901
2825
|
}
|
|
902
2826
|
|
|
903
2827
|
@dataclass
|
|
904
|
-
class
|
|
905
|
-
"""
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
2828
|
+
class OnRobot3FG15GripperConfiguration:
|
|
2829
|
+
"""Configuration for OnRobot 3FG15 Gripper"""
|
|
2830
|
+
grip_detected: Union[bool, None] = None
|
|
2831
|
+
force_grip_detected: Union[bool, None] = None
|
|
2832
|
+
calibration_ok: Union[bool, None] = None
|
|
2833
|
+
diameter: Union[float, None] = None
|
|
2834
|
+
grip_kind: Union[OnRobotGripKindEnum, None] = None
|
|
2835
|
+
finger_angle: Union[float, None] = None
|
|
2836
|
+
force_applied_fraction: Union[float, None] = None
|
|
2837
|
+
force_applied_newtons: Union[float, None] = None
|
|
2838
|
+
target_force_newtons: Union[float, None] = None
|
|
2839
|
+
finger_length: Union[float, None] = None
|
|
2840
|
+
finger_mounting_position: Union[float, None] = None
|
|
2841
|
+
finger_offset: Union[float, None] = None
|
|
2842
|
+
|
|
2843
|
+
def validate_grip_detected(self, value: bool) -> Tuple[bool, str]:
|
|
2844
|
+
if value is None:
|
|
2845
|
+
return [True, ""]
|
|
909
2846
|
|
|
910
|
-
|
|
2847
|
+
if not isinstance(value, bool):
|
|
2848
|
+
return [False, "grip_detected must be of type bool for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2849
|
+
|
|
2850
|
+
return [True, ""]
|
|
2851
|
+
|
|
2852
|
+
def validate_force_grip_detected(self, value: bool) -> Tuple[bool, str]:
|
|
911
2853
|
if value is None:
|
|
912
|
-
return [
|
|
2854
|
+
return [True, ""]
|
|
913
2855
|
|
|
914
|
-
if not
|
|
915
|
-
return [False, "
|
|
2856
|
+
if not isinstance(value, bool):
|
|
2857
|
+
return [False, "force_grip_detected must be of type bool for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
916
2858
|
|
|
917
2859
|
return [True, ""]
|
|
918
2860
|
|
|
919
|
-
def
|
|
2861
|
+
def validate_calibration_ok(self, value: bool) -> Tuple[bool, str]:
|
|
2862
|
+
if value is None:
|
|
2863
|
+
return [True, ""]
|
|
2864
|
+
|
|
2865
|
+
if not isinstance(value, bool):
|
|
2866
|
+
return [False, "calibration_ok must be of type bool for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2867
|
+
|
|
2868
|
+
return [True, ""]
|
|
2869
|
+
|
|
2870
|
+
def validate_diameter(self, value: float) -> Tuple[bool, str]:
|
|
920
2871
|
if value is None:
|
|
921
2872
|
return [True, ""]
|
|
922
2873
|
|
|
923
2874
|
if not isinstance(value, float):
|
|
924
|
-
return [False, "
|
|
2875
|
+
return [False, "diameter must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
925
2876
|
|
|
926
2877
|
return [True, ""]
|
|
927
2878
|
|
|
928
|
-
def
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
if not is_valid:
|
|
932
|
-
raise TypeError(error_str)
|
|
933
|
-
is_valid, error_str = self.validate_value(self.value)
|
|
934
|
-
if not is_valid:
|
|
935
|
-
raise TypeError(error_str)
|
|
2879
|
+
def validate_grip_kind(self, value: OnRobotGripKindEnum) -> Tuple[bool, str]:
|
|
2880
|
+
if value is None:
|
|
2881
|
+
return [True, ""]
|
|
936
2882
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
unit_kind=parse_force_unit_kind(data["unit_kind"]) if "unit_kind" in data else None,
|
|
940
|
-
value=parse_f_64(data["value"]) if "value" in data else None,
|
|
941
|
-
)
|
|
2883
|
+
if not ((isinstance(value, str) and OnRobotGripKindEnum in ['inward', 'outward']) or isinstance(value, OnRobotGripKindEnum)):
|
|
2884
|
+
return [False, "grip_kind must be of type OnRobotGripKindEnum for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
942
2885
|
|
|
943
|
-
|
|
944
|
-
return {
|
|
945
|
-
"unit_kind": serialize_force_unit_kind(data.unit_kind),
|
|
946
|
-
"value": None if data.value is None else serialize_f_64(data.value),
|
|
947
|
-
}
|
|
2886
|
+
return [True, ""]
|
|
948
2887
|
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
kind: Union[GripperKindEnum, None] = None
|
|
2888
|
+
def validate_finger_angle(self, value: float) -> Tuple[bool, str]:
|
|
2889
|
+
if value is None:
|
|
2890
|
+
return [True, ""]
|
|
953
2891
|
|
|
954
|
-
|
|
2892
|
+
if not isinstance(value, float):
|
|
2893
|
+
return [False, "finger_angle must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2894
|
+
|
|
2895
|
+
return [True, ""]
|
|
2896
|
+
|
|
2897
|
+
def validate_force_applied_fraction(self, value: float) -> Tuple[bool, str]:
|
|
955
2898
|
if value is None:
|
|
956
|
-
return [
|
|
2899
|
+
return [True, ""]
|
|
957
2900
|
|
|
958
|
-
if not
|
|
959
|
-
return [False, "
|
|
2901
|
+
if not isinstance(value, float):
|
|
2902
|
+
return [False, "force_applied_fraction must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
960
2903
|
|
|
961
2904
|
return [True, ""]
|
|
962
2905
|
|
|
963
|
-
def
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
if not is_valid:
|
|
967
|
-
raise TypeError(error_str)
|
|
2906
|
+
def validate_force_applied_newtons(self, value: float) -> Tuple[bool, str]:
|
|
2907
|
+
if value is None:
|
|
2908
|
+
return [True, ""]
|
|
968
2909
|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
kind=parse_gripper_kind_enum(data["kind"]) if "kind" in data else None,
|
|
972
|
-
)
|
|
2910
|
+
if not isinstance(value, float):
|
|
2911
|
+
return [False, "force_applied_newtons must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
973
2912
|
|
|
974
|
-
|
|
975
|
-
return {
|
|
976
|
-
"kind": serialize_gripper_kind_enum(data.kind),
|
|
977
|
-
}
|
|
2913
|
+
return [True, ""]
|
|
978
2914
|
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
joints: Union[JointRotations, None] = None
|
|
2915
|
+
def validate_target_force_newtons(self, value: float) -> Tuple[bool, str]:
|
|
2916
|
+
if value is None:
|
|
2917
|
+
return [True, ""]
|
|
983
2918
|
|
|
984
|
-
|
|
2919
|
+
if not isinstance(value, float):
|
|
2920
|
+
return [False, "target_force_newtons must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2921
|
+
|
|
2922
|
+
return [True, ""]
|
|
2923
|
+
|
|
2924
|
+
def validate_finger_length(self, value: float) -> Tuple[bool, str]:
|
|
985
2925
|
if value is None:
|
|
986
|
-
return [
|
|
2926
|
+
return [True, ""]
|
|
987
2927
|
|
|
988
|
-
if not
|
|
989
|
-
return [False, "
|
|
2928
|
+
if not isinstance(value, float):
|
|
2929
|
+
return [False, "finger_length must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2930
|
+
|
|
2931
|
+
return [True, ""]
|
|
2932
|
+
|
|
2933
|
+
def validate_finger_mounting_position(self, value: float) -> Tuple[bool, str]:
|
|
2934
|
+
if value is None:
|
|
2935
|
+
return [True, ""]
|
|
2936
|
+
|
|
2937
|
+
if not isinstance(value, float):
|
|
2938
|
+
return [False, "finger_mounting_position must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2939
|
+
|
|
2940
|
+
return [True, ""]
|
|
2941
|
+
|
|
2942
|
+
def validate_finger_offset(self, value: float) -> Tuple[bool, str]:
|
|
2943
|
+
if value is None:
|
|
2944
|
+
return [True, ""]
|
|
2945
|
+
|
|
2946
|
+
if not isinstance(value, float):
|
|
2947
|
+
return [False, "finger_offset must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
990
2948
|
|
|
991
2949
|
return [True, ""]
|
|
992
2950
|
|
|
993
2951
|
def __post_init__(self):
|
|
994
2952
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
995
|
-
is_valid, error_str = self.
|
|
2953
|
+
is_valid, error_str = self.validate_grip_detected(self.grip_detected)
|
|
2954
|
+
if not is_valid:
|
|
2955
|
+
raise TypeError(error_str)
|
|
2956
|
+
is_valid, error_str = self.validate_force_grip_detected(self.force_grip_detected)
|
|
2957
|
+
if not is_valid:
|
|
2958
|
+
raise TypeError(error_str)
|
|
2959
|
+
is_valid, error_str = self.validate_calibration_ok(self.calibration_ok)
|
|
2960
|
+
if not is_valid:
|
|
2961
|
+
raise TypeError(error_str)
|
|
2962
|
+
is_valid, error_str = self.validate_diameter(self.diameter)
|
|
2963
|
+
if not is_valid:
|
|
2964
|
+
raise TypeError(error_str)
|
|
2965
|
+
is_valid, error_str = self.validate_grip_kind(self.grip_kind)
|
|
2966
|
+
if not is_valid:
|
|
2967
|
+
raise TypeError(error_str)
|
|
2968
|
+
is_valid, error_str = self.validate_finger_angle(self.finger_angle)
|
|
2969
|
+
if not is_valid:
|
|
2970
|
+
raise TypeError(error_str)
|
|
2971
|
+
is_valid, error_str = self.validate_force_applied_fraction(self.force_applied_fraction)
|
|
2972
|
+
if not is_valid:
|
|
2973
|
+
raise TypeError(error_str)
|
|
2974
|
+
is_valid, error_str = self.validate_force_applied_newtons(self.force_applied_newtons)
|
|
2975
|
+
if not is_valid:
|
|
2976
|
+
raise TypeError(error_str)
|
|
2977
|
+
is_valid, error_str = self.validate_target_force_newtons(self.target_force_newtons)
|
|
2978
|
+
if not is_valid:
|
|
2979
|
+
raise TypeError(error_str)
|
|
2980
|
+
is_valid, error_str = self.validate_finger_length(self.finger_length)
|
|
2981
|
+
if not is_valid:
|
|
2982
|
+
raise TypeError(error_str)
|
|
2983
|
+
is_valid, error_str = self.validate_finger_mounting_position(self.finger_mounting_position)
|
|
2984
|
+
if not is_valid:
|
|
2985
|
+
raise TypeError(error_str)
|
|
2986
|
+
is_valid, error_str = self.validate_finger_offset(self.finger_offset)
|
|
996
2987
|
if not is_valid:
|
|
997
2988
|
raise TypeError(error_str)
|
|
998
2989
|
|
|
999
|
-
def
|
|
1000
|
-
return
|
|
1001
|
-
|
|
2990
|
+
def parse_on_robot_3_fg_15_gripper_configuration(data: object):
|
|
2991
|
+
return OnRobot3FG15GripperConfiguration(
|
|
2992
|
+
grip_detected=parse_bool(data["grip_detected"]) if "grip_detected" in data else None,
|
|
2993
|
+
force_grip_detected=parse_bool(data["force_grip_detected"]) if "force_grip_detected" in data else None,
|
|
2994
|
+
calibration_ok=parse_bool(data["calibration_ok"]) if "calibration_ok" in data else None,
|
|
2995
|
+
diameter=parse_f_64(data["diameter"]) if "diameter" in data else None,
|
|
2996
|
+
grip_kind=parse_on_robot_grip_kind_enum(data["grip_kind"]) if "grip_kind" in data else None,
|
|
2997
|
+
finger_angle=parse_f_64(data["finger_angle"]) if "finger_angle" in data else None,
|
|
2998
|
+
force_applied_fraction=parse_f_64(data["force_applied_fraction"]) if "force_applied_fraction" in data else None,
|
|
2999
|
+
force_applied_newtons=parse_f_64(data["force_applied_newtons"]) if "force_applied_newtons" in data else None,
|
|
3000
|
+
target_force_newtons=parse_f_64(data["target_force_newtons"]) if "target_force_newtons" in data else None,
|
|
3001
|
+
finger_length=parse_f_64(data["finger_length"]) if "finger_length" in data else None,
|
|
3002
|
+
finger_mounting_position=parse_f_64(data["finger_mounting_position"]) if "finger_mounting_position" in data else None,
|
|
3003
|
+
finger_offset=parse_f_64(data["finger_offset"]) if "finger_offset" in data else None,
|
|
1002
3004
|
)
|
|
1003
3005
|
|
|
1004
|
-
def
|
|
3006
|
+
def serialize_on_robot_3_fg_15_gripper_configuration(data: OnRobot3FG15GripperConfiguration) -> object:
|
|
1005
3007
|
return {
|
|
1006
|
-
"
|
|
3008
|
+
"grip_detected": None if data.grip_detected is None else serialize_bool(data.grip_detected),
|
|
3009
|
+
"force_grip_detected": None if data.force_grip_detected is None else serialize_bool(data.force_grip_detected),
|
|
3010
|
+
"calibration_ok": None if data.calibration_ok is None else serialize_bool(data.calibration_ok),
|
|
3011
|
+
"diameter": None if data.diameter is None else serialize_f_64(data.diameter),
|
|
3012
|
+
"grip_kind": None if data.grip_kind is None else serialize_on_robot_grip_kind_enum(data.grip_kind),
|
|
3013
|
+
"finger_angle": None if data.finger_angle is None else serialize_f_64(data.finger_angle),
|
|
3014
|
+
"force_applied_fraction": None if data.force_applied_fraction is None else serialize_f_64(data.force_applied_fraction),
|
|
3015
|
+
"force_applied_newtons": None if data.force_applied_newtons is None else serialize_f_64(data.force_applied_newtons),
|
|
3016
|
+
"target_force_newtons": None if data.target_force_newtons is None else serialize_f_64(data.target_force_newtons),
|
|
3017
|
+
"finger_length": None if data.finger_length is None else serialize_f_64(data.finger_length),
|
|
3018
|
+
"finger_mounting_position": None if data.finger_mounting_position is None else serialize_f_64(data.finger_mounting_position),
|
|
3019
|
+
"finger_offset": None if data.finger_offset is None else serialize_f_64(data.finger_offset),
|
|
1007
3020
|
}
|
|
1008
3021
|
|
|
3022
|
+
PlanesList = List[Plane]
|
|
3023
|
+
|
|
3024
|
+
def parse_planes_list(data: object) -> PlanesList:
|
|
3025
|
+
return [parse_plane(item) for item in data]
|
|
3026
|
+
|
|
3027
|
+
def serialize_planes_list(data: PlanesList) -> List[object]:
|
|
3028
|
+
return [serialize_plane(item) for item in data]
|
|
3029
|
+
|
|
1009
3030
|
@dataclass
|
|
1010
|
-
class
|
|
1011
|
-
"""
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
value: Union[float, None] = None
|
|
3031
|
+
class Orientation:
|
|
3032
|
+
"""Orientation of an object in 3D space"""
|
|
3033
|
+
kind: Union[OrientationKindEnum, None] = None
|
|
3034
|
+
quaternion: Union[Quaternion, None] = None
|
|
1015
3035
|
|
|
1016
|
-
def
|
|
3036
|
+
def validate_kind(self, value: OrientationKindEnum) -> Tuple[bool, str]:
|
|
1017
3037
|
if value is None:
|
|
1018
|
-
return [False, "
|
|
3038
|
+
return [False, "kind is required for Orientation"]
|
|
1019
3039
|
|
|
1020
|
-
if not ((isinstance(value, str) and
|
|
1021
|
-
return [False, "
|
|
3040
|
+
if not ((isinstance(value, str) and OrientationKindEnum in ['quaternion']) or isinstance(value, OrientationKindEnum)):
|
|
3041
|
+
return [False, "kind must be of type OrientationKindEnum for Orientation, got " + type(value).__name__]
|
|
1022
3042
|
|
|
1023
3043
|
return [True, ""]
|
|
1024
3044
|
|
|
1025
|
-
def
|
|
3045
|
+
def validate_quaternion(self, value: Quaternion) -> Tuple[bool, str]:
|
|
1026
3046
|
if value is None:
|
|
1027
3047
|
return [True, ""]
|
|
1028
3048
|
|
|
1029
|
-
if not isinstance(value,
|
|
1030
|
-
return [False, "
|
|
3049
|
+
if not isinstance(value, Quaternion):
|
|
3050
|
+
return [False, "quaternion must be of type Quaternion for Orientation, got " + type(value).__name__]
|
|
1031
3051
|
|
|
1032
3052
|
return [True, ""]
|
|
1033
3053
|
|
|
1034
3054
|
def __post_init__(self):
|
|
1035
3055
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1036
|
-
is_valid, error_str = self.
|
|
3056
|
+
is_valid, error_str = self.validate_kind(self.kind)
|
|
1037
3057
|
if not is_valid:
|
|
1038
3058
|
raise TypeError(error_str)
|
|
1039
|
-
is_valid, error_str = self.
|
|
3059
|
+
is_valid, error_str = self.validate_quaternion(self.quaternion)
|
|
1040
3060
|
if not is_valid:
|
|
1041
3061
|
raise TypeError(error_str)
|
|
1042
3062
|
|
|
1043
|
-
def
|
|
1044
|
-
return
|
|
1045
|
-
|
|
1046
|
-
|
|
3063
|
+
def parse_orientation(data: object):
|
|
3064
|
+
return Orientation(
|
|
3065
|
+
kind=parse_orientation_kind_enum(data["kind"]) if "kind" in data else None,
|
|
3066
|
+
quaternion=parse_quaternion(data["quaternion"]) if "quaternion" in data else None,
|
|
1047
3067
|
)
|
|
1048
3068
|
|
|
1049
|
-
def
|
|
3069
|
+
def serialize_orientation(data: Orientation) -> object:
|
|
1050
3070
|
return {
|
|
1051
|
-
"
|
|
1052
|
-
"
|
|
3071
|
+
"kind": serialize_orientation_kind_enum(data.kind),
|
|
3072
|
+
"quaternion": None if data.quaternion is None else serialize_quaternion(data.quaternion),
|
|
1053
3073
|
}
|
|
1054
3074
|
|
|
1055
3075
|
@dataclass
|
|
1056
|
-
class
|
|
1057
|
-
"""
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
3076
|
+
class FailureStateDetails:
|
|
3077
|
+
"""Failure state details."""
|
|
3078
|
+
failure_trace_id: Union[str, None] = None
|
|
3079
|
+
kind: Union[str, None] = None
|
|
3080
|
+
failed_step: Union[str, None] = None
|
|
3081
|
+
reason: Union[str, None] = None
|
|
3082
|
+
recovery_type: Union[RecoveryTypeEnum, None] = None
|
|
3083
|
+
is_recoverable_with_wrist_button: Union[bool, None] = None
|
|
1062
3084
|
|
|
1063
|
-
def
|
|
3085
|
+
def validate_failure_trace_id(self, value: str) -> Tuple[bool, str]:
|
|
1064
3086
|
if value is None:
|
|
1065
3087
|
return [True, ""]
|
|
1066
3088
|
|
|
1067
|
-
if not
|
|
1068
|
-
return [False, "
|
|
3089
|
+
if not isinstance(value, str):
|
|
3090
|
+
return [False, "failure_trace_id must be of type str for FailureStateDetails, got " + type(value).__name__]
|
|
3091
|
+
|
|
3092
|
+
return [True, ""]
|
|
3093
|
+
|
|
3094
|
+
def validate_kind(self, value: str) -> Tuple[bool, str]:
|
|
3095
|
+
if value is None:
|
|
3096
|
+
return [True, ""]
|
|
3097
|
+
|
|
3098
|
+
if not isinstance(value, str):
|
|
3099
|
+
return [False, "kind must be of type str for FailureStateDetails, got " + type(value).__name__]
|
|
3100
|
+
|
|
3101
|
+
return [True, ""]
|
|
3102
|
+
|
|
3103
|
+
def validate_failed_step(self, value: str) -> Tuple[bool, str]:
|
|
3104
|
+
if value is None:
|
|
3105
|
+
return [True, ""]
|
|
3106
|
+
|
|
3107
|
+
if not isinstance(value, str):
|
|
3108
|
+
return [False, "failed_step must be of type str for FailureStateDetails, got " + type(value).__name__]
|
|
1069
3109
|
|
|
1070
3110
|
return [True, ""]
|
|
1071
3111
|
|
|
1072
|
-
def
|
|
3112
|
+
def validate_reason(self, value: str) -> Tuple[bool, str]:
|
|
1073
3113
|
if value is None:
|
|
1074
3114
|
return [True, ""]
|
|
1075
3115
|
|
|
1076
|
-
if not isinstance(value,
|
|
1077
|
-
return [False, "
|
|
3116
|
+
if not isinstance(value, str):
|
|
3117
|
+
return [False, "reason must be of type str for FailureStateDetails, got " + type(value).__name__]
|
|
1078
3118
|
|
|
1079
3119
|
return [True, ""]
|
|
1080
3120
|
|
|
1081
|
-
def
|
|
3121
|
+
def validate_recovery_type(self, value: RecoveryTypeEnum) -> Tuple[bool, str]:
|
|
1082
3122
|
if value is None:
|
|
1083
3123
|
return [True, ""]
|
|
1084
3124
|
|
|
1085
|
-
if not isinstance(value,
|
|
1086
|
-
return [False, "
|
|
3125
|
+
if not ((isinstance(value, str) and RecoveryTypeEnum in ['Recoverable', 'NotRecoverable', 'Restart', 'GuidedMode', 'ManualRecoveryMode']) or isinstance(value, RecoveryTypeEnum)):
|
|
3126
|
+
return [False, "recovery_type must be of type RecoveryTypeEnum for FailureStateDetails, got " + type(value).__name__]
|
|
1087
3127
|
|
|
1088
3128
|
return [True, ""]
|
|
1089
3129
|
|
|
1090
|
-
def
|
|
3130
|
+
def validate_is_recoverable_with_wrist_button(self, value: bool) -> Tuple[bool, str]:
|
|
1091
3131
|
if value is None:
|
|
1092
3132
|
return [True, ""]
|
|
1093
3133
|
|
|
1094
|
-
if not isinstance(value,
|
|
1095
|
-
return [False, "
|
|
3134
|
+
if not isinstance(value, bool):
|
|
3135
|
+
return [False, "is_recoverable_with_wrist_button must be of type bool for FailureStateDetails, got " + type(value).__name__]
|
|
1096
3136
|
|
|
1097
3137
|
return [True, ""]
|
|
1098
3138
|
|
|
1099
3139
|
def __post_init__(self):
|
|
1100
3140
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1101
|
-
is_valid, error_str = self.
|
|
3141
|
+
is_valid, error_str = self.validate_failure_trace_id(self.failure_trace_id)
|
|
1102
3142
|
if not is_valid:
|
|
1103
3143
|
raise TypeError(error_str)
|
|
1104
|
-
is_valid, error_str = self.
|
|
3144
|
+
is_valid, error_str = self.validate_kind(self.kind)
|
|
1105
3145
|
if not is_valid:
|
|
1106
3146
|
raise TypeError(error_str)
|
|
1107
|
-
is_valid, error_str = self.
|
|
3147
|
+
is_valid, error_str = self.validate_failed_step(self.failed_step)
|
|
1108
3148
|
if not is_valid:
|
|
1109
3149
|
raise TypeError(error_str)
|
|
1110
|
-
is_valid, error_str = self.
|
|
3150
|
+
is_valid, error_str = self.validate_reason(self.reason)
|
|
3151
|
+
if not is_valid:
|
|
3152
|
+
raise TypeError(error_str)
|
|
3153
|
+
is_valid, error_str = self.validate_recovery_type(self.recovery_type)
|
|
3154
|
+
if not is_valid:
|
|
3155
|
+
raise TypeError(error_str)
|
|
3156
|
+
is_valid, error_str = self.validate_is_recoverable_with_wrist_button(self.is_recoverable_with_wrist_button)
|
|
1111
3157
|
if not is_valid:
|
|
1112
3158
|
raise TypeError(error_str)
|
|
1113
3159
|
|
|
1114
|
-
def
|
|
1115
|
-
return
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
3160
|
+
def parse_failure_state_details(data: object):
|
|
3161
|
+
return FailureStateDetails(
|
|
3162
|
+
failure_trace_id=parse_str(data["failure_trace_id"]) if "failure_trace_id" in data else None,
|
|
3163
|
+
kind=parse_str(data["kind"]) if "kind" in data else None,
|
|
3164
|
+
failed_step=parse_str(data["failed_step"]) if "failed_step" in data else None,
|
|
3165
|
+
reason=parse_str(data["reason"]) if "reason" in data else None,
|
|
3166
|
+
recovery_type=parse_recovery_type_enum(data["recovery_type"]) if "recovery_type" in data else None,
|
|
3167
|
+
is_recoverable_with_wrist_button=parse_bool(data["is_recoverable_with_wrist_button"]) if "is_recoverable_with_wrist_button" in data else None,
|
|
1120
3168
|
)
|
|
1121
3169
|
|
|
1122
|
-
def
|
|
3170
|
+
def serialize_failure_state_details(data: FailureStateDetails) -> object:
|
|
1123
3171
|
return {
|
|
1124
|
-
"
|
|
1125
|
-
"
|
|
1126
|
-
"
|
|
1127
|
-
"
|
|
3172
|
+
"failure_trace_id": None if data.failure_trace_id is None else serialize_str(data.failure_trace_id),
|
|
3173
|
+
"kind": None if data.kind is None else serialize_str(data.kind),
|
|
3174
|
+
"failed_step": None if data.failed_step is None else serialize_str(data.failed_step),
|
|
3175
|
+
"reason": None if data.reason is None else serialize_str(data.reason),
|
|
3176
|
+
"recovery_type": None if data.recovery_type is None else serialize_recovery_type_enum(data.recovery_type),
|
|
3177
|
+
"is_recoverable_with_wrist_button": None if data.is_recoverable_with_wrist_button is None else serialize_bool(data.is_recoverable_with_wrist_button),
|
|
1128
3178
|
}
|
|
1129
3179
|
|
|
1130
|
-
PlanesList = List[Plane]
|
|
1131
|
-
|
|
1132
|
-
def parse_planes_list(data: object) -> PlanesList:
|
|
1133
|
-
return [parse_plane(item) for item in data]
|
|
1134
|
-
|
|
1135
|
-
def serialize_planes_list(data: PlanesList) -> List[object]:
|
|
1136
|
-
return [serialize_plane(item) for item in data]
|
|
1137
|
-
|
|
1138
3180
|
@dataclass
|
|
1139
|
-
class
|
|
1140
|
-
"""
|
|
1141
|
-
kind: Union[
|
|
1142
|
-
quaternion: Union[Quaternion, None] = None
|
|
3181
|
+
class RobotControlMode:
|
|
3182
|
+
"""Definition of Robot Control State, which tells you which service or system is controlling the Robot"""
|
|
3183
|
+
kind: Union[RobotControlModeEnum, None] = None
|
|
1143
3184
|
|
|
1144
|
-
def validate_kind(self, value:
|
|
3185
|
+
def validate_kind(self, value: RobotControlModeEnum) -> Tuple[bool, str]:
|
|
1145
3186
|
if value is None:
|
|
1146
|
-
return [
|
|
3187
|
+
return [True, ""]
|
|
1147
3188
|
|
|
1148
|
-
if not ((isinstance(value, str) and
|
|
1149
|
-
return [False, "kind must be of type
|
|
3189
|
+
if not ((isinstance(value, str) and RobotControlModeEnum in ['api', 'routine_editor']) or isinstance(value, RobotControlModeEnum)):
|
|
3190
|
+
return [False, "kind must be of type RobotControlModeEnum for RobotControlMode, got " + type(value).__name__]
|
|
1150
3191
|
|
|
1151
3192
|
return [True, ""]
|
|
1152
3193
|
|
|
1153
|
-
def
|
|
3194
|
+
def __post_init__(self):
|
|
3195
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
3196
|
+
is_valid, error_str = self.validate_kind(self.kind)
|
|
3197
|
+
if not is_valid:
|
|
3198
|
+
raise TypeError(error_str)
|
|
3199
|
+
|
|
3200
|
+
def parse_robot_control_mode(data: object):
|
|
3201
|
+
return RobotControlMode(
|
|
3202
|
+
kind=parse_robot_control_mode_enum(data["kind"]) if "kind" in data else None,
|
|
3203
|
+
)
|
|
3204
|
+
|
|
3205
|
+
def serialize_robot_control_mode(data: RobotControlMode) -> object:
|
|
3206
|
+
return {
|
|
3207
|
+
"kind": None if data.kind is None else serialize_robot_control_mode_enum(data.kind),
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3210
|
+
@dataclass
|
|
3211
|
+
class ROSControlStateResponse:
|
|
3212
|
+
"""Response to a query for the current state of ROS control."""
|
|
3213
|
+
state: Union[ROSControlStateEnum, None] = None
|
|
3214
|
+
|
|
3215
|
+
def validate_state(self, value: ROSControlStateEnum) -> Tuple[bool, str]:
|
|
1154
3216
|
if value is None:
|
|
1155
3217
|
return [True, ""]
|
|
1156
3218
|
|
|
1157
|
-
if not isinstance(value,
|
|
1158
|
-
return [False, "
|
|
3219
|
+
if not ((isinstance(value, str) and ROSControlStateEnum in ['enabled', 'disabled']) or isinstance(value, ROSControlStateEnum)):
|
|
3220
|
+
return [False, "state must be of type ROSControlStateEnum for ROSControlStateResponse, got " + type(value).__name__]
|
|
1159
3221
|
|
|
1160
3222
|
return [True, ""]
|
|
1161
3223
|
|
|
1162
3224
|
def __post_init__(self):
|
|
1163
3225
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1164
|
-
is_valid, error_str = self.
|
|
1165
|
-
if not is_valid:
|
|
1166
|
-
raise TypeError(error_str)
|
|
1167
|
-
is_valid, error_str = self.validate_quaternion(self.quaternion)
|
|
3226
|
+
is_valid, error_str = self.validate_state(self.state)
|
|
1168
3227
|
if not is_valid:
|
|
1169
3228
|
raise TypeError(error_str)
|
|
1170
3229
|
|
|
1171
|
-
def
|
|
1172
|
-
return
|
|
1173
|
-
|
|
1174
|
-
quaternion=parse_quaternion(data["quaternion"]) if "quaternion" in data else None,
|
|
3230
|
+
def parse_ros_control_state_response(data: object):
|
|
3231
|
+
return ROSControlStateResponse(
|
|
3232
|
+
state=parse_ros_control_state_enum(data["state"]) if "state" in data else None,
|
|
1175
3233
|
)
|
|
1176
3234
|
|
|
1177
|
-
def
|
|
3235
|
+
def serialize_ros_control_state_response(data: ROSControlStateResponse) -> object:
|
|
1178
3236
|
return {
|
|
1179
|
-
"
|
|
1180
|
-
"quaternion": None if data.quaternion is None else serialize_quaternion(data.quaternion),
|
|
3237
|
+
"state": None if data.state is None else serialize_ros_control_state_enum(data.state),
|
|
1181
3238
|
}
|
|
1182
3239
|
|
|
1183
3240
|
@dataclass
|
|
1184
|
-
class
|
|
1185
|
-
"""
|
|
1186
|
-
|
|
3241
|
+
class ROSControlUpdateRequest:
|
|
3242
|
+
"""Request to update the state of direct ROS control."""
|
|
3243
|
+
action: Union[ROSControlStateEnum, None] = None
|
|
1187
3244
|
|
|
1188
|
-
def
|
|
3245
|
+
def validate_action(self, value: ROSControlStateEnum) -> Tuple[bool, str]:
|
|
1189
3246
|
if value is None:
|
|
1190
3247
|
return [True, ""]
|
|
1191
3248
|
|
|
1192
|
-
if not ((isinstance(value, str) and
|
|
1193
|
-
return [False, "
|
|
3249
|
+
if not ((isinstance(value, str) and ROSControlStateEnum in ['enabled', 'disabled']) or isinstance(value, ROSControlStateEnum)):
|
|
3250
|
+
return [False, "action must be of type ROSControlStateEnum for ROSControlUpdateRequest, got " + type(value).__name__]
|
|
1194
3251
|
|
|
1195
3252
|
return [True, ""]
|
|
1196
3253
|
|
|
1197
3254
|
def __post_init__(self):
|
|
1198
3255
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1199
|
-
is_valid, error_str = self.
|
|
3256
|
+
is_valid, error_str = self.validate_action(self.action)
|
|
1200
3257
|
if not is_valid:
|
|
1201
3258
|
raise TypeError(error_str)
|
|
1202
3259
|
|
|
1203
|
-
def
|
|
1204
|
-
return
|
|
1205
|
-
|
|
3260
|
+
def parse_ros_control_update_request(data: object):
|
|
3261
|
+
return ROSControlUpdateRequest(
|
|
3262
|
+
action=parse_ros_control_state_enum(data["action"]) if "action" in data else None,
|
|
1206
3263
|
)
|
|
1207
3264
|
|
|
1208
|
-
def
|
|
3265
|
+
def serialize_ros_control_update_request(data: ROSControlUpdateRequest) -> object:
|
|
1209
3266
|
return {
|
|
1210
|
-
"
|
|
3267
|
+
"action": None if data.action is None else serialize_ros_control_state_enum(data.action),
|
|
1211
3268
|
}
|
|
1212
3269
|
|
|
1213
3270
|
@dataclass
|
|
@@ -1240,6 +3297,51 @@ def serialize_play_routine_request(data: PlayRoutineRequest) -> object:
|
|
|
1240
3297
|
"variables": None if data.variables is None else serialize_routine_variables_state_map(data.variables),
|
|
1241
3298
|
}
|
|
1242
3299
|
|
|
3300
|
+
@dataclass
|
|
3301
|
+
class TextToSkillRequest:
|
|
3302
|
+
"""Request to convert text to a skill."""
|
|
3303
|
+
text: Union[str, None] = None
|
|
3304
|
+
skills: Union[SkillsList, None] = None
|
|
3305
|
+
|
|
3306
|
+
def validate_text(self, value: str) -> Tuple[bool, str]:
|
|
3307
|
+
if value is None:
|
|
3308
|
+
return [True, ""]
|
|
3309
|
+
|
|
3310
|
+
if not isinstance(value, str):
|
|
3311
|
+
return [False, "text must be of type str for TextToSkillRequest, got " + type(value).__name__]
|
|
3312
|
+
|
|
3313
|
+
return [True, ""]
|
|
3314
|
+
|
|
3315
|
+
def validate_skills(self, value: SkillsList) -> Tuple[bool, str]:
|
|
3316
|
+
if value is None:
|
|
3317
|
+
return [True, ""]
|
|
3318
|
+
|
|
3319
|
+
if not (isinstance(value, list) and all(isinstance(x, str) for x in value)):
|
|
3320
|
+
return [False, "skills must be of type SkillsList for TextToSkillRequest, got " + type(value).__name__]
|
|
3321
|
+
|
|
3322
|
+
return [True, ""]
|
|
3323
|
+
|
|
3324
|
+
def __post_init__(self):
|
|
3325
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
3326
|
+
is_valid, error_str = self.validate_text(self.text)
|
|
3327
|
+
if not is_valid:
|
|
3328
|
+
raise TypeError(error_str)
|
|
3329
|
+
is_valid, error_str = self.validate_skills(self.skills)
|
|
3330
|
+
if not is_valid:
|
|
3331
|
+
raise TypeError(error_str)
|
|
3332
|
+
|
|
3333
|
+
def parse_text_to_skill_request(data: object):
|
|
3334
|
+
return TextToSkillRequest(
|
|
3335
|
+
text=parse_str(data["text"]) if "text" in data else None,
|
|
3336
|
+
skills=parse_skills_list(data["skills"]) if "skills" in data else None,
|
|
3337
|
+
)
|
|
3338
|
+
|
|
3339
|
+
def serialize_text_to_skill_request(data: TextToSkillRequest) -> object:
|
|
3340
|
+
return {
|
|
3341
|
+
"text": None if data.text is None else serialize_str(data.text),
|
|
3342
|
+
"skills": None if data.skills is None else serialize_skills_list(data.skills),
|
|
3343
|
+
}
|
|
3344
|
+
|
|
1243
3345
|
@dataclass
|
|
1244
3346
|
class StatusHealthResponse:
|
|
1245
3347
|
"""Status Health Response"""
|
|
@@ -1316,6 +3418,111 @@ def serialize_arm_position_update_request_response_event_stream_details(data: Ar
|
|
|
1316
3418
|
"subscriptions": serialize_arm_position_update_request_response_event_stream_subscriptions_list(data.subscriptions),
|
|
1317
3419
|
}
|
|
1318
3420
|
|
|
3421
|
+
@dataclass
|
|
3422
|
+
class JointsStateResponse:
|
|
3423
|
+
"""Response to a query for the current state of the joints"""
|
|
3424
|
+
J0: Union[JointState, None] = None
|
|
3425
|
+
J1: Union[JointState, None] = None
|
|
3426
|
+
J2: Union[JointState, None] = None
|
|
3427
|
+
J3: Union[JointState, None] = None
|
|
3428
|
+
J4: Union[JointState, None] = None
|
|
3429
|
+
J5: Union[JointState, None] = None
|
|
3430
|
+
|
|
3431
|
+
def validate_J0(self, value: JointState) -> Tuple[bool, str]:
|
|
3432
|
+
if value is None:
|
|
3433
|
+
return [True, ""]
|
|
3434
|
+
|
|
3435
|
+
if not isinstance(value, JointState):
|
|
3436
|
+
return [False, "J0 must be of type JointState for JointsStateResponse, got " + type(value).__name__]
|
|
3437
|
+
|
|
3438
|
+
return [True, ""]
|
|
3439
|
+
|
|
3440
|
+
def validate_J1(self, value: JointState) -> Tuple[bool, str]:
|
|
3441
|
+
if value is None:
|
|
3442
|
+
return [True, ""]
|
|
3443
|
+
|
|
3444
|
+
if not isinstance(value, JointState):
|
|
3445
|
+
return [False, "J1 must be of type JointState for JointsStateResponse, got " + type(value).__name__]
|
|
3446
|
+
|
|
3447
|
+
return [True, ""]
|
|
3448
|
+
|
|
3449
|
+
def validate_J2(self, value: JointState) -> Tuple[bool, str]:
|
|
3450
|
+
if value is None:
|
|
3451
|
+
return [True, ""]
|
|
3452
|
+
|
|
3453
|
+
if not isinstance(value, JointState):
|
|
3454
|
+
return [False, "J2 must be of type JointState for JointsStateResponse, got " + type(value).__name__]
|
|
3455
|
+
|
|
3456
|
+
return [True, ""]
|
|
3457
|
+
|
|
3458
|
+
def validate_J3(self, value: JointState) -> Tuple[bool, str]:
|
|
3459
|
+
if value is None:
|
|
3460
|
+
return [True, ""]
|
|
3461
|
+
|
|
3462
|
+
if not isinstance(value, JointState):
|
|
3463
|
+
return [False, "J3 must be of type JointState for JointsStateResponse, got " + type(value).__name__]
|
|
3464
|
+
|
|
3465
|
+
return [True, ""]
|
|
3466
|
+
|
|
3467
|
+
def validate_J4(self, value: JointState) -> Tuple[bool, str]:
|
|
3468
|
+
if value is None:
|
|
3469
|
+
return [True, ""]
|
|
3470
|
+
|
|
3471
|
+
if not isinstance(value, JointState):
|
|
3472
|
+
return [False, "J4 must be of type JointState for JointsStateResponse, got " + type(value).__name__]
|
|
3473
|
+
|
|
3474
|
+
return [True, ""]
|
|
3475
|
+
|
|
3476
|
+
def validate_J5(self, value: JointState) -> Tuple[bool, str]:
|
|
3477
|
+
if value is None:
|
|
3478
|
+
return [True, ""]
|
|
3479
|
+
|
|
3480
|
+
if not isinstance(value, JointState):
|
|
3481
|
+
return [False, "J5 must be of type JointState for JointsStateResponse, got " + type(value).__name__]
|
|
3482
|
+
|
|
3483
|
+
return [True, ""]
|
|
3484
|
+
|
|
3485
|
+
def __post_init__(self):
|
|
3486
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
3487
|
+
is_valid, error_str = self.validate_J0(self.J0)
|
|
3488
|
+
if not is_valid:
|
|
3489
|
+
raise TypeError(error_str)
|
|
3490
|
+
is_valid, error_str = self.validate_J1(self.J1)
|
|
3491
|
+
if not is_valid:
|
|
3492
|
+
raise TypeError(error_str)
|
|
3493
|
+
is_valid, error_str = self.validate_J2(self.J2)
|
|
3494
|
+
if not is_valid:
|
|
3495
|
+
raise TypeError(error_str)
|
|
3496
|
+
is_valid, error_str = self.validate_J3(self.J3)
|
|
3497
|
+
if not is_valid:
|
|
3498
|
+
raise TypeError(error_str)
|
|
3499
|
+
is_valid, error_str = self.validate_J4(self.J4)
|
|
3500
|
+
if not is_valid:
|
|
3501
|
+
raise TypeError(error_str)
|
|
3502
|
+
is_valid, error_str = self.validate_J5(self.J5)
|
|
3503
|
+
if not is_valid:
|
|
3504
|
+
raise TypeError(error_str)
|
|
3505
|
+
|
|
3506
|
+
def parse_joints_state_response(data: object):
|
|
3507
|
+
return JointsStateResponse(
|
|
3508
|
+
J0=parse_joint_state(data["J0"]) if "J0" in data else None,
|
|
3509
|
+
J1=parse_joint_state(data["J1"]) if "J1" in data else None,
|
|
3510
|
+
J2=parse_joint_state(data["J2"]) if "J2" in data else None,
|
|
3511
|
+
J3=parse_joint_state(data["J3"]) if "J3" in data else None,
|
|
3512
|
+
J4=parse_joint_state(data["J4"]) if "J4" in data else None,
|
|
3513
|
+
J5=parse_joint_state(data["J5"]) if "J5" in data else None,
|
|
3514
|
+
)
|
|
3515
|
+
|
|
3516
|
+
def serialize_joints_state_response(data: JointsStateResponse) -> object:
|
|
3517
|
+
return {
|
|
3518
|
+
"J0": None if data.J0 is None else serialize_joint_state(data.J0),
|
|
3519
|
+
"J1": None if data.J1 is None else serialize_joint_state(data.J1),
|
|
3520
|
+
"J2": None if data.J2 is None else serialize_joint_state(data.J2),
|
|
3521
|
+
"J3": None if data.J3 is None else serialize_joint_state(data.J3),
|
|
3522
|
+
"J4": None if data.J4 is None else serialize_joint_state(data.J4),
|
|
3523
|
+
"J5": None if data.J5 is None else serialize_joint_state(data.J5),
|
|
3524
|
+
}
|
|
3525
|
+
|
|
1319
3526
|
@dataclass
|
|
1320
3527
|
class Routine:
|
|
1321
3528
|
"""Robot Routine containing steps to automate robot movement and operations"""
|
|
@@ -1323,67 +3530,143 @@ class Routine:
|
|
|
1323
3530
|
name: Union[str, None] = None
|
|
1324
3531
|
environment_variables: Union[EnvironmentVariablesList, None] = None
|
|
1325
3532
|
|
|
1326
|
-
def validate_id(self, value: str) -> Tuple[bool, str]:
|
|
3533
|
+
def validate_id(self, value: str) -> Tuple[bool, str]:
|
|
3534
|
+
if value is None:
|
|
3535
|
+
return [True, ""]
|
|
3536
|
+
|
|
3537
|
+
if not isinstance(value, str):
|
|
3538
|
+
return [False, "id must be of type str for Routine, got " + type(value).__name__]
|
|
3539
|
+
|
|
3540
|
+
return [True, ""]
|
|
3541
|
+
|
|
3542
|
+
def validate_name(self, value: str) -> Tuple[bool, str]:
|
|
3543
|
+
if value is None:
|
|
3544
|
+
return [True, ""]
|
|
3545
|
+
|
|
3546
|
+
if not isinstance(value, str):
|
|
3547
|
+
return [False, "name must be of type str for Routine, got " + type(value).__name__]
|
|
3548
|
+
|
|
3549
|
+
return [True, ""]
|
|
3550
|
+
|
|
3551
|
+
def validate_environment_variables(self, value: EnvironmentVariablesList) -> Tuple[bool, str]:
|
|
3552
|
+
if value is None:
|
|
3553
|
+
return [True, ""]
|
|
3554
|
+
|
|
3555
|
+
if not (isinstance(value, list) and all(isinstance(x, EnvironmentVariable) for x in value)):
|
|
3556
|
+
return [False, "environment_variables must be of type EnvironmentVariablesList for Routine, got " + type(value).__name__]
|
|
3557
|
+
|
|
3558
|
+
return [True, ""]
|
|
3559
|
+
|
|
3560
|
+
def __post_init__(self):
|
|
3561
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
3562
|
+
is_valid, error_str = self.validate_id(self.id)
|
|
3563
|
+
if not is_valid:
|
|
3564
|
+
raise TypeError(error_str)
|
|
3565
|
+
is_valid, error_str = self.validate_name(self.name)
|
|
3566
|
+
if not is_valid:
|
|
3567
|
+
raise TypeError(error_str)
|
|
3568
|
+
is_valid, error_str = self.validate_environment_variables(self.environment_variables)
|
|
3569
|
+
if not is_valid:
|
|
3570
|
+
raise TypeError(error_str)
|
|
3571
|
+
|
|
3572
|
+
def parse_routine(data: object):
|
|
3573
|
+
return Routine(
|
|
3574
|
+
id=parse_str(data["id"]) if "id" in data else None,
|
|
3575
|
+
name=parse_str(data["name"]) if "name" in data else None,
|
|
3576
|
+
environment_variables=parse_environment_variables_list(data["environment_variables"]) if "environment_variables" in data else None,
|
|
3577
|
+
)
|
|
3578
|
+
|
|
3579
|
+
def serialize_routine(data: Routine) -> object:
|
|
3580
|
+
return {
|
|
3581
|
+
"id": None if data.id is None else serialize_str(data.id),
|
|
3582
|
+
"name": None if data.name is None else serialize_str(data.name),
|
|
3583
|
+
"environment_variables": None if data.environment_variables is None else serialize_environment_variables_list(data.environment_variables),
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3586
|
+
ArmJointRotationsList = List[ArmJointRotations]
|
|
3587
|
+
|
|
3588
|
+
def parse_arm_joint_rotations_list(data: object) -> ArmJointRotationsList:
|
|
3589
|
+
return [parse_arm_joint_rotations(item) for item in data]
|
|
3590
|
+
|
|
3591
|
+
def serialize_arm_joint_rotations_list(data: ArmJointRotationsList) -> List[object]:
|
|
3592
|
+
return [serialize_arm_joint_rotations(item) for item in data]
|
|
3593
|
+
|
|
3594
|
+
@dataclass
|
|
3595
|
+
class OnRobot2FG14GripperCommandRequest:
|
|
3596
|
+
"""Control the OnRobot 2FG14 gripper (end effector) of the robot
|
|
3597
|
+
"""
|
|
3598
|
+
grip_direction: Union[LinearGripDirectionEnum, None] = None
|
|
3599
|
+
target_force: Union[ForceUnit, None] = None
|
|
3600
|
+
target_grip_width: Union[LinearUnit, None] = None
|
|
3601
|
+
control_kind: Union[OnRobot2FG14ControlKindEnum, None] = None
|
|
3602
|
+
|
|
3603
|
+
def validate_grip_direction(self, value: LinearGripDirectionEnum) -> Tuple[bool, str]:
|
|
3604
|
+
if value is None:
|
|
3605
|
+
return [False, "grip_direction is required for OnRobot2FG14GripperCommandRequest"]
|
|
3606
|
+
|
|
3607
|
+
if not ((isinstance(value, str) and LinearGripDirectionEnum in ['inward', 'outward']) or isinstance(value, LinearGripDirectionEnum)):
|
|
3608
|
+
return [False, "grip_direction must be of type LinearGripDirectionEnum for OnRobot2FG14GripperCommandRequest, got " + type(value).__name__]
|
|
3609
|
+
|
|
3610
|
+
return [True, ""]
|
|
3611
|
+
|
|
3612
|
+
def validate_target_force(self, value: ForceUnit) -> Tuple[bool, str]:
|
|
1327
3613
|
if value is None:
|
|
1328
3614
|
return [True, ""]
|
|
1329
3615
|
|
|
1330
|
-
if not isinstance(value,
|
|
1331
|
-
return [False, "
|
|
3616
|
+
if not isinstance(value, ForceUnit):
|
|
3617
|
+
return [False, "target_force must be of type ForceUnit for OnRobot2FG14GripperCommandRequest, got " + type(value).__name__]
|
|
1332
3618
|
|
|
1333
3619
|
return [True, ""]
|
|
1334
3620
|
|
|
1335
|
-
def
|
|
3621
|
+
def validate_target_grip_width(self, value: LinearUnit) -> Tuple[bool, str]:
|
|
1336
3622
|
if value is None:
|
|
1337
3623
|
return [True, ""]
|
|
1338
3624
|
|
|
1339
|
-
if not isinstance(value,
|
|
1340
|
-
return [False, "
|
|
3625
|
+
if not isinstance(value, LinearUnit):
|
|
3626
|
+
return [False, "target_grip_width must be of type LinearUnit for OnRobot2FG14GripperCommandRequest, got " + type(value).__name__]
|
|
1341
3627
|
|
|
1342
3628
|
return [True, ""]
|
|
1343
3629
|
|
|
1344
|
-
def
|
|
3630
|
+
def validate_control_kind(self, value: OnRobot2FG14ControlKindEnum) -> Tuple[bool, str]:
|
|
1345
3631
|
if value is None:
|
|
1346
|
-
return [
|
|
3632
|
+
return [False, "control_kind is required for OnRobot2FG14GripperCommandRequest"]
|
|
1347
3633
|
|
|
1348
|
-
if not (isinstance(value,
|
|
1349
|
-
return [False, "
|
|
3634
|
+
if not ((isinstance(value, str) and OnRobot2FG14ControlKindEnum in ['move', 'force_grip']) or isinstance(value, OnRobot2FG14ControlKindEnum)):
|
|
3635
|
+
return [False, "control_kind must be of type OnRobot2FG14ControlKindEnum for OnRobot2FG14GripperCommandRequest, got " + type(value).__name__]
|
|
1350
3636
|
|
|
1351
3637
|
return [True, ""]
|
|
1352
3638
|
|
|
1353
3639
|
def __post_init__(self):
|
|
1354
3640
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1355
|
-
is_valid, error_str = self.
|
|
3641
|
+
is_valid, error_str = self.validate_grip_direction(self.grip_direction)
|
|
1356
3642
|
if not is_valid:
|
|
1357
3643
|
raise TypeError(error_str)
|
|
1358
|
-
is_valid, error_str = self.
|
|
3644
|
+
is_valid, error_str = self.validate_target_force(self.target_force)
|
|
1359
3645
|
if not is_valid:
|
|
1360
3646
|
raise TypeError(error_str)
|
|
1361
|
-
is_valid, error_str = self.
|
|
3647
|
+
is_valid, error_str = self.validate_target_grip_width(self.target_grip_width)
|
|
3648
|
+
if not is_valid:
|
|
3649
|
+
raise TypeError(error_str)
|
|
3650
|
+
is_valid, error_str = self.validate_control_kind(self.control_kind)
|
|
1362
3651
|
if not is_valid:
|
|
1363
3652
|
raise TypeError(error_str)
|
|
1364
3653
|
|
|
1365
|
-
def
|
|
1366
|
-
return
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
3654
|
+
def parse_on_robot_2_fg_14_gripper_command_request(data: object):
|
|
3655
|
+
return OnRobot2FG14GripperCommandRequest(
|
|
3656
|
+
grip_direction=parse_linear_grip_direction_enum(data["grip_direction"]) if "grip_direction" in data else None,
|
|
3657
|
+
target_force=parse_force_unit(data["target_force"]) if "target_force" in data else None,
|
|
3658
|
+
target_grip_width=parse_linear_unit(data["target_grip_width"]) if "target_grip_width" in data else None,
|
|
3659
|
+
control_kind=parse_on_robot_2_fg_14_control_kind_enum(data["control_kind"]) if "control_kind" in data else None,
|
|
1370
3660
|
)
|
|
1371
3661
|
|
|
1372
|
-
def
|
|
3662
|
+
def serialize_on_robot_2_fg_14_gripper_command_request(data: OnRobot2FG14GripperCommandRequest) -> object:
|
|
1373
3663
|
return {
|
|
1374
|
-
"
|
|
1375
|
-
"
|
|
1376
|
-
"
|
|
3664
|
+
"grip_direction": serialize_linear_grip_direction_enum(data.grip_direction),
|
|
3665
|
+
"target_force": None if data.target_force is None else serialize_force_unit(data.target_force),
|
|
3666
|
+
"target_grip_width": None if data.target_grip_width is None else serialize_linear_unit(data.target_grip_width),
|
|
3667
|
+
"control_kind": serialize_on_robot_2_fg_14_control_kind_enum(data.control_kind),
|
|
1377
3668
|
}
|
|
1378
3669
|
|
|
1379
|
-
ArmJointRotationsList = List[ArmJointRotations]
|
|
1380
|
-
|
|
1381
|
-
def parse_arm_joint_rotations_list(data: object) -> ArmJointRotationsList:
|
|
1382
|
-
return [parse_arm_joint_rotations(item) for item in data]
|
|
1383
|
-
|
|
1384
|
-
def serialize_arm_joint_rotations_list(data: ArmJointRotationsList) -> List[object]:
|
|
1385
|
-
return [serialize_arm_joint_rotations(item) for item in data]
|
|
1386
|
-
|
|
1387
3670
|
@dataclass
|
|
1388
3671
|
class OnRobot2FG7GripperCommandRequest:
|
|
1389
3672
|
"""Control the OnRobot 2FG7 gripper (end effector) of the robot
|
|
@@ -1536,6 +3819,187 @@ def serialize_on_robot_3_fg_15_gripper_command_request(data: OnRobot3FG15Gripper
|
|
|
1536
3819
|
"control_kind": serialize_on_robot_3_fg_15_control_kind_enum(data.control_kind),
|
|
1537
3820
|
}
|
|
1538
3821
|
|
|
3822
|
+
@dataclass
|
|
3823
|
+
class SchunkEGxGripperCommandRequest:
|
|
3824
|
+
"""Control the Schunk EGU / EGK gripper (end effector) of the robot
|
|
3825
|
+
"""
|
|
3826
|
+
target_grip_width: Union[LinearUnit, None] = None
|
|
3827
|
+
control_kind: Union[SchunkEGxControlKindEnum, None] = None
|
|
3828
|
+
|
|
3829
|
+
def validate_target_grip_width(self, value: LinearUnit) -> Tuple[bool, str]:
|
|
3830
|
+
if value is None:
|
|
3831
|
+
return [True, ""]
|
|
3832
|
+
|
|
3833
|
+
if not isinstance(value, LinearUnit):
|
|
3834
|
+
return [False, "target_grip_width must be of type LinearUnit for SchunkEGxGripperCommandRequest, got " + type(value).__name__]
|
|
3835
|
+
|
|
3836
|
+
return [True, ""]
|
|
3837
|
+
|
|
3838
|
+
def validate_control_kind(self, value: SchunkEGxControlKindEnum) -> Tuple[bool, str]:
|
|
3839
|
+
if value is None:
|
|
3840
|
+
return [False, "control_kind is required for SchunkEGxGripperCommandRequest"]
|
|
3841
|
+
|
|
3842
|
+
if not ((isinstance(value, str) and SchunkEGxControlKindEnum in ['move']) or isinstance(value, SchunkEGxControlKindEnum)):
|
|
3843
|
+
return [False, "control_kind must be of type SchunkEGxControlKindEnum for SchunkEGxGripperCommandRequest, got " + type(value).__name__]
|
|
3844
|
+
|
|
3845
|
+
return [True, ""]
|
|
3846
|
+
|
|
3847
|
+
def __post_init__(self):
|
|
3848
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
3849
|
+
is_valid, error_str = self.validate_target_grip_width(self.target_grip_width)
|
|
3850
|
+
if not is_valid:
|
|
3851
|
+
raise TypeError(error_str)
|
|
3852
|
+
is_valid, error_str = self.validate_control_kind(self.control_kind)
|
|
3853
|
+
if not is_valid:
|
|
3854
|
+
raise TypeError(error_str)
|
|
3855
|
+
|
|
3856
|
+
def parse_schunk_e_gx_gripper_command_request(data: object):
|
|
3857
|
+
return SchunkEGxGripperCommandRequest(
|
|
3858
|
+
target_grip_width=parse_linear_unit(data["target_grip_width"]) if "target_grip_width" in data else None,
|
|
3859
|
+
control_kind=parse_schunk_e_gx_control_kind_enum(data["control_kind"]) if "control_kind" in data else None,
|
|
3860
|
+
)
|
|
3861
|
+
|
|
3862
|
+
def serialize_schunk_e_gx_gripper_command_request(data: SchunkEGxGripperCommandRequest) -> object:
|
|
3863
|
+
return {
|
|
3864
|
+
"target_grip_width": None if data.target_grip_width is None else serialize_linear_unit(data.target_grip_width),
|
|
3865
|
+
"control_kind": serialize_schunk_e_gx_control_kind_enum(data.control_kind),
|
|
3866
|
+
}
|
|
3867
|
+
|
|
3868
|
+
@dataclass
|
|
3869
|
+
class GripperConfiguration:
|
|
3870
|
+
"""Configuration of gripper, also known as End Effector"""
|
|
3871
|
+
kind: Union[GripperKindEnum, None] = None
|
|
3872
|
+
onrobot_2fg7: Union[OnRobot2FG7GripperConfiguration, None] = None
|
|
3873
|
+
onrobot_2fg14: Union[OnRobot2FG14GripperConfiguration, None] = None
|
|
3874
|
+
onrobot_3fg15: Union[OnRobot3FG15GripperConfiguration, None] = None
|
|
3875
|
+
onrobot_screwdriver: Union[OnRobotScrewdriverConfiguration, None] = None
|
|
3876
|
+
dh_ag: Union[DHAGGripperConfiguration, None] = None
|
|
3877
|
+
dh_pgc: Union[DHPGCGripperConfiguration, None] = None
|
|
3878
|
+
dh_cgi: Union[DHCGIGripperConfiguration, None] = None
|
|
3879
|
+
|
|
3880
|
+
def validate_kind(self, value: GripperKindEnum) -> Tuple[bool, str]:
|
|
3881
|
+
if value is None:
|
|
3882
|
+
return [False, "kind is required for GripperConfiguration"]
|
|
3883
|
+
|
|
3884
|
+
if not ((isinstance(value, str) and GripperKindEnum in ['onrobot_2fg7', 'onrobot_2fg14', 'onrobot_3fg15', 'onrobot_screwdriver', 'dh_ag', 'dh_pgc', 'dh_cgi', 'schunk_egx', 'none_connected']) or isinstance(value, GripperKindEnum)):
|
|
3885
|
+
return [False, "kind must be of type GripperKindEnum for GripperConfiguration, got " + type(value).__name__]
|
|
3886
|
+
|
|
3887
|
+
return [True, ""]
|
|
3888
|
+
|
|
3889
|
+
def validate_onrobot_2fg7(self, value: OnRobot2FG7GripperConfiguration) -> Tuple[bool, str]:
|
|
3890
|
+
if value is None:
|
|
3891
|
+
return [True, ""]
|
|
3892
|
+
|
|
3893
|
+
if not isinstance(value, OnRobot2FG7GripperConfiguration):
|
|
3894
|
+
return [False, "onrobot_2fg7 must be of type OnRobot2FG7GripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3895
|
+
|
|
3896
|
+
return [True, ""]
|
|
3897
|
+
|
|
3898
|
+
def validate_onrobot_2fg14(self, value: OnRobot2FG14GripperConfiguration) -> Tuple[bool, str]:
|
|
3899
|
+
if value is None:
|
|
3900
|
+
return [True, ""]
|
|
3901
|
+
|
|
3902
|
+
if not isinstance(value, OnRobot2FG14GripperConfiguration):
|
|
3903
|
+
return [False, "onrobot_2fg14 must be of type OnRobot2FG14GripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3904
|
+
|
|
3905
|
+
return [True, ""]
|
|
3906
|
+
|
|
3907
|
+
def validate_onrobot_3fg15(self, value: OnRobot3FG15GripperConfiguration) -> Tuple[bool, str]:
|
|
3908
|
+
if value is None:
|
|
3909
|
+
return [True, ""]
|
|
3910
|
+
|
|
3911
|
+
if not isinstance(value, OnRobot3FG15GripperConfiguration):
|
|
3912
|
+
return [False, "onrobot_3fg15 must be of type OnRobot3FG15GripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3913
|
+
|
|
3914
|
+
return [True, ""]
|
|
3915
|
+
|
|
3916
|
+
def validate_onrobot_screwdriver(self, value: OnRobotScrewdriverConfiguration) -> Tuple[bool, str]:
|
|
3917
|
+
if value is None:
|
|
3918
|
+
return [True, ""]
|
|
3919
|
+
|
|
3920
|
+
if not isinstance(value, OnRobotScrewdriverConfiguration):
|
|
3921
|
+
return [False, "onrobot_screwdriver must be of type OnRobotScrewdriverConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3922
|
+
|
|
3923
|
+
return [True, ""]
|
|
3924
|
+
|
|
3925
|
+
def validate_dh_ag(self, value: DHAGGripperConfiguration) -> Tuple[bool, str]:
|
|
3926
|
+
if value is None:
|
|
3927
|
+
return [True, ""]
|
|
3928
|
+
|
|
3929
|
+
if not isinstance(value, DHAGGripperConfiguration):
|
|
3930
|
+
return [False, "dh_ag must be of type DHAGGripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3931
|
+
|
|
3932
|
+
return [True, ""]
|
|
3933
|
+
|
|
3934
|
+
def validate_dh_pgc(self, value: DHPGCGripperConfiguration) -> Tuple[bool, str]:
|
|
3935
|
+
if value is None:
|
|
3936
|
+
return [True, ""]
|
|
3937
|
+
|
|
3938
|
+
if not isinstance(value, DHPGCGripperConfiguration):
|
|
3939
|
+
return [False, "dh_pgc must be of type DHPGCGripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3940
|
+
|
|
3941
|
+
return [True, ""]
|
|
3942
|
+
|
|
3943
|
+
def validate_dh_cgi(self, value: DHCGIGripperConfiguration) -> Tuple[bool, str]:
|
|
3944
|
+
if value is None:
|
|
3945
|
+
return [True, ""]
|
|
3946
|
+
|
|
3947
|
+
if not isinstance(value, DHCGIGripperConfiguration):
|
|
3948
|
+
return [False, "dh_cgi must be of type DHCGIGripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3949
|
+
|
|
3950
|
+
return [True, ""]
|
|
3951
|
+
|
|
3952
|
+
def __post_init__(self):
|
|
3953
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
3954
|
+
is_valid, error_str = self.validate_kind(self.kind)
|
|
3955
|
+
if not is_valid:
|
|
3956
|
+
raise TypeError(error_str)
|
|
3957
|
+
is_valid, error_str = self.validate_onrobot_2fg7(self.onrobot_2fg7)
|
|
3958
|
+
if not is_valid:
|
|
3959
|
+
raise TypeError(error_str)
|
|
3960
|
+
is_valid, error_str = self.validate_onrobot_2fg14(self.onrobot_2fg14)
|
|
3961
|
+
if not is_valid:
|
|
3962
|
+
raise TypeError(error_str)
|
|
3963
|
+
is_valid, error_str = self.validate_onrobot_3fg15(self.onrobot_3fg15)
|
|
3964
|
+
if not is_valid:
|
|
3965
|
+
raise TypeError(error_str)
|
|
3966
|
+
is_valid, error_str = self.validate_onrobot_screwdriver(self.onrobot_screwdriver)
|
|
3967
|
+
if not is_valid:
|
|
3968
|
+
raise TypeError(error_str)
|
|
3969
|
+
is_valid, error_str = self.validate_dh_ag(self.dh_ag)
|
|
3970
|
+
if not is_valid:
|
|
3971
|
+
raise TypeError(error_str)
|
|
3972
|
+
is_valid, error_str = self.validate_dh_pgc(self.dh_pgc)
|
|
3973
|
+
if not is_valid:
|
|
3974
|
+
raise TypeError(error_str)
|
|
3975
|
+
is_valid, error_str = self.validate_dh_cgi(self.dh_cgi)
|
|
3976
|
+
if not is_valid:
|
|
3977
|
+
raise TypeError(error_str)
|
|
3978
|
+
|
|
3979
|
+
def parse_gripper_configuration(data: object):
|
|
3980
|
+
return GripperConfiguration(
|
|
3981
|
+
kind=parse_gripper_kind_enum(data["kind"]) if "kind" in data else None,
|
|
3982
|
+
onrobot_2fg7=parse_on_robot_2_fg_7_gripper_configuration(data["onrobot_2fg7"]) if "onrobot_2fg7" in data else None,
|
|
3983
|
+
onrobot_2fg14=parse_on_robot_2_fg_14_gripper_configuration(data["onrobot_2fg14"]) if "onrobot_2fg14" in data else None,
|
|
3984
|
+
onrobot_3fg15=parse_on_robot_3_fg_15_gripper_configuration(data["onrobot_3fg15"]) if "onrobot_3fg15" in data else None,
|
|
3985
|
+
onrobot_screwdriver=parse_on_robot_screwdriver_configuration(data["onrobot_screwdriver"]) if "onrobot_screwdriver" in data else None,
|
|
3986
|
+
dh_ag=parse_dhag_gripper_configuration(data["dh_ag"]) if "dh_ag" in data else None,
|
|
3987
|
+
dh_pgc=parse_dhpgc_gripper_configuration(data["dh_pgc"]) if "dh_pgc" in data else None,
|
|
3988
|
+
dh_cgi=parse_dhcgi_gripper_configuration(data["dh_cgi"]) if "dh_cgi" in data else None,
|
|
3989
|
+
)
|
|
3990
|
+
|
|
3991
|
+
def serialize_gripper_configuration(data: GripperConfiguration) -> object:
|
|
3992
|
+
return {
|
|
3993
|
+
"kind": serialize_gripper_kind_enum(data.kind),
|
|
3994
|
+
"onrobot_2fg7": None if data.onrobot_2fg7 is None else serialize_on_robot_2_fg_7_gripper_configuration(data.onrobot_2fg7),
|
|
3995
|
+
"onrobot_2fg14": None if data.onrobot_2fg14 is None else serialize_on_robot_2_fg_14_gripper_configuration(data.onrobot_2fg14),
|
|
3996
|
+
"onrobot_3fg15": None if data.onrobot_3fg15 is None else serialize_on_robot_3_fg_15_gripper_configuration(data.onrobot_3fg15),
|
|
3997
|
+
"onrobot_screwdriver": None if data.onrobot_screwdriver is None else serialize_on_robot_screwdriver_configuration(data.onrobot_screwdriver),
|
|
3998
|
+
"dh_ag": None if data.dh_ag is None else serialize_dhag_gripper_configuration(data.dh_ag),
|
|
3999
|
+
"dh_pgc": None if data.dh_pgc is None else serialize_dhpgc_gripper_configuration(data.dh_pgc),
|
|
4000
|
+
"dh_cgi": None if data.dh_cgi is None else serialize_dhcgi_gripper_configuration(data.dh_cgi),
|
|
4001
|
+
}
|
|
4002
|
+
|
|
1539
4003
|
@dataclass
|
|
1540
4004
|
class PlanesPaginatedResponse:
|
|
1541
4005
|
"""Paginated response containing plane data"""
|
|
@@ -1586,6 +4050,7 @@ class PositionAndOrientation:
|
|
|
1586
4050
|
"""Position of the arm tooltip"""
|
|
1587
4051
|
axis_alignment: Union[str, None] = None
|
|
1588
4052
|
reference_frame: Union[str, None] = None
|
|
4053
|
+
local_accuracy_calibration: Union[str, None] = None
|
|
1589
4054
|
position: Union[Position, None] = None
|
|
1590
4055
|
orientation: Union[Orientation, None] = None
|
|
1591
4056
|
|
|
@@ -1607,6 +4072,15 @@ class PositionAndOrientation:
|
|
|
1607
4072
|
|
|
1608
4073
|
return [True, ""]
|
|
1609
4074
|
|
|
4075
|
+
def validate_local_accuracy_calibration(self, value: str) -> Tuple[bool, str]:
|
|
4076
|
+
if value is None:
|
|
4077
|
+
return [True, ""]
|
|
4078
|
+
|
|
4079
|
+
if not isinstance(value, str):
|
|
4080
|
+
return [False, "local_accuracy_calibration must be of type str for PositionAndOrientation, got " + type(value).__name__]
|
|
4081
|
+
|
|
4082
|
+
return [True, ""]
|
|
4083
|
+
|
|
1610
4084
|
def validate_position(self, value: Position) -> Tuple[bool, str]:
|
|
1611
4085
|
if value is None:
|
|
1612
4086
|
return [False, "position is required for PositionAndOrientation"]
|
|
@@ -1631,6 +4105,9 @@ class PositionAndOrientation:
|
|
|
1631
4105
|
if not is_valid:
|
|
1632
4106
|
raise TypeError(error_str)
|
|
1633
4107
|
is_valid, error_str = self.validate_reference_frame(self.reference_frame)
|
|
4108
|
+
if not is_valid:
|
|
4109
|
+
raise TypeError(error_str)
|
|
4110
|
+
is_valid, error_str = self.validate_local_accuracy_calibration(self.local_accuracy_calibration)
|
|
1634
4111
|
if not is_valid:
|
|
1635
4112
|
raise TypeError(error_str)
|
|
1636
4113
|
is_valid, error_str = self.validate_position(self.position)
|
|
@@ -1644,6 +4121,7 @@ def parse_position_and_orientation(data: object):
|
|
|
1644
4121
|
return PositionAndOrientation(
|
|
1645
4122
|
axis_alignment=parse_str(data["axis_alignment"]) if "axis_alignment" in data else None,
|
|
1646
4123
|
reference_frame=parse_str(data["reference_frame"]) if "reference_frame" in data else None,
|
|
4124
|
+
local_accuracy_calibration=parse_str(data["local_accuracy_calibration"]) if "local_accuracy_calibration" in data else None,
|
|
1647
4125
|
position=parse_position(data["position"]) if "position" in data else None,
|
|
1648
4126
|
orientation=parse_orientation(data["orientation"]) if "orientation" in data else None,
|
|
1649
4127
|
)
|
|
@@ -1652,10 +4130,71 @@ def serialize_position_and_orientation(data: PositionAndOrientation) -> object:
|
|
|
1652
4130
|
return {
|
|
1653
4131
|
"axis_alignment": None if data.axis_alignment is None else serialize_str(data.axis_alignment),
|
|
1654
4132
|
"reference_frame": None if data.reference_frame is None else serialize_str(data.reference_frame),
|
|
4133
|
+
"local_accuracy_calibration": None if data.local_accuracy_calibration is None else serialize_str(data.local_accuracy_calibration),
|
|
1655
4134
|
"position": serialize_position(data.position),
|
|
1656
4135
|
"orientation": serialize_orientation(data.orientation),
|
|
1657
4136
|
}
|
|
1658
4137
|
|
|
4138
|
+
@dataclass
|
|
4139
|
+
class FailureStateResponse:
|
|
4140
|
+
"""Failure state response informs user of how and whether the robot may be recovered."""
|
|
4141
|
+
status: Union[RobotStatusEnum, None] = None
|
|
4142
|
+
failed: Union[bool, None] = None
|
|
4143
|
+
failure: Union[FailureStateDetails, None] = None
|
|
4144
|
+
|
|
4145
|
+
def validate_status(self, value: RobotStatusEnum) -> Tuple[bool, str]:
|
|
4146
|
+
if value is None:
|
|
4147
|
+
return [True, ""]
|
|
4148
|
+
|
|
4149
|
+
if not ((isinstance(value, str) and RobotStatusEnum in ['Idle', 'RunningAdHocCommand', 'RoutineRunning', 'Antigravity', 'AntigravitySlow', 'Failure', 'Recovering']) or isinstance(value, RobotStatusEnum)):
|
|
4150
|
+
return [False, "status must be of type RobotStatusEnum for FailureStateResponse, got " + type(value).__name__]
|
|
4151
|
+
|
|
4152
|
+
return [True, ""]
|
|
4153
|
+
|
|
4154
|
+
def validate_failed(self, value: bool) -> Tuple[bool, str]:
|
|
4155
|
+
if value is None:
|
|
4156
|
+
return [True, ""]
|
|
4157
|
+
|
|
4158
|
+
if not isinstance(value, bool):
|
|
4159
|
+
return [False, "failed must be of type bool for FailureStateResponse, got " + type(value).__name__]
|
|
4160
|
+
|
|
4161
|
+
return [True, ""]
|
|
4162
|
+
|
|
4163
|
+
def validate_failure(self, value: FailureStateDetails) -> Tuple[bool, str]:
|
|
4164
|
+
if value is None:
|
|
4165
|
+
return [True, ""]
|
|
4166
|
+
|
|
4167
|
+
if not isinstance(value, FailureStateDetails):
|
|
4168
|
+
return [False, "failure must be of type FailureStateDetails for FailureStateResponse, got " + type(value).__name__]
|
|
4169
|
+
|
|
4170
|
+
return [True, ""]
|
|
4171
|
+
|
|
4172
|
+
def __post_init__(self):
|
|
4173
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
4174
|
+
is_valid, error_str = self.validate_status(self.status)
|
|
4175
|
+
if not is_valid:
|
|
4176
|
+
raise TypeError(error_str)
|
|
4177
|
+
is_valid, error_str = self.validate_failed(self.failed)
|
|
4178
|
+
if not is_valid:
|
|
4179
|
+
raise TypeError(error_str)
|
|
4180
|
+
is_valid, error_str = self.validate_failure(self.failure)
|
|
4181
|
+
if not is_valid:
|
|
4182
|
+
raise TypeError(error_str)
|
|
4183
|
+
|
|
4184
|
+
def parse_failure_state_response(data: object):
|
|
4185
|
+
return FailureStateResponse(
|
|
4186
|
+
status=parse_robot_status_enum(data["status"]) if "status" in data else None,
|
|
4187
|
+
failed=parse_bool(data["failed"]) if "failed" in data else None,
|
|
4188
|
+
failure=parse_failure_state_details(data["failure"]) if "failure" in data else None,
|
|
4189
|
+
)
|
|
4190
|
+
|
|
4191
|
+
def serialize_failure_state_response(data: FailureStateResponse) -> object:
|
|
4192
|
+
return {
|
|
4193
|
+
"status": None if data.status is None else serialize_robot_status_enum(data.status),
|
|
4194
|
+
"failed": None if data.failed is None else serialize_bool(data.failed),
|
|
4195
|
+
"failure": None if data.failure is None else serialize_failure_state_details(data.failure),
|
|
4196
|
+
}
|
|
4197
|
+
|
|
1659
4198
|
@dataclass
|
|
1660
4199
|
class ArmPositionUpdateRequestResponseFormat:
|
|
1661
4200
|
"""Specify how the response should be sent
|
|
@@ -1716,13 +4255,18 @@ class GripperCommandRequest:
|
|
|
1716
4255
|
"""
|
|
1717
4256
|
kind: Union[GripperKindEnum, None] = None
|
|
1718
4257
|
onrobot_2fg7: Union[OnRobot2FG7GripperCommandRequest, None] = None
|
|
4258
|
+
onrobot_2fg14: Union[OnRobot2FG14GripperCommandRequest, None] = None
|
|
1719
4259
|
onrobot_3fg15: Union[OnRobot3FG15GripperCommandRequest, None] = None
|
|
4260
|
+
dh_ag: Union[DHAGGripperCommandRequest, None] = None
|
|
4261
|
+
dh_pgc: Union[DHPGCGripperCommandRequest, None] = None
|
|
4262
|
+
dh_cgi: Union[DHCGIGripperCommandRequest, None] = None
|
|
4263
|
+
schunk_egx: Union[SchunkEGxGripperCommandRequest, None] = None
|
|
1720
4264
|
|
|
1721
4265
|
def validate_kind(self, value: GripperKindEnum) -> Tuple[bool, str]:
|
|
1722
4266
|
if value is None:
|
|
1723
4267
|
return [False, "kind is required for GripperCommandRequest"]
|
|
1724
4268
|
|
|
1725
|
-
if not ((isinstance(value, str) and GripperKindEnum in ['onrobot_2fg7', 'onrobot_3fg15', 'none_connected']) or isinstance(value, GripperKindEnum)):
|
|
4269
|
+
if not ((isinstance(value, str) and GripperKindEnum in ['onrobot_2fg7', 'onrobot_2fg14', 'onrobot_3fg15', 'onrobot_screwdriver', 'dh_ag', 'dh_pgc', 'dh_cgi', 'schunk_egx', 'none_connected']) or isinstance(value, GripperKindEnum)):
|
|
1726
4270
|
return [False, "kind must be of type GripperKindEnum for GripperCommandRequest, got " + type(value).__name__]
|
|
1727
4271
|
|
|
1728
4272
|
return [True, ""]
|
|
@@ -1736,6 +4280,15 @@ class GripperCommandRequest:
|
|
|
1736
4280
|
|
|
1737
4281
|
return [True, ""]
|
|
1738
4282
|
|
|
4283
|
+
def validate_onrobot_2fg14(self, value: OnRobot2FG14GripperCommandRequest) -> Tuple[bool, str]:
|
|
4284
|
+
if value is None:
|
|
4285
|
+
return [True, ""]
|
|
4286
|
+
|
|
4287
|
+
if not isinstance(value, OnRobot2FG14GripperCommandRequest):
|
|
4288
|
+
return [False, "onrobot_2fg14 must be of type OnRobot2FG14GripperCommandRequest for GripperCommandRequest, got " + type(value).__name__]
|
|
4289
|
+
|
|
4290
|
+
return [True, ""]
|
|
4291
|
+
|
|
1739
4292
|
def validate_onrobot_3fg15(self, value: OnRobot3FG15GripperCommandRequest) -> Tuple[bool, str]:
|
|
1740
4293
|
if value is None:
|
|
1741
4294
|
return [True, ""]
|
|
@@ -1745,30 +4298,91 @@ class GripperCommandRequest:
|
|
|
1745
4298
|
|
|
1746
4299
|
return [True, ""]
|
|
1747
4300
|
|
|
4301
|
+
def validate_dh_ag(self, value: DHAGGripperCommandRequest) -> Tuple[bool, str]:
|
|
4302
|
+
if value is None:
|
|
4303
|
+
return [True, ""]
|
|
4304
|
+
|
|
4305
|
+
if not isinstance(value, DHAGGripperCommandRequest):
|
|
4306
|
+
return [False, "dh_ag must be of type DHAGGripperCommandRequest for GripperCommandRequest, got " + type(value).__name__]
|
|
4307
|
+
|
|
4308
|
+
return [True, ""]
|
|
4309
|
+
|
|
4310
|
+
def validate_dh_pgc(self, value: DHPGCGripperCommandRequest) -> Tuple[bool, str]:
|
|
4311
|
+
if value is None:
|
|
4312
|
+
return [True, ""]
|
|
4313
|
+
|
|
4314
|
+
if not isinstance(value, DHPGCGripperCommandRequest):
|
|
4315
|
+
return [False, "dh_pgc must be of type DHPGCGripperCommandRequest for GripperCommandRequest, got " + type(value).__name__]
|
|
4316
|
+
|
|
4317
|
+
return [True, ""]
|
|
4318
|
+
|
|
4319
|
+
def validate_dh_cgi(self, value: DHCGIGripperCommandRequest) -> Tuple[bool, str]:
|
|
4320
|
+
if value is None:
|
|
4321
|
+
return [True, ""]
|
|
4322
|
+
|
|
4323
|
+
if not isinstance(value, DHCGIGripperCommandRequest):
|
|
4324
|
+
return [False, "dh_cgi must be of type DHCGIGripperCommandRequest for GripperCommandRequest, got " + type(value).__name__]
|
|
4325
|
+
|
|
4326
|
+
return [True, ""]
|
|
4327
|
+
|
|
4328
|
+
def validate_schunk_egx(self, value: SchunkEGxGripperCommandRequest) -> Tuple[bool, str]:
|
|
4329
|
+
if value is None:
|
|
4330
|
+
return [True, ""]
|
|
4331
|
+
|
|
4332
|
+
if not isinstance(value, SchunkEGxGripperCommandRequest):
|
|
4333
|
+
return [False, "schunk_egx must be of type SchunkEGxGripperCommandRequest for GripperCommandRequest, got " + type(value).__name__]
|
|
4334
|
+
|
|
4335
|
+
return [True, ""]
|
|
4336
|
+
|
|
1748
4337
|
def __post_init__(self):
|
|
1749
4338
|
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1750
4339
|
is_valid, error_str = self.validate_kind(self.kind)
|
|
1751
4340
|
if not is_valid:
|
|
1752
4341
|
raise TypeError(error_str)
|
|
1753
4342
|
is_valid, error_str = self.validate_onrobot_2fg7(self.onrobot_2fg7)
|
|
4343
|
+
if not is_valid:
|
|
4344
|
+
raise TypeError(error_str)
|
|
4345
|
+
is_valid, error_str = self.validate_onrobot_2fg14(self.onrobot_2fg14)
|
|
1754
4346
|
if not is_valid:
|
|
1755
4347
|
raise TypeError(error_str)
|
|
1756
4348
|
is_valid, error_str = self.validate_onrobot_3fg15(self.onrobot_3fg15)
|
|
1757
4349
|
if not is_valid:
|
|
1758
4350
|
raise TypeError(error_str)
|
|
4351
|
+
is_valid, error_str = self.validate_dh_ag(self.dh_ag)
|
|
4352
|
+
if not is_valid:
|
|
4353
|
+
raise TypeError(error_str)
|
|
4354
|
+
is_valid, error_str = self.validate_dh_pgc(self.dh_pgc)
|
|
4355
|
+
if not is_valid:
|
|
4356
|
+
raise TypeError(error_str)
|
|
4357
|
+
is_valid, error_str = self.validate_dh_cgi(self.dh_cgi)
|
|
4358
|
+
if not is_valid:
|
|
4359
|
+
raise TypeError(error_str)
|
|
4360
|
+
is_valid, error_str = self.validate_schunk_egx(self.schunk_egx)
|
|
4361
|
+
if not is_valid:
|
|
4362
|
+
raise TypeError(error_str)
|
|
1759
4363
|
|
|
1760
4364
|
def parse_gripper_command_request(data: object):
|
|
1761
4365
|
return GripperCommandRequest(
|
|
1762
4366
|
kind=parse_gripper_kind_enum(data["kind"]) if "kind" in data else None,
|
|
1763
4367
|
onrobot_2fg7=parse_on_robot_2_fg_7_gripper_command_request(data["onrobot_2fg7"]) if "onrobot_2fg7" in data else None,
|
|
4368
|
+
onrobot_2fg14=parse_on_robot_2_fg_14_gripper_command_request(data["onrobot_2fg14"]) if "onrobot_2fg14" in data else None,
|
|
1764
4369
|
onrobot_3fg15=parse_on_robot_3_fg_15_gripper_command_request(data["onrobot_3fg15"]) if "onrobot_3fg15" in data else None,
|
|
4370
|
+
dh_ag=parse_dhag_gripper_command_request(data["dh_ag"]) if "dh_ag" in data else None,
|
|
4371
|
+
dh_pgc=parse_dhpgc_gripper_command_request(data["dh_pgc"]) if "dh_pgc" in data else None,
|
|
4372
|
+
dh_cgi=parse_dhcgi_gripper_command_request(data["dh_cgi"]) if "dh_cgi" in data else None,
|
|
4373
|
+
schunk_egx=parse_schunk_e_gx_gripper_command_request(data["schunk_egx"]) if "schunk_egx" in data else None,
|
|
1765
4374
|
)
|
|
1766
4375
|
|
|
1767
4376
|
def serialize_gripper_command_request(data: GripperCommandRequest) -> object:
|
|
1768
4377
|
return {
|
|
1769
4378
|
"kind": serialize_gripper_kind_enum(data.kind),
|
|
1770
4379
|
"onrobot_2fg7": None if data.onrobot_2fg7 is None else serialize_on_robot_2_fg_7_gripper_command_request(data.onrobot_2fg7),
|
|
4380
|
+
"onrobot_2fg14": None if data.onrobot_2fg14 is None else serialize_on_robot_2_fg_14_gripper_command_request(data.onrobot_2fg14),
|
|
1771
4381
|
"onrobot_3fg15": None if data.onrobot_3fg15 is None else serialize_on_robot_3_fg_15_gripper_command_request(data.onrobot_3fg15),
|
|
4382
|
+
"dh_ag": None if data.dh_ag is None else serialize_dhag_gripper_command_request(data.dh_ag),
|
|
4383
|
+
"dh_pgc": None if data.dh_pgc is None else serialize_dhpgc_gripper_command_request(data.dh_pgc),
|
|
4384
|
+
"dh_cgi": None if data.dh_cgi is None else serialize_dhcgi_gripper_command_request(data.dh_cgi),
|
|
4385
|
+
"schunk_egx": None if data.schunk_egx is None else serialize_schunk_e_gx_gripper_command_request(data.schunk_egx),
|
|
1772
4386
|
}
|
|
1773
4387
|
|
|
1774
4388
|
@dataclass
|