Hello, fellow tech enthusiasts. Having finally completed this project, I look back with pride, and with a little bit of more faith in my abilities and in making theory practice.
SLAM stands for Simultaneous Localization and Mapping. In this project, SLAM was like the backbone, enabling our robot to understand and navigate its environment. SLAM involves creating a map of an unknown environment while simultaneously tracking the robot’s location within that map. It’s like being blindfolded in a room and having to both map out the room and pinpoint your location within it.
The core of this project was to implement a path planning algorithm, using the mBot as our test subject, so from theory to practice. Path planning is essentially the robot’s brain figuring out how to get from point A to point B without bumping into obstacles.
First, we used a Grid Graph, a data structure to represent the map. Think of it like a chessboard, where each square is a potential spot for mBot to move. Next, we taught mBot to identify its ‘neighbors’ – the squares it can move to from its current location. We used the BFS algorithm to explore the map. BFS is like casting a net wider and wider from the starting point, checking each square systematically until the goal is reached. Before letting mBot loose, I tested my algorithm on the webapp API by Michigan, which was great for saving us time and troubleshooting. Finally, I uploaded our code to mBot and watched in happiness as it navigated around our makeshift obstacle course (of course not with the first try!).
For path planning, iexperimented with two algorithms: BFS and A*. BFS is straightforward; it doesn’t consider the goal’s location until it finds it by exploring all possible paths. A*, on the other hand, is more like a homing missile; it considers the goal’s location right from the start, making it faster and more efficient.
Pseudocode for BFS
function BFS(start, goal)
initialize queue with start node
while queue is not empty
current = dequeue()
if current is goal
return success
for each neighbor of current
if neighbor is not visited
mark neighbor as visited
enqueue neighbor
return failure
The mbot, plans the entire path before moving. This makes it Efficient and less prone to getting stuck. But it needs a map beforehand and struggles with dynamic changes in the environment.
It also reacts to obstacles as they appear.But something that happened once is that it got stuck in “dead ends.” once or twice.
This project was a blend of frustration and excitement. The biggest challenge was debugging. Sometimes mBot would stubbornly crash into a wall, other times it would spin in circles, lost and confused. Each bug fixed was a mini-win :). Through trial and error, I learned the importance of precise calculations and the value of patience in coding.
Transforming theory into practice with mBot was an unforgettable journey. It gave me a new appreciation for the complexity behind seemingly simple navigational tasks. This project was not just about programming a robot; it was about problem-solving, perseverance, and the joy of seeing your code come to life.