python-motion-planning 1.1.1__tar.gz → 2.0.dev1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. {python_motion_planning-1.1.1 → python_motion_planning-2.0.dev1}/PKG-INFO +86 -162
  2. python_motion_planning-2.0.dev1/README.md +126 -0
  3. {python_motion_planning-1.1.1 → python_motion_planning-2.0.dev1}/pyproject.toml +4 -5
  4. python_motion_planning-2.0.dev1/src/python_motion_planning/__init__.py +4 -0
  5. python_motion_planning-2.0.dev1/src/python_motion_planning/common/__init__.py +3 -0
  6. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/__init__.py +6 -0
  7. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/map/__init__.py +2 -0
  8. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/map/base_map.py +125 -0
  9. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/map/grid.py +569 -0
  10. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/node.py +111 -0
  11. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/robot/__init__.py +3 -0
  12. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/robot/base_robot.py +214 -0
  13. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/robot/circular_robot.py +47 -0
  14. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/robot/diff_drive_robot.py +109 -0
  15. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/robot/tmp.py +404 -0
  16. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/types.py +19 -0
  17. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/world/__init__.py +1 -0
  18. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/world/base_world.py +120 -0
  19. python_motion_planning-2.0.dev1/src/python_motion_planning/common/env/world/toy_simulator.py +206 -0
  20. python_motion_planning-2.0.dev1/src/python_motion_planning/common/utils/__init__.py +2 -0
  21. python_motion_planning-2.0.dev1/src/python_motion_planning/common/utils/frame_transformer.py +218 -0
  22. python_motion_planning-2.0.dev1/src/python_motion_planning/common/utils/geometry.py +105 -0
  23. python_motion_planning-2.0.dev1/src/python_motion_planning/common/visualizer/__init__.py +1 -0
  24. python_motion_planning-2.0.dev1/src/python_motion_planning/common/visualizer/visualizer.py +529 -0
  25. python_motion_planning-2.0.dev1/src/python_motion_planning/controller/__init__.py +3 -0
  26. python_motion_planning-2.0.dev1/src/python_motion_planning/controller/base_controller.py +158 -0
  27. python_motion_planning-2.0.dev1/src/python_motion_planning/controller/path_tracker/__init__.py +5 -0
  28. python_motion_planning-2.0.dev1/src/python_motion_planning/controller/path_tracker/apf.py +232 -0
  29. python_motion_planning-2.0.dev1/src/python_motion_planning/controller/path_tracker/dwa.py +253 -0
  30. python_motion_planning-2.0.dev1/src/python_motion_planning/controller/path_tracker/path_tracker.py +257 -0
  31. python_motion_planning-2.0.dev1/src/python_motion_planning/controller/path_tracker/pid.py +76 -0
  32. python_motion_planning-2.0.dev1/src/python_motion_planning/controller/path_tracker/pure_pursuit.py +65 -0
  33. python_motion_planning-2.0.dev1/src/python_motion_planning/controller/random_controller.py +27 -0
  34. {python_motion_planning-1.1.1/src/python_motion_planning/curve_generation → python_motion_planning-2.0.dev1/src/python_motion_planning/curve_generator}/bezier_curve.py +41 -41
  35. {python_motion_planning-1.1.1/src/python_motion_planning/curve_generation → python_motion_planning-2.0.dev1/src/python_motion_planning/curve_generator}/bspline_curve.py +51 -51
  36. {python_motion_planning-1.1.1/src/python_motion_planning/curve_generation → python_motion_planning-2.0.dev1/src/python_motion_planning/curve_generator}/cubic_spline.py +44 -44
  37. {python_motion_planning-1.1.1/src/python_motion_planning/curve_generation → python_motion_planning-2.0.dev1/src/python_motion_planning/curve_generator}/dubins_curve.py +31 -31
  38. python_motion_planning-2.0.dev1/src/python_motion_planning/curve_generator/fem_pos_smooth.py +114 -0
  39. {python_motion_planning-1.1.1/src/python_motion_planning/curve_generation → python_motion_planning-2.0.dev1/src/python_motion_planning/curve_generator}/polynomial_curve.py +58 -58
  40. {python_motion_planning-1.1.1/src/python_motion_planning/curve_generation → python_motion_planning-2.0.dev1/src/python_motion_planning/curve_generator}/reeds_shepp.py +48 -48
  41. python_motion_planning-2.0.dev1/src/python_motion_planning/path_planner/__init__.py +3 -0
  42. python_motion_planning-2.0.dev1/src/python_motion_planning/path_planner/base_path_planner.py +88 -0
  43. python_motion_planning-2.0.dev1/src/python_motion_planning/path_planner/graph_search/__init__.py +3 -0
  44. python_motion_planning-2.0.dev1/src/python_motion_planning/path_planner/graph_search/a_star.py +96 -0
  45. python_motion_planning-2.0.dev1/src/python_motion_planning/path_planner/graph_search/dijkstra.py +97 -0
  46. python_motion_planning-2.0.dev1/src/python_motion_planning/path_planner/graph_search/theta_star.py +118 -0
  47. python_motion_planning-2.0.dev1/src/python_motion_planning/path_planner/sample_search/__init__.py +2 -0
  48. python_motion_planning-2.0.dev1/src/python_motion_planning/path_planner/sample_search/rrt.py +201 -0
  49. python_motion_planning-2.0.dev1/src/python_motion_planning/path_planner/sample_search/rrt_star.py +209 -0
  50. {python_motion_planning-1.1.1 → python_motion_planning-2.0.dev1}/src/python_motion_planning.egg-info/PKG-INFO +86 -162
  51. python_motion_planning-2.0.dev1/src/python_motion_planning.egg-info/SOURCES.txt +56 -0
  52. {python_motion_planning-1.1.1 → python_motion_planning-2.0.dev1}/src/python_motion_planning.egg-info/requires.txt +1 -2
  53. {python_motion_planning-1.1.1 → python_motion_planning-2.0.dev1}/src/python_motion_planning.egg-info/top_level.txt +1 -0
  54. python_motion_planning-1.1.1/README.md +0 -201
  55. python_motion_planning-1.1.1/src/python_motion_planning/__init__.py +0 -4
  56. python_motion_planning-1.1.1/src/python_motion_planning/curve_generation/fem_pos_smooth.py +0 -114
  57. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/__init__.py +0 -3
  58. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/evolutionary_search/__init__.py +0 -4
  59. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/evolutionary_search/aco.py +0 -186
  60. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/evolutionary_search/evolutionary_search.py +0 -87
  61. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/evolutionary_search/pso.py +0 -356
  62. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/__init__.py +0 -28
  63. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/a_star.py +0 -124
  64. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/d_star.py +0 -291
  65. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/d_star_lite.py +0 -188
  66. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/dijkstra.py +0 -85
  67. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/gbfs.py +0 -86
  68. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/graph_search.py +0 -87
  69. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/jps.py +0 -165
  70. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/lazy_theta_star.py +0 -114
  71. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/lpa_star.py +0 -230
  72. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/s_theta_star.py +0 -133
  73. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/theta_star.py +0 -171
  74. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/graph_search/voronoi.py +0 -200
  75. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/sample_search/__init__.py +0 -6
  76. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/sample_search/informed_rrt.py +0 -152
  77. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/sample_search/rrt.py +0 -151
  78. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/sample_search/rrt_connect.py +0 -147
  79. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/sample_search/rrt_star.py +0 -77
  80. python_motion_planning-1.1.1/src/python_motion_planning/global_planner/sample_search/sample_search.py +0 -135
  81. python_motion_planning-1.1.1/src/python_motion_planning/local_planner/__init__.py +0 -15
  82. python_motion_planning-1.1.1/src/python_motion_planning/local_planner/apf.py +0 -144
  83. python_motion_planning-1.1.1/src/python_motion_planning/local_planner/dwa.py +0 -212
  84. python_motion_planning-1.1.1/src/python_motion_planning/local_planner/local_planner.py +0 -262
  85. python_motion_planning-1.1.1/src/python_motion_planning/local_planner/lqr.py +0 -146
  86. python_motion_planning-1.1.1/src/python_motion_planning/local_planner/mpc.py +0 -214
  87. python_motion_planning-1.1.1/src/python_motion_planning/local_planner/pid.py +0 -158
  88. python_motion_planning-1.1.1/src/python_motion_planning/local_planner/rpp.py +0 -147
  89. python_motion_planning-1.1.1/src/python_motion_planning/utils/__init__.py +0 -19
  90. python_motion_planning-1.1.1/src/python_motion_planning/utils/agent/__init__.py +0 -0
  91. python_motion_planning-1.1.1/src/python_motion_planning/utils/agent/agent.py +0 -135
  92. python_motion_planning-1.1.1/src/python_motion_planning/utils/environment/__init__.py +0 -0
  93. python_motion_planning-1.1.1/src/python_motion_planning/utils/environment/env.py +0 -117
  94. python_motion_planning-1.1.1/src/python_motion_planning/utils/environment/node.py +0 -85
  95. python_motion_planning-1.1.1/src/python_motion_planning/utils/environment/point2d.py +0 -96
  96. python_motion_planning-1.1.1/src/python_motion_planning/utils/environment/pose2d.py +0 -91
  97. python_motion_planning-1.1.1/src/python_motion_planning/utils/helper/__init__.py +0 -3
  98. python_motion_planning-1.1.1/src/python_motion_planning/utils/helper/math_helper.py +0 -65
  99. python_motion_planning-1.1.1/src/python_motion_planning/utils/planner/__init__.py +0 -0
  100. python_motion_planning-1.1.1/src/python_motion_planning/utils/planner/control_factory.py +0 -27
  101. python_motion_planning-1.1.1/src/python_motion_planning/utils/planner/curve_factory.py +0 -29
  102. python_motion_planning-1.1.1/src/python_motion_planning/utils/planner/planner.py +0 -40
  103. python_motion_planning-1.1.1/src/python_motion_planning/utils/planner/search_factory.py +0 -51
  104. python_motion_planning-1.1.1/src/python_motion_planning/utils/plot/__init__.py +0 -0
  105. python_motion_planning-1.1.1/src/python_motion_planning/utils/plot/plot.py +0 -274
  106. python_motion_planning-1.1.1/src/python_motion_planning.egg-info/SOURCES.txt +0 -67
  107. {python_motion_planning-1.1.1 → python_motion_planning-2.0.dev1}/LICENSE +0 -0
  108. {python_motion_planning-1.1.1 → python_motion_planning-2.0.dev1}/setup.cfg +0 -0
  109. {python_motion_planning-1.1.1/src/python_motion_planning/curve_generation → python_motion_planning-2.0.dev1/src/python_motion_planning/curve_generator}/__init__.py +0 -0
  110. {python_motion_planning-1.1.1/src/python_motion_planning/curve_generation → python_motion_planning-2.0.dev1/src/python_motion_planning/curve_generator}/curve.py +0 -0
  111. {python_motion_planning-1.1.1 → python_motion_planning-2.0.dev1}/src/python_motion_planning.egg-info/dependency_links.txt +0 -0
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-motion-planning
3
- Version: 1.1.1
3
+ Version: 2.0.dev1
4
4
  Summary: Motion planning algorithms for Python
