Inspiration
Ever since we bought our iRobot cleaning robot a few years ago, I've always wondered if there was any better way to plan its motion other than simply changing direction when it bumps into a wall. When I was brainstorming ideas for TreasureHacks 3.5, I was reminded of this. What if we could use generative AI to plan the most efficient path possible for a cleaning robot? So that's exactly what I set out to do in this hackathon.
What it does
SmartClean takes in the environment of the area you want to clean as input. Basically, the user just has to specify the starting position of the robot, which areas the robot can go to, which areas are inaccessible to the robot (due to obstacles and such), and which areas are dirty and need to be cleaned. SmartClean then outputs a list of instructions for the robot to take. For example, N E V means first move in the North direction on a map (up), then East, then South, and then vacuum the current spot. Input: 6 is the number of columns, 5 is the number of rows, # is blocked cells (the 4 on top could be a couch), and _ are open cells.
Input:
6
5
_ #### _
_ * * * * _
_* # # * _
_@* _ _ _
Output: N V N V E V E V E V S V S W W W V
How I built it
I used a simple uniform cost search algorithm to plan the path the robot takes from the initial state to the goal (no dirty cells remaining). I represented the state of the room with cells, like on a coordinate plane. Since the room is fully observable and deterministic, this algorithm guarantees to find the most optimal solution if there is one. Uniform cost search can also be used because the amount of power expended by the robot to move is the same anywhere in the room since it is flat.
Challenges I ran into
This was the first time I have ever used an AI search algorithm, so creating this project was by no means easy. Simply understanding the algorithm and implementing it took me quite a while. Specifically, I was also new to all the types of lists, queues, and stacks, so creating and understanding the priority queue and comparator was difficult as well. Also, the closed list of already visited nodes gave me a lot of trouble, since it just didn't work correctly (honestly I still don't know why it didn't), so I had to completely change how it was represented.
Accomplishments that I'm proud of
As mentioned above, this is pretty much my first experience with AI search algorithms. In addition to that, this is also the first hackathon I've ever participated in, so I'm very proud of myself for that. I am also proud of successfully writing a program that uses generative AI practically to solve a problem in the real world. In addition, I am proud of myself for learning search algorithms and figuring out how to implement one in Java to solve a problem all on my own.
What I learned
I learned how to use priority queues and create my own comparator for the queue. I also learned As for the algorithms themselves, I learned about many types of search algorithms, including uniform-cost, depth-first, A*, and greedy search. In my attempts of trying to use one to solve the problem, I successfully implemented uniform cost search and learned a lot about the other algorithms as well. In the process of researching the algorithms, I also learned about time and space complexity and big O notation, which I know will be useful in the future.
What's next for SmartClean
SmartClean is a very barebones program right now that only runs in the terminal, so the next step is to create a graphical user interface that allows the user to easily hand draw the room & dirty areas that need cleaning. Then, I will improve the program's efficiency by adding more algorithms for different-sized worlds (speedy search and A*), change my state representation so that it does not hold the whole world, and change my closed list to a hash table.
Log in or sign up for Devpost to join the conversation.