RRT.py 998 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import env
  2. import plotting
  3. import matplotlib.pyplot as plt
  4. import matplotlib.patches as patches
  5. class RRT:
  6. def __init__(self, xI, xG):
  7. # Plotting = plotting.Plotting(xI, xG)
  8. # Plotting.animation([xI, xG], [xI, xG], "zhou")
  9. fig, ax = plt.subplots()
  10. plt.axis([-5, 5, -5, 5])
  11. ax.plot()
  12. ax.add_patch(
  13. patches.Rectangle(
  14. (1, 1),
  15. 0.5,
  16. 0.5,
  17. edgecolor='black',
  18. facecolor='black',
  19. fill=True
  20. ))
  21. ax.add_patch(
  22. patches.Circle(
  23. (3, 3),
  24. 0.5,
  25. edgecolor='black',
  26. facecolor='black',
  27. fill=True
  28. )
  29. )
  30. plt.axis("equal")
  31. plt.show()
  32. def planning(self):
  33. return
  34. if __name__ == '__main__':
  35. x_Start = (5, 5) # Starting node
  36. x_Goal = (49, 5) # Goal node
  37. rrt = RRT(x_Start, x_Goal)