5
- Maintainer-email: Yang Haodong <913982779@qq.com>, Wu Maojia <2223942063@qq.com>
5
+ Maintainer-email: Wu Maojia <omige@mail.nwpu.edu.cn>, Yang Haodong <913982779@qq.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
7
7
  Version 3, 29 June 2007
8
8
 
@@ -687,9 +687,8 @@ License-File: LICENSE
687
687
  Requires-Dist: numpy
688
688
  Requires-Dist: scipy
689
689
  Requires-Dist: matplotlib
690
- Requires-Dist: cvxopt
691
690
  Requires-Dist: osqp
692
- Requires-Dist: tqdm
691
+ Requires-Dist: gymnasium
693
692
  Dynamic: license-file
694
693
 
695
694
 
@@ -702,12 +701,12 @@ Dynamic: license-file
702
701
  * `Path Planning`: It's based on path constraints (such as obstacles), planning the optimal path sequence for the robot to travel without conflict between the start and goal.
703
702
  * `Trajectory planning`: It plans the motion state to approach the global path based on kinematics, dynamics constraints and path sequence.
704
703
 
705
- This repository provides the implementations of common `Motion planning` algorithms. **Your stars and forks are welcome**. Maintaining this repository requires a huge amount of work. **Therefore, you are also welcome to contribute to this repository by opening issues, submitting pull requests or joining our development team**.
706
-
707
704
  The theory analysis can be found at [motion-planning](https://blog.csdn.net/frigidwinter/category_11410243.html).
708
705
 
709
706
  We also provide [ROS C++](https://github.com/ai-winter/ros_motion_planning) version and [Matlab](https://github.com/ai-winter/matlab_motion_planning) version.
710
707
 
708
+ This repository provides the implementations of common `Motion planning` algorithms. **Your stars and forks are welcome**. Submitting pull requests or joining our development team are also welcome. For trivial modification, please directly contribute to `dev` branch. For big modification, please [contact](#contact) us before you contribute.
709
+
711
710
  # Quick Start
712
711
 
713
712
  ## Overview
@@ -715,28 +714,23 @@ The source file structure is shown below
715
714
 
716
715
  ```
717
716
  python_motion_planning
718
- ├─global_planner
717
+ ├─common
718
+ | ├─env
719
+ | | ├─map
720
+ | | ├─robot
721
+ | | └─world
722
+ | ├─utils
723
+ | └─visualizer
724
+ ├─controller
725
+ | └─path_tracker
726
+ ├─path_planner
719
727
  | ├─graph_search
720
- | ├─sample_search
721
- | └─evolutionary_search
722
- ├─local_planner
723
- ├─curve_generation
724
- └─utils
725
- ├─agent
726
- ├─environment
727
- ├─helper
728
- ├─planner
729
- └─plot
728
+ | └─sample_search
729
+ └─curve_generation
730
730
  ```
731
731
 
732
- * The global planning algorithm implementation is in the folder `global_planner` with `graph_search`, `sample_search` and `evolutionary search`.
733
-
734
- * The local planning algorithm implementation is in the folder `local_planner`.
735
-
736
- * The curve generation algorithm implementation is in the folder `curve_generation`.
737
-
738
732
  ## Install
739
- *(Optional)* The code was tested in python=3.10. We recommend using `conda` to install the dependencies.
733
+ *(Optional)* The code was tested in python=3.10, though other similar versions should also work. We recommend using `conda` to install the dependencies.
740
734
 
741
735
  ```shell
742
736
  conda create -n pmp python=3.10
@@ -746,150 +740,80 @@ conda activate pmp
746
740
  To install the repository, please run the following command in shell.
747
741
 
748
742
  ```shell
749
- pip install python-motion-planning
743
+ pip install python-motion-planning==2.0.dev1
750
744
  ```
751
745
 
752
746
  ## Run
753
- Below are some simple examples.
754
-
755
- 1. Run A* with discrete environment (Grid)
756
- ```python
757
- import python_motion_planning as pmp
758
-
759
- # Create environment with custom obstacles
760
- env = pmp.Grid(51, 31)
761
- obstacles = env.obstacles
762
- for i in range(10, 21):
763
- obstacles.add((i, 15))
764
- for i in range(15):
765
- obstacles.add((20, i))
766
- for i in range(15, 30):
767
- obstacles.add((30, i))
768
- for i in range(16):
769
- obstacles.add((40, i))
770
- env.update(obstacles)
771
-
772
- planner = pmp.AStar(start=(5, 5), goal=(45, 25), env=env) # create planner
773
- cost, path, expand = planner.plan() # plan
774
- planner.plot.animation(path, str(planner), cost, expand) # animation
775
- ```
776
-
777
- 2. Run RRT with continuous environment (Map)
778
- ```python
779
- import python_motion_planning as pmp
780
-
781
- # Create environment with custom obstacles
782
- env = pmp.Map(51, 31)
783
- obs_rect = [
784
- [14, 12, 8, 2],
785
- [18, 22, 8, 3],
786
- [26, 7, 2, 12],
787
- [32, 14, 10, 2]
788
- ]
789
- obs_circ = [
790
- [7, 12, 3],
791
- [46, 20, 2],
792
- [15, 5, 2],
793
- [37, 7, 3],
794
- [37, 23, 3]
795
- ]
796
- env.update(obs_rect=obs_rect, obs_circ=obs_circ)
797
-
798
- planner = pmp.RRT(start=(18, 8), goal=(37, 18), env=env) # create planner
799
- cost, path, expand = planner.plan() # plan
800
- planner.plot.animation(path, str(planner), cost, expand) # animation
801
- ```
802
-
803
- More examples can be found in the folder `examples` in the repository.
804
747
 
805
- For more details, you can refer to [online documentation](https://ai-winter.github.io/python_motion_planning/).
806
-
807
- # Version
808
- ## Global Planner
809
-
810
- Planner | Version | Animation
811
- ------------ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ---------
812
- **GBFS** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/graph_search/gbfs.py) | ![gbfs_python.png](assets/gbfs_python.png)
813
- **Dijkstra** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/graph_search/dijkstra.py) | ![dijkstra_python.png](assets/dijkstra_python.png)
814
- **A*** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/graph_search/a_star.py) | ![a_star_python.png](assets/a_star_python.png)
815
- **JPS** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/graph_search/jps.py) | ![jps_python.png](assets/jps_python.png)
816
- **D*** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/graph_search/d_star.py) | ![d_star_python.png](assets/d_star_python.png)
817
- **LPA*** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/graph_search/lpa_star.py) | ![lpa_star_python.png](assets/lpa_star_python.png)
818
- **D\* Lite** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/graph_search/d_star_lite.py) | ![d_star_lite_python.png](assets/d_star_lite_python.png)
819
- **Theta\*** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/graph_search/theta_star.py) | ![theta_star_python.png](assets/theta_star_python.png)
820
- **Lazy Theta\*** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/graph_search/lazy_theta_star.py) | ![lazy_theta_star_python.png](assets/lazy_theta_star_python.png)
821
- **S-Theta\*** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/graph_search/s_theta_star.py) | ![s_theta_star_python.png](assets/s_theta_star_python.png)
822
- **Anya** | [![Status](https://img.shields.io/badge/develop-v1.0-red)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/graph_search/anya.py) | ![Status](https://img.shields.io/badge/gif-none-yellow)
823
- **Voronoi** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/graph_search/voronoi.py) | ![voronoi_python.png](assets/voronoi_python.png)
824
- **RRT** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/sample_search/rrt.py) | ![rrt_python.png](assets/rrt_python.png)
825
- **RRT*** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/sample_search/rrt_star.py) | ![rrt_star_python.png](assets/rrt_star_python.png)
826
- **Informed RRT** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/sample_search/informed_rrt.py) | ![informed_rrt_python.png](assets/informed_rrt_python.png)
827
- **RRT-Connect** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/sample_search/rrt_connect.py) | ![rrt_connect_python.png](assets/rrt_connect_python.png)
828
- | **ACO** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/evolutionary_search/aco.py) | ![aco_python.png](assets/aco_python.png)
829
- | **GA** | ![Status](https://img.shields.io/badge/develop-v1.0-red) | ![Status](https://img.shields.io/badge/gif-none-yellow)
830
- | **PSO** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/global_planner/evolutionary_search/pso.py) | ![pso_python.png](assets/pso_python.svg) ![pso_python_cost.png](assets/pso_python_cost.svg)
831
-
832
-
833
- ## Local Planner
834
-
835
- | Planner | Version | Animation
836
- |-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| --------------------------------------------------
837
- | **PID** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/local_planner/pid.py) | ![pid_python.svg](assets/pid_python.svg)
838
- | **APF** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/local_planner/apf.py) | ![apf_python.svg](assets/apf_python.svg)
839
- | **DWA** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/local_planner/dwa.py) | ![dwa_python.svg](assets/dwa_python.svg)
840
- | **RPP** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/local_planner/rpp.py) | ![rpp_python.svg](assets/rpp_python.svg)
841
- | **LQR** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/local_planner/lqr.py) | ![lqr_python.svg](assets/lqr_python.svg)
842
- | **TEB** | ![Status](https://img.shields.io/badge/develop-v1.0-red) | ![Status](https://img.shields.io/badge/gif-none-yellow)
843
- | **MPC** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/local_planner/mpc.py) | ![mpc_python.svg](assets/mpc_python.svg)
844
- | **MPPI** | ![Status](https://img.shields.io/badge/develop-v1.0-red) |![Status](https://img.shields.io/badge/gif-none-yellow)
845
- | **Lattice** | ![Status](https://img.shields.io/badge/develop-v1.0-red) |![Status](https://img.shields.io/badge/gif-none-yellow)
846
- | **DQN** | ![Status](https://img.shields.io/badge/develop-v1.0-red) |![Status](https://img.shields.io/badge/gif-none-yellow)
847
- | **DDPG** | ![Status](https://img.shields.io/badge/develop-v1.0-red) |![Status](https://img.shields.io/badge/gif-none-yellow)
848
-
849
- ## Curve Generation
850
-
851
- | Planner | Version | Animation |
748
+ Please refer to the Tutorials part of [online documentation](https://ai-winter.github.io/python_motion_planning/).
749
+
750
+ # Demos
751
+ ## Path Planner
752
+
753
+ |Planner|2D Grid|3D Grid
754
+ |-------|-------|-------
755
+ **GBFS**|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
756
+ **Dijkstra**|![dijkstra_2d.svg](assets/dijkstra_2d.svg)|![dijkstra_3d.svg](assets/dijkstra_3d.svg)
757
+ **A\***|![a_star_2d.svg](assets/a_star_2d.svg)|![a_star_3d.svg](assets/a_star_3d.svg)
758
+ **JPS**|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
759
+ **D\***|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
760
+ **LPA\***|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
761
+ **D\* Lite**|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
762
+ **Theta\***|![theta_star_2d.svg](assets/theta_star_2d.svg)|![theta_star_3d.svg](assets/theta_star_3d.svg)
763
+ **Lazy Theta\***|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
764
+ **S-Theta\***|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
765
+ **Anya**|Not implemented|Not implemented
766
+ **Voronoi**|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
767
+ **RRT**|![rrt_2d.svg](assets/rrt_2d.svg)|![rrt_3d.svg](assets/rrt_3d.svg)
768
+ **RRT\***|![rrt_star_2d.svg](assets/rrt_star_2d.svg)|![rrt_star_3d.svg](assets/rrt_star_3d.svg)
769
+ **Informed RRT**|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
770
+ **RRT-Connect**|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
771
+ | **ACO** |Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
772
+ | **GA** |Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
773
+ | **PSO** |Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
774
+
775
+
776
+ ## Controller
777
+
778
+ We provide a toy simulator with simple physical simulation to test controllers (path-trakcers). The toy simulator supports multi-agents/multi-robots. The available robots include `CircularRobot` (Omnidirectional) and `DiffDriveRobot` (Only support moving forward and backward). Currently only 2D simulator is provided. 3D simulator has not been implemented.
779
+
780
+ In the following demos, the blue robot 1 is the `CircularRobot`, and the orange robot 2 is the `DiffDriveRobot`.
781
+
782
+ |Planner|2D|3D
783
+ |-------|-------|-------
784
+ |**Path Trakcer**|![path_tracker_2d.gif](assets/path_tracker_2d.gif)|Not implemented
785
+ | **Pure Pursuit** |![pure_pursuit_2d.gif](assets/pure_pursuit_2d.gif)|Not implemented
786
+ | **PID** |![pid_2d.gif](assets/pid_2d.gif)|Not implemented
787
+ | **APF** |![apf_2d.gif](assets/apf_2d.gif)|Not implemented
788
+ | **DWA** |![dwa_2d.gif](assets/dwa_2d.gif)|Not implemented
789
+ | **RPP** |Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
790
+ | **LQR** |Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
791
+ | **MPC** |Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
792
+ | **MPPI** |Not implemented|Not implemented
793
+ | **TEB** |Not implemented|Not implemented
794
+ | **Lattice** |Not implemented|Not implemented
795
+ | **DQN** |Not implemented|Not implemented
796
+ | **DDPG** |Implemented in [V1.0](https://github.com/ai-winter/python_motion_planning/tree/v1.0), not migrated|Not implemented
797
+
798
+ ## Curve Generator
799
+
800
+ The visualization of the curve generators has not been implemented in current version. They can be visualized in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1).
801
+
802
+ | Planner |2D|3D|
852
803
  | ------- | -------------------------------------------------------- | --------------------------------------------------------
853
- | **Polynomia** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/curve_generation/polynomial_curve.py) | ![polynomial_curve_python.gif](assets/polynomial_curve_python.gif)
854
- | **Bezier** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/curve_generation/bezier_curve.py) | ![bezier_curve_python.png](assets/bezier_curve_python.png)
855
- | **Cubic Spline** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/curve_generation/cubic_spline.py) | ![cubic_spline_python.png](assets/cubic_spline_python.png)
856
- | **BSpline** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/curve_generation/bspline_curve.py) | ![bspline_curve_python.png](assets/bspline_curve_python.png)
857
- | **Dubins** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/curve_generation/dubins_curve.py) | ![dubins_curve_python.png](assets/dubins_curve_python.png)
858
- | **Reeds-Shepp** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/curve_generation/reeds_shepp.py) | ![reeds_shepp_python.png](assets/reeds_shepp_python.gif)
859
- | **Fem-Pos Smoother** | [![Status](https://img.shields.io/badge/done-v1.0-brightgreen)](https://github.com/ai-winter/python_motion_planning/blob/master/curve_generation/fem_pos_smooth.py) | ![fem_pos_smoother_python.png](assets/fem_pos_smoother_python.png)
860
-
861
-
862
-
863
-
864
- # Papers
865
- ## Global Planning
866
-
867
- * [A*: ](https://ieeexplore.ieee.org/document/4082128) A Formal Basis for the heuristic Determination of Minimum Cost Paths
868
- * [JPS:](https://ojs.aaai.org/index.php/AAAI/article/view/7994) Online Graph Pruning for Pathfinding On Grid Maps
869
- * [Lifelong Planning A*: ](https://www.cs.cmu.edu/~maxim/files/aij04.pdf) Lifelong Planning A*
870
- * [D*: ](http://web.mit.edu/16.412j/www/html/papers/original_dstar_icra94.pdf) Optimal and Efficient Path Planning for Partially-Known Environments
871
- * [D* Lite: ](http://idm-lab.org/bib/abstracts/papers/aaai02b.pdf) D* Lite
872
- * [Theta*: ](https://www.jair.org/index.php/jair/article/view/10676) Theta*: Any-Angle Path Planning on Grids
873
- * [Lazy Theta*: ](https://ojs.aaai.org/index.php/AAAI/article/view/7566) Lazy Theta*: Any-Angle Path Planning and Path Length Analysis in 3D
874
- * [S-Theta*: ](https://link.springer.com/chapter/10.1007/978-1-4471-4739-8_8) S-Theta*: low steering path-planning algorithm
875
- * [Anya: ](http://www.grastien.net/ban/articles/hgoa-jair16.pdf) Optimal Any-Angle Pathfinding In Practice
876
- * [RRT: ](http://msl.cs.uiuc.edu/~lavalle/papers/Lav98c.pdf) Rapidly-Exploring Random Trees: A New Tool for Path Planning
877
- * [RRT-Connect: ](http://www-cgi.cs.cmu.edu/afs/cs/academic/class/15494-s12/readings/kuffner_icra2000.pdf) RRT-Connect: An Efficient Approach to Single-Query Path Planning
878
- * [RRT*: ](https://journals.sagepub.com/doi/abs/10.1177/0278364911406761) Sampling-based algorithms for optimal motion planning
879
- * [Informed RRT*: ](https://arxiv.org/abs/1404.2334) Optimal Sampling-based Path Planning Focused via Direct Sampling of an Admissible Ellipsoidal heuristic
880
- * [ACO: ](http://www.cs.yale.edu/homes/lans/readings/routing/dorigo-ants-1999.pdf) Ant Colony Optimization: A New Meta-Heuristic
881
-
882
- ## Local Planning
883
-
884
- * [DWA: ](https://www.ri.cmu.edu/pub_files/pub1/fox_dieter_1997_1/fox_dieter_1997_1.pdf) The Dynamic Window Approach to Collision Avoidance
885
- * [APF: ](https://ieeexplore.ieee.org/document/1087247) Real-time obstacle avoidance for manipulators and mobile robots
886
- * [RPP: ](https://arxiv.org/pdf/2305.20026.pdf) Regulated Pure Pursuit for Robot Path Tracking
887
- * [DDPG: ](https://arxiv.org/abs/1509.02971) Continuous control with deep reinforcement learning
804
+ | **Polynomia** | ![polynomial_curve_python.gif](assets/polynomial_curve_python.gif)|Not implemented
805
+ | **Bezier** |![bezier_curve_python.png](assets/bezier_curve_python.png)|Not implemented
806
+ | **Cubic Spline** |![cubic_spline_python.png](assets/cubic_spline_python.png)|Not implemented
807
+ | **BSpline** |![bspline_curve_python.png](assets/bspline_curve_python.png)|Not implemented
808
+ | **Dubins** |![dubins_curve_python.png](assets/dubins_curve_python.png)|Not implemented
809
+ | **Reeds-Shepp** |![reeds_shepp_python.png](assets/reeds_shepp_python.gif)|Not implemented
810
+ | **Fem-Pos Smoother** |![fem_pos_smoother_python.png](assets/fem_pos_smoother_python.png)|Not implemented
888
811
 
889
- ## Curve Generation
812
+ # Contact
890
813
 
891
- * [Dubins: ]() On curves of minimal length with a constraint on average curvature, and with prescribed initial and terminal positions and tangents
814
+ Long-term maintainers:
892
815
 
893
- # Acknowledgment
816
+ * [@omigeft](https://github.com/omigeft) (Wu Maojia)
817
+ * [@ai-winter](https://github.com/ai-winter) (Yang Haodong)
894
818
 
895
- * Our visualization and animation framework of Python Version refers to [https://github.com/zhm-real/PathPlanning](https://github.com/zhm-real/PathPlanning). Thanks sincerely.
819
+ You can contact us via the information provided on our profile.
@@ -0,0 +1,126 @@
1
+
2
+ # Introduction
3
+
4
+ `Motion planning` plans the state sequence of the robot without conflict between the start and goal.
5
+
6
+ `Motion planning` mainly includes `Path planning` and `Trajectory planning`.
7
+
8
+ * `Path Planning`: It's based on path constraints (such as obstacles), planning the optimal path sequence for the robot to travel without conflict between the start and goal.
9
+ * `Trajectory planning`: It plans the motion state to approach the global path based on kinematics, dynamics constraints and path sequence.
10
+
11
+ The theory analysis can be found at [motion-planning](https://blog.csdn.net/frigidwinter/category_11410243.html).
12
+
13
+ We also provide [ROS C++](https://github.com/ai-winter/ros_motion_planning) version and [Matlab](https://github.com/ai-winter/matlab_motion_planning) version.
14
+
15
+ This repository provides the implementations of common `Motion planning` algorithms. **Your stars and forks are welcome**. Submitting pull requests or joining our development team are also welcome. For trivial modification, please directly contribute to `dev` branch. For big modification, please [contact](#contact) us before you contribute.
16
+
17
+ # Quick Start
18
+
19
+ ## Overview
20
+ The source file structure is shown below
21
+
22
+ ```
23
+ python_motion_planning
24
+ ├─common
25
+ | ├─env
26
+ | | ├─map
27
+ | | ├─robot
28
+ | | └─world
29
+ | ├─utils
30
+ | └─visualizer
31
+ ├─controller
32
+ | └─path_tracker
33
+ ├─path_planner
34
+ | ├─graph_search
35
+ | └─sample_search
36
+ └─curve_generation
37
+ ```
38
+
39
+ ## Install
40
+ *(Optional)* The code was tested in python=3.10, though other similar versions should also work. We recommend using `conda` to install the dependencies.
41
+
42
+ ```shell
43
+ conda create -n pmp python=3.10
44
+ conda activate pmp
45
+ ```
46
+
47
+ To install the repository, please run the following command in shell.
48
+
49
+ ```shell
50
+ pip install python-motion-planning==2.0.dev1
51
+ ```
52
+
53
+ ## Run
54
+
55
+ Please refer to the Tutorials part of [online documentation](https://ai-winter.github.io/python_motion_planning/).
56
+
57
+ # Demos
58
+ ## Path Planner
59
+
60
+ |Planner|2D Grid|3D Grid
61
+ |-------|-------|-------
62
+ **GBFS**|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
63
+ **Dijkstra**|![dijkstra_2d.svg](assets/dijkstra_2d.svg)|![dijkstra_3d.svg](assets/dijkstra_3d.svg)
64
+ **A\***|![a_star_2d.svg](assets/a_star_2d.svg)|![a_star_3d.svg](assets/a_star_3d.svg)
65
+ **JPS**|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
66
+ **D\***|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
67
+ **LPA\***|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
68
+ **D\* Lite**|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
69
+ **Theta\***|![theta_star_2d.svg](assets/theta_star_2d.svg)|![theta_star_3d.svg](assets/theta_star_3d.svg)
70
+ **Lazy Theta\***|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
71
+ **S-Theta\***|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
72
+ **Anya**|Not implemented|Not implemented
73
+ **Voronoi**|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
74
+ **RRT**|![rrt_2d.svg](assets/rrt_2d.svg)|![rrt_3d.svg](assets/rrt_3d.svg)
75
+ **RRT\***|![rrt_star_2d.svg](assets/rrt_star_2d.svg)|![rrt_star_3d.svg](assets/rrt_star_3d.svg)
76
+ **Informed RRT**|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
77
+ **RRT-Connect**|Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
78
+ | **ACO** |Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
79
+ | **GA** |Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
80
+ | **PSO** |Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
81
+
82
+
83
+ ## Controller
84
+
85
+ We provide a toy simulator with simple physical simulation to test controllers (path-trakcers). The toy simulator supports multi-agents/multi-robots. The available robots include `CircularRobot` (Omnidirectional) and `DiffDriveRobot` (Only support moving forward and backward). Currently only 2D simulator is provided. 3D simulator has not been implemented.
86
+
87
+ In the following demos, the blue robot 1 is the `CircularRobot`, and the orange robot 2 is the `DiffDriveRobot`.
88
+
89
+ |Planner|2D|3D
90
+ |-------|-------|-------
91
+ |**Path Trakcer**|![path_tracker_2d.gif](assets/path_tracker_2d.gif)|Not implemented
92
+ | **Pure Pursuit** |![pure_pursuit_2d.gif](assets/pure_pursuit_2d.gif)|Not implemented
93
+ | **PID** |![pid_2d.gif](assets/pid_2d.gif)|Not implemented
94
+ | **APF** |![apf_2d.gif](assets/apf_2d.gif)|Not implemented
95
+ | **DWA** |![dwa_2d.gif](assets/dwa_2d.gif)|Not implemented
96
+ | **RPP** |Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
97
+ | **LQR** |Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
98
+ | **MPC** |Implemented in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1), not migrated|Not implemented
99
+ | **MPPI** |Not implemented|Not implemented
100
+ | **TEB** |Not implemented|Not implemented
101
+ | **Lattice** |Not implemented|Not implemented
102
+ | **DQN** |Not implemented|Not implemented
103
+ | **DDPG** |Implemented in [V1.0](https://github.com/ai-winter/python_motion_planning/tree/v1.0), not migrated|Not implemented
104
+
105
+ ## Curve Generator
106
+
107
+ The visualization of the curve generators has not been implemented in current version. They can be visualized in [V1.1.1](https://github.com/ai-winter/python_motion_planning/tree/v1.1.1).
108
+
109
+ | Planner |2D|3D|
110
+ | ------- | -------------------------------------------------------- | --------------------------------------------------------
111
+ | **Polynomia** | ![polynomial_curve_python.gif](assets/polynomial_curve_python.gif)|Not implemented
112
+ | **Bezier** |![bezier_curve_python.png](assets/bezier_curve_python.png)|Not implemented
113
+ | **Cubic Spline** |![cubic_spline_python.png](assets/cubic_spline_python.png)|Not implemented
114
+ | **BSpline** |![bspline_curve_python.png](assets/bspline_curve_python.png)|Not implemented
115
+ | **Dubins** |![dubins_curve_python.png](assets/dubins_curve_python.png)|Not implemented
116
+ | **Reeds-Shepp** |![reeds_shepp_python.png](assets/reeds_shepp_python.gif)|Not implemented
117
+ | **Fem-Pos Smoother** |![fem_pos_smoother_python.png](assets/fem_pos_smoother_python.png)|Not implemented
118
+
119
+ # Contact
120
+
121
+ Long-term maintainers:
122
+
123
+ * [@omigeft](https://github.com/omigeft) (Wu Maojia)
124
+ * [@ai-winter](https://github.com/ai-winter) (Yang Haodong)
125
+
126
+ You can contact us via the information provided on our profile.
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-motion-planning"
7
- version = "1.1.1"
7
+ version = "2.0.dev1"
8
8
  description = "Motion planning algorithms for Python"
9
9
  maintainers = [
10
- {name = "Yang Haodong", email = "913982779@qq.com"},
11
- {name = "Wu Maojia", email = "2223942063@qq.com"}
10
+ {name = "Wu Maojia", email = "omige@mail.nwpu.edu.cn"},
11
+ {name = "Yang Haodong", email = "913982779@qq.com"}
12
12
  ]
13
13
  readme = "README.md"
14
14
  license = {file = "LICENSE"}
@@ -17,9 +17,8 @@ dependencies = [
17
17
  "numpy",
18
18
  "scipy",
19
19
  "matplotlib",
20
- "cvxopt",
21
20
  "osqp",
22
- "tqdm"
21
+ "gymnasium"
23
22
  ]
24
23
  classifiers = [
25
24
  "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
@@ -0,0 +1,4 @@
1
+ from .common import *
2
+ from .path_planner import *
3
+ from .controller import *
4
+ from .curve_generator import *
@@ -0,0 +1,3 @@
1
+ from .utils import *
2
+ from .env import *
3
+ from .visualizer import *
@@ -0,0 +1,6 @@
1
+ # from .world import *
2
+ from .node import *
3
+ from .types import *
4
+ from .map import *
5
+ from .world import *
6
+ from .robot import *
@@ -0,0 +1,2 @@
1
+ from .base_map import *
2
+ from .grid import *
@@ -0,0 +1,125 @@
1
+ """
2
+ @file: map.py
3
+ @author: Wu Maojia
4
+ @update: 2025.10.3
5
+ """
6
+ from typing import Iterable, Union
7
+ from abc import ABC, abstractmethod
8
+
9
+ import numpy as np
10
+
11
+ from python_motion_planning.common.env import Node
12
+
13
+
14
+ class BaseMap(ABC):
15
+ """
16
+ Base class for Path Planning Map.
17
+
18
+ Args:
19
+ bounds: The size of map in the world (shape: (n, 2) (n>=2)). bounds[i, 0] means the lower bound of the world in the i-th dimension. bounds[i, 1] means the upper bound of the world in the i-th dimension.
20
+ dtype: data type of coordinates
21
+ """
22
+ def __init__(self, bounds: Iterable, dtype: np.dtype) -> None:
23
+ super().__init__()
24
+ self._bounds = np.asarray(bounds, dtype=float)
25
+ self._dtype = dtype
26
+
27
+ if len(self._bounds.shape) != 2 or self._bounds.shape[0] <= 1 or self._bounds.shape[1] != 2:
28
+ raise ValueError(f"The shape of bounds must be (n, 2) (n>=2) instead of {self._bounds.shape}")
29
+
30
+ for d in range(self._bounds.shape[0]):
31
+ if self._bounds[d, 0] >= self._bounds[d, 1]:
32
+ raise ValueError(f"The lower bound of the world in the {d}-th dimension must be smaller than the upper bound of the world in the {d}-th dimension.")
33
+
34
+ @property
35
+ def bounds(self) -> np.ndarray:
36
+ return self._bounds
37
+
38
+ @property
39
+ def dim(self) -> int:
40
+ return self._bounds.shape[0]
41
+
42
+ @property
43
+ def dtype(self) -> np.dtype:
44
+ return self._dtype
45
+
46
+ @abstractmethod
47
+ def map_to_world(self, point: tuple) -> tuple:
48
+ """
49
+ Convert map coordinates to world coordinates.
50
+
51
+ Args:
52
+ point: Point in map coordinates.
53
+
54
+ Returns:
55
+ point: Point in world coordinates.
56
+ """
57
+ pass
58
+
59
+ @abstractmethod
60
+ def world_to_map(self, point: tuple) -> tuple:
61
+ """
62
+ Convert world coordinates to map coordinates.
63
+
64
+ Args:
65
+ point: Point in world coordinates.
66
+
67
+ Returns:
68
+ point: Point in map coordinates.
69
+ """
70
+ pass
71
+
72
+ @abstractmethod
73
+ def get_distance(self, p1: tuple, p2: tuple) -> float:
74
+ """
75
+ Get the distance between two points.
76
+
77
+ Args:
78
+ p1: First point.
79
+ p2: Second point.
80
+
81
+ Returns:
82
+ dist: Distance between two points.
83
+ """
84
+ pass
85
+
86
+ @abstractmethod
87
+ def get_neighbors(self, node: Node) -> list:
88
+ """
89
+ Get neighbor nodes of a given node.
90
+
91
+ Args:
92
+ node: Node to get neighbor nodes.
93
+
94
+ Returns:
95
+ nodes: List of neighbor nodes.
96
+ """
97
+ pass
98
+
99
+ @abstractmethod
100
+ def is_expandable(self, point: tuple) -> bool:
101
+ """
102
+ Check if a point is expandable.
103
+
104
+ Args:
105
+ point: Point to check.
106
+
107
+ Returns:
108
+ expandable: True if the point is expandable, False otherwise.
109
+ """
110
+ pass
111
+
112
+ @abstractmethod
113
+ def in_collision(self, p1: tuple, p2: tuple) -> bool:
114
+ """
115
+ Check if the line of sight between two points is in collision.
116
+
117
+ Args:
118
+ p1: Start point of the line.
119
+ p2: End point of the line.
120
+
121
+ Returns:
122
+ in_collision: True if the line of sight is in collision, False otherwise.
123
+ """
124
+ pass
125
+