standardbots 2.20241003.28__py3-none-any.whl → 2.20241003.30__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/models.py +1186 -122
- {standardbots-2.20241003.28.dist-info → standardbots-2.20241003.30.dist-info}/METADATA +1 -1
- standardbots-2.20241003.30.dist-info/RECORD +8 -0
- standardbots-2.20241003.28.dist-info/RECORD +0 -8
- {standardbots-2.20241003.28.dist-info → standardbots-2.20241003.30.dist-info}/WHEEL +0 -0
- {standardbots-2.20241003.28.dist-info → standardbots-2.20241003.30.dist-info}/top_level.txt +0 -0
|
@@ -915,6 +915,8 @@ class GripperKindEnum(Enum):
|
|
|
915
915
|
"""An OnRobot 2FG14 Gripper is connected"""
|
|
916
916
|
Onrobot3Fg15 = "onrobot_3fg15"
|
|
917
917
|
"""An OnRobot 3FG15 Gripper is connected"""
|
|
918
|
+
OnrobotScrewdriver = "onrobot_screwdriver"
|
|
919
|
+
"""An OnRobot Screwdriver is connected"""
|
|
918
920
|
DhAg = "dh_ag"
|
|
919
921
|
"""A DH AG Gripper is connected"""
|
|
920
922
|
DhPgc = "dh_pgc"
|
|
@@ -1020,6 +1022,213 @@ def parse_on_robot_3_fg_15_control_kind_enum(data: object) -> OnRobot3FG15Contro
|
|
|
1020
1022
|
def serialize_on_robot_3_fg_15_control_kind_enum(data: Union[OnRobot3FG15ControlKindEnum, str]) -> object:
|
|
1021
1023
|
return OnRobot3FG15ControlKindEnum(data).value
|
|
1022
1024
|
|
|
1025
|
+
class OnRobotGripKindEnum(Enum):
|
|
1026
|
+
Inward = "inward"
|
|
1027
|
+
"""Enum Inward = `inward`"""
|
|
1028
|
+
Outward = "outward"
|
|
1029
|
+
"""Enum Outward = `outward`"""
|
|
1030
|
+
|
|
1031
|
+
def parse_on_robot_grip_kind_enum(data: object) -> OnRobotGripKindEnum:
|
|
1032
|
+
return OnRobotGripKindEnum(data)
|
|
1033
|
+
|
|
1034
|
+
def serialize_on_robot_grip_kind_enum(data: Union[OnRobotGripKindEnum, str]) -> object:
|
|
1035
|
+
return OnRobotGripKindEnum(data).value
|
|
1036
|
+
|
|
1037
|
+
@dataclass
|
|
1038
|
+
class OnRobotScrewdriverConfiguration:
|
|
1039
|
+
"""Configuration for OnRobot Screwdriver"""
|
|
1040
|
+
status: Union[int, None] = None
|
|
1041
|
+
error: Union[str, None] = None
|
|
1042
|
+
busy: Union[bool, None] = None
|
|
1043
|
+
additional_results: Union[int, None] = None
|
|
1044
|
+
current_torque: Union[float, None] = None
|
|
1045
|
+
shank_position: Union[float, None] = None
|
|
1046
|
+
torque_angle_gradient: Union[float, None] = None
|
|
1047
|
+
achieved_torque: Union[float, None] = None
|
|
1048
|
+
target_force: Union[float, None] = None
|
|
1049
|
+
target_torque: Union[float, None] = None
|
|
1050
|
+
quick_changer_version: Union[int, None] = None
|
|
1051
|
+
uncalibrated_error: Union[bool, None] = None
|
|
1052
|
+
|
|
1053
|
+
def validate_status(self, value: int) -> Tuple[bool, str]:
|
|
1054
|
+
if value is None:
|
|
1055
|
+
return [True, ""]
|
|
1056
|
+
|
|
1057
|
+
if not isinstance(value, int):
|
|
1058
|
+
return [False, "status must be of type int for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1059
|
+
|
|
1060
|
+
return [True, ""]
|
|
1061
|
+
|
|
1062
|
+
def validate_error(self, value: str) -> Tuple[bool, str]:
|
|
1063
|
+
if value is None:
|
|
1064
|
+
return [True, ""]
|
|
1065
|
+
|
|
1066
|
+
if not isinstance(value, str):
|
|
1067
|
+
return [False, "error must be of type str for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1068
|
+
|
|
1069
|
+
return [True, ""]
|
|
1070
|
+
|
|
1071
|
+
def validate_busy(self, value: bool) -> Tuple[bool, str]:
|
|
1072
|
+
if value is None:
|
|
1073
|
+
return [True, ""]
|
|
1074
|
+
|
|
1075
|
+
if not isinstance(value, bool):
|
|
1076
|
+
return [False, "busy must be of type bool for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1077
|
+
|
|
1078
|
+
return [True, ""]
|
|
1079
|
+
|
|
1080
|
+
def validate_additional_results(self, value: int) -> Tuple[bool, str]:
|
|
1081
|
+
if value is None:
|
|
1082
|
+
return [True, ""]
|
|
1083
|
+
|
|
1084
|
+
if not isinstance(value, int):
|
|
1085
|
+
return [False, "additional_results must be of type int for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1086
|
+
|
|
1087
|
+
return [True, ""]
|
|
1088
|
+
|
|
1089
|
+
def validate_current_torque(self, value: float) -> Tuple[bool, str]:
|
|
1090
|
+
if value is None:
|
|
1091
|
+
return [True, ""]
|
|
1092
|
+
|
|
1093
|
+
if not isinstance(value, float):
|
|
1094
|
+
return [False, "current_torque must be of type float for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1095
|
+
|
|
1096
|
+
return [True, ""]
|
|
1097
|
+
|
|
1098
|
+
def validate_shank_position(self, value: float) -> Tuple[bool, str]:
|
|
1099
|
+
if value is None:
|
|
1100
|
+
return [True, ""]
|
|
1101
|
+
|
|
1102
|
+
if not isinstance(value, float):
|
|
1103
|
+
return [False, "shank_position must be of type float for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1104
|
+
|
|
1105
|
+
return [True, ""]
|
|
1106
|
+
|
|
1107
|
+
def validate_torque_angle_gradient(self, value: float) -> Tuple[bool, str]:
|
|
1108
|
+
if value is None:
|
|
1109
|
+
return [True, ""]
|
|
1110
|
+
|
|
1111
|
+
if not isinstance(value, float):
|
|
1112
|
+
return [False, "torque_angle_gradient must be of type float for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1113
|
+
|
|
1114
|
+
return [True, ""]
|
|
1115
|
+
|
|
1116
|
+
def validate_achieved_torque(self, value: float) -> Tuple[bool, str]:
|
|
1117
|
+
if value is None:
|
|
1118
|
+
return [True, ""]
|
|
1119
|
+
|
|
1120
|
+
if not isinstance(value, float):
|
|
1121
|
+
return [False, "achieved_torque must be of type float for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1122
|
+
|
|
1123
|
+
return [True, ""]
|
|
1124
|
+
|
|
1125
|
+
def validate_target_force(self, value: float) -> Tuple[bool, str]:
|
|
1126
|
+
if value is None:
|
|
1127
|
+
return [True, ""]
|
|
1128
|
+
|
|
1129
|
+
if not isinstance(value, float):
|
|
1130
|
+
return [False, "target_force must be of type float for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1131
|
+
|
|
1132
|
+
return [True, ""]
|
|
1133
|
+
|
|
1134
|
+
def validate_target_torque(self, value: float) -> Tuple[bool, str]:
|
|
1135
|
+
if value is None:
|
|
1136
|
+
return [True, ""]
|
|
1137
|
+
|
|
1138
|
+
if not isinstance(value, float):
|
|
1139
|
+
return [False, "target_torque must be of type float for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1140
|
+
|
|
1141
|
+
return [True, ""]
|
|
1142
|
+
|
|
1143
|
+
def validate_quick_changer_version(self, value: int) -> Tuple[bool, str]:
|
|
1144
|
+
if value is None:
|
|
1145
|
+
return [True, ""]
|
|
1146
|
+
|
|
1147
|
+
if not isinstance(value, int):
|
|
1148
|
+
return [False, "quick_changer_version must be of type int for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1149
|
+
|
|
1150
|
+
return [True, ""]
|
|
1151
|
+
|
|
1152
|
+
def validate_uncalibrated_error(self, value: bool) -> Tuple[bool, str]:
|
|
1153
|
+
if value is None:
|
|
1154
|
+
return [True, ""]
|
|
1155
|
+
|
|
1156
|
+
if not isinstance(value, bool):
|
|
1157
|
+
return [False, "uncalibrated_error must be of type bool for OnRobotScrewdriverConfiguration, got " + type(value).__name__]
|
|
1158
|
+
|
|
1159
|
+
return [True, ""]
|
|
1160
|
+
|
|
1161
|
+
def __post_init__(self):
|
|
1162
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1163
|
+
is_valid, error_str = self.validate_status(self.status)
|
|
1164
|
+
if not is_valid:
|
|
1165
|
+
raise TypeError(error_str)
|
|
1166
|
+
is_valid, error_str = self.validate_error(self.error)
|
|
1167
|
+
if not is_valid:
|
|
1168
|
+
raise TypeError(error_str)
|
|
1169
|
+
is_valid, error_str = self.validate_busy(self.busy)
|
|
1170
|
+
if not is_valid:
|
|
1171
|
+
raise TypeError(error_str)
|
|
1172
|
+
is_valid, error_str = self.validate_additional_results(self.additional_results)
|
|
1173
|
+
if not is_valid:
|
|
1174
|
+
raise TypeError(error_str)
|
|
1175
|
+
is_valid, error_str = self.validate_current_torque(self.current_torque)
|
|
1176
|
+
if not is_valid:
|
|
1177
|
+
raise TypeError(error_str)
|
|
1178
|
+
is_valid, error_str = self.validate_shank_position(self.shank_position)
|
|
1179
|
+
if not is_valid:
|
|
1180
|
+
raise TypeError(error_str)
|
|
1181
|
+
is_valid, error_str = self.validate_torque_angle_gradient(self.torque_angle_gradient)
|
|
1182
|
+
if not is_valid:
|
|
1183
|
+
raise TypeError(error_str)
|
|
1184
|
+
is_valid, error_str = self.validate_achieved_torque(self.achieved_torque)
|
|
1185
|
+
if not is_valid:
|
|
1186
|
+
raise TypeError(error_str)
|
|
1187
|
+
is_valid, error_str = self.validate_target_force(self.target_force)
|
|
1188
|
+
if not is_valid:
|
|
1189
|
+
raise TypeError(error_str)
|
|
1190
|
+
is_valid, error_str = self.validate_target_torque(self.target_torque)
|
|
1191
|
+
if not is_valid:
|
|
1192
|
+
raise TypeError(error_str)
|
|
1193
|
+
is_valid, error_str = self.validate_quick_changer_version(self.quick_changer_version)
|
|
1194
|
+
if not is_valid:
|
|
1195
|
+
raise TypeError(error_str)
|
|
1196
|
+
is_valid, error_str = self.validate_uncalibrated_error(self.uncalibrated_error)
|
|
1197
|
+
if not is_valid:
|
|
1198
|
+
raise TypeError(error_str)
|
|
1199
|
+
|
|
1200
|
+
def parse_on_robot_screwdriver_configuration(data: object):
|
|
1201
|
+
return OnRobotScrewdriverConfiguration(
|
|
1202
|
+
status=parse_i_32(data["status"]) if "status" in data else None,
|
|
1203
|
+
error=parse_str(data["error"]) if "error" in data else None,
|
|
1204
|
+
busy=parse_bool(data["busy"]) if "busy" in data else None,
|
|
1205
|
+
additional_results=parse_i_32(data["additional_results"]) if "additional_results" in data else None,
|
|
1206
|
+
current_torque=parse_f_64(data["current_torque"]) if "current_torque" in data else None,
|
|
1207
|
+
shank_position=parse_f_64(data["shank_position"]) if "shank_position" in data else None,
|
|
1208
|
+
torque_angle_gradient=parse_f_64(data["torque_angle_gradient"]) if "torque_angle_gradient" in data else None,
|
|
1209
|
+
achieved_torque=parse_f_64(data["achieved_torque"]) if "achieved_torque" in data else None,
|
|
1210
|
+
target_force=parse_f_64(data["target_force"]) if "target_force" in data else None,
|
|
1211
|
+
target_torque=parse_f_64(data["target_torque"]) if "target_torque" in data else None,
|
|
1212
|
+
quick_changer_version=parse_i_32(data["quick_changer_version"]) if "quick_changer_version" in data else None,
|
|
1213
|
+
uncalibrated_error=parse_bool(data["uncalibrated_error"]) if "uncalibrated_error" in data else None,
|
|
1214
|
+
)
|
|
1215
|
+
|
|
1216
|
+
def serialize_on_robot_screwdriver_configuration(data: OnRobotScrewdriverConfiguration) -> object:
|
|
1217
|
+
return {
|
|
1218
|
+
"status": None if data.status is None else serialize_i_32(data.status),
|
|
1219
|
+
"error": None if data.error is None else serialize_str(data.error),
|
|
1220
|
+
"busy": None if data.busy is None else serialize_bool(data.busy),
|
|
1221
|
+
"additional_results": None if data.additional_results is None else serialize_i_32(data.additional_results),
|
|
1222
|
+
"current_torque": None if data.current_torque is None else serialize_f_64(data.current_torque),
|
|
1223
|
+
"shank_position": None if data.shank_position is None else serialize_f_64(data.shank_position),
|
|
1224
|
+
"torque_angle_gradient": None if data.torque_angle_gradient is None else serialize_f_64(data.torque_angle_gradient),
|
|
1225
|
+
"achieved_torque": None if data.achieved_torque is None else serialize_f_64(data.achieved_torque),
|
|
1226
|
+
"target_force": None if data.target_force is None else serialize_f_64(data.target_force),
|
|
1227
|
+
"target_torque": None if data.target_torque is None else serialize_f_64(data.target_torque),
|
|
1228
|
+
"quick_changer_version": None if data.quick_changer_version is None else serialize_i_32(data.quick_changer_version),
|
|
1229
|
+
"uncalibrated_error": None if data.uncalibrated_error is None else serialize_bool(data.uncalibrated_error),
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1023
1232
|
class OrientationKindEnum(Enum):
|
|
1024
1233
|
Quaternion = "quaternion"
|
|
1025
1234
|
"""Enum Quaternion = `quaternion`"""
|
|
@@ -1826,81 +2035,6 @@ def serialize_force_unit(data: ForceUnit) -> object:
|
|
|
1826
2035
|
"value": None if data.value is None else serialize_f_64(data.value),
|
|
1827
2036
|
}
|
|
1828
2037
|
|
|
1829
|
-
@dataclass
|
|
1830
|
-
class GripperConfiguration:
|
|
1831
|
-
"""Configuration of gripper, also known as End Effector"""
|
|
1832
|
-
kind: Union[GripperKindEnum, None] = None
|
|
1833
|
-
dh_ag: Union[DHAGGripperConfiguration, None] = None
|
|
1834
|
-
dh_pgc: Union[DHPGCGripperConfiguration, None] = None
|
|
1835
|
-
dh_cgi: Union[DHCGIGripperConfiguration, None] = None
|
|
1836
|
-
|
|
1837
|
-
def validate_kind(self, value: GripperKindEnum) -> Tuple[bool, str]:
|
|
1838
|
-
if value is None:
|
|
1839
|
-
return [False, "kind is required for GripperConfiguration"]
|
|
1840
|
-
|
|
1841
|
-
if not ((isinstance(value, str) and GripperKindEnum in ['onrobot_2fg7', 'onrobot_2fg14', 'onrobot_3fg15', 'dh_ag', 'dh_pgc', 'dh_cgi', 'schunk_egx', 'none_connected']) or isinstance(value, GripperKindEnum)):
|
|
1842
|
-
return [False, "kind must be of type GripperKindEnum for GripperConfiguration, got " + type(value).__name__]
|
|
1843
|
-
|
|
1844
|
-
return [True, ""]
|
|
1845
|
-
|
|
1846
|
-
def validate_dh_ag(self, value: DHAGGripperConfiguration) -> Tuple[bool, str]:
|
|
1847
|
-
if value is None:
|
|
1848
|
-
return [True, ""]
|
|
1849
|
-
|
|
1850
|
-
if not isinstance(value, DHAGGripperConfiguration):
|
|
1851
|
-
return [False, "dh_ag must be of type DHAGGripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
1852
|
-
|
|
1853
|
-
return [True, ""]
|
|
1854
|
-
|
|
1855
|
-
def validate_dh_pgc(self, value: DHPGCGripperConfiguration) -> Tuple[bool, str]:
|
|
1856
|
-
if value is None:
|
|
1857
|
-
return [True, ""]
|
|
1858
|
-
|
|
1859
|
-
if not isinstance(value, DHPGCGripperConfiguration):
|
|
1860
|
-
return [False, "dh_pgc must be of type DHPGCGripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
1861
|
-
|
|
1862
|
-
return [True, ""]
|
|
1863
|
-
|
|
1864
|
-
def validate_dh_cgi(self, value: DHCGIGripperConfiguration) -> Tuple[bool, str]:
|
|
1865
|
-
if value is None:
|
|
1866
|
-
return [True, ""]
|
|
1867
|
-
|
|
1868
|
-
if not isinstance(value, DHCGIGripperConfiguration):
|
|
1869
|
-
return [False, "dh_cgi must be of type DHCGIGripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
1870
|
-
|
|
1871
|
-
return [True, ""]
|
|
1872
|
-
|
|
1873
|
-
def __post_init__(self):
|
|
1874
|
-
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
1875
|
-
is_valid, error_str = self.validate_kind(self.kind)
|
|
1876
|
-
if not is_valid:
|
|
1877
|
-
raise TypeError(error_str)
|
|
1878
|
-
is_valid, error_str = self.validate_dh_ag(self.dh_ag)
|
|
1879
|
-
if not is_valid:
|
|
1880
|
-
raise TypeError(error_str)
|
|
1881
|
-
is_valid, error_str = self.validate_dh_pgc(self.dh_pgc)
|
|
1882
|
-
if not is_valid:
|
|
1883
|
-
raise TypeError(error_str)
|
|
1884
|
-
is_valid, error_str = self.validate_dh_cgi(self.dh_cgi)
|
|
1885
|
-
if not is_valid:
|
|
1886
|
-
raise TypeError(error_str)
|
|
1887
|
-
|
|
1888
|
-
def parse_gripper_configuration(data: object):
|
|
1889
|
-
return GripperConfiguration(
|
|
1890
|
-
kind=parse_gripper_kind_enum(data["kind"]) if "kind" in data else None,
|
|
1891
|
-
dh_ag=parse_dhag_gripper_configuration(data["dh_ag"]) if "dh_ag" in data else None,
|
|
1892
|
-
dh_pgc=parse_dhpgc_gripper_configuration(data["dh_pgc"]) if "dh_pgc" in data else None,
|
|
1893
|
-
dh_cgi=parse_dhcgi_gripper_configuration(data["dh_cgi"]) if "dh_cgi" in data else None,
|
|
1894
|
-
)
|
|
1895
|
-
|
|
1896
|
-
def serialize_gripper_configuration(data: GripperConfiguration) -> object:
|
|
1897
|
-
return {
|
|
1898
|
-
"kind": serialize_gripper_kind_enum(data.kind),
|
|
1899
|
-
"dh_ag": None if data.dh_ag is None else serialize_dhag_gripper_configuration(data.dh_ag),
|
|
1900
|
-
"dh_pgc": None if data.dh_pgc is None else serialize_dhpgc_gripper_configuration(data.dh_pgc),
|
|
1901
|
-
"dh_cgi": None if data.dh_cgi is None else serialize_dhcgi_gripper_configuration(data.dh_cgi),
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
2038
|
@dataclass
|
|
1905
2039
|
class IOStateResponse:
|
|
1906
2040
|
"""Response to a query for the current state of I/O."""
|
|
@@ -2112,70 +2246,865 @@ def serialize_position(data: Position) -> object:
|
|
|
2112
2246
|
"z": None if data.z is None else serialize_f_64(data.z),
|
|
2113
2247
|
}
|
|
2114
2248
|
|
|
2115
|
-
PlanesList = List[Plane]
|
|
2116
|
-
|
|
2117
|
-
def parse_planes_list(data: object) -> PlanesList:
|
|
2118
|
-
return [parse_plane(item) for item in data]
|
|
2119
|
-
|
|
2120
|
-
def serialize_planes_list(data: PlanesList) -> List[object]:
|
|
2121
|
-
return [serialize_plane(item) for item in data]
|
|
2122
|
-
|
|
2123
2249
|
@dataclass
|
|
2124
|
-
class
|
|
2125
|
-
"""
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2250
|
+
class OnRobot2FG14GripperConfiguration:
|
|
2251
|
+
"""Configuration for OnRobot 2FG14 Gripper"""
|
|
2252
|
+
grip_kind: Union[OnRobotGripKindEnum, None] = None
|
|
2253
|
+
grip_detected: Union[bool, None] = None
|
|
2254
|
+
normalized_width_inner: Union[float, None] = None
|
|
2255
|
+
normalized_width_outer: Union[float, None] = None
|
|
2256
|
+
width_inner: Union[float, None] = None
|
|
2257
|
+
min_width_inner: Union[float, None] = None
|
|
2258
|
+
max_width_inner: Union[float, None] = None
|
|
2259
|
+
width_outer: Union[float, None] = None
|
|
2260
|
+
min_width_outer: Union[float, None] = None
|
|
2261
|
+
max_width_outer: Union[float, None] = None
|
|
2262
|
+
force: Union[float, None] = None
|
|
2263
|
+
max_force: Union[float, None] = None
|
|
2264
|
+
finger_mounting_position: Union[float, None] = None
|
|
2265
|
+
finger_offset: Union[float, None] = None
|
|
2266
|
+
finger_angle: Union[float, None] = None
|
|
2267
|
+
finger_length: Union[float, None] = None
|
|
2268
|
+
finger_height: Union[float, None] = None
|
|
2269
|
+
linear_sensor_error: Union[bool, None] = None
|
|
2270
|
+
uncalibrated_error: Union[bool, None] = None
|
|
2271
|
+
|
|
2272
|
+
def validate_grip_kind(self, value: OnRobotGripKindEnum) -> Tuple[bool, str]:
|
|
2130
2273
|
if value is None:
|
|
2131
|
-
return [
|
|
2274
|
+
return [True, ""]
|
|
2132
2275
|
|
|
2133
|
-
if not ((isinstance(value, str) and
|
|
2134
|
-
return [False, "
|
|
2276
|
+
if not ((isinstance(value, str) and OnRobotGripKindEnum in ['inward', 'outward']) or isinstance(value, OnRobotGripKindEnum)):
|
|
2277
|
+
return [False, "grip_kind must be of type OnRobotGripKindEnum for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2135
2278
|
|
|
2136
2279
|
return [True, ""]
|
|
2137
2280
|
|
|
2138
|
-
def
|
|
2281
|
+
def validate_grip_detected(self, value: bool) -> Tuple[bool, str]:
|
|
2139
2282
|
if value is None:
|
|
2140
2283
|
return [True, ""]
|
|
2141
2284
|
|
|
2142
|
-
if not isinstance(value,
|
|
2143
|
-
return [False, "
|
|
2285
|
+
if not isinstance(value, bool):
|
|
2286
|
+
return [False, "grip_detected must be of type bool for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2144
2287
|
|
|
2145
2288
|
return [True, ""]
|
|
2146
2289
|
|
|
2147
|
-
def
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
if not is_valid:
|
|
2151
|
-
raise TypeError(error_str)
|
|
2152
|
-
is_valid, error_str = self.validate_quaternion(self.quaternion)
|
|
2153
|
-
if not is_valid:
|
|
2154
|
-
raise TypeError(error_str)
|
|
2155
|
-
|
|
2156
|
-
def parse_orientation(data: object):
|
|
2157
|
-
return Orientation(
|
|
2158
|
-
kind=parse_orientation_kind_enum(data["kind"]) if "kind" in data else None,
|
|
2159
|
-
quaternion=parse_quaternion(data["quaternion"]) if "quaternion" in data else None,
|
|
2160
|
-
)
|
|
2290
|
+
def validate_normalized_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2291
|
+
if value is None:
|
|
2292
|
+
return [True, ""]
|
|
2161
2293
|
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
"kind": serialize_orientation_kind_enum(data.kind),
|
|
2165
|
-
"quaternion": None if data.quaternion is None else serialize_quaternion(data.quaternion),
|
|
2166
|
-
}
|
|
2294
|
+
if not isinstance(value, float):
|
|
2295
|
+
return [False, "normalized_width_inner must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2167
2296
|
|
|
2168
|
-
|
|
2169
|
-
class RecoveryStatusResponse:
|
|
2170
|
-
"""Recovery status response"""
|
|
2171
|
-
state: Union[RecoveryStateEnum, None] = None
|
|
2297
|
+
return [True, ""]
|
|
2172
2298
|
|
|
2173
|
-
def
|
|
2299
|
+
def validate_normalized_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2174
2300
|
if value is None:
|
|
2175
2301
|
return [True, ""]
|
|
2176
2302
|
|
|
2177
|
-
if not
|
|
2178
|
-
return [False, "
|
|
2303
|
+
if not isinstance(value, float):
|
|
2304
|
+
return [False, "normalized_width_outer must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2305
|
+
|
|
2306
|
+
return [True, ""]
|
|
2307
|
+
|
|
2308
|
+
def validate_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2309
|
+
if value is None:
|
|
2310
|
+
return [True, ""]
|
|
2311
|
+
|
|
2312
|
+
if not isinstance(value, float):
|
|
2313
|
+
return [False, "width_inner must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2314
|
+
|
|
2315
|
+
return [True, ""]
|
|
2316
|
+
|
|
2317
|
+
def validate_min_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2318
|
+
if value is None:
|
|
2319
|
+
return [True, ""]
|
|
2320
|
+
|
|
2321
|
+
if not isinstance(value, float):
|
|
2322
|
+
return [False, "min_width_inner must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2323
|
+
|
|
2324
|
+
return [True, ""]
|
|
2325
|
+
|
|
2326
|
+
def validate_max_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2327
|
+
if value is None:
|
|
2328
|
+
return [True, ""]
|
|
2329
|
+
|
|
2330
|
+
if not isinstance(value, float):
|
|
2331
|
+
return [False, "max_width_inner must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2332
|
+
|
|
2333
|
+
return [True, ""]
|
|
2334
|
+
|
|
2335
|
+
def validate_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2336
|
+
if value is None:
|
|
2337
|
+
return [True, ""]
|
|
2338
|
+
|
|
2339
|
+
if not isinstance(value, float):
|
|
2340
|
+
return [False, "width_outer must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2341
|
+
|
|
2342
|
+
return [True, ""]
|
|
2343
|
+
|
|
2344
|
+
def validate_min_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2345
|
+
if value is None:
|
|
2346
|
+
return [True, ""]
|
|
2347
|
+
|
|
2348
|
+
if not isinstance(value, float):
|
|
2349
|
+
return [False, "min_width_outer must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2350
|
+
|
|
2351
|
+
return [True, ""]
|
|
2352
|
+
|
|
2353
|
+
def validate_max_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2354
|
+
if value is None:
|
|
2355
|
+
return [True, ""]
|
|
2356
|
+
|
|
2357
|
+
if not isinstance(value, float):
|
|
2358
|
+
return [False, "max_width_outer must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2359
|
+
|
|
2360
|
+
return [True, ""]
|
|
2361
|
+
|
|
2362
|
+
def validate_force(self, value: float) -> Tuple[bool, str]:
|
|
2363
|
+
if value is None:
|
|
2364
|
+
return [True, ""]
|
|
2365
|
+
|
|
2366
|
+
if not isinstance(value, float):
|
|
2367
|
+
return [False, "force must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2368
|
+
|
|
2369
|
+
return [True, ""]
|
|
2370
|
+
|
|
2371
|
+
def validate_max_force(self, value: float) -> Tuple[bool, str]:
|
|
2372
|
+
if value is None:
|
|
2373
|
+
return [True, ""]
|
|
2374
|
+
|
|
2375
|
+
if not isinstance(value, float):
|
|
2376
|
+
return [False, "max_force must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2377
|
+
|
|
2378
|
+
return [True, ""]
|
|
2379
|
+
|
|
2380
|
+
def validate_finger_mounting_position(self, value: float) -> Tuple[bool, str]:
|
|
2381
|
+
if value is None:
|
|
2382
|
+
return [True, ""]
|
|
2383
|
+
|
|
2384
|
+
if not isinstance(value, float):
|
|
2385
|
+
return [False, "finger_mounting_position must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2386
|
+
|
|
2387
|
+
return [True, ""]
|
|
2388
|
+
|
|
2389
|
+
def validate_finger_offset(self, value: float) -> Tuple[bool, str]:
|
|
2390
|
+
if value is None:
|
|
2391
|
+
return [True, ""]
|
|
2392
|
+
|
|
2393
|
+
if not isinstance(value, float):
|
|
2394
|
+
return [False, "finger_offset must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2395
|
+
|
|
2396
|
+
return [True, ""]
|
|
2397
|
+
|
|
2398
|
+
def validate_finger_angle(self, value: float) -> Tuple[bool, str]:
|
|
2399
|
+
if value is None:
|
|
2400
|
+
return [True, ""]
|
|
2401
|
+
|
|
2402
|
+
if not isinstance(value, float):
|
|
2403
|
+
return [False, "finger_angle must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2404
|
+
|
|
2405
|
+
return [True, ""]
|
|
2406
|
+
|
|
2407
|
+
def validate_finger_length(self, value: float) -> Tuple[bool, str]:
|
|
2408
|
+
if value is None:
|
|
2409
|
+
return [True, ""]
|
|
2410
|
+
|
|
2411
|
+
if not isinstance(value, float):
|
|
2412
|
+
return [False, "finger_length must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2413
|
+
|
|
2414
|
+
return [True, ""]
|
|
2415
|
+
|
|
2416
|
+
def validate_finger_height(self, value: float) -> Tuple[bool, str]:
|
|
2417
|
+
if value is None:
|
|
2418
|
+
return [True, ""]
|
|
2419
|
+
|
|
2420
|
+
if not isinstance(value, float):
|
|
2421
|
+
return [False, "finger_height must be of type float for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2422
|
+
|
|
2423
|
+
return [True, ""]
|
|
2424
|
+
|
|
2425
|
+
def validate_linear_sensor_error(self, value: bool) -> Tuple[bool, str]:
|
|
2426
|
+
if value is None:
|
|
2427
|
+
return [True, ""]
|
|
2428
|
+
|
|
2429
|
+
if not isinstance(value, bool):
|
|
2430
|
+
return [False, "linear_sensor_error must be of type bool for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2431
|
+
|
|
2432
|
+
return [True, ""]
|
|
2433
|
+
|
|
2434
|
+
def validate_uncalibrated_error(self, value: bool) -> Tuple[bool, str]:
|
|
2435
|
+
if value is None:
|
|
2436
|
+
return [True, ""]
|
|
2437
|
+
|
|
2438
|
+
if not isinstance(value, bool):
|
|
2439
|
+
return [False, "uncalibrated_error must be of type bool for OnRobot2FG14GripperConfiguration, got " + type(value).__name__]
|
|
2440
|
+
|
|
2441
|
+
return [True, ""]
|
|
2442
|
+
|
|
2443
|
+
def __post_init__(self):
|
|
2444
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
2445
|
+
is_valid, error_str = self.validate_grip_kind(self.grip_kind)
|
|
2446
|
+
if not is_valid:
|
|
2447
|
+
raise TypeError(error_str)
|
|
2448
|
+
is_valid, error_str = self.validate_grip_detected(self.grip_detected)
|
|
2449
|
+
if not is_valid:
|
|
2450
|
+
raise TypeError(error_str)
|
|
2451
|
+
is_valid, error_str = self.validate_normalized_width_inner(self.normalized_width_inner)
|
|
2452
|
+
if not is_valid:
|
|
2453
|
+
raise TypeError(error_str)
|
|
2454
|
+
is_valid, error_str = self.validate_normalized_width_outer(self.normalized_width_outer)
|
|
2455
|
+
if not is_valid:
|
|
2456
|
+
raise TypeError(error_str)
|
|
2457
|
+
is_valid, error_str = self.validate_width_inner(self.width_inner)
|
|
2458
|
+
if not is_valid:
|
|
2459
|
+
raise TypeError(error_str)
|
|
2460
|
+
is_valid, error_str = self.validate_min_width_inner(self.min_width_inner)
|
|
2461
|
+
if not is_valid:
|
|
2462
|
+
raise TypeError(error_str)
|
|
2463
|
+
is_valid, error_str = self.validate_max_width_inner(self.max_width_inner)
|
|
2464
|
+
if not is_valid:
|
|
2465
|
+
raise TypeError(error_str)
|
|
2466
|
+
is_valid, error_str = self.validate_width_outer(self.width_outer)
|
|
2467
|
+
if not is_valid:
|
|
2468
|
+
raise TypeError(error_str)
|
|
2469
|
+
is_valid, error_str = self.validate_min_width_outer(self.min_width_outer)
|
|
2470
|
+
if not is_valid:
|
|
2471
|
+
raise TypeError(error_str)
|
|
2472
|
+
is_valid, error_str = self.validate_max_width_outer(self.max_width_outer)
|
|
2473
|
+
if not is_valid:
|
|
2474
|
+
raise TypeError(error_str)
|
|
2475
|
+
is_valid, error_str = self.validate_force(self.force)
|
|
2476
|
+
if not is_valid:
|
|
2477
|
+
raise TypeError(error_str)
|
|
2478
|
+
is_valid, error_str = self.validate_max_force(self.max_force)
|
|
2479
|
+
if not is_valid:
|
|
2480
|
+
raise TypeError(error_str)
|
|
2481
|
+
is_valid, error_str = self.validate_finger_mounting_position(self.finger_mounting_position)
|
|
2482
|
+
if not is_valid:
|
|
2483
|
+
raise TypeError(error_str)
|
|
2484
|
+
is_valid, error_str = self.validate_finger_offset(self.finger_offset)
|
|
2485
|
+
if not is_valid:
|
|
2486
|
+
raise TypeError(error_str)
|
|
2487
|
+
is_valid, error_str = self.validate_finger_angle(self.finger_angle)
|
|
2488
|
+
if not is_valid:
|
|
2489
|
+
raise TypeError(error_str)
|
|
2490
|
+
is_valid, error_str = self.validate_finger_length(self.finger_length)
|
|
2491
|
+
if not is_valid:
|
|
2492
|
+
raise TypeError(error_str)
|
|
2493
|
+
is_valid, error_str = self.validate_finger_height(self.finger_height)
|
|
2494
|
+
if not is_valid:
|
|
2495
|
+
raise TypeError(error_str)
|
|
2496
|
+
is_valid, error_str = self.validate_linear_sensor_error(self.linear_sensor_error)
|
|
2497
|
+
if not is_valid:
|
|
2498
|
+
raise TypeError(error_str)
|
|
2499
|
+
is_valid, error_str = self.validate_uncalibrated_error(self.uncalibrated_error)
|
|
2500
|
+
if not is_valid:
|
|
2501
|
+
raise TypeError(error_str)
|
|
2502
|
+
|
|
2503
|
+
def parse_on_robot_2_fg_14_gripper_configuration(data: object):
|
|
2504
|
+
return OnRobot2FG14GripperConfiguration(
|
|
2505
|
+
grip_kind=parse_on_robot_grip_kind_enum(data["grip_kind"]) if "grip_kind" in data else None,
|
|
2506
|
+
grip_detected=parse_bool(data["grip_detected"]) if "grip_detected" in data else None,
|
|
2507
|
+
normalized_width_inner=parse_f_64(data["normalized_width_inner"]) if "normalized_width_inner" in data else None,
|
|
2508
|
+
normalized_width_outer=parse_f_64(data["normalized_width_outer"]) if "normalized_width_outer" in data else None,
|
|
2509
|
+
width_inner=parse_f_64(data["width_inner"]) if "width_inner" in data else None,
|
|
2510
|
+
min_width_inner=parse_f_64(data["min_width_inner"]) if "min_width_inner" in data else None,
|
|
2511
|
+
max_width_inner=parse_f_64(data["max_width_inner"]) if "max_width_inner" in data else None,
|
|
2512
|
+
width_outer=parse_f_64(data["width_outer"]) if "width_outer" in data else None,
|
|
2513
|
+
min_width_outer=parse_f_64(data["min_width_outer"]) if "min_width_outer" in data else None,
|
|
2514
|
+
max_width_outer=parse_f_64(data["max_width_outer"]) if "max_width_outer" in data else None,
|
|
2515
|
+
force=parse_f_64(data["force"]) if "force" in data else None,
|
|
2516
|
+
max_force=parse_f_64(data["max_force"]) if "max_force" in data else None,
|
|
2517
|
+
finger_mounting_position=parse_f_64(data["finger_mounting_position"]) if "finger_mounting_position" in data else None,
|
|
2518
|
+
finger_offset=parse_f_64(data["finger_offset"]) if "finger_offset" in data else None,
|
|
2519
|
+
finger_angle=parse_f_64(data["finger_angle"]) if "finger_angle" in data else None,
|
|
2520
|
+
finger_length=parse_f_64(data["finger_length"]) if "finger_length" in data else None,
|
|
2521
|
+
finger_height=parse_f_64(data["finger_height"]) if "finger_height" in data else None,
|
|
2522
|
+
linear_sensor_error=parse_bool(data["linear_sensor_error"]) if "linear_sensor_error" in data else None,
|
|
2523
|
+
uncalibrated_error=parse_bool(data["uncalibrated_error"]) if "uncalibrated_error" in data else None,
|
|
2524
|
+
)
|
|
2525
|
+
|
|
2526
|
+
def serialize_on_robot_2_fg_14_gripper_configuration(data: OnRobot2FG14GripperConfiguration) -> object:
|
|
2527
|
+
return {
|
|
2528
|
+
"grip_kind": None if data.grip_kind is None else serialize_on_robot_grip_kind_enum(data.grip_kind),
|
|
2529
|
+
"grip_detected": None if data.grip_detected is None else serialize_bool(data.grip_detected),
|
|
2530
|
+
"normalized_width_inner": None if data.normalized_width_inner is None else serialize_f_64(data.normalized_width_inner),
|
|
2531
|
+
"normalized_width_outer": None if data.normalized_width_outer is None else serialize_f_64(data.normalized_width_outer),
|
|
2532
|
+
"width_inner": None if data.width_inner is None else serialize_f_64(data.width_inner),
|
|
2533
|
+
"min_width_inner": None if data.min_width_inner is None else serialize_f_64(data.min_width_inner),
|
|
2534
|
+
"max_width_inner": None if data.max_width_inner is None else serialize_f_64(data.max_width_inner),
|
|
2535
|
+
"width_outer": None if data.width_outer is None else serialize_f_64(data.width_outer),
|
|
2536
|
+
"min_width_outer": None if data.min_width_outer is None else serialize_f_64(data.min_width_outer),
|
|
2537
|
+
"max_width_outer": None if data.max_width_outer is None else serialize_f_64(data.max_width_outer),
|
|
2538
|
+
"force": None if data.force is None else serialize_f_64(data.force),
|
|
2539
|
+
"max_force": None if data.max_force is None else serialize_f_64(data.max_force),
|
|
2540
|
+
"finger_mounting_position": None if data.finger_mounting_position is None else serialize_f_64(data.finger_mounting_position),
|
|
2541
|
+
"finger_offset": None if data.finger_offset is None else serialize_f_64(data.finger_offset),
|
|
2542
|
+
"finger_angle": None if data.finger_angle is None else serialize_f_64(data.finger_angle),
|
|
2543
|
+
"finger_length": None if data.finger_length is None else serialize_f_64(data.finger_length),
|
|
2544
|
+
"finger_height": None if data.finger_height is None else serialize_f_64(data.finger_height),
|
|
2545
|
+
"linear_sensor_error": None if data.linear_sensor_error is None else serialize_bool(data.linear_sensor_error),
|
|
2546
|
+
"uncalibrated_error": None if data.uncalibrated_error is None else serialize_bool(data.uncalibrated_error),
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
@dataclass
|
|
2550
|
+
class OnRobot2FG7GripperConfiguration:
|
|
2551
|
+
"""Configuration for OnRobot 2FG7 Gripper"""
|
|
2552
|
+
grip_kind: Union[OnRobotGripKindEnum, None] = None
|
|
2553
|
+
grip_detected: Union[bool, None] = None
|
|
2554
|
+
normalized_width_inner: Union[float, None] = None
|
|
2555
|
+
normalized_width_outer: Union[float, None] = None
|
|
2556
|
+
width_inner: Union[float, None] = None
|
|
2557
|
+
min_width_inner: Union[float, None] = None
|
|
2558
|
+
max_width_inner: Union[float, None] = None
|
|
2559
|
+
width_outer: Union[float, None] = None
|
|
2560
|
+
min_width_outer: Union[float, None] = None
|
|
2561
|
+
max_width_outer: Union[float, None] = None
|
|
2562
|
+
force: Union[float, None] = None
|
|
2563
|
+
max_force: Union[float, None] = None
|
|
2564
|
+
finger_mounting_position: Union[float, None] = None
|
|
2565
|
+
finger_offset: Union[float, None] = None
|
|
2566
|
+
finger_angle: Union[float, None] = None
|
|
2567
|
+
finger_length: Union[float, None] = None
|
|
2568
|
+
finger_height: Union[float, None] = None
|
|
2569
|
+
linear_sensor_error: Union[bool, None] = None
|
|
2570
|
+
uncalibrated_error: Union[bool, None] = None
|
|
2571
|
+
|
|
2572
|
+
def validate_grip_kind(self, value: OnRobotGripKindEnum) -> Tuple[bool, str]:
|
|
2573
|
+
if value is None:
|
|
2574
|
+
return [True, ""]
|
|
2575
|
+
|
|
2576
|
+
if not ((isinstance(value, str) and OnRobotGripKindEnum in ['inward', 'outward']) or isinstance(value, OnRobotGripKindEnum)):
|
|
2577
|
+
return [False, "grip_kind must be of type OnRobotGripKindEnum for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2578
|
+
|
|
2579
|
+
return [True, ""]
|
|
2580
|
+
|
|
2581
|
+
def validate_grip_detected(self, value: bool) -> Tuple[bool, str]:
|
|
2582
|
+
if value is None:
|
|
2583
|
+
return [True, ""]
|
|
2584
|
+
|
|
2585
|
+
if not isinstance(value, bool):
|
|
2586
|
+
return [False, "grip_detected must be of type bool for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2587
|
+
|
|
2588
|
+
return [True, ""]
|
|
2589
|
+
|
|
2590
|
+
def validate_normalized_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2591
|
+
if value is None:
|
|
2592
|
+
return [True, ""]
|
|
2593
|
+
|
|
2594
|
+
if not isinstance(value, float):
|
|
2595
|
+
return [False, "normalized_width_inner must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2596
|
+
|
|
2597
|
+
return [True, ""]
|
|
2598
|
+
|
|
2599
|
+
def validate_normalized_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2600
|
+
if value is None:
|
|
2601
|
+
return [True, ""]
|
|
2602
|
+
|
|
2603
|
+
if not isinstance(value, float):
|
|
2604
|
+
return [False, "normalized_width_outer must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2605
|
+
|
|
2606
|
+
return [True, ""]
|
|
2607
|
+
|
|
2608
|
+
def validate_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2609
|
+
if value is None:
|
|
2610
|
+
return [True, ""]
|
|
2611
|
+
|
|
2612
|
+
if not isinstance(value, float):
|
|
2613
|
+
return [False, "width_inner must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2614
|
+
|
|
2615
|
+
return [True, ""]
|
|
2616
|
+
|
|
2617
|
+
def validate_min_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2618
|
+
if value is None:
|
|
2619
|
+
return [True, ""]
|
|
2620
|
+
|
|
2621
|
+
if not isinstance(value, float):
|
|
2622
|
+
return [False, "min_width_inner must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2623
|
+
|
|
2624
|
+
return [True, ""]
|
|
2625
|
+
|
|
2626
|
+
def validate_max_width_inner(self, value: float) -> Tuple[bool, str]:
|
|
2627
|
+
if value is None:
|
|
2628
|
+
return [True, ""]
|
|
2629
|
+
|
|
2630
|
+
if not isinstance(value, float):
|
|
2631
|
+
return [False, "max_width_inner must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2632
|
+
|
|
2633
|
+
return [True, ""]
|
|
2634
|
+
|
|
2635
|
+
def validate_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2636
|
+
if value is None:
|
|
2637
|
+
return [True, ""]
|
|
2638
|
+
|
|
2639
|
+
if not isinstance(value, float):
|
|
2640
|
+
return [False, "width_outer must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2641
|
+
|
|
2642
|
+
return [True, ""]
|
|
2643
|
+
|
|
2644
|
+
def validate_min_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2645
|
+
if value is None:
|
|
2646
|
+
return [True, ""]
|
|
2647
|
+
|
|
2648
|
+
if not isinstance(value, float):
|
|
2649
|
+
return [False, "min_width_outer must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2650
|
+
|
|
2651
|
+
return [True, ""]
|
|
2652
|
+
|
|
2653
|
+
def validate_max_width_outer(self, value: float) -> Tuple[bool, str]:
|
|
2654
|
+
if value is None:
|
|
2655
|
+
return [True, ""]
|
|
2656
|
+
|
|
2657
|
+
if not isinstance(value, float):
|
|
2658
|
+
return [False, "max_width_outer must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2659
|
+
|
|
2660
|
+
return [True, ""]
|
|
2661
|
+
|
|
2662
|
+
def validate_force(self, value: float) -> Tuple[bool, str]:
|
|
2663
|
+
if value is None:
|
|
2664
|
+
return [True, ""]
|
|
2665
|
+
|
|
2666
|
+
if not isinstance(value, float):
|
|
2667
|
+
return [False, "force must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2668
|
+
|
|
2669
|
+
return [True, ""]
|
|
2670
|
+
|
|
2671
|
+
def validate_max_force(self, value: float) -> Tuple[bool, str]:
|
|
2672
|
+
if value is None:
|
|
2673
|
+
return [True, ""]
|
|
2674
|
+
|
|
2675
|
+
if not isinstance(value, float):
|
|
2676
|
+
return [False, "max_force must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2677
|
+
|
|
2678
|
+
return [True, ""]
|
|
2679
|
+
|
|
2680
|
+
def validate_finger_mounting_position(self, value: float) -> Tuple[bool, str]:
|
|
2681
|
+
if value is None:
|
|
2682
|
+
return [True, ""]
|
|
2683
|
+
|
|
2684
|
+
if not isinstance(value, float):
|
|
2685
|
+
return [False, "finger_mounting_position must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2686
|
+
|
|
2687
|
+
return [True, ""]
|
|
2688
|
+
|
|
2689
|
+
def validate_finger_offset(self, value: float) -> Tuple[bool, str]:
|
|
2690
|
+
if value is None:
|
|
2691
|
+
return [True, ""]
|
|
2692
|
+
|
|
2693
|
+
if not isinstance(value, float):
|
|
2694
|
+
return [False, "finger_offset must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2695
|
+
|
|
2696
|
+
return [True, ""]
|
|
2697
|
+
|
|
2698
|
+
def validate_finger_angle(self, value: float) -> Tuple[bool, str]:
|
|
2699
|
+
if value is None:
|
|
2700
|
+
return [True, ""]
|
|
2701
|
+
|
|
2702
|
+
if not isinstance(value, float):
|
|
2703
|
+
return [False, "finger_angle must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2704
|
+
|
|
2705
|
+
return [True, ""]
|
|
2706
|
+
|
|
2707
|
+
def validate_finger_length(self, value: float) -> Tuple[bool, str]:
|
|
2708
|
+
if value is None:
|
|
2709
|
+
return [True, ""]
|
|
2710
|
+
|
|
2711
|
+
if not isinstance(value, float):
|
|
2712
|
+
return [False, "finger_length must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2713
|
+
|
|
2714
|
+
return [True, ""]
|
|
2715
|
+
|
|
2716
|
+
def validate_finger_height(self, value: float) -> Tuple[bool, str]:
|
|
2717
|
+
if value is None:
|
|
2718
|
+
return [True, ""]
|
|
2719
|
+
|
|
2720
|
+
if not isinstance(value, float):
|
|
2721
|
+
return [False, "finger_height must be of type float for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2722
|
+
|
|
2723
|
+
return [True, ""]
|
|
2724
|
+
|
|
2725
|
+
def validate_linear_sensor_error(self, value: bool) -> Tuple[bool, str]:
|
|
2726
|
+
if value is None:
|
|
2727
|
+
return [True, ""]
|
|
2728
|
+
|
|
2729
|
+
if not isinstance(value, bool):
|
|
2730
|
+
return [False, "linear_sensor_error must be of type bool for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2731
|
+
|
|
2732
|
+
return [True, ""]
|
|
2733
|
+
|
|
2734
|
+
def validate_uncalibrated_error(self, value: bool) -> Tuple[bool, str]:
|
|
2735
|
+
if value is None:
|
|
2736
|
+
return [True, ""]
|
|
2737
|
+
|
|
2738
|
+
if not isinstance(value, bool):
|
|
2739
|
+
return [False, "uncalibrated_error must be of type bool for OnRobot2FG7GripperConfiguration, got " + type(value).__name__]
|
|
2740
|
+
|
|
2741
|
+
return [True, ""]
|
|
2742
|
+
|
|
2743
|
+
def __post_init__(self):
|
|
2744
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
2745
|
+
is_valid, error_str = self.validate_grip_kind(self.grip_kind)
|
|
2746
|
+
if not is_valid:
|
|
2747
|
+
raise TypeError(error_str)
|
|
2748
|
+
is_valid, error_str = self.validate_grip_detected(self.grip_detected)
|
|
2749
|
+
if not is_valid:
|
|
2750
|
+
raise TypeError(error_str)
|
|
2751
|
+
is_valid, error_str = self.validate_normalized_width_inner(self.normalized_width_inner)
|
|
2752
|
+
if not is_valid:
|
|
2753
|
+
raise TypeError(error_str)
|
|
2754
|
+
is_valid, error_str = self.validate_normalized_width_outer(self.normalized_width_outer)
|
|
2755
|
+
if not is_valid:
|
|
2756
|
+
raise TypeError(error_str)
|
|
2757
|
+
is_valid, error_str = self.validate_width_inner(self.width_inner)
|
|
2758
|
+
if not is_valid:
|
|
2759
|
+
raise TypeError(error_str)
|
|
2760
|
+
is_valid, error_str = self.validate_min_width_inner(self.min_width_inner)
|
|
2761
|
+
if not is_valid:
|
|
2762
|
+
raise TypeError(error_str)
|
|
2763
|
+
is_valid, error_str = self.validate_max_width_inner(self.max_width_inner)
|
|
2764
|
+
if not is_valid:
|
|
2765
|
+
raise TypeError(error_str)
|
|
2766
|
+
is_valid, error_str = self.validate_width_outer(self.width_outer)
|
|
2767
|
+
if not is_valid:
|
|
2768
|
+
raise TypeError(error_str)
|
|
2769
|
+
is_valid, error_str = self.validate_min_width_outer(self.min_width_outer)
|
|
2770
|
+
if not is_valid:
|
|
2771
|
+
raise TypeError(error_str)
|
|
2772
|
+
is_valid, error_str = self.validate_max_width_outer(self.max_width_outer)
|
|
2773
|
+
if not is_valid:
|
|
2774
|
+
raise TypeError(error_str)
|
|
2775
|
+
is_valid, error_str = self.validate_force(self.force)
|
|
2776
|
+
if not is_valid:
|
|
2777
|
+
raise TypeError(error_str)
|
|
2778
|
+
is_valid, error_str = self.validate_max_force(self.max_force)
|
|
2779
|
+
if not is_valid:
|
|
2780
|
+
raise TypeError(error_str)
|
|
2781
|
+
is_valid, error_str = self.validate_finger_mounting_position(self.finger_mounting_position)
|
|
2782
|
+
if not is_valid:
|
|
2783
|
+
raise TypeError(error_str)
|
|
2784
|
+
is_valid, error_str = self.validate_finger_offset(self.finger_offset)
|
|
2785
|
+
if not is_valid:
|
|
2786
|
+
raise TypeError(error_str)
|
|
2787
|
+
is_valid, error_str = self.validate_finger_angle(self.finger_angle)
|
|
2788
|
+
if not is_valid:
|
|
2789
|
+
raise TypeError(error_str)
|
|
2790
|
+
is_valid, error_str = self.validate_finger_length(self.finger_length)
|
|
2791
|
+
if not is_valid:
|
|
2792
|
+
raise TypeError(error_str)
|
|
2793
|
+
is_valid, error_str = self.validate_finger_height(self.finger_height)
|
|
2794
|
+
if not is_valid:
|
|
2795
|
+
raise TypeError(error_str)
|
|
2796
|
+
is_valid, error_str = self.validate_linear_sensor_error(self.linear_sensor_error)
|
|
2797
|
+
if not is_valid:
|
|
2798
|
+
raise TypeError(error_str)
|
|
2799
|
+
is_valid, error_str = self.validate_uncalibrated_error(self.uncalibrated_error)
|
|
2800
|
+
if not is_valid:
|
|
2801
|
+
raise TypeError(error_str)
|
|
2802
|
+
|
|
2803
|
+
def parse_on_robot_2_fg_7_gripper_configuration(data: object):
|
|
2804
|
+
return OnRobot2FG7GripperConfiguration(
|
|
2805
|
+
grip_kind=parse_on_robot_grip_kind_enum(data["grip_kind"]) if "grip_kind" in data else None,
|
|
2806
|
+
grip_detected=parse_bool(data["grip_detected"]) if "grip_detected" in data else None,
|
|
2807
|
+
normalized_width_inner=parse_f_64(data["normalized_width_inner"]) if "normalized_width_inner" in data else None,
|
|
2808
|
+
normalized_width_outer=parse_f_64(data["normalized_width_outer"]) if "normalized_width_outer" in data else None,
|
|
2809
|
+
width_inner=parse_f_64(data["width_inner"]) if "width_inner" in data else None,
|
|
2810
|
+
min_width_inner=parse_f_64(data["min_width_inner"]) if "min_width_inner" in data else None,
|
|
2811
|
+
max_width_inner=parse_f_64(data["max_width_inner"]) if "max_width_inner" in data else None,
|
|
2812
|
+
width_outer=parse_f_64(data["width_outer"]) if "width_outer" in data else None,
|
|
2813
|
+
min_width_outer=parse_f_64(data["min_width_outer"]) if "min_width_outer" in data else None,
|
|
2814
|
+
max_width_outer=parse_f_64(data["max_width_outer"]) if "max_width_outer" in data else None,
|
|
2815
|
+
force=parse_f_64(data["force"]) if "force" in data else None,
|
|
2816
|
+
max_force=parse_f_64(data["max_force"]) if "max_force" in data else None,
|
|
2817
|
+
finger_mounting_position=parse_f_64(data["finger_mounting_position"]) if "finger_mounting_position" in data else None,
|
|
2818
|
+
finger_offset=parse_f_64(data["finger_offset"]) if "finger_offset" in data else None,
|
|
2819
|
+
finger_angle=parse_f_64(data["finger_angle"]) if "finger_angle" in data else None,
|
|
2820
|
+
finger_length=parse_f_64(data["finger_length"]) if "finger_length" in data else None,
|
|
2821
|
+
finger_height=parse_f_64(data["finger_height"]) if "finger_height" in data else None,
|
|
2822
|
+
linear_sensor_error=parse_bool(data["linear_sensor_error"]) if "linear_sensor_error" in data else None,
|
|
2823
|
+
uncalibrated_error=parse_bool(data["uncalibrated_error"]) if "uncalibrated_error" in data else None,
|
|
2824
|
+
)
|
|
2825
|
+
|
|
2826
|
+
def serialize_on_robot_2_fg_7_gripper_configuration(data: OnRobot2FG7GripperConfiguration) -> object:
|
|
2827
|
+
return {
|
|
2828
|
+
"grip_kind": None if data.grip_kind is None else serialize_on_robot_grip_kind_enum(data.grip_kind),
|
|
2829
|
+
"grip_detected": None if data.grip_detected is None else serialize_bool(data.grip_detected),
|
|
2830
|
+
"normalized_width_inner": None if data.normalized_width_inner is None else serialize_f_64(data.normalized_width_inner),
|
|
2831
|
+
"normalized_width_outer": None if data.normalized_width_outer is None else serialize_f_64(data.normalized_width_outer),
|
|
2832
|
+
"width_inner": None if data.width_inner is None else serialize_f_64(data.width_inner),
|
|
2833
|
+
"min_width_inner": None if data.min_width_inner is None else serialize_f_64(data.min_width_inner),
|
|
2834
|
+
"max_width_inner": None if data.max_width_inner is None else serialize_f_64(data.max_width_inner),
|
|
2835
|
+
"width_outer": None if data.width_outer is None else serialize_f_64(data.width_outer),
|
|
2836
|
+
"min_width_outer": None if data.min_width_outer is None else serialize_f_64(data.min_width_outer),
|
|
2837
|
+
"max_width_outer": None if data.max_width_outer is None else serialize_f_64(data.max_width_outer),
|
|
2838
|
+
"force": None if data.force is None else serialize_f_64(data.force),
|
|
2839
|
+
"max_force": None if data.max_force is None else serialize_f_64(data.max_force),
|
|
2840
|
+
"finger_mounting_position": None if data.finger_mounting_position is None else serialize_f_64(data.finger_mounting_position),
|
|
2841
|
+
"finger_offset": None if data.finger_offset is None else serialize_f_64(data.finger_offset),
|
|
2842
|
+
"finger_angle": None if data.finger_angle is None else serialize_f_64(data.finger_angle),
|
|
2843
|
+
"finger_length": None if data.finger_length is None else serialize_f_64(data.finger_length),
|
|
2844
|
+
"finger_height": None if data.finger_height is None else serialize_f_64(data.finger_height),
|
|
2845
|
+
"linear_sensor_error": None if data.linear_sensor_error is None else serialize_bool(data.linear_sensor_error),
|
|
2846
|
+
"uncalibrated_error": None if data.uncalibrated_error is None else serialize_bool(data.uncalibrated_error),
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2849
|
+
@dataclass
|
|
2850
|
+
class OnRobot3FG15GripperConfiguration:
|
|
2851
|
+
"""Configuration for OnRobot 3FG15 Gripper"""
|
|
2852
|
+
grip_detected: Union[bool, None] = None
|
|
2853
|
+
force_grip_detected: Union[bool, None] = None
|
|
2854
|
+
calibration_ok: Union[bool, None] = None
|
|
2855
|
+
diameter: Union[float, None] = None
|
|
2856
|
+
grip_kind: Union[OnRobotGripKindEnum, None] = None
|
|
2857
|
+
finger_angle: Union[float, None] = None
|
|
2858
|
+
force_applied_fraction: Union[float, None] = None
|
|
2859
|
+
force_applied_newtons: Union[float, None] = None
|
|
2860
|
+
target_force_newtons: Union[float, None] = None
|
|
2861
|
+
finger_length: Union[float, None] = None
|
|
2862
|
+
finger_mounting_position: Union[float, None] = None
|
|
2863
|
+
finger_offset: Union[float, None] = None
|
|
2864
|
+
|
|
2865
|
+
def validate_grip_detected(self, value: bool) -> Tuple[bool, str]:
|
|
2866
|
+
if value is None:
|
|
2867
|
+
return [True, ""]
|
|
2868
|
+
|
|
2869
|
+
if not isinstance(value, bool):
|
|
2870
|
+
return [False, "grip_detected must be of type bool for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2871
|
+
|
|
2872
|
+
return [True, ""]
|
|
2873
|
+
|
|
2874
|
+
def validate_force_grip_detected(self, value: bool) -> Tuple[bool, str]:
|
|
2875
|
+
if value is None:
|
|
2876
|
+
return [True, ""]
|
|
2877
|
+
|
|
2878
|
+
if not isinstance(value, bool):
|
|
2879
|
+
return [False, "force_grip_detected must be of type bool for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2880
|
+
|
|
2881
|
+
return [True, ""]
|
|
2882
|
+
|
|
2883
|
+
def validate_calibration_ok(self, value: bool) -> Tuple[bool, str]:
|
|
2884
|
+
if value is None:
|
|
2885
|
+
return [True, ""]
|
|
2886
|
+
|
|
2887
|
+
if not isinstance(value, bool):
|
|
2888
|
+
return [False, "calibration_ok must be of type bool for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2889
|
+
|
|
2890
|
+
return [True, ""]
|
|
2891
|
+
|
|
2892
|
+
def validate_diameter(self, value: float) -> Tuple[bool, str]:
|
|
2893
|
+
if value is None:
|
|
2894
|
+
return [True, ""]
|
|
2895
|
+
|
|
2896
|
+
if not isinstance(value, float):
|
|
2897
|
+
return [False, "diameter must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2898
|
+
|
|
2899
|
+
return [True, ""]
|
|
2900
|
+
|
|
2901
|
+
def validate_grip_kind(self, value: OnRobotGripKindEnum) -> Tuple[bool, str]:
|
|
2902
|
+
if value is None:
|
|
2903
|
+
return [True, ""]
|
|
2904
|
+
|
|
2905
|
+
if not ((isinstance(value, str) and OnRobotGripKindEnum in ['inward', 'outward']) or isinstance(value, OnRobotGripKindEnum)):
|
|
2906
|
+
return [False, "grip_kind must be of type OnRobotGripKindEnum for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2907
|
+
|
|
2908
|
+
return [True, ""]
|
|
2909
|
+
|
|
2910
|
+
def validate_finger_angle(self, value: float) -> Tuple[bool, str]:
|
|
2911
|
+
if value is None:
|
|
2912
|
+
return [True, ""]
|
|
2913
|
+
|
|
2914
|
+
if not isinstance(value, float):
|
|
2915
|
+
return [False, "finger_angle must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2916
|
+
|
|
2917
|
+
return [True, ""]
|
|
2918
|
+
|
|
2919
|
+
def validate_force_applied_fraction(self, value: float) -> Tuple[bool, str]:
|
|
2920
|
+
if value is None:
|
|
2921
|
+
return [True, ""]
|
|
2922
|
+
|
|
2923
|
+
if not isinstance(value, float):
|
|
2924
|
+
return [False, "force_applied_fraction must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2925
|
+
|
|
2926
|
+
return [True, ""]
|
|
2927
|
+
|
|
2928
|
+
def validate_force_applied_newtons(self, value: float) -> Tuple[bool, str]:
|
|
2929
|
+
if value is None:
|
|
2930
|
+
return [True, ""]
|
|
2931
|
+
|
|
2932
|
+
if not isinstance(value, float):
|
|
2933
|
+
return [False, "force_applied_newtons must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2934
|
+
|
|
2935
|
+
return [True, ""]
|
|
2936
|
+
|
|
2937
|
+
def validate_target_force_newtons(self, value: float) -> Tuple[bool, str]:
|
|
2938
|
+
if value is None:
|
|
2939
|
+
return [True, ""]
|
|
2940
|
+
|
|
2941
|
+
if not isinstance(value, float):
|
|
2942
|
+
return [False, "target_force_newtons must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2943
|
+
|
|
2944
|
+
return [True, ""]
|
|
2945
|
+
|
|
2946
|
+
def validate_finger_length(self, value: float) -> Tuple[bool, str]:
|
|
2947
|
+
if value is None:
|
|
2948
|
+
return [True, ""]
|
|
2949
|
+
|
|
2950
|
+
if not isinstance(value, float):
|
|
2951
|
+
return [False, "finger_length must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2952
|
+
|
|
2953
|
+
return [True, ""]
|
|
2954
|
+
|
|
2955
|
+
def validate_finger_mounting_position(self, value: float) -> Tuple[bool, str]:
|
|
2956
|
+
if value is None:
|
|
2957
|
+
return [True, ""]
|
|
2958
|
+
|
|
2959
|
+
if not isinstance(value, float):
|
|
2960
|
+
return [False, "finger_mounting_position must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2961
|
+
|
|
2962
|
+
return [True, ""]
|
|
2963
|
+
|
|
2964
|
+
def validate_finger_offset(self, value: float) -> Tuple[bool, str]:
|
|
2965
|
+
if value is None:
|
|
2966
|
+
return [True, ""]
|
|
2967
|
+
|
|
2968
|
+
if not isinstance(value, float):
|
|
2969
|
+
return [False, "finger_offset must be of type float for OnRobot3FG15GripperConfiguration, got " + type(value).__name__]
|
|
2970
|
+
|
|
2971
|
+
return [True, ""]
|
|
2972
|
+
|
|
2973
|
+
def __post_init__(self):
|
|
2974
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
2975
|
+
is_valid, error_str = self.validate_grip_detected(self.grip_detected)
|
|
2976
|
+
if not is_valid:
|
|
2977
|
+
raise TypeError(error_str)
|
|
2978
|
+
is_valid, error_str = self.validate_force_grip_detected(self.force_grip_detected)
|
|
2979
|
+
if not is_valid:
|
|
2980
|
+
raise TypeError(error_str)
|
|
2981
|
+
is_valid, error_str = self.validate_calibration_ok(self.calibration_ok)
|
|
2982
|
+
if not is_valid:
|
|
2983
|
+
raise TypeError(error_str)
|
|
2984
|
+
is_valid, error_str = self.validate_diameter(self.diameter)
|
|
2985
|
+
if not is_valid:
|
|
2986
|
+
raise TypeError(error_str)
|
|
2987
|
+
is_valid, error_str = self.validate_grip_kind(self.grip_kind)
|
|
2988
|
+
if not is_valid:
|
|
2989
|
+
raise TypeError(error_str)
|
|
2990
|
+
is_valid, error_str = self.validate_finger_angle(self.finger_angle)
|
|
2991
|
+
if not is_valid:
|
|
2992
|
+
raise TypeError(error_str)
|
|
2993
|
+
is_valid, error_str = self.validate_force_applied_fraction(self.force_applied_fraction)
|
|
2994
|
+
if not is_valid:
|
|
2995
|
+
raise TypeError(error_str)
|
|
2996
|
+
is_valid, error_str = self.validate_force_applied_newtons(self.force_applied_newtons)
|
|
2997
|
+
if not is_valid:
|
|
2998
|
+
raise TypeError(error_str)
|
|
2999
|
+
is_valid, error_str = self.validate_target_force_newtons(self.target_force_newtons)
|
|
3000
|
+
if not is_valid:
|
|
3001
|
+
raise TypeError(error_str)
|
|
3002
|
+
is_valid, error_str = self.validate_finger_length(self.finger_length)
|
|
3003
|
+
if not is_valid:
|
|
3004
|
+
raise TypeError(error_str)
|
|
3005
|
+
is_valid, error_str = self.validate_finger_mounting_position(self.finger_mounting_position)
|
|
3006
|
+
if not is_valid:
|
|
3007
|
+
raise TypeError(error_str)
|
|
3008
|
+
is_valid, error_str = self.validate_finger_offset(self.finger_offset)
|
|
3009
|
+
if not is_valid:
|
|
3010
|
+
raise TypeError(error_str)
|
|
3011
|
+
|
|
3012
|
+
def parse_on_robot_3_fg_15_gripper_configuration(data: object):
|
|
3013
|
+
return OnRobot3FG15GripperConfiguration(
|
|
3014
|
+
grip_detected=parse_bool(data["grip_detected"]) if "grip_detected" in data else None,
|
|
3015
|
+
force_grip_detected=parse_bool(data["force_grip_detected"]) if "force_grip_detected" in data else None,
|
|
3016
|
+
calibration_ok=parse_bool(data["calibration_ok"]) if "calibration_ok" in data else None,
|
|
3017
|
+
diameter=parse_f_64(data["diameter"]) if "diameter" in data else None,
|
|
3018
|
+
grip_kind=parse_on_robot_grip_kind_enum(data["grip_kind"]) if "grip_kind" in data else None,
|
|
3019
|
+
finger_angle=parse_f_64(data["finger_angle"]) if "finger_angle" in data else None,
|
|
3020
|
+
force_applied_fraction=parse_f_64(data["force_applied_fraction"]) if "force_applied_fraction" in data else None,
|
|
3021
|
+
force_applied_newtons=parse_f_64(data["force_applied_newtons"]) if "force_applied_newtons" in data else None,
|
|
3022
|
+
target_force_newtons=parse_f_64(data["target_force_newtons"]) if "target_force_newtons" in data else None,
|
|
3023
|
+
finger_length=parse_f_64(data["finger_length"]) if "finger_length" in data else None,
|
|
3024
|
+
finger_mounting_position=parse_f_64(data["finger_mounting_position"]) if "finger_mounting_position" in data else None,
|
|
3025
|
+
finger_offset=parse_f_64(data["finger_offset"]) if "finger_offset" in data else None,
|
|
3026
|
+
)
|
|
3027
|
+
|
|
3028
|
+
def serialize_on_robot_3_fg_15_gripper_configuration(data: OnRobot3FG15GripperConfiguration) -> object:
|
|
3029
|
+
return {
|
|
3030
|
+
"grip_detected": None if data.grip_detected is None else serialize_bool(data.grip_detected),
|
|
3031
|
+
"force_grip_detected": None if data.force_grip_detected is None else serialize_bool(data.force_grip_detected),
|
|
3032
|
+
"calibration_ok": None if data.calibration_ok is None else serialize_bool(data.calibration_ok),
|
|
3033
|
+
"diameter": None if data.diameter is None else serialize_f_64(data.diameter),
|
|
3034
|
+
"grip_kind": None if data.grip_kind is None else serialize_on_robot_grip_kind_enum(data.grip_kind),
|
|
3035
|
+
"finger_angle": None if data.finger_angle is None else serialize_f_64(data.finger_angle),
|
|
3036
|
+
"force_applied_fraction": None if data.force_applied_fraction is None else serialize_f_64(data.force_applied_fraction),
|
|
3037
|
+
"force_applied_newtons": None if data.force_applied_newtons is None else serialize_f_64(data.force_applied_newtons),
|
|
3038
|
+
"target_force_newtons": None if data.target_force_newtons is None else serialize_f_64(data.target_force_newtons),
|
|
3039
|
+
"finger_length": None if data.finger_length is None else serialize_f_64(data.finger_length),
|
|
3040
|
+
"finger_mounting_position": None if data.finger_mounting_position is None else serialize_f_64(data.finger_mounting_position),
|
|
3041
|
+
"finger_offset": None if data.finger_offset is None else serialize_f_64(data.finger_offset),
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
PlanesList = List[Plane]
|
|
3045
|
+
|
|
3046
|
+
def parse_planes_list(data: object) -> PlanesList:
|
|
3047
|
+
return [parse_plane(item) for item in data]
|
|
3048
|
+
|
|
3049
|
+
def serialize_planes_list(data: PlanesList) -> List[object]:
|
|
3050
|
+
return [serialize_plane(item) for item in data]
|
|
3051
|
+
|
|
3052
|
+
@dataclass
|
|
3053
|
+
class Orientation:
|
|
3054
|
+
"""Orientation of an object in 3D space"""
|
|
3055
|
+
kind: Union[OrientationKindEnum, None] = None
|
|
3056
|
+
quaternion: Union[Quaternion, None] = None
|
|
3057
|
+
|
|
3058
|
+
def validate_kind(self, value: OrientationKindEnum) -> Tuple[bool, str]:
|
|
3059
|
+
if value is None:
|
|
3060
|
+
return [False, "kind is required for Orientation"]
|
|
3061
|
+
|
|
3062
|
+
if not ((isinstance(value, str) and OrientationKindEnum in ['quaternion']) or isinstance(value, OrientationKindEnum)):
|
|
3063
|
+
return [False, "kind must be of type OrientationKindEnum for Orientation, got " + type(value).__name__]
|
|
3064
|
+
|
|
3065
|
+
return [True, ""]
|
|
3066
|
+
|
|
3067
|
+
def validate_quaternion(self, value: Quaternion) -> Tuple[bool, str]:
|
|
3068
|
+
if value is None:
|
|
3069
|
+
return [True, ""]
|
|
3070
|
+
|
|
3071
|
+
if not isinstance(value, Quaternion):
|
|
3072
|
+
return [False, "quaternion must be of type Quaternion for Orientation, got " + type(value).__name__]
|
|
3073
|
+
|
|
3074
|
+
return [True, ""]
|
|
3075
|
+
|
|
3076
|
+
def __post_init__(self):
|
|
3077
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
3078
|
+
is_valid, error_str = self.validate_kind(self.kind)
|
|
3079
|
+
if not is_valid:
|
|
3080
|
+
raise TypeError(error_str)
|
|
3081
|
+
is_valid, error_str = self.validate_quaternion(self.quaternion)
|
|
3082
|
+
if not is_valid:
|
|
3083
|
+
raise TypeError(error_str)
|
|
3084
|
+
|
|
3085
|
+
def parse_orientation(data: object):
|
|
3086
|
+
return Orientation(
|
|
3087
|
+
kind=parse_orientation_kind_enum(data["kind"]) if "kind" in data else None,
|
|
3088
|
+
quaternion=parse_quaternion(data["quaternion"]) if "quaternion" in data else None,
|
|
3089
|
+
)
|
|
3090
|
+
|
|
3091
|
+
def serialize_orientation(data: Orientation) -> object:
|
|
3092
|
+
return {
|
|
3093
|
+
"kind": serialize_orientation_kind_enum(data.kind),
|
|
3094
|
+
"quaternion": None if data.quaternion is None else serialize_quaternion(data.quaternion),
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3097
|
+
@dataclass
|
|
3098
|
+
class RecoveryStatusResponse:
|
|
3099
|
+
"""Recovery status response"""
|
|
3100
|
+
state: Union[RecoveryStateEnum, None] = None
|
|
3101
|
+
|
|
3102
|
+
def validate_state(self, value: RecoveryStateEnum) -> Tuple[bool, str]:
|
|
3103
|
+
if value is None:
|
|
3104
|
+
return [True, ""]
|
|
3105
|
+
|
|
3106
|
+
if not ((isinstance(value, str) and RecoveryStateEnum in ['Success', 'Interrupted', 'NonIdle', 'Braked', 'PlanningFailure', 'ExecutionFailure', 'ControlSystemFailure', 'EStopTriggered', 'GripperFailure', 'OutOfJointLimitsFailure', 'CollisionFailure', 'TorqueCollisionFailure', 'InBoxingPositionFailure', 'PowerBoardCheckFailure', 'MotionPlannerFailure', 'MotionPlannerFailureStartPositionCollision', 'IOFailure', 'InvalidRoutineLoadedFailure', 'InferenceFailure', 'CameraFailure', 'HaasFailure', 'BotmanHeartbeatLost', 'InternalFailure', 'TorqueLimitExceeded', 'StepPlayFailure', 'UnbrakeFailure', 'WeldFailure', 'TriggerFaultFailure']) or isinstance(value, RecoveryStateEnum)):
|
|
3107
|
+
return [False, "state must be of type RecoveryStateEnum for RecoveryStatusResponse, got " + type(value).__name__]
|
|
2179
3108
|
|
|
2180
3109
|
return [True, ""]
|
|
2181
3110
|
|
|
@@ -2883,6 +3812,141 @@ def serialize_schunk_e_gx_gripper_command_request(data: SchunkEGxGripperCommandR
|
|
|
2883
3812
|
"control_kind": serialize_schunk_e_gx_control_kind_enum(data.control_kind),
|
|
2884
3813
|
}
|
|
2885
3814
|
|
|
3815
|
+
@dataclass
|
|
3816
|
+
class GripperConfiguration:
|
|
3817
|
+
"""Configuration of gripper, also known as End Effector"""
|
|
3818
|
+
kind: Union[GripperKindEnum, None] = None
|
|
3819
|
+
onrobot_2fg7: Union[OnRobot2FG7GripperConfiguration, None] = None
|
|
3820
|
+
onrobot_2fg14: Union[OnRobot2FG14GripperConfiguration, None] = None
|
|
3821
|
+
onrobot_3fg15: Union[OnRobot3FG15GripperConfiguration, None] = None
|
|
3822
|
+
onrobot_screwdriver: Union[OnRobotScrewdriverConfiguration, None] = None
|
|
3823
|
+
dh_ag: Union[DHAGGripperConfiguration, None] = None
|
|
3824
|
+
dh_pgc: Union[DHPGCGripperConfiguration, None] = None
|
|
3825
|
+
dh_cgi: Union[DHCGIGripperConfiguration, None] = None
|
|
3826
|
+
|
|
3827
|
+
def validate_kind(self, value: GripperKindEnum) -> Tuple[bool, str]:
|
|
3828
|
+
if value is None:
|
|
3829
|
+
return [False, "kind is required for GripperConfiguration"]
|
|
3830
|
+
|
|
3831
|
+
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)):
|
|
3832
|
+
return [False, "kind must be of type GripperKindEnum for GripperConfiguration, got " + type(value).__name__]
|
|
3833
|
+
|
|
3834
|
+
return [True, ""]
|
|
3835
|
+
|
|
3836
|
+
def validate_onrobot_2fg7(self, value: OnRobot2FG7GripperConfiguration) -> Tuple[bool, str]:
|
|
3837
|
+
if value is None:
|
|
3838
|
+
return [True, ""]
|
|
3839
|
+
|
|
3840
|
+
if not isinstance(value, OnRobot2FG7GripperConfiguration):
|
|
3841
|
+
return [False, "onrobot_2fg7 must be of type OnRobot2FG7GripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3842
|
+
|
|
3843
|
+
return [True, ""]
|
|
3844
|
+
|
|
3845
|
+
def validate_onrobot_2fg14(self, value: OnRobot2FG14GripperConfiguration) -> Tuple[bool, str]:
|
|
3846
|
+
if value is None:
|
|
3847
|
+
return [True, ""]
|
|
3848
|
+
|
|
3849
|
+
if not isinstance(value, OnRobot2FG14GripperConfiguration):
|
|
3850
|
+
return [False, "onrobot_2fg14 must be of type OnRobot2FG14GripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3851
|
+
|
|
3852
|
+
return [True, ""]
|
|
3853
|
+
|
|
3854
|
+
def validate_onrobot_3fg15(self, value: OnRobot3FG15GripperConfiguration) -> Tuple[bool, str]:
|
|
3855
|
+
if value is None:
|
|
3856
|
+
return [True, ""]
|
|
3857
|
+
|
|
3858
|
+
if not isinstance(value, OnRobot3FG15GripperConfiguration):
|
|
3859
|
+
return [False, "onrobot_3fg15 must be of type OnRobot3FG15GripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3860
|
+
|
|
3861
|
+
return [True, ""]
|
|
3862
|
+
|
|
3863
|
+
def validate_onrobot_screwdriver(self, value: OnRobotScrewdriverConfiguration) -> Tuple[bool, str]:
|
|
3864
|
+
if value is None:
|
|
3865
|
+
return [True, ""]
|
|
3866
|
+
|
|
3867
|
+
if not isinstance(value, OnRobotScrewdriverConfiguration):
|
|
3868
|
+
return [False, "onrobot_screwdriver must be of type OnRobotScrewdriverConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3869
|
+
|
|
3870
|
+
return [True, ""]
|
|
3871
|
+
|
|
3872
|
+
def validate_dh_ag(self, value: DHAGGripperConfiguration) -> Tuple[bool, str]:
|
|
3873
|
+
if value is None:
|
|
3874
|
+
return [True, ""]
|
|
3875
|
+
|
|
3876
|
+
if not isinstance(value, DHAGGripperConfiguration):
|
|
3877
|
+
return [False, "dh_ag must be of type DHAGGripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3878
|
+
|
|
3879
|
+
return [True, ""]
|
|
3880
|
+
|
|
3881
|
+
def validate_dh_pgc(self, value: DHPGCGripperConfiguration) -> Tuple[bool, str]:
|
|
3882
|
+
if value is None:
|
|
3883
|
+
return [True, ""]
|
|
3884
|
+
|
|
3885
|
+
if not isinstance(value, DHPGCGripperConfiguration):
|
|
3886
|
+
return [False, "dh_pgc must be of type DHPGCGripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3887
|
+
|
|
3888
|
+
return [True, ""]
|
|
3889
|
+
|
|
3890
|
+
def validate_dh_cgi(self, value: DHCGIGripperConfiguration) -> Tuple[bool, str]:
|
|
3891
|
+
if value is None:
|
|
3892
|
+
return [True, ""]
|
|
3893
|
+
|
|
3894
|
+
if not isinstance(value, DHCGIGripperConfiguration):
|
|
3895
|
+
return [False, "dh_cgi must be of type DHCGIGripperConfiguration for GripperConfiguration, got " + type(value).__name__]
|
|
3896
|
+
|
|
3897
|
+
return [True, ""]
|
|
3898
|
+
|
|
3899
|
+
def __post_init__(self):
|
|
3900
|
+
# Type check incoming model - raise error if invalid (required or wrong type)
|
|
3901
|
+
is_valid, error_str = self.validate_kind(self.kind)
|
|
3902
|
+
if not is_valid:
|
|
3903
|
+
raise TypeError(error_str)
|
|
3904
|
+
is_valid, error_str = self.validate_onrobot_2fg7(self.onrobot_2fg7)
|
|
3905
|
+
if not is_valid:
|
|
3906
|
+
raise TypeError(error_str)
|
|
3907
|
+
is_valid, error_str = self.validate_onrobot_2fg14(self.onrobot_2fg14)
|
|
3908
|
+
if not is_valid:
|
|
3909
|
+
raise TypeError(error_str)
|
|
3910
|
+
is_valid, error_str = self.validate_onrobot_3fg15(self.onrobot_3fg15)
|
|
3911
|
+
if not is_valid:
|
|
3912
|
+
raise TypeError(error_str)
|
|
3913
|
+
is_valid, error_str = self.validate_onrobot_screwdriver(self.onrobot_screwdriver)
|
|
3914
|
+
if not is_valid:
|
|
3915
|
+
raise TypeError(error_str)
|
|
3916
|
+
is_valid, error_str = self.validate_dh_ag(self.dh_ag)
|
|
3917
|
+
if not is_valid:
|
|
3918
|
+
raise TypeError(error_str)
|
|
3919
|
+
is_valid, error_str = self.validate_dh_pgc(self.dh_pgc)
|
|
3920
|
+
if not is_valid:
|
|
3921
|
+
raise TypeError(error_str)
|
|
3922
|
+
is_valid, error_str = self.validate_dh_cgi(self.dh_cgi)
|
|
3923
|
+
if not is_valid:
|
|
3924
|
+
raise TypeError(error_str)
|
|
3925
|
+
|
|
3926
|
+
def parse_gripper_configuration(data: object):
|
|
3927
|
+
return GripperConfiguration(
|
|
3928
|
+
kind=parse_gripper_kind_enum(data["kind"]) if "kind" in data else None,
|
|
3929
|
+
onrobot_2fg7=parse_on_robot_2_fg_7_gripper_configuration(data["onrobot_2fg7"]) if "onrobot_2fg7" in data else None,
|
|
3930
|
+
onrobot_2fg14=parse_on_robot_2_fg_14_gripper_configuration(data["onrobot_2fg14"]) if "onrobot_2fg14" in data else None,
|
|
3931
|
+
onrobot_3fg15=parse_on_robot_3_fg_15_gripper_configuration(data["onrobot_3fg15"]) if "onrobot_3fg15" in data else None,
|
|
3932
|
+
onrobot_screwdriver=parse_on_robot_screwdriver_configuration(data["onrobot_screwdriver"]) if "onrobot_screwdriver" in data else None,
|
|
3933
|
+
dh_ag=parse_dhag_gripper_configuration(data["dh_ag"]) if "dh_ag" in data else None,
|
|
3934
|
+
dh_pgc=parse_dhpgc_gripper_configuration(data["dh_pgc"]) if "dh_pgc" in data else None,
|
|
3935
|
+
dh_cgi=parse_dhcgi_gripper_configuration(data["dh_cgi"]) if "dh_cgi" in data else None,
|
|
3936
|
+
)
|
|
3937
|
+
|
|
3938
|
+
def serialize_gripper_configuration(data: GripperConfiguration) -> object:
|
|
3939
|
+
return {
|
|
3940
|
+
"kind": serialize_gripper_kind_enum(data.kind),
|
|
3941
|
+
"onrobot_2fg7": None if data.onrobot_2fg7 is None else serialize_on_robot_2_fg_7_gripper_configuration(data.onrobot_2fg7),
|
|
3942
|
+
"onrobot_2fg14": None if data.onrobot_2fg14 is None else serialize_on_robot_2_fg_14_gripper_configuration(data.onrobot_2fg14),
|
|
3943
|
+
"onrobot_3fg15": None if data.onrobot_3fg15 is None else serialize_on_robot_3_fg_15_gripper_configuration(data.onrobot_3fg15),
|
|
3944
|
+
"onrobot_screwdriver": None if data.onrobot_screwdriver is None else serialize_on_robot_screwdriver_configuration(data.onrobot_screwdriver),
|
|
3945
|
+
"dh_ag": None if data.dh_ag is None else serialize_dhag_gripper_configuration(data.dh_ag),
|
|
3946
|
+
"dh_pgc": None if data.dh_pgc is None else serialize_dhpgc_gripper_configuration(data.dh_pgc),
|
|
3947
|
+
"dh_cgi": None if data.dh_cgi is None else serialize_dhcgi_gripper_configuration(data.dh_cgi),
|
|
3948
|
+
}
|
|
3949
|
+
|
|
2886
3950
|
@dataclass
|
|
2887
3951
|
class PlanesPaginatedResponse:
|
|
2888
3952
|
"""Paginated response containing plane data"""
|
|
@@ -3074,7 +4138,7 @@ class GripperCommandRequest:
|
|
|
3074
4138
|
if value is None:
|
|
3075
4139
|
return [False, "kind is required for GripperCommandRequest"]
|
|
3076
4140
|
|
|
3077
|
-
if not ((isinstance(value, str) and GripperKindEnum in ['onrobot_2fg7', 'onrobot_2fg14', 'onrobot_3fg15', 'dh_ag', 'dh_pgc', 'dh_cgi', 'schunk_egx', 'none_connected']) or isinstance(value, GripperKindEnum)):
|
|
4141
|
+
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)):
|
|
3078
4142
|
return [False, "kind must be of type GripperKindEnum for GripperCommandRequest, got " + type(value).__name__]
|
|
3079
4143
|
|
|
3080
4144
|
return [True, ""]
|