Convert core C++ VBS algorithm to Python#1
Conversation
xiahaa
commented
Jun 27, 2025
- Implemented Python equivalents for ConfigParser, Environment, Field, and VisibilityBasedSolver.
- Core pathfinding logic, visibility propagation, and path reconstruction are translated.
- Includes methods for saving results (text and images) and basic benchmarking framework.
- Known issue: Performance is slower than C++; image maze test case did not find path in initial Python tests, may require parameter tuning or further optimization.
- Implemented Python equivalents for ConfigParser, Environment, Field, and VisibilityBasedSolver. - Core pathfinding logic, visibility propagation, and path reconstruction are translated. - Includes methods for saving results (text and images) and basic benchmarking framework. - Known issue: Performance is slower than C++; image maze test case did not find path in initial Python tests, may require parameter tuning or further optimization.
|
Hi @xiahaa |
- Ported `ASTARPATH.m` to `astar_path.py`, including MATLAB-style neighbor generation (for various Connecting_Distance) and line-of-sight checks. Resolved A* bug related to float32 precision; now uses float64. - Ported `getAccessibilityMapPlanner.m` to `matlab_visibility.py`. - Created example planner scripts `run_planner_random_py.py` and `run_planner_maze_py.py` mirroring the MATLAB sample planners (`c_sample_planner...` and `d_sample_planner...`), using the ported MATLAB visibility function. - `run_planner_maze_py.py` successfully finds paths. - `run_planner_random_py.py` may require parameter tuning for its specific heuristic. - The main C++ port (`main_vbs.py`) tested with a small configuration.
|
Hi @xiahaa, Thanks for your contribution. It's great to see a Python implementation of the library—it adds value and broadens accessibility. Before merging, I’d like to request a few changes to ensure consistency and maintainability across the project:
Once these changes are made, I’ll be happy to approve and merge the PR. Thanks again—you’ve done great work and I appreciate your contribution! Best, |
- C++ VBS algorithm (parser, environment, solver, main) ported to Python. - Key MATLAB components (A* pathfinding, visibility propagation, example planners) ported to Python. - Initial tests run on all major components: - `main_vbs.py` (C++ port) executes with small config. - `astar_path.py` passes most tests after precision fix; one larger map case (CD=1) remains problematic. - `run_planner_maze_py.py` (MATLAB planner port) successfully finds paths. - `run_planner_random_py.py` (MATLAB planner port) needs parameter tuning. - Added `test_vbs_compute_visibility.py` test harness for 1-to-1 C++ vs Python validation (requires user-generated C++ data).
- Finalized Python ports of C++ VBS algorithm components. - Finalized Python ports of MATLAB A* and visibility planner components. - Included example planner scripts based on MATLAB samples. - Created initial 1-to-1 comparison test harnesses: - `test_vbs_compute_visibility.py` for C++ visibility logic. - `test_matlab_get_accessibility_map.py` for MATLAB visibility logic. These await user-generated data from original C++/MATLAB code. - Addressed various bugs and refinements during testing, including A* precision fix. - Known items for further investigation: A* failure on one specific test case (CD=1, larger map), performance of Python planner scripts.