python-motion-planning 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 (112) hide show
  1. {python_motion_planning-1.1 → python_motion_planning-2.0.dev1}/PKG-INFO +90 -156
  2. python_motion_planning-2.0.dev1/README.md +126 -0
  3. {python_motion_planning-1.1 → python_motion_planning-2.0.dev1}/pyproject.toml +4 -6
  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/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/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/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/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/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/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 → python_motion_planning-2.0.dev1}/src/python_motion_planning.egg-info/PKG-INFO +90 -156
  51. python_motion_planning-2.0.dev1/src/python_motion_planning.egg-info/SOURCES.txt +56 -0
  52. python_motion_planning-2.0.dev1/src/python_motion_planning.egg-info/requires.txt +5 -0
  53. {python_motion_planning-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/README.md +0 -191
  55. python_motion_planning-1.1/src/python_motion_planning/__init__.py +0 -4
  56. python_motion_planning-1.1/src/python_motion_planning/curve_generation/fem_pos_smooth.py +0 -114
  57. python_motion_planning-1.1/src/python_motion_planning/global_planner/__init__.py +0 -3
  58. python_motion_planning-1.1/src/python_motion_planning/global_planner/evolutionary_search/__init__.py +0 -4
  59. python_motion_planning-1.1/src/python_motion_planning/global_planner/evolutionary_search/aco.py +0 -186
  60. python_motion_planning-1.1/src/python_motion_planning/global_planner/evolutionary_search/evolutionary_search.py +0 -87
  61. python_motion_planning-1.1/src/python_motion_planning/global_planner/evolutionary_search/pso.py +0 -356
  62. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/__init__.py +0 -28
  63. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/a_star.py +0 -124
  64. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/d_star.py +0 -291
  65. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/d_star_lite.py +0 -188
  66. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/dijkstra.py +0 -77
  67. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/gbfs.py +0 -78
  68. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/graph_search.py +0 -87
  69. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/jps.py +0 -165
  70. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/lazy_theta_star.py +0 -114
  71. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/lpa_star.py +0 -230
  72. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/s_theta_star.py +0 -133
  73. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/theta_star.py +0 -171
  74. python_motion_planning-1.1/src/python_motion_planning/global_planner/graph_search/voronoi.py +0 -200
  75. python_motion_planning-1.1/src/python_motion_planning/global_planner/sample_search/__init__.py +0 -6
  76. python_motion_planning-1.1/src/python_motion_planning/global_planner/sample_search/informed_rrt.py +0 -152
  77. python_motion_planning-1.1/src/python_motion_planning/global_planner/sample_search/rrt.py +0 -151
  78. python_motion_planning-1.1/src/python_motion_planning/global_planner/sample_search/rrt_connect.py +0 -147
  79. python_motion_planning-1.1/src/python_motion_planning/global_planner/sample_search/rrt_star.py +0 -77
  80. python_motion_planning-1.1/src/python_motion_planning/global_planner/sample_search/sample_search.py +0 -135
  81. python_motion_planning-1.1/src/python_motion_planning/local_planner/__init__.py +0 -15
  82. python_motion_planning-1.1/src/python_motion_planning/local_planner/apf.py +0 -144
  83. python_motion_planning-1.1/src/python_motion_planning/local_planner/dwa.py +0 -212
  84. python_motion_planning-1.1/src/python_motion_planning/local_planner/local_planner.py +0 -262
  85. python_motion_planning-1.1/src/python_motion_planning/local_planner/lqr.py +0 -146
  86. python_motion_planning-1.1/src/python_motion_planning/local_planner/mpc.py +0 -214
  87. python_motion_planning-1.1/src/python_motion_planning/local_planner/pid.py +0 -158
  88. python_motion_planning-1.1/src/python_motion_planning/local_planner/rpp.py +0 -147
  89. python_motion_planning-1.1/src/python_motion_planning/utils/__init__.py +0 -19
  90. python_motion_planning-1.1/src/python_motion_planning/utils/agent/__init__.py +0 -0
  91. python_motion_planning-1.1/src/python_motion_planning/utils/agent/agent.py +0 -135
  92. python_motion_planning-1.1/src/python_motion_planning/utils/environment/__init__.py +0 -0
  93. python_motion_planning-1.1/src/python_motion_planning/utils/environment/env.py +0 -134
  94. python_motion_planning-1.1/src/python_motion_planning/utils/environment/node.py +0 -85
  95. python_motion_planning-1.1/src/python_motion_planning/utils/environment/point2d.py +0 -96
  96. python_motion_planning-1.1/src/python_motion_planning/utils/environment/pose2d.py +0 -91
  97. python_motion_planning-1.1/src/python_motion_planning/utils/helper/__init__.py +0 -3
  98. python_motion_planning-1.1/src/python_motion_planning/utils/helper/math_helper.py +0 -65
  99. python_motion_planning-1.1/src/python_motion_planning/utils/planner/__init__.py +0 -0
  100. python_motion_planning-1.1/src/python_motion_planning/utils/planner/control_factory.py +0 -27
  101. python_motion_planning-1.1/src/python_motion_planning/utils/planner/curve_factory.py +0 -29
  102. python_motion_planning-1.1/src/python_motion_planning/utils/planner/planner.py +0 -40
  103. python_motion_planning-1.1/src/python_motion_planning/utils/planner/search_factory.py +0 -51
  104. python_motion_planning-1.1/src/python_motion_planning/utils/plot/__init__.py +0 -0
  105. python_motion_planning-1.1/src/python_motion_planning/utils/plot/plot.py +0 -274
  106. python_motion_planning-1.1/src/python_motion_planning.egg-info/SOURCES.txt +0 -67
  107. python_motion_planning-1.1/src/python_motion_planning.egg-info/requires.txt +0 -7
  108. {python_motion_planning-1.1 → python_motion_planning-2.0.dev1}/LICENSE +0 -0
  109. {python_motion_planning-1.1 → python_motion_planning-2.0.dev1}/setup.cfg +0 -0
  110. {python_motion_planning-1.1/src/python_motion_planning/curve_generation → python_motion_planning-2.0.dev1/src/python_motion_planning/curve_generator}/__init__.py +0 -0
  111. {python_motion_planning-1.1/src/python_motion_planning/curve_generation → python_motion_planning-2.0.dev1/src/python_motion_planning/curve_generator}/curve.py +0 -0
  112. {python_motion_planning-1.1 → python_motion_planning-2.0.dev1}/src/python_motion_planning.egg-info/dependency_links.txt +0 -0
@@ -1,8 +1,8 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: python-motion-planning
3
- Version: 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,10 +687,9 @@ 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
693
- Requires-Dist: tensorboard==2.12.0
691
+ Requires-Dist: gymnasium
692
+ Dynamic: license-file
694
693
 
695
694
 
696
695
  # Introduction
@@ -702,45 +701,36 @@ Requires-Dist: tensorboard==2.12.0
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
714
- The file structure is shown below
713
+ The source file structure is shown below
715
714
 
716
715
  ```
717
716
  python_motion_planning
718
- ├─assets
719
- ├─docs
720
- ├─examples
721
- └─python_motion_planning
722
- ├─global_planner
723
- | ├─graph_search
724
- | ├─sample_search
725
- | └─evolutionary_search
726
- ├─local_planner
727
- ├─curve_generation
728
- └─utils
729
- ├─agent
730
- ├─environment
731
- ├─helper
732
- ├─planner
733
- └─plot
717
+ ├─common
718
+ | ├─env
719
+ | | ├─map
720
+ | | ├─robot
721
+ | | └─world
722
+ | ├─utils
723
+ | └─visualizer
724
+ ├─controller
725
+ | └─path_tracker
726
+ ├─path_planner
727
+ | ├─graph_search
728
+ | └─sample_search
729
+ └─curve_generation
734
730
  ```
735
731
 
736
- * The global planning algorithm implementation is in the folder `global_planner` with `graph_search`, `sample_search` and `evolutionary search`.
737
-
738
- * The local planning algorithm implementation is in the folder `local_planner`.
739
-
740
- * The curve generation algorithm implementation is in the folder `curve_generation`.
741
-
742
732
  ## Install
743
- *(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.
744
734
 
745
735
  ```shell
746
736
  conda create -n pmp python=3.10
@@ -750,136 +740,80 @@ conda activate pmp
750
740
  To install the repository, please run the following command in shell.
751
741
 
752
742
  ```shell
753
- pip install python-motion-planning
743
+ pip install python-motion-planning==2.0.dev1
754
744
  ```
755
745
 
756
746
  ## Run
757
- Below are some simple examples.
758
-
759
- 1. Run planning and animation separately
760
- ```python
761
- import python_motion_planning as pmp
762
- planner = pmp.AStar(start=(5, 5), goal=(45, 25), env=pmp.Grid(51, 31))
763
- cost, path, expand = planner.plan()
764
- planner.plot.animation(path, str(planner), cost, expand) # animation
765
- ```
766
-
767
- 2. Run planning and animation in one step
768
- ```python
769
- import python_motion_planning as pmp
770
- planner = pmp.AStar(start=(5, 5), goal=(45, 25), env=pmp.Grid(51, 31))
771
- planner.run() # run both planning and animation
772
- ```
773
-
774
- 3. Create planner in factory mode
775
- ```python
776
- import python_motion_planning as pmp
777
- search_factory = pmp.SearchFactory()
778
- planner = search_factory("a_star", start=(5, 5), goal=(45, 25), env=pmp.Grid(51, 31))
779
- planner.run() # run both planning and animation
780
- ```
781
-
782
- More examples can be found in the folder `examples` in the repository.
783
-
784
- ## Documentation
785
-
786
- For more details, you can refer to [online documentation](https://ai-winter.github.io/python_motion_planning/).
787
-
788
- The documentation is auto-generated using mkdocs. To do this, enter the root directory and run
789
-
790
- ```shell
791
- python generate_mkdocs.py
792
- mkdocs serve
793
- ```
794
-
795
- Then open the browser and go to [http://127.0.0.1:8000](http://127.0.0.1:8000). That is the generated documentation.
796
-
797
- # Version
798
- ## Global Planner
799
-
800
- Planner | Version | Animation
801
- ------------ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ---------
802
- **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)
803
- **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)
804
- **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)
805
- **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)
806
- **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)
807
- **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)
808
- **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)
809
- **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)
810
- **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)
811
- **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)
812
- **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)
813
- **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)
814
- **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)
815
- **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)
816
- **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)
817
- **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)
818
- | **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)
819
- | **GA** | ![Status](https://img.shields.io/badge/develop-v1.0-red) | ![Status](https://img.shields.io/badge/gif-none-yellow)
820
- | **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)
821
-
822
-
823
- ## Local Planner
824
-
825
- | Planner | Version | Animation
826
- |-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| --------------------------------------------------
827
- | **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)
828
- | **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)
829
- | **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)
830
- | **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)
831
- | **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)
832
- | **TEB** | ![Status](https://img.shields.io/badge/develop-v1.0-red) | ![Status](https://img.shields.io/badge/gif-none-yellow)
833
- | **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)
834
- | **MPPI** | ![Status](https://img.shields.io/badge/develop-v1.0-red) |![Status](https://img.shields.io/badge/gif-none-yellow)
835
- | **Lattice** | ![Status](https://img.shields.io/badge/develop-v1.0-red) |![Status](https://img.shields.io/badge/gif-none-yellow)
836
- | **DQN** | ![Status](https://img.shields.io/badge/develop-v1.0-red) |![Status](https://img.shields.io/badge/gif-none-yellow)
837
- | **DDPG** | ![Status](https://img.shields.io/badge/develop-v1.0-red) |![Status](https://img.shields.io/badge/gif-none-yellow)
838
747
 
839
- ## Curve Generation
840
-
841
- | 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|
842
803
  | ------- | -------------------------------------------------------- | --------------------------------------------------------
843
- | **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)
844
- | **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)
845
- | **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)
846
- | **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)
847
- | **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)
848
- | **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)
849
- | **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)
850
-
851
-
852
-
853
-
854
- # Papers
855
- ## Global Planning
856
-
857
- * [A*: ](https://ieeexplore.ieee.org/document/4082128) A Formal Basis for the heuristic Determination of Minimum Cost Paths
858
- * [JPS:](https://ojs.aaai.org/index.php/AAAI/article/view/7994) Online Graph Pruning for Pathfinding On Grid Maps
859
- * [Lifelong Planning A*: ](https://www.cs.cmu.edu/~maxim/files/aij04.pdf) Lifelong Planning A*
860
- * [D*: ](http://web.mit.edu/16.412j/www/html/papers/original_dstar_icra94.pdf) Optimal and Efficient Path Planning for Partially-Known Environments
861
- * [D* Lite: ](http://idm-lab.org/bib/abstracts/papers/aaai02b.pdf) D* Lite
862
- * [Theta*: ](https://www.jair.org/index.php/jair/article/view/10676) Theta*: Any-Angle Path Planning on Grids
863
- * [Lazy Theta*: ](https://ojs.aaai.org/index.php/AAAI/article/view/7566) Lazy Theta*: Any-Angle Path Planning and Path Length Analysis in 3D
864
- * [S-Theta*: ](https://link.springer.com/chapter/10.1007/978-1-4471-4739-8_8) S-Theta*: low steering path-planning algorithm
865
- * [Anya: ](http://www.grastien.net/ban/articles/hgoa-jair16.pdf) Optimal Any-Angle Pathfinding In Practice
866
- * [RRT: ](http://msl.cs.uiuc.edu/~lavalle/papers/Lav98c.pdf) Rapidly-Exploring Random Trees: A New Tool for Path Planning
867
- * [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
868
- * [RRT*: ](https://journals.sagepub.com/doi/abs/10.1177/0278364911406761) Sampling-based algorithms for optimal motion planning
869
- * [Informed RRT*: ](https://arxiv.org/abs/1404.2334) Optimal Sampling-based Path Planning Focused via Direct Sampling of an Admissible Ellipsoidal heuristic
870
- * [ACO: ](http://www.cs.yale.edu/homes/lans/readings/routing/dorigo-ants-1999.pdf) Ant Colony Optimization: A New Meta-Heuristic
871
-
872
- ## Local Planning
873
-
874
- * [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
875
- * [APF: ](https://ieeexplore.ieee.org/document/1087247) Real-time obstacle avoidance for manipulators and mobile robots
876
- * [RPP: ](https://arxiv.org/pdf/2305.20026.pdf) Regulated Pure Pursuit for Robot Path Tracking
877
- * [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
878
811
 
879
- ## Curve Generation
812
+ # Contact
880
813
 
881
- * [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:
882
815
 
883
- # Acknowledgment
816
+ * [@omigeft](https://github.com/omigeft) (Wu Maojia)
817
+ * [@ai-winter](https://github.com/ai-winter) (Yang Haodong)
884
818
 
885
- * 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"
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,10 +17,8 @@ dependencies = [
17
17
  "numpy",
18
18
  "scipy",
19
19
  "matplotlib",
20
- "cvxopt",
21
20
  "osqp",
22
- "tqdm",
23
- "tensorboard==2.12.0"
21
+ "gymnasium"
24
22
  ]
25
23
  classifiers = [
26
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
+