An open-source path planning project based on NetworkX, focusing on providing efficient and flexible graph algorithm support for various path optimization problems. This project is mainly applied to shuttle car path planning and task scheduling in automated storage systems.
- Shortest path calculation based on NetworkX graph algorithms
- Multi-layer warehouse map modeling (supports up to 4-layer立体 warehouses)
- Visual map display and path drawing
- Shuttle car (Car) control module
- PLC (Programmable Logic Controller) communication module
- Supports real device connection and simulation mode
- WCS (Warehouse Control System) task management
- WMS (Warehouse Management System) order processing
- Task priority scheduling mechanism
- RESTful API interface (provides v1 and v2 versions)
- Supports Swagger UI documentation
- Database operation interface
- Visual operation interface based on Streamlit
- Provides debugging tool pages
- Supports manual and automated operation modes
- Python 3.10+
- FastAPI - Web framework
- NetworkX - Graph algorithm processing
- SQLAlchemy - Database ORM
- Matplotlib - Data visualization
- Streamlit - Frontend interface
┌──────────────────┐ ┌────────────────┐ ┌────────────────────────┐
│ Streamlit UI │ │ FastAPI API │ │ Device Communication │
│ (Visualization) │◄──►│ (REST API) │◄──►│ (PLC/Shuttle Control) │
└──────────────────┘ └────────────────┘ └────────────────────────┘
│ │
┌─────────▼─────────┐ ┌─────────▼────────────┐
│ Task Scheduler │ │ Path Planning │
│ (TaskScheduler) │ │ (NetworkX Algorithms)│
└───────────────────┘ └──────────────────────┘
│ │
┌─────────▼──────────┐ ┌─────────▼──────────┐
│ Database Layer │ │ Map Data Layer │
│ (SQLite/SQLAlchemy)│ │ (JSON Config Files)│
└────────────────────┘ └────────────────────┘
nx_path_planning/
├── backend/ # Backend application
│ ├── app/ # Main application directory
│ │ ├── api/ # REST API interfaces
│ │ │ ├── v1/ # API version 1
│ │ │ └── v2/ # API version 2
│ │ ├── core/ # Core application components
│ │ ├── data/ # Database files
│ │ ├── devices/ # Device control modules
│ │ ├── map_core/ # Map and path core algorithms
│ │ │ └── data/ # Map configuration data
│ │ ├── models/ # Database models
│ │ ├── plc_system/ # PLC communication system
│ │ ├── protocols/ # Communication protocols
│ │ ├── res_system/ # RES communication system
│ │ ├── task_scheduler/ # Task scheduling module
│ │ ├── utils/ # Utility functions
│ │ └── main.py # Application entry point
│ ├── tests/ # Test files
│ ├── build.py # Build script
│ └── run.py # Run script
├── frontend/ # Frontend application
│ ├── v1/ # Frontend version 1
│ └── v2/ # Frontend version 2
├── tests/ # Additional test files
├── README.md # English documentation
├── README.zh.md # Chinese documentation
├── LICENSE # License file
└── .gitignore # Git ignore file
- Python 3.10 or higher
- pip package manager
- Clone the project code:
git clone <project_url>
cd nx_path_planning- Install dependencies:
pip install -r requirements.txt- Configure system parameters (optional): Edit the configuration files to modify device IP addresses and other configuration items
- Start the API service:
cd backend
python run.py- Start the visualization interface (new terminal window):
cd frontend/v2
streamlit run main.py- API Documentation: http://localhost:8765/docs or http://localhost:8765/redoc
- Visualization Interface: http://localhost:8501
This module is responsible for warehouse map construction and path planning algorithm implementation:
MapBase.py- Map base class, responsible for reading map configuration and building NetworkX graphPathBase.py- Path planning base class, provides shortest path calculation functionalityPathCustom.py- Custom path planning extensions
Responsible for communication with physical devices:
async_devices_controller.py- Asynchronous device controllerdevices_controller.py- Device controllerfsm_devices_controller.py- Finite state machine device controllerservice_asyncio.py- Asynchronous communication service
Provides RESTful API interfaces:
v1/- First version of API interfacesv2/- Second version of API interfaces (recommended)
Responsible for task scheduling and management:
TaskScheduler.py- Main task scheduler implementationmodels.py- Task data models
The main system configuration items are in the backend/app/core/config.py file.
- Create new files in the corresponding module directory
- Follow existing code style and specifications
- Write unit tests
- Update API documentation
- Modify the map configuration files in
backend/app/map_core/data/ - Add new node and edge definitions
- Restart the service for the configuration to take effect
- Fork the repository
- Create a Feat_xxx branch
- Commit your code
- Create a Pull Request
This project is licensed under the Apache License 2.0. See the LICENSE file for details.