| | |
| | | |
| | | radiusLen = None |
| | | |
| | | #with open("./codeMatrix.txt", "r") as file: |
| | | # codeMatrix = np.array(json.loads(file.read())) |
| | | |
| | | #with open("./cdaMatrix.txt", "r") as file: |
| | | # data = json.loads(file.read()) |
| | | # cdaMatrix = np.array(data) |
| | | |
| | | # 将字符串转换为浮点型数组 |
| | | def convert_to_float_array(str_array): |
| | |
| | | radiusLenStr = sys.argv[1] |
| | | radiusLen = float(radiusLenStr) |
| | | |
| | | codeMatrixPath = sys.argv[2] |
| | | cdaMatrixPath = sys.argv[3] |
| | | |
| | | redisHost = sys.argv[4] |
| | | redisPwd = sys.argv[5] |
| | | redisPort = sys.argv[6] |
| | | redisIdx = sys.argv[7] |
| | | |
| | | with open(codeMatrixPath, "r") as file: |
| | | codeMatrix = np.array(json.loads(file.read())) |
| | | |
| | | with open(cdaMatrixPath, "r") as file: |
| | | data = json.loads(file.read()) |
| | | cdaMatrix = np.array(data) |
| | | redisHost = sys.argv[2] |
| | | redisPwd = sys.argv[3] |
| | | redisPort = sys.argv[4] |
| | | redisIdx = sys.argv[5] |
| | | |
| | | startTime = time.perf_counter() |
| | | |
| | | waveMatrix = initWaveMatrix() |
| | | |
| | | # 创建一个连接池 |
| | | pool = redis.ConnectionPool(host=redisHost, port=int(redisPort), password=redisPwd, db=int(redisIdx)) |
| | | r = redis.Redis(connection_pool=pool) |
| | | dynamicMatrixStr = r.get('KV.AGV_MAP_ASTAR_DYNAMIC_FLAG.1') |
| | | |
| | | codeMatrixStr = r.get('KV.AGV_MAP_ASTAR_CODE_FLAG.1') |
| | | codeMatrix = np.array(json.loads(codeMatrixStr)) |
| | | |
| | | cdaMatrixStr = r.get('KV.AGV_MAP_ASTAR_CDA_FLAG.1') |
| | | cdaMatrix = np.array(json.loads(cdaMatrixStr)) |
| | | |
| | | dynamicMatrixStr = r.get('KV.AGV_MAP_ASTAR_DYNAMIC_FLAG.1') |
| | | dynamicMatrix = np.array(json.loads(dynamicMatrixStr)) |
| | | |
| | | waveMatrix = initWaveMatrix() |
| | | |
| | | # # 使用 numpy 加速的代码 |
| | | process_dynamic_matrix(dynamicMatrix, codeMatrix) |
| | | |