Robot motion planning: Navigate a grid-like maze
My solution for Udacity’s robot motion planning project.
A simulated robot-like agent is placed in the corner of a grid-like maze with the task to find the shortest path to the maze’s center.
The agent is equipped with three range-limited ranging sensors pointing to the front, left and right side of the agent.
It has no knowledge of the maze map and has to construct a representation of the maze in order
to find the shortest path.
The program runs in two phases:
Trémaux’s algorithm is used during exploration and mapping
as an implementation of a depth-first search for planning the agent’s movements and to obtain the complete map of the maze.
Afterwards, the internal map is treated as a graph and Dijkstra’s algorithm is used to create an action policy for the agent which enables it afterwards to reach the maze center on the shortest path while using it’s limited actions efficiently.
robot.py
: Contains the implementation of the AI algorithms to explore and map the maze,
find the shortest path and race to the goal on the shortest path. It also has the code that simulates a robot with limited capabilities and logs the paths
the robot has taken to a log file called path.json
. Comments are provided in the code,
explaining the details of the implementation.
run.py
: Tester code to evaluate the agent implementation on a maze and display the results afterwards.
showmaze.py
: Contains visualization code to plot a maze and show the exploration of a maze and
the race to the goal on the shortest path.
# Execute in respository root
pipenv install
pipenv shell
cd maze_exploration
Execute run.py
inside the maze_exploration
directory, giving a maze definition text file as an argument.
Example: Run programn and visualize results:
# Execute in maze_exploration folder
python run.py maze_01.txt
Example: Visualize a maze file:
# Execute in maze_exploration folder
python showmaze.py maze_01.txt