An implementation of grid-based path planning algorithms for navigating robots through obstacles.
Table of Contents
This project is a Java-based application designed to simulate a grid-based path planning scenario. The program allows users to define the size of a grid, place a robot and an end point, and then calculates the shortest path from the robot's starting position to the end point while avoiding obstacles placed randomly on the grid based on Breadth-First Search (BFS)
algorithm.
Java: The core programming language used for developing the grid path planning program, leveraging object-oriented principles for efficient pathfinding and grid management.
Console-Based UI: Utilizes Java’s standard input and output libraries to provide an interactive console-based user interface, enabling intuitive user input and visual grid representation.
- Customizable Grid Size: Users can define the number of rows and columns for the grid (between 5 and 50).
- Obstacle Placement: The program randomly places obstacles on the grid while ensuring there is always a possible path from the robot to the end point.
- Pathfinding Algorithm: Utilizes a breadth-first search (BFS) algorithm to find the shortest path from the robot to the end point.
- Interactive Console Input: User-friendly prompts to input grid size, robot starting position, and end point position.
- Visual Grid Display: Displays the initial grid layout with coordinates, the robot's path, and obstacles.
To run this project, ensure you have the following prerequisites:
- Java Development Kit (JDK) 8 or higher
- IDE or text editor of your choice (e.g., IntelliJ IDEA, Eclipse, VSCode)
-
Clone the Repository:
git clone https://github.com/yourusername/GridPathPlanning.git cd GridPathPlanning
-
Compile the Java Files:
javac Main.java Grid.java RobotState.java
-
Run the Program:
java Main
Once the program is running:
-
Input the Grid Dimensions:
- Enter the number of rows and columns (both between 5 and 50).
-
Position the Robot:
- Enter the starting position for the robot (within the grid bounds).
-
Set the End Point:
- Enter the coordinates for the end point (must be different from the robot's start position).
-
View the Output:
- The program will display the grid, indicating the shortest path from the robot to the end point, avoiding obstacles.
★★★ Welcome to the Grid Path Planning Program ★★★
★ Enter the number of rows (between 5 and 50): 10
★ Enter the number of columns (between 5 and 50): 10
★ Enter the position of the robot:
Row: 0
Column: 0
★ Enter the position of the end point:
Row: 9
Column: 9
+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
| (0,0) | (0,1) | (0,2) | (0,3) | (0,4) | (0,5) | (0,6) | (0,7) | (0,8) | (0,9) |
...
Contributions are welcome! If you have ideas for new features or bug fixes, please fork the repository and submit a pull request. Here’s how:
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE.txt
for more details. This means you can freely use, modify, and distribute the code, but please include the license notice in any copies or substantial portions of the software
Have questions, suggestions, or just want to chat about the project? Reach out to me!
Name: Himan Withana
Email: [email protected]
Special thanks to the following resources and tools that have been invaluable in the creation and development of this project: