当前位置:   article > 正文

机器人路径规划:基于改进型A*算法的机器人路径规划(提供Python代码)_a*算法多机器人路径规划

a*算法多机器人路径规划

一、A*算法介绍

A*算法最早可追溯到1968年,在IEEE Transactions on Systems Science and Cybernetics中的论文A Formal Basis for the Heuristic Determination of Minimum Cost Paths中首次提出。
https://blog.csdn.net/weixin_46204734/article/details/136790525

参考文献

[1] Hart P E ,MEMBER,IEEE,et al.A Formal Basis for the Heuristic Determination of Minimum Cost Paths[J].IEEE Transactions on Systems Science and Cybernetics, 2007, 4(2):100-107.DOI:10.1109/TSSC.1968.300136.

[2] Hart P E , Nilsson N J , Raphael B .A Formal Basis for the Heuristic Determination of Minimum Cost Paths[J].IEEE Transactions on Systems Science & Cybernetics, 1972, 4(2):28-29.DOI:10.1145/1056777.1056779.

[2]张海涛,程荫杭.基于A*算法的全局路径搜索[J].微计算机信息, 2007(17):3.DOI:10.3969/j.issn.1008-0570.2007.17.095.

二、部分代码

  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. show_animation = False
  4. use_beam_search = False
  5. use_iterative_deepening = False
  6. use_dynamic_weighting = False
  7. use_theta_star = False
  8. use_jump_point = False
  9. beam_capacity = 30
  10. max_theta = 5
  11. only_corners = False
  12. max_corner = 5
  13. w, epsilon, upper_bound_depth = 1, 4, 500
  14. def draw_horizontal_line(start_x, start_y, length, o_x, o_y, o_dict):
  15. for i in range(start_x, start_x + length):
  16. for j in range(start_y, start_y + 2):
  17. o_x.append(i)
  18. o_y.append(j)
  19. o_dict[(i, j)] = True
  20. def draw_vertical_line(start_x, start_y, length, o_x, o_y, o_dict):
  21. for i in range(start_x, start_x + 2):
  22. for j in range(start_y, start_y + length):
  23. o_x.append(i)
  24. o_y.append(j)
  25. o_dict[(i, j)] = True
  26. def in_line_of_sight(obs_grid, x1, y1, x2, y2):
  27. t = 0
  28. while t <= 0.5:
  29. xt = (1 - t) * x1 + t * x2
  30. yt = (1 - t) * y1 + t * y2
  31. if obs_grid[(int(xt), int(yt))]:
  32. return False, None
  33. xt = (1 - t) * x2 + t * x1
  34. yt = (1 - t) * y2 + t * y1
  35. if obs_grid[(int(xt), int(yt))]:
  36. return False, None
  37. t += 0.001
  38. dist = np.linalg.norm(np.array([x1, y1] - np.array([x2, y2])))
  39. return True, dist

三、部分结果

四、完整Python代码

见下方联系方式

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/520032
推荐阅读
相关标签
  

闽ICP备14008679号