Best Python code snippet using localstack_python
smooth_leveling.py
Source:smooth_leveling.py
1import jpype2import time3import json4from operator import methodcaller5from jpype import *6from auto.getres import Res7# Login = None8from tools.base_logging import Log9log = Log()10class Listener:11 def onSocketConnectionSuccess(self):12 # global Login13 # Login = True14 print("BZL è¿æ¥æå")15 def onSocketDisconnection(self, e):16 print('BZL è¿æ¥æå¼')17 def onSocketConnectionFailed(self, e):18 # global Login19 # Login = False20 print('BZL è¿æ¥å¤±è´¥')21 # print(Login)22 def readData(self, header, body):23 pass24 # print("读åæ°æ®")25 # print(type(header), type(body))26 # print(str(header))27 # print(str(body))28 def upDateLaserData(self, data):29 print("æ¿å
æ°æ®æ´æ°")30 print(list(data))31 def upDateMapData(self, data):32 print("å°å¾æ°æ®æ´æ°")33 print(list(data))34 def upDateJsonFileData(self, data):35 print("jsonè·¯å¾æ´æ°")36 print(str(data))37 def upDateIOTMap(self, data):38 print("IOTçæå°å¾éç¥")39 print(str(data))40 def refusedConnect(self, data):41 print("å·²æAPPè¿æ¥")42 print(str(data))43 def upDateHeart(self, data):44 pass45 # print("å¿è·³éç¥ï¼" + str(data))46 def revControllerData(self, data):47 print("controller_serveræ°æ®")48 print(str(data))49 def notifyPGMOperation(self, data):50 print("notifyPGMOperation")51 print(str(data))52 def notifyYAMLOperation(self, data):53 print("notifyYAMLOperation")54 print(str(data))55 def notifyJSONOperation(self, data):56 print("notifyJSONOperation")57 print(str(data))58 def responseResult(self, mResponseType, mResult):59 print("BZL responseResult")60 print(mResponseType)61 print(mResult)62 def responseLogin(self, mLoginInfo):63 # setattr(Res, 'Login', True)64 print("responseLogin")65 print(str(mLoginInfo))66 def responseMapConfig(self, mOccupancyGrid):67 print("protobufæ°æ® å°å¾é
ç½®åæ°")68 print(str(mOccupancyGrid))69 def responseLaserConfig(self, mLaserScan):70 print("protobufæ°æ® æ¿å
é
ç½®åæ°")71 print(str(mLaserScan))72 def responseMapList(self, mFileInfos):73 print("protobufæ°æ® å°å¾å表")74 print(str(mFileInfos))75 def responseRosStatus(self, mRosPose, mLocalizationState):76 print("protobufæ°æ® æºå¨ä½ç½®åæ¿å
å®ä½ç¶æ")77 print(str(mRosPose))78 print(str(mLocalizationState))79 def ros_communication_response_Data(self, s):80 # if json.loads(str(s)).get('cmd_type') == 1000:81 # log.info(json.loads(str(s)))82 # print('s:{}'.format(str(s)))83 # print('response_Data:{}'.format(getattr(Res, 'response_Data')))84 # if json.loads(str(s)) == getattr(Res, 'response_Data'):85 # setattr(Res, 'response', True)86 # if getattr(Res, 'start_listener') and json.loads(str(s)).get('cmd_type') == 1001:87 # print("å¼å§çæ§ï¼{}".format(time.time()))88 # # print('s:{}'.format(str(s)))89 # # print('response_Data:{}'.format(getattr(Res, 'response_Data')))90 #91 # data = json.loads(str(s)).get('data')92 # # print(data)93 # setattr(Res, 'data1', data[-1]['data'])94 # setattr(Res, 'data2', data[0]['data'])95 # setattr(Res, 'start_listener', False)96 # print(data[0]['data'][73])97 # print('ros_communication_response_Data')98 # print(str(s))99 # pass100 # å°é¢æ¹å¹³101 if getattr(Res, 'start_listener') and json.load(str(s))["cmd_type"] == 1000:102 data = json.loads(str(s)).get('data')103 setattr(Res, 'data', data[-1]['result'])104 setattr(Res, 'start_listener', False)105 def revLandmarkData(self, data):106 print("åå
æ¿æ°æ®")107 print(str(data))108 def revLocationStatus(self, data):109 print("å®ä½ç¶ææ°æ®")110 print(str(data))111 def revSwitchScene(self, data):112 print("åºæ¯åæ¢åºç")113 print(str(data))114 def userManagerData(self, jsons):115 print("ç¨æ·ç®¡çéä¼ çjsonæ°æ®")116 print(str(jsons))117def readJson(file_name):118 with open(file_name, 'r') as f:119 data = json.load(f)120 mapdata = data['TaskData']121 return mapdata122def send_heart(seconds, agv):123 count = seconds * 20124 count = int(count)125 for i in range(count):126 agv.sendRosCommunicationRequestData('{"cmd_type":2020,"data":[],"seq_cmd":1}')127 time.sleep(0.05)128def pressure_request(duration, number, objects, cls_boj):129 """130 :param duration: æç»æ¶é´131 :param number: 循ç¯æ¬¡æ°132 :param objects: æ¹æ³å称 对象(methodcaller('loginRobot', 'bzl_user2', 'ss1234567'),) 第ä¸ä¸ªåæ°æ¹æ³å称å符串ï¼åç»åæ°ä¸ºæ¹æ³çåæ°133 :param cls_boj: 类对象134 :return:135 """136 # t1 = time.time()137 time1 = 1 / number138 for t in range(duration):139 for i in range(number):140 for obj in objects:141 # start_time = time.time()142 obj(cls_boj)143 time.sleep(time1)144 # end_time = time.time()145 # print(end_time - start_time)146 # t2 = time.time()147 time.sleep(1)148 # print("end: time=" + str(t2 - t1))149def test():150 jpype.startJVM(jpype.getDefaultJVMPath(), "-ea", "-Djava.class.path=BaseAGV-2.3.1.jar") # å¯å¨jvm151 # jpype.startJVM(jpype.getDefaultJVMPath(), "-ea", "-Djava.class.path=agvsdk.jar")152 AGVManager = jpype.JClass("com.bzl.baseagv.AGVManager")().getInstance() # AGVManageråä¾153 # AGVManager.setAGVStatusListener()154 Direction = jpype.JPackage('com.bzl.baseagv.impl').Direction # java æ举类155 mFileAction = jpype.JPackage('com.bzl.baseagv.impl').FileType # java æ举类156 MapType = jpype.JPackage('com.bzl.baseagv.proto.Robot').MapType # java æ举类157 TestAction = jpype.JPackage('com.bzl.baseagv.controllerjson.testdata').TestAction # java æ举类158 # StartTestParam = jpype.JObject('com.bzl.baseagv.controllerjson.testdata.StartTestParam')159 # StartTestParam = jpype.JClass('com.bzl.baseagv.controllerjson.testdata.StartTestParam')()160 StartTestParam = jpype.JPackage('com.bzl.baseagv.controllerjson.testdata.StartTestParam').StartTestParam161 GetErrorCodeHistoryParam = jpype.JPackage(162 'com.bzl.baseagv.controllerjson.errordata.GetErrorCodeHistoryParam').GetErrorCodeHistoryParam163 ExportErrorCodeHistoryParam = jpype.JPackage(164 'com.bzl.baseagv.controllerjson.errordata.ExportErrorCodeHistoryParam').ExportErrorCodeHistoryParam165 UserBean = jpype.JPackage('com.bzl.baseagv.controllerjson.userdata.UserBean').UserBean166 listener = jpype.JProxy("com.bzl.baseagv.impl.RobotListener", inst=Listener()) # æ¥æ°æ®ä¸æ¥çå¬é载类167 AGVManager.setRobotListener(listener) # æ°æ®ä¸æ¥çå¬168 # AGVManager.setAGVIPPort('192.168.8.1', 5979) # 设置æºå¨IPå端å£169 # AGVManager.setAGVIPPort('192.168.1.10', 5979) # 设置æºå¨IPå端å£170 AGVManager.setAGVIPPort('192.168.1.110', 5979) # 端å£é误171 # AGVManager.setAGVIPPort('192.168.1.111', 5979) # ipé误172 AGVManager.connectRobot() # è¿æ¥æºå¨äºº173 time.sleep(0.5)174 AGVManager.loginRobot('bzl_user2', 'ss1234567') # ç»å½æºå¨äºº175 # AGVManager.loginRobot('zxc123', 'asdfghjkllkjhgfdsa')176 # AGVManager.loginRobot('bzl_user', 'ss1234567') # è´¦å·é误177 # AGVManager.loginRobot('bzl_user2', 'ss12345678') #å¯ç é误178 # AGVManager.loginRobot('', 'ss1234567') # è´¦å·ä¸ºç©º179 # AGVManager.loginRobot('bzl_user2', '') #å¯ç 为空180 # AGVManager.loginRobot('auto', '')181 # while not Login:38ã182 # print('1')183 # if Login is True:184 # print("ç»å½æå")185 # else:186 # print("ç»å½å¤±è´¥")187 # AGVManager.sendRosCommunicationRequestData(188 # '{"cmd_type":1001,"data":[{"addr":19539,"cmd":0,"data":[36864],"num":2}],"seq_cmd":1}')189 # time.sleep(2)190 print(getattr(Res, 'Login'))191 # while not Login:192 # print('1')193 # if Login is True:194 # print("ç»å½æå")195 # else:196 # print("ç»å½å¤±è´¥")197 while True:198 input_text = input()199 if input_text == "3": # å¿è·³ä½¿è½200 AGVManager.setHeartEnable(True)201 elif input_text == "4": # åéå¿è·³202 AGVManager.sendHeart()203 elif input_text == "5": # 请æ±æºå¨äººä¿¡æ¯204 AGVManager.reqControllerServerInfo()205 elif input_text == "6": # 请æ±æºå¨ç¶æï¼ä½ç½®åå®ä½ç¶æï¼206 AGVManager.reqAllFrequentQuery()207 elif input_text == "7": # 请æ±æ¿å
æ°æ®208 AGVManager.reqLaserConfigAndData()209 elif input_text == "8": # 请æ±å°å¾å表210 AGVManager.reqMapList()211 elif input_text == "9": # 请æ±æºå¨å½åå°å¾212 AGVManager.reqMapConfigAndData()213 elif input_text == "10": # è·åæå®å°å¾214 map_name = input("è¾å
¥å°å¾å称")215 AGVManager.reqPreViewMap(map_name) # (String name)216 elif input_text == "11": # å è½½å°å¾217 map_name = input('è¾å
¥å°å¾å称')218 AGVManager.loadMapByRoomBean(map_name, MapType.MAP_TYPE_2D) # (String name)219 elif input_text == "12": # å¼å§å»ºå¾220 AGVManager.startMapping(MapType.MAP_TYPE_2D)221 #222 elif input_text == "13": # ç»æ建å¾223 map_name = input('è¾å
¥å°å¾å称')224 AGVManager.finishMapping(map_name) # (String name)225 #226 elif input_text == '14': # åæ¶å»ºå¾227 AGVManager.cancelMapping()228 elif input_text == "15": # å é¤å°å¾229 map_name = input('è¾å
¥å°å¾å称')230 AGVManager.deleteMap(map_name) # (String name)231 elif input_text == "16": # 设置åå§ç¹232 AGVManager.setInitPos(jpype.JFloat(-0.7), jpype.JFloat(-0.7), jpype.JFloat(-0.8))233 elif input_text == "M": # åºç移å¨åä¸234 t1 = time.time()235 AGVManager.move(Direction.UP, 0.1)236 time.sleep(0.25)237 AGVManager.move(Direction.DOWN, 0.1)238 time.sleep(0.25)239 AGVManager.move(Direction.LEFT, 0.1)240 time.sleep(0.25)241 AGVManager.move(Direction.RIGHT, 0.1)242 time.sleep(0.25)243 t2 = time.time()244 print(t2 - t1)245 elif input_text == "w": # åºç移å¨åä¸246 speed = float(input("请è¾å
¥é度ï¼0.1表示100mm/sï¼"))247 for n in range(1):248 AGVManager.move(Direction.UP, speed)249 time.sleep(0.5)250 elif input_text == "s": # åºç移å¨åä¸251 speed = float(input("请è¾å
¥é度ï¼0.1表示100mm/sï¼"))252 for n in range(1):253 AGVManager.move(Direction.DOWN, speed)254 time.sleep(0.5)255 elif input_text == "a": # åºç移å¨åå·¦256 speed = float(input("请è¾å
¥é度ï¼0.1表示100mm/sï¼"))257 AGVManager.move(Direction.LEFT, speed)258 elif input_text == "d": # åºç移å¨åå³259 speed = float(input("请è¾å
¥é度ï¼0.1表示100mm/sï¼"))260 AGVManager.move(Direction.RIGHT, speed)261 elif input_text == "aa": # åºç移å¨å·¦è½¬ç§»å¨262 speed = float(input("请è¾å
¥é度ï¼0.1表示100mm/sï¼"))263 AGVManager.move(Direction.YAW_LEFT, speed)264 time.sleep(1)265 # AGVManager.move(Direction.YAW_RIGHT, speed)266 # time.sleep(1)267 # AGVManager.move(Direction.UP, speed)268 # time.sleep(1)269 # AGVManager.move(Direction.DOWN, speed)270 elif input_text == "dd": # åºç移å¨å³è½¬ç§»å¨271 speed = float(input("请è¾å
¥é度ï¼0.1表示100mm/sï¼"))272 AGVManager.move(Direction.YAW_RIGHT, speed)273 # AGVManager.move(Direction.UP, 300)274 elif input_text == 'wa': # å·¦åæ¹æ²çº¿è¿å¨275 # speed = float(input("请è¾å
¥é度ï¼0.1表示100mm/sï¼"))276 l_x = 0.1277 l_y = 0.1278 l_z = 0.1279 a_x = 0.1280 a_y = 0.1281 a_z = 0.1282 AGVManager.move(l_x, l_y, l_z, a_x, a_y, a_z)283 elif input_text == "17": # åºç移å¨å³è½¬ç§»å¨ è¶
åºèå´284 AGVManager.move(Direction.YAW_RIGHT, 3)285 AGVManager.move(Direction.UP, 600)286 elif input_text == "18": # åºç移å¨å³è½¬ç§»å¨ è¶
åºèå´287 AGVManager.move(Direction.YAW_RIGHT, -1)288 AGVManager.move(Direction.UP, -100)289 elif input_text == "19": # æ¸
é¤æ
é290 ty = input("bit0ï¼å¤ä½æ¸
空è¿æ§æ
éï¼éçå¾
1så·¦å³ï¼ bit1ï¼æ¸
空çµæºæ
éï¼å¾å¿«ï¼ bit2ï¼å¤ä½çµæºé©±å¨ï¼éçå¾
10så·¦å³")291 ty = int(ty)292 AGVManager.clearFault(ty)293 elif input_text == "20": # æ¸
é¤ä»»å¡294 AGVManager.clearRoutePose()295 elif input_text == "21": # è·ååå
æ¿æ°æ®296 AGVManager.getLandMarkData()297 elif input_text == "22": # 硬æ¥åå¤ä½298 AGVManager.resetHardEmergencyStop()299 elif input_text == "23": # è·åå§å¤æµè¯ç¶æä¿¡æ¯300 AGVManager.getFunctionTestState()301 elif input_text == "24": # åç¹å¯¼èª302 AGVManager.setNavigationPoint(1.2, 1.4, 0.05) # (double x, double y, float angle)303 elif input_text == "25": # å¯å¨å®è·ç¦»ç§»å¨304 AGVManager.fixedDistanceMoveStart(20, 0, 0.05) # (double x, double y,int speed)305 elif input_text == "26": # åæ¢å®è·ç¦»ç§»å¨306 AGVManager.fixedDistanceMoveStop()307 #308 # elif input_text == "27": # åç¹å¤ç¹å¯¼èªæ°æ®ç»è£
309 # """åæ°:310 # taskID - ä»»å¡ID311 # mapName - å°å¾åå312 # navigationLoopNumber - 循ç¯æ¬¡æ°313 # OrgPt - èµ·å§ç¹314 # mWorkPointBeans - è·¯å¾ç¹"""315 # lst = jpype.java.util.ArrayList()316 # lst.add(WorkPointBean(jpype.JDouble(1.2), jpype.JDouble(1.2)))317 # AGVManager.moveRoutePose(1, "map1", 1, WorkPointBean(jpype.JDouble(1.2), jpype.JDouble(1.2)),318 # lst) # (int taskID, String mapName, int navigationLoopNumber, WorkPointBean OrgPt, List<WorkPointBean> mWorkPointBeans)319 elif input_text == "28": # æå320 AGVManager.pauseRoutePose()321 elif input_text == "29": # 继ç»322 AGVManager.continueRoutePose()323 elif input_text == "30": # åæ¢324 AGVManager.cancelRoutePose()325 elif input_text == "31": # cyber1.1å¼å§ä»»å¡326 AGVManager.runRoutePose()327 # elif input_text == "31": # rosåcyber1.0å¼å§ ä»åªä¸ªç¹å¼å§ï¼é»è®¤0328 # AGVManager.startRoutePose(1)329 elif input_text == "32": # å¼å§ ä»åªä¸ªç¹å¼å§ï¼é»è®¤0 workIndex - å¼å§å·¥èºä½ä¸ç¹330 AGVManager.startRoutePose(1, 2) # (int position, int workIndex)331 elif input_text == "33": # èªå¨æ¨¡å¼332 AGVManager.turnAutoMode()333 elif input_text == "34": # æå¨æ¨¡å¼334 AGVManager.turnManualMode()335 elif input_text == "35": # æ¥å336 AGVManager.quickStop()337 elif input_text == "36": # æ¥åå¤ä½338 AGVManager.cancelQuickStop()339 elif input_text == "37": # è·åå¼å¸¸æçµä½ä¸æ¢å¤ä¿¡æ¯340 AGVManager.getResumeWorkInfo()341 # elif input_text == "38": # æä½PGMãYAMLãJSONæ件-å¢å |ä¿®æ¹JSONæ件342 # # JSON_DELETEï¼å é¤jsonæä»¶ï¼ JSON_EDITï¼å¢å |ä¿®æ¹Jsonæ件ï¼PGM_EDITï¼å¢å |ä¿®æ¹PGMæ件;YAML_EDIT:å¢å |ä¿®æ¹YAMLæ件343 # with open('map1.json', 'rb') as f:344 # data = f.read()345 # AGVManager.editFileInfo(mFileAction.JSON_EDIT, 'map1.json',346 # data) # (FileType mFileAction, String name, byte[] datas)347 # elif input_text == "39": # æä½PGMãYAMLãJSONæ件-å¢å |ä¿®æ¹PGMæ件348 # # JSON_DELETEï¼å é¤jsonæä»¶ï¼ JSON_EDITï¼å¢å |ä¿®æ¹Jsonæ件ï¼PGM_EDITï¼å¢å |ä¿®æ¹PGMæ件;YAML_EDIT:å¢å |ä¿®æ¹YAMLæ件349 # with open('map1.pgm', 'rb') as f:350 # data = f.read()351 # AGVManager.editFileInfo(mFileAction.PGM_EDIT, 'map1.pgm',352 # data) # (FileType mFileAction, String name, byte[] datas)353 # elif input_text == "40": # æä½PGMãYAMLãJSONæ件-å¢å |ä¿®æ¹YAMLæ件354 # # JSON_DELETEï¼å é¤jsonæä»¶ï¼ JSON_EDITï¼å¢å |ä¿®æ¹Jsonæ件ï¼PGM_EDITï¼å¢å |ä¿®æ¹PGMæ件;YAML_EDIT:å¢å |ä¿®æ¹YAMLæ件355 # with open('map1.yaml', 'rb') as f:356 # data = f.read()357 # AGVManager.editFileInfo(mFileAction.YAML_EDIT, 'map1.yaml',358 # data) # (FileType mFileAction, String name, byte[] datas)359 # elif input_text == "41": # æä½PGMãYAMLãJSONæ件-å¢å |ä¿®æ¹JSONæ件360 # # JSON_DELETEï¼å é¤jsonæä»¶ï¼ JSON_EDITï¼å¢å |ä¿®æ¹Jsonæ件ï¼PGM_EDITï¼å¢å |ä¿®æ¹PGMæ件;YAML_EDIT:å¢å |ä¿®æ¹YAMLæ件361 # with open('map_0711.json', 'rb') as f:362 # data = f.read()363 # AGVManager.editFileInfo(mFileAction.JSON_DELETE, 'map_0711.json',364 # data) # (FileType mFileAction, String name, byte[] datas)365 elif input_text == "42": # cyber1.1设置å¼å§ç«ç¹366 AGVManager.setRouteStartPose(1)367 elif input_text == "43": # cyber1.1设置å¼å§ç«ç¹368 AGVManager.setRouteStartPose(1, 1)369 elif input_text == "44": # 3D建å¾ä½¿ç¨ï¼å¯å¨å®ä½370 AGVManager.startLocalizationNode()371 elif input_text == "45": # åæ¢æºå¨è¿è¡åºæ¯372 i = input("è¾å
¥åºæ¯ï¼1室å
ï¼0室å¤")373 a = int(i)374 AGVManager.switchScence(a)375 elif input_text == '46': # è·åéç¨è®¡æ£æ¥ä¿¡æ¯376 AGVManager.getOdomInspectInfo()377 elif input_text == '47': # å¼å§å¯å¨æµè¯378 """379 testType - æµè¯ç±»åï¼0é»è®¤ï¼ 1é´éï¼2è¿ç»380 runDis - è¿å¨è·ç¦»ï¼åä½m381 """382 AGVManager.startFunctionTest(0, 1)383 elif input_text == '48': # å¼å§éç¨è®¡æ£æ¥384 AGVManager.startInspectOdom()385 elif input_text == '49': # åæ¢æµè¯386 AGVManager.stopFunctionTest()387 elif input_text == "50": # AGV移å¨ç¶æ-èªå¨æ¨¡å¼ä¸å¼ä¿æ¤ç388 AGVManager.sendRosCommunicationRequestData(389 '{"cmd_type":1001,"data":[{"addr":4097,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')390 elif input_text == "51": # AGV移å¨ç¶æ-èªå¨æ¨¡å¼ä¸å¼ä¿æ¤ç391 AGVManager.sendRosCommunicationRequestData(392 '{"cmd_type":1001,"data":[{"addr":4097,"cmd":5,"data":[4],"num":2}],"seq_cmd":1}')393 # elif input_text == "52": # AGV移å¨ç¶æ-èªå¨æ¨¡å¼ä¸å
³ä¿æ¤ç394 # AGVManager.sendRosCommunicationRequestData(395 # '{"cmd_type":1001,"data":[{"addr":4097,"cmd":5,"data":[3],"num":2}],"seq_cmd":1}')396 #397 # elif input_text == "53": # AGV移å¨ç¶æ-å¼å¼å¸¸398 # AGVManager.sendRosCommunicationRequestData(399 # '{"cmd_type":1001,"data":[{"addr":4097,"cmd":5,"data":[2],"num":2}],"seq_cmd":1}')400 #401 # elif input_text == "54": # AGV移å¨ç¶æ-å¼å¼å¸¸402 # AGVManager.sendRosCommunicationRequestData(403 # '{"cmd_type":1001,"data":[{"addr":4097,"cmd":5,"data":[2],"num":2}],"seq_cmd":1}')404 # elif input_text == "54": # æ´ä½åé¶åæ¶405 # AGVManager.sendRosCommunicationRequestData(406 # '{"cmd_type":1001,"data":[{"addr":4181,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')407 #408 # elif input_text == "55": # æ´ä½åé¶409 # AGVManager.sendRosCommunicationRequestData(410 # '{"cmd_type":1001,"data":[{"addr":4181,"cmd":5,"data":[11],"num":2}],"seq_cmd":1}')411 #412 # elif input_text == "56": # ä¸çº§åéåé¶413 # AGVManager.sendRosCommunicationRequestData(414 # '{"cmd_type":1001,"data":[{"addr":4128,"cmd":5,"data":[16],"num":2}],"seq_cmd":1}')415 #416 # elif input_text == "57": # ä¸çº§åéåé¶åæ¶417 # AGVManager.sendRosCommunicationRequestData(418 # '{"cmd_type":1001,"data":[{"addr":4128,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')419 #420 # elif input_text == "58": # ä¸çº§åé设置ç®æ ä½ç½®421 # AGVManager.sendRosCommunicationRequestData(422 # '{"cmd_type":1001,"data":[{"addr":4129,"cmd":5,"data":[200],"num":2}],"seq_cmd":1}')423 #424 # elif input_text == "59": # ä¸çº§åé设置ç®æ é度425 # AGVManager.sendRosCommunicationRequestData(426 # '{"cmd_type":1001,"data":[{"addr":4130,"cmd":5,"data":[30],"num":2}],"seq_cmd":1}')427 #428 # elif input_text == "60": # ä¸çº§åéä½ç½®æ¨¡å¼å¼å¯429 # AGVManager.sendRosCommunicationRequestData(430 # '{"cmd_type":1001,"data":[{"addr":4128,"cmd":5,"data":[8],"num":2}],"seq_cmd":1}')431 #432 # elif input_text == "61": # ä¸çº§åé模å¼åæ¶433 # AGVManager.sendRosCommunicationRequestData(434 # '{"cmd_type":1001,"data":[{"addr":4128,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')435 #436 # elif input_text == "62": # ä¸çº§åéç¹å¨æ¨¡å¼å¼å¯437 # AGVManager.sendRosCommunicationRequestData(438 # '{"cmd_type":1001,"data":[{"addr":4128,"cmd":5,"data":[1],"num":2}],"seq_cmd":1}')439 #440 # elif input_text == "63": # ä¸çº§åéå¤ä½441 # AGVManager.sendRosCommunicationRequestData(442 # '{"cmd_type":1001,"data":[{"addr":4128,"cmd":5,"data":[32],"num":2}],"seq_cmd":1}')443 #444 # elif input_text == "64": # ä¸çº§åéå¤ä½åæ¶445 # AGVManager.sendRosCommunicationRequestData(446 # '{"cmd_type":1001,"data":[{"addr":4128,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')447 #448 # elif input_text == "65": # ä¸çº§ç¹å¨æ¨¡å¼åèµ·449 # AGVManager.sendRosCommunicationRequestData(450 # '{"cmd_type":1001,"data":[{"addr":4128,"cmd":5,"data":[3],"num":2}],"seq_cmd":1}')451 # time.sleep(1)452 # AGVManager.sendRosCommunicationRequestData(453 # '{"cmd_type":1001,"data":[{"addr":4128,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')454 #455 # elif input_text == "66": # ä¸çº§ç¹å¨æ¨¡å¼ä¸é456 # AGVManager.sendRosCommunicationRequestData(457 # '{"cmd_type":1001,"data":[{"addr":4128,"cmd":5,"data":[5],"num":2}],"seq_cmd":1}')458 # time.sleep(1)459 # AGVManager.sendRosCommunicationRequestData(460 # '{"cmd_type":1001,"data":[{"addr":4128,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')461 #462 # elif input_text == "67": # äºçº§åéåé¶463 # AGVManager.sendRosCommunicationRequestData(464 # '{"cmd_type":1001,"data":[{"addr":4131,"cmd":5,"data":[16],"num":2}],"seq_cmd":1}')465 #466 # elif input_text == "68": # äºçº§åéåé¶åæ¶467 # AGVManager.sendRosCommunicationRequestData(468 # '{"cmd_type":1001,"data":[{"addr":4131,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')469 #470 # elif input_text == "69": # äºçº§åéç®æ ä½ç½®è®¾ç½®471 # AGVManager.sendRosCommunicationRequestData(472 # '{"cmd_type":1001,"data":[{"addr":4132,"cmd":5,"data":[200],"num":2}],"seq_cmd":1}')473 #474 # elif input_text == "70": # äºçº§åéç®æ é度设置475 # AGVManager.sendRosCommunicationRequestData(476 # '{"cmd_type":1001,"data":[{"addr":4133,"cmd":5,"data":[30],"num":2}],"seq_cmd":1}')477 #478 # elif input_text == "71": # äºçº§åéä½ç½®æ¨¡å¼å¼å¯479 # AGVManager.sendRosCommunicationRequestData(480 # '{"cmd_type":1001,"data":[{"addr":4131,"cmd":5,"data":[8],"num":2}],"seq_cmd":1}')481 #482 # elif input_text == "72": # äºçº§åéä½ç½®æ¨¡å¼åæ¶483 # AGVManager.sendRosCommunicationRequestData(484 # '{"cmd_type":1001,"data":[{"addr":4131,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')485 #486 # elif input_text == "73": # äºçº§åéå¤ä½487 # AGVManager.sendRosCommunicationRequestData(488 # '{"cmd_type":1001,"data":[{"addr":4131,"cmd":5,"data":[32],"num":2}],"seq_cmd":1}')489 #490 # elif input_text == "74": # äºçº§åéå¤ä½åæ¶491 # AGVManager.sendRosCommunicationRequestData(492 # '{"cmd_type":1001,"data":[{"addr":4131,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')493 #494 # elif input_text == "75": # äºçº§åéç¹å¨æ¨¡å¼å¼å¯495 # AGVManager.sendRosCommunicationRequestData(496 # '{"cmd_type":1001,"data":[{"addr":4131,"cmd":5,"data":[1],"num":2}],"seq_cmd":1}')497 #498 # elif input_text == "76": # äºçº§åéç¹å¨æ¨¡å¼åæ¶499 # AGVManager.sendRosCommunicationRequestData(500 # '{"cmd_type":1001,"data":[{"addr":4131,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')501 #502 # elif input_text == "77": # äºçº§åéç¹å¨æ¨¡å¼åèµ·503 # AGVManager.sendRosCommunicationRequestData(504 # '{"cmd_type":1001,"data":[{"addr":4131,"cmd":5,"data":[3],"num":2}],"seq_cmd":1}')505 # time.sleep(1)506 # AGVManager.sendRosCommunicationRequestData(507 # '{"cmd_type":1001,"data":[{"addr":4131,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')508 #509 # elif input_text == "78": # äºçº§åéç¹å¨æ¨¡å¼ä¸é510 # AGVManager.sendRosCommunicationRequestData(511 # '{"cmd_type":1001,"data":[{"addr":4131,"cmd":5,"data":[5],"num":2}],"seq_cmd":1}')512 # time.sleep(1)513 # AGVManager.sendRosCommunicationRequestData(514 # '{"cmd_type":1001,"data":[{"addr":4131,"cmd":5,"data":[0],"num":2}],"seq_cmd":1}')515 #516 # elif input_text == "79": # ä¸è£
éç¨æ¹æ³517 # addr = input("请è¾å
¥å¯åå¨å°åï¼")518 # add = int(addr, 16)519 # data = input("请è¾å
¥dataå¼ï¼")520 # try:521 # data = int(data)522 # except:523 # data = float(data)524 # # print(data)525 # start = input("æ¯å¦å¼å¯çå¬(y/n):")526 # if start == 'y':527 # setattr(Res, 'start_listener', True)528 # time.sleep(1)529 # data1 = getattr(Res, 'data1')530 # data3 = getattr(Res, 'data2')531 # setattr(Res, 'data1', None)532 # setattr(Res, 'data2', None)533 # print("TX2åå
¥æ°æ®ï¼{}".format(data1))534 # print("PLCåå
¥æ°æ®ï¼{}".format(data3))535 # print('....................')536 # json_data = '{"cmd_type":1001,"data":[{"addr":%s,"cmd":5,"data":[%s],"num":2}],"seq_cmd":1}' % (add, data)537 # AGVManager.sendRosCommunicationRequestData(json_data)538 # time.sleep(1)539 # if start == 'y':540 # setattr(Res, 'start_listener', True)541 # time.sleep(2)542 # data2 = getattr(Res, 'data1')543 # data4 = getattr(Res, 'data2')544 # print("TX2åå
¥æ°æ®ï¼{}".format(data2))545 # print("PLCåå
¥æ°æ®ï¼{}".format(data4))546 # # print(data2[85], data1[85])547 # # print(data3==data4)548 #549 # for i in range(len(data2)):550 # # print("i{}:{}-----{}".format(i, data1[i], data2[i]))551 # # if i != data1[data2.index(i)] and data2.index(i) > 0:552 # if data1[i] != data2[i]:553 # print("TX2åå
¥å
åå°åååä½ç½®ä¸ºï¼{},åå¼ï¼{}ï¼ç°å¼ï¼{}".format(i, data1[i], data2[i]))554 # print("---------")555 # for i in range(len(data4)):556 # # print("i:{}-----{}".format(i, data1[data2.index(i)]))557 # # if i != data3[data4.index(i)] and data4.index(i) not in [16, 17]:558 # if data3[i] != data4[i]:559 # print("PLCåå
¥å
åå°åååä½ç½®ä¸ºï¼{},åå¼ï¼{}ï¼ç°å¼ï¼{}".format(i, data3[i], data4[i]))560 # setattr(Res, 'start_listener', False)561 # setattr(Res, 'data1', None)562 # setattr(Res, 'data2', None)563 #564 #565 # elif input_text == "94": # è·¯å¾ä¸å566 # mapData = str(readJson('map_0710.json'))567 # msg = AGVManager.sendRosCommunicationRequestData('{"cmd_type":2000,"data":[' + mapData + '],"seq_cmd":1}')568 # print(msg)569 #570 # elif input_text == '95': # ç»å½æ¥å£ååæµè¯571 # pressure_request(60, 2, (methodcaller('loginRobot', 'bzl_user2', 'ss1234567'),), AGVManager)572 # print('ç»å½æ¥å£ååæµè¯')573 #574 # elif input_text == '96': # è·åå°å¾å表æ¥å£ååæµè¯575 # pressure_request(60, 50, (methodcaller('reqMapList'),), AGVManager)576 # print('è·åå°å¾å表æ¥å£ååæµè¯')577 #578 # elif input_text == '97': # è·åæ¿å
ç¹äºæ°æ®æ¥å£ååæµè¯579 # pressure_request(60, 50, (methodcaller('reqLaserConfigAndData'),), AGVManager)580 # print('è·åæ¿å
ç¹äºæ°æ®æ¥å£ååæµè¯')581 #582 # elif input_text == '98': # è·åæºå¨çä¿¡æ¯æ¥å£ååæµè¯583 # pressure_request(60, 50, (methodcaller('reqControllerServerInfo'),), AGVManager)584 # print('è·åæºå¨çä¿¡æ¯æ¥å£ååæµè¯')585 #586 # elif input_text == '99': # è·åæºå¨çç¶æä¿¡æ¯æ¥å£ååæµè¯587 # pressure_request(60, 50, (methodcaller('reqAllFrequentQuery'),), AGVManager)588 # print('è·åæºå¨çç¶æä¿¡æ¯æ¥å£ååæµè¯')589 #590 # elif input_text == '100': # å è½½å°å¾æ¥å£ååæµè¯591 # pressure_request(60, 10, (methodcaller('loadMapByRoomBean', 'yyy', MapType.MAP_TYPE_2D),), AGVManager)592 # print('å è½½å°å¾æ¥å£ååæµè¯')593 #594 # elif input_text == '997':595 # # 导åºåå²æ
é596 # e = ExportErrorCodeHistoryParam()597 # e.setEnd_time(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))598 # jl = java.util.ArrayList()599 # # é误ç èå´E01000å°E06017600 # # a = input("è¾å
¥èµ·å§æ
éç èå´")601 # # b = input("è¾å
¥ç»ææ
éç èå´")602 # a = 'E01000'603 # b = 'E06000'604 # jl.add(a)605 # jl.add(b)606 # e.setError_code_range(jl)607 # e.setStart_time('2020-09-01 12:12:12')608 # AGVManager.exportFaultHistory(e)609 #610 #611 # elif input_text == '998':612 # # å页æ¥è¯¢æºå¨åå²æ
é613 # g = GetErrorCodeHistoryParam()614 # g.setEnd_time(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))615 # jl = java.util.ArrayList()616 # # é误ç èå´E01000å°E06017617 # a = input("è¾å
¥èµ·å§æ
éç èå´")618 # b = input("è¾å
¥ç»ææ
éç èå´")619 # jl.add(a)620 # jl.add(b)621 # g.setError_code_range(jl)622 # g.setPage_count(5)623 # g.setPage_num(1)624 # g.setStart_time('2020-09-01 12:12:12')625 # AGVManager.getFaultHistoryList(g)626 # print(123)627 #628 # elif input_text == '999':629 # # å¼å§å¯å¨å§å¤æµè¯630 # s = StartTestParam()631 # s.setAngular_speed(0)632 # s.setLine_speed(0.3)633 # s.setMove_duration(1)634 # list = [TestAction.TEST_ACTION_GO_AHEAD, TestAction.TEST_ACTION_GO_BACK]635 # jl = java.util.ArrayList()636 # for i in list:637 # jl.add(i)638 # s.setMove_mode_queue(jl)639 # s.setRotate_duration(0.1)640 # s.setStop_duration(0.1)641 # AGVManager.startFunctionTest(s)642 #643 # elif input_text == "120": # åéå¿è·³ååæµè¯644 # send_heart(60, AGVManager)645 #646 # elif input_text == '1000': # æ°å¢è´¦å·ä¿¡æ¯647 # u = UserBean()648 # name = input('è¾å
¥è´¦å·åï¼')649 # u.setUserName(name)650 # nick_name = input('è¾å
¥ç¨æ·åï¼')651 # u.setNickName(nick_name)652 # pwd = input('è¾å
¥å¯ç ï¼')653 # u.setPassword(pwd)654 # role_num = input('éæ©è§è²ï¼1.管çå 2.çæµå 3.æä½å')655 # role_dict = {'1': u.ROLE_ADMIN, '2': u.ROLE_BUILDER, '3': u.ROLE_OPERATOR}656 # role = role_dict[role_num]657 # u.setRole(role)658 # c_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())659 # u.setCreateTime(c_time)660 # print(u)661 # AGVManager.addNewUser(u)662 #663 # elif input_text == '1001': # è·åç¨æ·å表664 # AGVManager.getUserList()665 #666 # elif input_text == '1002':667 # name = input('è¾å
¥è¦å é¤çè´¦å·')668 # AGVManager.deleteUser(name)669 #670 # elif input_text == '1003': # ç¼è¾è´¦å·ä¿¡æ¯671 # u = UserBean()672 # name = input('è¾å
¥è´¦å·åï¼')673 # u.setUserName(name)674 # nick_name = input('è¾å
¥ç¨æ·åï¼')675 # u.setNickName(nick_name)676 # pwd = input('è¾å
¥å¯ç ï¼')677 # u.setPassword(pwd)678 # role_num = input('éæ©è§è²ï¼1.管çå 2.çæµå 3.æä½å')679 # role_dict = {'1': u.ROLE_ADMIN, '2': u.ROLE_BUILDER, '3': u.ROLE_OPERATOR}680 # role = role_dict[role_num]681 # u.setRole(role)682 # c_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())683 # u.setCreateTime(c_time)684 # print(u)685 # AGVManager.editUserInfo(u)686 #687 # elif input_text == "1004": # 以æå®é度ææ£æ¹å移å¨X688 # AGVManager.sendRosCommunicationRequestData(689 # '{"cmd_type":1001,"data":[{"addr":8211,"cmd":5,"data":[10],"num":2}],"seq_cmd":1}')690 #691 # elif input_text == '1005':692 # data = {693 # "cmd_type": 1000,694 # "data": {695 # "req_cmd_type": 1008,696 # "result": 0697 # },698 # "seq_cmd": 1,699 # "version": "1.0"700 # }701 #702 # setattr(Res, 'response_Data', data)703 # print(getattr(Res, 'response_Data'))704 # AGVManager.turnAutoMode()705 # time.sleep(1)706 # print(getattr(Res, 'response'))707 #708 # setattr(Res, 'response', False)709 # data1 = {710 # "cmd_type": 1000,711 # "data": {712 # "req_cmd_type": 1009,713 # "result": 0714 # },715 # "seq_cmd": 2,716 # "version": "1.0"717 # }718 # setattr(Res, 'response_Data', data1)719 # AGVManager.turnManualMode()720 # time.sleep(1)721 # print(getattr(Res, 'response'))722 elif input_text == "90001": # åæ°è®¾ç½®æ°æ®è·å723 setattr(Res, 'start_listener', True)724 time.sleep(1)725 AGVManager.sendRosCommunicationRequestData('{"cmd_type":9000, "seq_cmd":9000, "data":{}}')726 time.sleep(1)727 assert_fun(0)728 elif input_text == "90002": # åæ°è®¾ç½®æ°æ®è·å-cmd_type为å符串729 setattr(Res, 'start_listener', True)730 time.sleep(1)731 AGVManager.sendRosCommunicationRequestData('{"cmd_type":"9000", "seq_cmd":9000, "data":{}}')732 time.sleep(1)733 assert_fun(1)734 elif input_text == "90003": # åæ°è®¾ç½®æ°æ®è·å-cmd_typeæµ®ç¹æ°735 setattr(Res, 'start_listener', True)736 time.sleep(1)737 AGVManager.sendRosCommunicationRequestData('{"cmd_type":9000.0, "seq_cmd":9000, "data":{}}')738 time.sleep(1)739 assert_fun(1)740 elif input_text == "90004": # åæ°è®¾ç½®æ°æ®è·å-cmd_type为None741 setattr(Res, 'start_listener', True)742 time.sleep(1)743 AGVManager.sendRosCommunicationRequestData('{"cmd_type":None, "seq_cmd":9000, "data":{}}')744 time.sleep(1)745 assert_fun(1)746 elif input_text == "90005": # åæ°è®¾ç½®æ°æ®è·å-cmd_type为""747 setattr(Res, 'start_listener', True)748 time.sleep(1)749 AGVManager.sendRosCommunicationRequestData('{"cmd_type":"", "seq_cmd":9000, "data":{}}')750 time.sleep(1)751 assert_fun(1)752 elif input_text == "90006": # åæ°è®¾ç½®æ°æ®è·å-cmd_typeåæ°ç¼ºå¤±753 setattr(Res, 'start_listener', True)754 time.sleep(1)755 AGVManager.sendRosCommunicationRequestData('{"seq_cmd":9000, "data":{}}')756 time.sleep(1)757 assert_fun(1)758 elif input_text == "90007": # åæ°è®¾ç½®æ°æ®è·å-seq_cmd为å符å759 setattr(Res, 'start_listener', True)760 time.sleep(1)761 AGVManager.sendRosCommunicationRequestData('{"cmd_type":9000, "seq_cmd":"9000", "data":{}}')762 time.sleep(1)763 assert_fun(1)764 elif input_text == "90008": # åæ°è®¾ç½®æ°æ®è·å-seq_cmd为å符串765 setattr(Res, 'start_listener', True)766 time.sleep(1)767 AGVManager.sendRosCommunicationRequestData('{"cmd_type":9000, "seq_cmd":"9000", "data":{}}')768 time.sleep(1)769 assert_fun(1)770 elif input_text == "90009": # åæ°è®¾ç½®æ°æ®è·å-seq_cmd为""771 setattr(Res, 'start_listener', True)772 time.sleep(1)773 AGVManager.sendRosCommunicationRequestData('{"cmd_type":9000, "seq_cmd":"", "data":{}}')774 time.sleep(1)775 assert_fun(1)776 elif input_text == "900010": # åæ°è®¾ç½®æ°æ®è·å-seq_cmd为None777 setattr(Res, 'start_listener', True)778 time.sleep(1)779 AGVManager.sendRosCommunicationRequestData('{"cmd_type":9000, "seq_cmd":None, "data":{}}')780 time.sleep(1)781 assert_fun(1)782 elif input_text == "900011": # åæ°è®¾ç½®æ°æ®è·å-seq_cmd缺失783 setattr(Res, 'start_listener', True)784 time.sleep(1)785 AGVManager.sendRosCommunicationRequestData('{"cmd_type":9000, "data":{}}')786 time.sleep(1)787 assert_fun(1)788 elif input_text == "900012": # åæ°è®¾ç½®æ°æ®è·å-data为å符串789 setattr(Res, 'start_listener', True)790 time.sleep(1)791 AGVManager.sendRosCommunicationRequestData('{"cmd_type":9000, "seq_cmd":9000, "data":"test"')792 time.sleep(1)793 assert_fun(1)794 elif input_text == "900013": # åæ°è®¾ç½®æ°æ®è·å-data为""795 setattr(Res, 'start_listener', True)796 time.sleep(1)797 AGVManager.sendRosCommunicationRequestData('{"cmd_type":9000, "seq_cmd":9000, "data":""')798 time.sleep(1)799 assert_fun(1)800 elif input_text == "900014": # åæ°è®¾ç½®æ°æ®è·å-data为None801 setattr(Res, 'start_listener', True)802 time.sleep(1)803 AGVManager.sendRosCommunicationRequestData('{"cmd_type":9000, "seq_cmd":9000, "data":None')804 time.sleep(1)805 assert_fun(1)806 elif input_text == "900015": # åæ°è®¾ç½®æ°æ®è·å-data为缺失807 setattr(Res, 'start_listener', True)808 time.sleep(1)809 AGVManager.sendRosCommunicationRequestData('{"cmd_type":9000, "seq_cmd":9000')810 time.sleep(1)811 assert_fun(1)812 elif input_text == "100001": # ä¸è£
模å¼åæ¢ä¸ºä½ä¸æ¨¡å¼813 setattr(Res, 'start_listener', True)814 time.sleep(1)815 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10001, "seq_cmd":10001, "data":{}}') # å
ååæ®é模å¼816 time.sleep(1)817 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}')818 time.sleep(1)819 assert_fun(0)820 elif input_text == "100002": # ä¸è£
ä½ä¸æ¨¡å¼åæ¢ä¸ºä½ä¸æ¨¡å¼821 setattr(Res, 'start_listener', True)822 time.sleep(1)823 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}')824 time.sleep(1)825 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}')826 time.sleep(1)827 assert_fun(0)828 elif input_text == "100011": # ä¸è£
ä½ä¸æ¨¡å¼åæ¢ä¸ºæ®é模å¼829 setattr(Res, 'start_listener', True)830 time.sleep(1)831 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # å
ååä½ä¸æ¨¡å¼832 time.sleep(1)833 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10001, "seq_cmd":10001, "data":{}}')834 time.sleep(1)835 assert_fun(0)836 elif input_text == "100012": # ä¸è£
æ®é模å¼åæ¢ä¸ºæ®é模å¼837 setattr(Res, 'start_listener', True)838 time.sleep(1)839 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10001, "seq_cmd":10001, "data":{}}')840 time.sleep(1)841 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10001, "seq_cmd":10001, "data":{}}')842 time.sleep(1)843 assert_fun(0)844 elif input_text == "100031": # ä½ä¸æ¨¡å¼ æºå¨å¼å§ä½ä¸845 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼846 setattr(Res, 'start_listener', True)847 time.sleep(1)848 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10003, "seq_cmd":10003, "data":{}}') # å¼å§ä½ä¸849 time.sleep(1)850 assert_fun(0)851 setattr(Res, 'start_listener', True)852 time.sleep(10)853 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10004, "seq_cmd":10004, "data":{}}') # åæ¢ä½ä¸854 time.sleep(1)855 assert_fun(0)856 elif input_text == "100032": # ä½ä¸æ¨¡å¼ å¼å§æ¯æ£857 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼858 setattr(Res, 'start_listener', True)859 time.sleep(1)860 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10005, "seq_cmd":10005, "data":{}}') # å¼å§æ¯æ£861 time.sleep(1)862 assert_fun(0)863 elif input_text == "100033": # ä½ä¸æ¨¡å¼ å¼å§ä½ä¸ åæ¢æ¯æ£864 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼865 setattr(Res, 'start_listener', True)866 time.sleep(1)867 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10005, "seq_cmd":10005, "data":{}}') # å¼å§ä½ä¸868 time.sleep(1)869 assert_fun(0)870 setattr(Res, 'start_listener', True)871 time.sleep(10)872 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10004, "seq_cmd":10004, "data":{}}') # åæ¢ä½ä¸873 time.sleep(1)874 assert_fun(0)875 setattr(Res, 'start_listener', True)876 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10006, "seq_cmd":10006, "data":{}}') # åæ¢æ¯æ£877 time.sleep(1)878 assert_fun(1)879 elif input_text == "100034": # ä½ä¸æ¨¡å¼ åæ¢ä½ä¸ ä¸æ¯ç¨ä¾880 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10004, "seq_cmd":10004, "data":{}}') # åæ¢ä½ä¸881 elif input_text == "100035": # ä½ä¸æ¨¡å¼ æ¿å
èªå¨å
³é882 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼883 setattr(Res, 'start_listener', True)884 time.sleep(1)885 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10004, "seq_cmd":10004, "data":{}}') # æ¿å
èªå¨å
³é886 time.sleep(1)887 assert_fun(0)888 elif input_text == "100036": # ä½ä¸æ¨¡å¼ å·¦æ¨æä¸889 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼890 setattr(Res, 'start_listener', True)891 time.sleep(1)892 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10009, "seq_cmd":10009, "data":{}}') # å·¦æ¨æä¸893 time.sleep(1)894 assert_fun(1)895 elif input_text == "100037": # ä½ä¸æ¨¡å¼ å·¦æ¨æä¸896 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼897 setattr(Res, 'start_listener', True)898 time.sleep(1)899 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10010, "seq_cmd":10010, "data":{}}') # å·¦æ¨æä¸900 time.sleep(1)901 assert_fun(1)902 elif input_text == "100038": # ä½ä¸æ¨¡å¼ å³æ¨æä¸903 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼904 setattr(Res, 'start_listener', True)905 time.sleep(1)906 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10011, "seq_cmd":10011, "data":{}}') # å³æ¨æä¸907 time.sleep(1)908 assert_fun(1)909 elif input_text == "100039": # ä½ä¸æ¨¡å¼ å³æ¨æä¸910 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼911 setattr(Res, 'start_listener', True)912 time.sleep(1)913 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10012, "seq_cmd":10012, "data":{}}') # å³æ¨æä¸914 time.sleep(1)915 assert_fun(1)916 elif input_text == "1000310": # ä½ä¸æ¨¡å¼ å·¦å³æ¨æä¸917 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼918 setattr(Res, 'start_listener', True)919 time.sleep(1)920 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10013, "seq_cmd":10013, "data":{}}') # å³æ¨æä¸921 time.sleep(1)922 assert_fun(1)923 elif input_text == "1000311": # ä½ä¸æ¨¡å¼ å·¦å³æ¨æä¸924 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼925 setattr(Res, 'start_listener', True)926 time.sleep(1)927 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10014, "seq_cmd":10014, "data":{}}') # å³æ¨æä¸928 time.sleep(1)929 assert_fun(1)930 elif input_text == "1000312": # ä½ä¸æ¨¡å¼ æ¯æ£å¼å¯931 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼932 setattr(Res, 'start_listener', True)933 time.sleep(1)934 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10017, "seq_cmd":10017, "data":{}}') # æ¯æ£å¼å¯935 time.sleep(10)936 assert_fun(1)937 elif input_text == "1000313": # ä½ä¸æ¨¡å¼-å¼å§ä½ä¸-æ¯æ£å
³é938 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼939 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10003, "seq_cmd":10003, "data":{}}') # å¼å§ä½ä¸940 time.sleep(10)941 setattr(Res, 'start_listener', True)942 time.sleep(1)943 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10018, "seq_cmd":10018, "data":{}}') # æ¯æ£å
³é944 time.sleep(1)945 assert_fun(1)946 elif input_text == "100032": # æ®éæ¨¡å¼ æºå¨å¼å§ä½ä¸947 setattr(Res, 'start_listener', True)948 time.sleep(1)949 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10001, "seq_cmd":10001, "data":{}}') # æ®é模å¼950 time.sleep(1)951 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10003, "seq_cmd":10003, "data":{}}') # å¼å§ä½ä¸952 time.sleep(1)953 assert_fun(1)954 # setattr(Res, 'start_listener', True)955 # time.sleep(10)956 # AGVManager.sendRosCommunicationRequestData('{"cmd_type":10004, "seq_cmd":10004, "data":{}}') # åæ¢ä½ä¸957 # time.sleep(1)958 # assert_fun(1)959 elif input_text == "100032": # ä½ä¸è¿ç¨ä¸åæ¢ä¸ºæ®é模å¼960 setattr(Res, 'start_listener', True)961 time.sleep(1)962 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼963 time.sleep(1)964 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10003, "seq_cmd":10003, "data":{}}') # å¼å§ä½ä¸965 time.sleep(1)966 assert_fun(1)967 setattr(Res, 'start_listener', True)968 time.sleep(10)969 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10001, "seq_cmd":10001, "data":{}}') # æ®é模å¼970 time.sleep(1)971 assert_fun(1)972 elif input_text == "100033": # åæ¢ä½ä¸ # ä¸æ¯ç¨ä¾973 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10004, "seq_cmd":10004, "data":{}}')974 elif input_text == "100051": # æ®éæ¨¡å¼ å¼å§æ¯æ£ åæ¢æ¯æ£975 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10001, "seq_cmd":10001, "data":{}}') # åæ¢ä¸ºæ®é模å¼976 setattr(Res, 'start_listener', True)977 time.sleep(1)978 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10005, "seq_cmd":10005, "data":{}}') # å¼å§æ¯æ£979 time.sleep(10)980 assert_fun(0)981 setattr(Res, 'start_listener', True)982 time.sleep(1)983 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10006, "seq_cmd":10006, "data":{}}') # åæ¢æ¯æ£984 time.sleep(1)985 assert_fun(0)986 elif input_text == "100052": # æ¯æ£æ¶æ¹ä¸ºä½ä¸æ¨¡å¼987 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10001, "seq_cmd":10001, "data":{}}') # åæ¢ä¸ºæ®é模å¼988 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10005, "seq_cmd":10005, "data":{}}') # å¼å§æ¯æ£989 time.sleep(10)990 setattr(Res, 'start_listener', True)991 time.sleep(1)992 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10000, "seq_cmd":10000, "data":{}}') # ä½ä¸æ¨¡å¼993 time.sleep(1)994 assert_fun(0)995 elif input_text == "100053": # åæ¢æ¯æ£ # ä¸æ¯ç¨ä¾996 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10004, "seq_cmd":10004, "data":{}}')997 elif input_text == "100070": # æ®éæ¨¡å¼ æ¿å
èªå¨å¼å¯ å
³é998 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10001, "seq_cmd":10001, "data":{}}') # åæ¢ä¸ºæ®é模å¼999 setattr(Res, 'start_listener', True)1000 time.sleep(1)1001 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10007, "seq_cmd":10007, "data":{}}') # æ¿å
èªå¨å¼å¯1002 time.sleep(5)1003 assert_fun(0)1004 setattr(Res, 'start_listener', True)1005 time.sleep(1)1006 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10008, "seq_cmd":10008, "data":{}}') # æ¿å
èªå¨å
³é1007 time.sleep(10)1008 assert_fun(1)1009 elif input_text == "100081": # æ¿å
èªå¨å
³é å·¦æ¨æä¸1010 setattr(Res, 'start_listener', True)1011 time.sleep(1)1012 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10008, "seq_cmd":10008, "data":{}}') # æ¿å
èªå¨å
³é1013 time.sleep(2)1014 assert_fun(0)1015 setattr(Res, 'start_listener', True)1016 time.sleep(1)1017 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10009, "seq_cmd":10009, "data":{}}') # å·¦æ¨æä¸1018 time.sleep(0.5)1019 assert_fun(0)1020 setattr(Res, 'start_listener', True)1021 AGVManager.sendRosCommunicationRequestData(1022 '{"cmd_type":10100,"data":{"cancel_cmd":10009},"seq_cmd":1,"version":0}') # åæ¶ä¸è£
1023 time.sleep(0.5)1024 assert_fun(0)1025 elif input_text == "100082": # æ¿å
èªå¨å
³é å·¦æ¨æä¸1026 setattr(Res, 'start_listener', True)1027 time.sleep(1)1028 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10008, "seq_cmd":10008, "data":{}}') # æ¿å
èªå¨å
³é1029 time.sleep(2)1030 assert_fun(0)1031 setattr(Res, 'start_listener', True)1032 time.sleep(1)1033 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10010, "seq_cmd":10010, "data":{}}') # å·¦æ¨æä¸1034 time.sleep(0.5)1035 assert_fun(0)1036 setattr(Res, 'start_listener', True)1037 AGVManager.sendRosCommunicationRequestData(1038 '{"cmd_type":10100,"data":{"cancel_cmd":10010},"seq_cmd":1,"version":0}') # åæ¶ä¸è£
1039 time.sleep(0.5)1040 assert_fun(0)1041 elif input_text == "100083": # æ¿å
èªå¨å
³é å³æ¨æä¸1042 setattr(Res, 'start_listener', True)1043 time.sleep(1)1044 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10008, "seq_cmd":10008, "data":{}}') # æ¿å
èªå¨å
³é1045 time.sleep(2)1046 assert_fun(0)1047 setattr(Res, 'start_listener', True)1048 time.sleep(1)1049 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10011, "seq_cmd":10011, "data":{}}') # å³æ¨æä¸1050 time.sleep(0.5)1051 assert_fun(0)1052 setattr(Res, 'start_listener', True)1053 AGVManager.sendRosCommunicationRequestData(1054 '{"cmd_type":10100,"data":{"cancel_cmd":10011},"seq_cmd":1,"version":0}') # åæ¶ä¸è£
1055 time.sleep(0.5)1056 assert_fun(0)1057 elif input_text == "100084": # æ¿å
èªå¨å
³é å³æ¨æä¸1058 setattr(Res, 'start_listener', True)1059 time.sleep(1)1060 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10008, "seq_cmd":10008, "data":{}}') # æ¿å
èªå¨å
³é1061 time.sleep(2)1062 assert_fun(0)1063 setattr(Res, 'start_listener', True)1064 time.sleep(1)1065 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10012, "seq_cmd":10012, "data":{}}') # å³æ¨æä¸1066 time.sleep(0.5)1067 assert_fun(0)1068 setattr(Res, 'start_listener', True)1069 AGVManager.sendRosCommunicationRequestData(1070 '{"cmd_type":10100,"data":{"cancel_cmd":10012},"seq_cmd":1,"version":0}') # åæ¶ä¸è£
1071 time.sleep(0.5)1072 assert_fun(0)1073 elif input_text == "100085": # æ¿å
èªå¨å
³é å·¦å³æ¨æä¸1074 setattr(Res, 'start_listener', True)1075 time.sleep(1)1076 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10008, "seq_cmd":10008, "data":{}}') # æ¿å
èªå¨å
³é1077 time.sleep(2)1078 assert_fun(0)1079 setattr(Res, 'start_listener', True)1080 time.sleep(1)1081 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10013, "seq_cmd":10013, "data":{}}') # å³æ¨æä¸1082 time.sleep(0.5)1083 assert_fun(0)1084 setattr(Res, 'start_listener', True)1085 AGVManager.sendRosCommunicationRequestData(1086 '{"cmd_type":10100,"data":{"cancel_cmd":10013},"seq_cmd":1,"version":0}') # åæ¶ä¸è£
1087 time.sleep(0.5)1088 assert_fun(0)1089 elif input_text == "100086": # æ¿å
èªå¨å
³é å·¦å³æ¨æä¸1090 setattr(Res, 'start_listener', True)1091 time.sleep(1)1092 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10008, "seq_cmd":10008, "data":{}}') # æ¿å
èªå¨å
³é1093 time.sleep(2)1094 assert_fun(0)1095 setattr(Res, 'start_listener', True)1096 time.sleep(1)1097 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10014, "seq_cmd":10014, "data":{}}') # å·¦å³æ¨æä¸1098 time.sleep(0.5)1099 assert_fun(0)1100 setattr(Res, 'start_listener', True)1101 AGVManager.sendRosCommunicationRequestData(1102 '{"cmd_type":10100,"data":{"cancel_cmd":10014},"seq_cmd":1,"version":0}') # åæ¶ä¸è£
1103 time.sleep(0.5)1104 assert_fun(0)1105 elif input_text == "100071": # æ¿å
èªå¨å¼å¯ å·¦æ¨æä¸1106 setattr(Res, 'start_listener', True)1107 time.sleep(1)1108 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10007, "seq_cmd":10007, "data":{}}') # æ¿å
èªå¨å¼å¯1109 time.sleep(2)1110 assert_fun(0)1111 setattr(Res, 'start_listener', True)1112 time.sleep(1)1113 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10009, "seq_cmd":10009, "data":{}}') # å·¦æ¨æä¸1114 time.sleep(0.5)1115 assert_fun(1)1116 setattr(Res, 'start_listener', True)1117 AGVManager.sendRosCommunicationRequestData(1118 '{"cmd_type":10100,"data":{"cancel_cmd":10009},"seq_cmd":1,"version":0}') # åæ¶ä¸è£
1119 time.sleep(0.5)1120 assert_fun(0)1121 elif input_text == "100072": # æ¿å
èªå¨å¼å¯ å·¦æ¨æä¸1122 setattr(Res, 'start_listener', True)1123 time.sleep(1)1124 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10007, "seq_cmd":10007, "data":{}}') # æ¿å
èªå¨å¼å¯1125 time.sleep(2)1126 assert_fun(0)1127 setattr(Res, 'start_listener', True)1128 time.sleep(1)1129 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10010, "seq_cmd":10010, "data":{}}') # å·¦æ¨æä¸1130 time.sleep(0.5)1131 assert_fun(1)1132 setattr(Res, 'start_listener', True)1133 AGVManager.sendRosCommunicationRequestData(1134 '{"cmd_type":10100,"data":{"cancel_cmd":10010},"seq_cmd":1,"version":0}') # åæ¶ä¸è£
1135 time.sleep(0.5)1136 assert_fun(0)1137 elif input_text == "100073": # æ¿å
èªå¨å¼å¯ å³æ¨æä¸1138 setattr(Res, 'start_listener', True)1139 time.sleep(1)1140 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10007, "seq_cmd":10007, "data":{}}') # æ¿å
èªå¨å¼å¯1141 time.sleep(2)1142 assert_fun(0)1143 setattr(Res, 'start_listener', True)1144 time.sleep(1)1145 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10011, "seq_cmd":10011, "data":{}}') # å³æ¨æä¸1146 time.sleep(0.5)1147 assert_fun(1)1148 setattr(Res, 'start_listener', True)1149 AGVManager.sendRosCommunicationRequestData(1150 '{"cmd_type":10100,"data":{"cancel_cmd":10011},"seq_cmd":1,"version":0}') # åæ¶ä¸è£
1151 time.sleep(0.5)1152 assert_fun(0)1153 elif input_text == "100074": # æ¿å
èªå¨å¼å¯ å³æ¨æä¸1154 setattr(Res, 'start_listener', True)1155 time.sleep(1)1156 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10007, "seq_cmd":10007, "data":{}}') # æ¿å
èªå¨å¼å¯1157 time.sleep(2)1158 assert_fun(0)1159 setattr(Res, 'start_listener', True)1160 time.sleep(1)1161 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10012, "seq_cmd":10012, "data":{}}') # å³æ¨æä¸1162 time.sleep(0.5)1163 assert_fun(1)1164 setattr(Res, 'start_listener', True)1165 AGVManager.sendRosCommunicationRequestData(1166 '{"cmd_type":10100,"data":{"cancel_cmd":10012},"seq_cmd":1,"version":0}') # åæ¶ä¸è£
1167 time.sleep(0.5)1168 assert_fun(0)1169 elif input_text == "100075": # æ¿å
èªå¨å¼å¯ å·¦å³æ¨æä¸1170 setattr(Res, 'start_listener', True)1171 time.sleep(1)1172 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10007, "seq_cmd":10007, "data":{}}') # æ¿å
èªå¨å¼å¯1173 time.sleep(2)1174 assert_fun(0)1175 setattr(Res, 'start_listener', True)1176 time.sleep(1)1177 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10013, "seq_cmd":10013, "data":{}}') # å³æ¨æä¸1178 time.sleep(0.5)1179 assert_fun(0)1180 setattr(Res, 'start_listener', True)1181 AGVManager.sendRosCommunicationRequestData(1182 '{"cmd_type":10100,"data":{"cancel_cmd":10013},"seq_cmd":1,"version":0}') # åæ¶ä¸è£
1183 time.sleep(0.5)1184 assert_fun(0)1185 elif input_text == "100076": # æ¿å
èªå¨å¼å¯ å·¦å³æ¨æä¸1186 setattr(Res, 'start_listener', True)1187 time.sleep(1)1188 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10007, "seq_cmd":10007, "data":{}}') # æ¿å
èªå¨å¼å¯1189 time.sleep(2)1190 assert_fun(0)1191 setattr(Res, 'start_listener', True)1192 time.sleep(1)1193 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10014, "seq_cmd":10014, "data":{}}') # å·¦å³æ¨æä¸1194 time.sleep(0.5)1195 assert_fun(0)1196 setattr(Res, 'start_listener', True)1197 AGVManager.sendRosCommunicationRequestData(1198 '{"cmd_type":10100,"data":{"cancel_cmd":10014},"seq_cmd":1,"version":0}') # åæ¶ä¸è£
1199 time.sleep(0.5)1200 assert_fun(0)1201 elif input_text == "100171": # æ¯æ£å¼å¯ 确认å¨ä»ä¹æ¨¡å¼ä¸å¼å¯1202 setattr(Res, 'start_listener', True)1203 time.sleep(1)1204 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10017, "seq_cmd":10017, "data":{}}') # æ¯æ£å¼å¯1205 time.sleep(10)1206 assert_fun(0)1207 setattr(Res, 'start_listener', True)1208 time.sleep(1)1209 AGVManager.sendRosCommunicationRequestData('{"cmd_type":10018, "seq_cmd":10018, "data":{}}') # æ¯æ£å
³é1210 time.sleep(0.5)1211 assert_fun(0)1212 elif input_text == "90011": # æ¯æ£é¢ç设置-æ°å¼å¨åºé´å
1213 setattr(Res, 'start_listener', True)1214 time.sleep(1)1215 AGVManager.sendRosCommunicationRequestData(1216 '{"cmd_type":9001,"data":{"value":1000},"seq_cmd":1,"version":0}')1217 time.sleep(1)1218 assert_fun(0)1219 elif input_text == "90012": # æ¯æ£é¢ç设置-æ°å¼çäºæå°å¼1220 setattr(Res, 'start_listener', True)1221 time.sleep(1)1222 AGVManager.sendRosCommunicationRequestData(1223 '{"cmd_type":9001,"data":{"value":1000},"seq_cmd":1,"version":0}')1224 time.sleep(1)1225 assert_fun(0)1226 elif input_text == "90013": # æ¯æ£é¢ç设置-æ°å¼çäºæ大å¼1227 setattr(Res, 'start_listener', True)1228 time.sleep(1)1229 AGVManager.sendRosCommunicationRequestData(1230 '{"cmd_type":9001,"data":{"value":1000},"seq_cmd":1,"version":0}')1231 time.sleep(1)1232 assert_fun(0)1233 elif input_text == "90014": # æ¯æ£é¢ç设置-æ°å¼å°äºæå°å¼1234 setattr(Res, 'start_listener', True)1235 time.sleep(1)1236 AGVManager.sendRosCommunicationRequestData(1237 '{"cmd_type":9001,"data":{"value":1000},"seq_cmd":1,"version":0}')1238 time.sleep(1)1239 assert_fun(1)1240 elif input_text == "90015": # æ¯æ£é¢ç设置-æ°å¼å¤§äºæ大å¼1241 setattr(Res, 'start_listener', True)1242 time.sleep(1)1243 AGVManager.sendRosCommunicationRequestData(1244 '{"cmd_type":9001,"data":{"value":1000},"seq_cmd":1,"version":0}')1245 time.sleep(1)1246 assert_fun(1)1247 elif input_text == "90016": # æ¯æ£é¢ç设置-æ°å¼ä¸ºå符串1248 setattr(Res, 'start_listener', True)1249 time.sleep(1)1250 AGVManager.sendRosCommunicationRequestData(1251 '{"cmd_type":9001,"data":{"value":"1000"},"seq_cmd":1,"version":0}')1252 time.sleep(1)1253 assert_fun(1)1254 elif input_text == "90017": # æ¯æ£é¢ç设置-æ°å¼ä¸ºæµ®ç¹æ°1255 setattr(Res, 'start_listener', True)1256 time.sleep(1)1257 AGVManager.sendRosCommunicationRequestData(1258 '{"cmd_type":9001,"data":{"value":1000},"seq_cmd":1,"version":0}')1259 time.sleep(1)1260 assert_fun(1)1261 elif input_text == "90018": # æ¯æ£é¢ç设置-æ°å¼ä¸º""1262 setattr(Res, 'start_listener', True)1263 time.sleep(1)1264 AGVManager.sendRosCommunicationRequestData(1265 '{"cmd_type":9001,"data":{"value":1000},"seq_cmd":1,"version":0}')1266 time.sleep(1)1267 assert_fun(1)1268 elif input_text == "90019": # æ¯æ£é¢ç设置-æ°å¼ä¸ºNone1269 setattr(Res, 'start_listener', True)1270 time.sleep(1)1271 AGVManager.sendRosCommunicationRequestData(1272 '{"cmd_type":9001,"data":{"value":None},"seq_cmd":1,"version":0}')1273 time.sleep(1)1274 assert_fun(1)1275 elif input_text == "900110": # æ¯æ£é¢ç设置-æ°å¼ç¼ºå¤±1276 setattr(Res, 'start_listener', True)1277 time.sleep(1)1278 AGVManager.sendRosCommunicationRequestData(1279 '{"cmd_type":9001,"data":{"value":None},"seq_cmd":1,"version":0}')1280 time.sleep(1)1281 assert_fun(1)1282 elif input_text == "90021": # æ°´å¹³é«åº¦è®¾ç½®-æ°å¼å¨åºé´å
1283 setattr(Res, 'start_listener', True)1284 time.sleep(1)1285 AGVManager.sendRosCommunicationRequestData(1286 '{"cmd_type":9002,"data":{"value":1000},"seq_cmd":1,"version":0}')1287 time.sleep(1)1288 assert_fun(0)1289 elif input_text == "90022": # æ°´å¹³é«åº¦è®¾ç½®-æ°å¼çäºæå°å¼1290 setattr(Res, 'start_listener', True)1291 time.sleep(1)1292 AGVManager.sendRosCommunicationRequestData(1293 '{"cmd_type":9002,"data":{"value":1000},"seq_cmd":1,"version":0}')1294 time.sleep(1)1295 assert_fun(0)1296 elif input_text == "90023": # æ°´å¹³é«åº¦è®¾ç½®-æ°å¼çäºæ大å¼1297 setattr(Res, 'start_listener', True)1298 time.sleep(1)1299 AGVManager.sendRosCommunicationRequestData(1300 '{"cmd_type":9002,"data":{"value":1000},"seq_cmd":1,"version":0}')1301 time.sleep(1)1302 assert_fun(0)1303 elif input_text == "90024": # æ°´å¹³é«åº¦è®¾ç½®-æ°å¼å°äºæå°å¼1304 setattr(Res, 'start_listener', True)1305 time.sleep(1)1306 AGVManager.sendRosCommunicationRequestData(1307 '{"cmd_type":9002,"data":{"value":1000},"seq_cmd":1,"version":0}')1308 time.sleep(1)1309 assert_fun(1)1310 elif input_text == "90025": # æ°´å¹³é«åº¦è®¾ç½®-æ°å¼å¤§äºæ大å¼1311 setattr(Res, 'start_listener', True)1312 time.sleep(1)1313 AGVManager.sendRosCommunicationRequestData(1314 '{"cmd_type":9002,"data":{"value":1000},"seq_cmd":1,"version":0}')1315 time.sleep(1)1316 assert_fun(1)1317 elif input_text == "90026": # æ°´å¹³é«åº¦è®¾ç½®-æ°å¼ä¸ºå符串1318 setattr(Res, 'start_listener', True)1319 time.sleep(1)1320 AGVManager.sendRosCommunicationRequestData(1321 '{"cmd_type":9002,"data":{"value":"1000"},"seq_cmd":1,"version":0}')1322 time.sleep(1)1323 assert_fun(1)1324 elif input_text == "90027": # æ°´å¹³é«åº¦è®¾ç½®-æ°å¼ä¸ºæµ®ç¹æ°1325 setattr(Res, 'start_listener', True)1326 time.sleep(1)1327 AGVManager.sendRosCommunicationRequestData(1328 '{"cmd_type":9002,"data":{"value":1000.0},"seq_cmd":1,"version":0}')1329 time.sleep(1)1330 assert_fun(1)1331 elif input_text == "90028": # æ°´å¹³é«åº¦è®¾ç½®-æ°å¼ä¸º""1332 setattr(Res, 'start_listener', True)1333 time.sleep(1)1334 AGVManager.sendRosCommunicationRequestData(1335 '{"cmd_type":9002,"data":{"value":""},"seq_cmd":1,"version":0}')1336 time.sleep(1)1337 assert_fun(1)1338 elif input_text == "90029": # æ°´å¹³é«åº¦è®¾ç½®-æ°å¼ä¸ºNone1339 setattr(Res, 'start_listener', True)1340 time.sleep(1)1341 AGVManager.sendRosCommunicationRequestData(1342 '{"cmd_type":9002,"data":{"value":None},"seq_cmd":1,"version":0}')1343 time.sleep(1)1344 assert_fun(1)1345 elif input_text == "900210": # æ°´å¹³é«åº¦è®¾ç½®-æ°å¼ç¼ºå¤±1346 setattr(Res, 'start_listener', True)1347 time.sleep(1)1348 AGVManager.sendRosCommunicationRequestData(1349 '{"cmd_type":9002,"data":{},"seq_cmd":1,"version":0}')1350 time.sleep(1)1351 assert_fun(1)1352 elif input_text == "quit":1353 AGVManager.disconnectRobot()1354 break1355 jpype.shutdownJVM() # æåå
³éjvm1356def assert_fun(result1):1357 data = getattr(Res, "data")1358 print("recv_data:" + str(data))1359 if data == result1:1360 result = "æè¨æå"1361 else:1362 result = "æè¨å¤±è´¥"1363 print("result:" + result)1364 setattr(Res, 'start_listener', False)1365 setattr(Res, 'data', None)...
resolver.py
Source:resolver.py
...41 etcd_host, etcd_port)42 self._names = {}43 self._addr_cls = addr_cls or PlainAddress44 if start_listener:45 self.start_listener()46 def resolve(self, name):47 """Resolve gRPC service name.48 :param name: gRPC service name.49 :rtype list: A collection gRPC server address.50 """51 with self._lock:52 try:53 return self._names[name]54 except KeyError:55 addrs = self.get(name)56 self._names[name] = addrs57 return addrs58 def get(self, name):59 """Get values from Etcd.60 :param name: Etcd key prefix name.61 :rtype list: A collection of Etcd values.62 """63 keys = self._client.get_prefix(name)64 vals = []65 plain = True66 if self._addr_cls != PlainAddress:67 plain = False68 for val, metadata in keys:69 if plain:70 vals.append(self._addr_cls.from_value(val))71 else:72 add, addr = self._addr_cls.from_value(val)73 if add:74 vals.append(addr)75 return vals76 def update(self, **kwargs):77 """Add or delete service address.78 :param kwargs: Dictionary of ``'service_name': ((add-address, delete-address)).``79 """80 with self._lock:81 for name, (add, delete) in kwargs.items():82 try:83 self._names[name].extend(add)84 except KeyError:85 self._names[name] = add86 for del_item in delete:87 try:88 self._names[name].remove(del_item)89 except ValueError:90 continue91 def listen(self):92 """Listen for change about gRPC service address."""93 while not self._stopped:94 for name in self._names:95 try:96 vals = self.get(name)97 except:98 continue99 else:100 with self._lock:101 self._names[name] = vals102 time.sleep(self._listen_timeout)103 def start_listener(self, daemon=True):104 """Start listen thread.105 :param daemon: Indicate whether start thread as a daemon.106 """107 if self._listening:108 return109 thread_name = 'Thread-resolver-listener'110 self._listen_thread = threading.Thread(111 target=self.listen, name=thread_name)112 self._listen_thread.daemon = daemon113 self._listen_thread.start()114 self._listening = True115 def stop(self):116 """Stop service resolver."""117 if self._stopped:118 return119 self._stopped = True120 def __del__(self):121 self.stop()122class ZkServiceResolver(ServiceResolver):123 def __init__(self, zkServers, start_listener=True, connect_timeout=30, listen_timeout=5):124 self._client = KazooClient(hosts=zkServers, timeout=connect_timeout)125 self._listen_timeout = listen_timeout126 def resolve(self, name):127 pass128 def update(self, **kwargs):129 pass130 def listen(self):131 pass132class EurekaServiceResolver(ServiceResolver):133 def __init__(self, eureka_servers, resolver_name='eureka_nameresolver', start_listener=True, listen_timeout=30, connect_timeout=30):134 self._listening = False135 self._stopped = False136 self._listen_thread = None137 self._listen_timeout = listen_timeout138 self._lock = threading.Lock()139 instance_id = f'{resolver_name}:{self.get_ip()}'140 self._client = eureka_client.init(eureka_server=eureka_servers, app_name=resolver_name, instance_id=instance_id)141 self._names = {}142 if start_listener:143 self.start_listener()144 self._listen_timeout = listen_timeout145 def get_ip(self):146 hostname = socket.gethostname()147 # è·åæ¬æºip148 ip = socket.gethostbyname(hostname)149 return ip150 def resolve(self, name):151 """Resolve gRPC service name.152 :param name: gRPC service name.153 :rtype list: A collection gRPC server address.154 """155 with self._lock:156 try:157 return self._names[name]158 except KeyError:159 addrs = self.get(name)160 self._names[name] = addrs161 return addrs162 def get(self, name):163 """Get values from eureka.164 :param name: eureka service name.165 :rtype list: A collection of eureka values.166 """167 upper_name = name.upper()168 app = self._client.applications.get_application(upper_name)169 addrs = list()170 for up_instance in app.up_instances:171 addr = f"{up_instance.ipAddr}:{up_instance.metadata['gRPC.port']}"172 addrs.append(addr)173 return addrs174 def update(self, **kwargs):175 """Add or delete service address.176 :param kwargs: Dictionary of ``'service_name': ((add-address, delete-address)).``177 """178 with self._lock:179 for name, (add, delete) in kwargs.items():180 try:181 self._names[name].extend(add)182 except KeyError:183 self._names[name] = add184 for del_item in delete:185 try:186 self._names[name].remove(del_item)187 except ValueError:188 continue189 def listen(self):190 """Listen for change about gRPC service address."""191 while not self._stopped:192 for name in self._names:193 try:194 vals = self.get(name)195 except:196 continue197 else:198 with self._lock:199 self._names[name] = vals200 time.sleep(self._listen_timeout)201 def start_listener(self, daemon=True):202 """Start listen thread.203 :param daemon: Indicate whether start thread as a daemon.204 """205 if self._listening:206 return207 thread_name = 'Thread-resolver-listener'208 self._listen_thread = threading.Thread(209 target=self.listen, name=thread_name)210 self._listen_thread.daemon = daemon211 self._listen_thread.start()212 self._listening = True213 def stop(self):214 """Stop service resolver."""215 if self._stopped:...
__main__.py
Source:__main__.py
...41async def _on_started(event:hikari.StartedEvent) -> None:42 channel = await bot.rest.fetch_channel(bot_config["logging"]["startup"])43 await channel.send("Bot has Started")44 view = pingroles()45 view.start_listener()46 view2 = verify()47 view2.start_listener()48 view3 = botaccess()49 view3.start_listener()50 view4 = karutaaccess()51 view4.start_listener()52 view5 = colorroles()53 view5.start_listener()54 view6 = bioroles()55 view6.start_listener()56 # view3 = giveaway_view()57 # view3.start_listener()58@bot.listen(hikari.StoppingEvent)59async def _on_ended(event:hikari.StoppingEvent) -> None:60 channel = await bot.rest.fetch_channel(bot_config["logging"]["startup"])61 await channel.send("Bot has Stopped")62@bot.command()63@lightbulb.option("extension", "The extension to reload", modifier=lightbulb.commands.base.OptionModifier(3))64@lightbulb.add_checks(lightbulb.owner_only)65@lightbulb.command("reload", "reload a bots extension")66@lightbulb.implements(lightbulb.PrefixCommand)67async def _reload(ctx: lightbulb.Context) -> None:68 extension = ctx.options.extension69 try:70 ctx.bot.reload_extensions(f"bot.extensions.{extension}")71 embed = hikari.Embed(description=f"Reloaded extention {extension}", color=bot_config["color"]["default"])...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!