1616class MyCobotDataException (Exception ):
1717 pass
1818
19- class CobotXDataException (Exception ):
19+ class MercuryDataException (Exception ):
2020 pass
2121
2222class MyAgvDataException (Exception ):
@@ -196,29 +196,29 @@ def calibration_parameters(**kwargs):
196196 robot_limit = json .load (f )
197197 parameter_list = list (kwargs .keys ())
198198 class_name = kwargs .get ("class_name" , None )
199- if class_name == "CobotX " :
199+ if class_name == "Mercury " :
200200 for parameter in parameter_list [1 :]:
201201 value = kwargs .get (parameter , None )
202202 if parameter == 'id' and value not in robot_limit [class_name ][parameter ]:
203- check_id (value , robot_limit [class_name ][parameter ], CobotXDataException )
203+ check_id (value , robot_limit [class_name ][parameter ], MercuryDataException )
204204 elif parameter == 'angle' :
205205 id = kwargs .get ('id' , None )
206206 if id in [11 ,12 ,13 ]:
207207 index = robot_limit [class_name ]['id' ][id - 4 ] - 4
208208 else :
209209 index = robot_limit [class_name ]['id' ][id - 1 ] - 1
210210 if value < robot_limit [class_name ]["angles_min" ][index ] or value > robot_limit [class_name ]["angles_max" ][index ]:
211- raise CobotXDataException (
211+ raise MercuryDataException (
212212 "angle value not right, should be {0} ~ {1}, but received {2}" .format (
213213 robot_limit [class_name ]["angles_min" ][index ], robot_limit [class_name ]["angles_max" ][index ], value
214214 )
215215 )
216216 # elif parameter == 'angles':
217217 # if len(value) not in [7, 10]:
218- # raise CobotXDataException ("The length of `angles` must be 7 or 10.")
218+ # raise MercuryDataException ("The length of `angles` must be 7 or 10.")
219219 # for idx, angle in enumerate(value):
220220 # if not MIN_ANGLE <= angle <= MAX_ANGLE:
221- # raise CobotXDataException (
221+ # raise MercuryDataException (
222222 # "Has invalid angle value, error on index {0}. angle should be {1} ~ {2}.".format(
223223 # idx, MIN_ANGLE, MAX_ANGLE
224224 # )
@@ -228,43 +228,43 @@ def calibration_parameters(**kwargs):
228228
229229 index = kwargs .get ('id' , None ) - 1
230230 if value < robot_limit [class_name ]["coords_min" ][index ] or value > robot_limit [class_name ]["coords_max" ][index ]:
231- raise CobotXDataException (
231+ raise MercuryDataException (
232232 "coord value not right, should be {0} ~ {1}, but received {2}" .format (
233233 robot_limit [class_name ]["coords_min" ][index ], robot_limit [class_name ]["coords_max" ][index ], value
234234 )
235235 )
236236 elif parameter == 'coords' :
237- check_coords (value , robot_limit , class_name , CobotXDataException )
237+ check_coords (value , robot_limit , class_name , MercuryDataException )
238238
239239 elif parameter == 'speed' and not 1 <= value <= 100 :
240- raise CobotXDataException (
240+ raise MercuryDataException (
241241 "speed value not right, should be 1 ~ 100, the error speed is %s"
242242 % value
243243 )
244244
245245 elif parameter == 'rgb' :
246- check_rgb_value (value , CobotXDataException , class_name )
246+ check_rgb_value (value , MercuryDataException , class_name )
247247 # if direction is not None:
248248 elif parameter in ['direction' , 'flag' , 'mode' ]:
249249 if value not in [0 , 1 ]:
250- raise CobotXDataException ("{} only supports 0 or 1, but received {}" .format (parameter , value ))
250+ raise MercuryDataException ("{} only supports 0 or 1, but received {}" .format (parameter , value ))
251251
252252 elif parameter == 'coord_id' :
253253 if value < 1 or value > 6 :
254- raise CobotXDataException ("coord_id only supports 1 ~ 6, but received {}" .format (value ))
254+ raise MercuryDataException ("coord_id only supports 1 ~ 6, but received {}" .format (value ))
255255
256256 elif parameter == 'solution_angle' :
257257 if value > 90 or value < - 90 :
258- raise CobotXDataException ("The angle range is -90° ~ 90°, but received {}" .format (value ))
258+ raise MercuryDataException ("The angle range is -90° ~ 90°, but received {}" .format (value ))
259259 elif parameter == 'address' :
260260 if value < 32 or value > 34 :
261- raise CobotXDataException ("The angle address is 32 ~ 34, but received {}" .format (value ))
261+ raise MercuryDataException ("The angle address is 32 ~ 34, but received {}" .format (value ))
262262 elif parameter == 'value' :
263263 if value < 1 or value > 32000 :
264- raise CobotXDataException ("The angle value is 1 ~ 32000, but received {}" .format (value ))
264+ raise MercuryDataException ("The angle value is 1 ~ 32000, but received {}" .format (value ))
265265 elif parameter == "servo_restore" :
266266 if value not in [1 ,2 ,3 ,4 ,5 ,6 ,7 ,13 ,254 ]:
267- raise CobotXDataException ("The joint_id should be in [1,2,3,4,5,6,7,13,254], but received {}" .format (value ))
267+ raise MercuryDataException ("The joint_id should be in [1,2,3,4,5,6,7,13,254], but received {}" .format (value ))
268268
269269 elif class_name == "MyAgv" :
270270 for parameter in parameter_list [1 :]:
0 commit comments