DEVLOG 5 - PERFECTION
The simulation is now fully functional and perfect in a sense. The only thing left is adding noise for realism, and UI to make it interactive.
Changes + Additions
Drivetrain
The robots now have simulated drivetrains. They are modeled off 3 wheel omnidrives, and allow them to convert their desired velocity into wheel speeds. This leaves room for me to manipulate the accuracy/precision of the wheels, to see how well the robots can adapt
Formations
The robots can now form a circle as well as a line. For the circle formation, the robots first find a suitable cyclical path through the swarm, and assign positions in the path. Next, they find where they should be in relation to their 2 neighbours based on a regular polygon of size n. I struggled a bit with this part because the robots couldn’t consistently tell which way to go, and would sometimes bend inwards towards the center of the circle instead of out. I fixed this by making them take all visible robots into account not just the closest 2. This allowed them to find which direction the center of the swarm was in, and they choose the position furthest from that center as their target.
Optimization
The algorithm the robots used to find the most efficient path through the swarm would was causing the simulation to freeze, or even crash with larger swarms. This is because the robots were checking every possible path, the amount of which grows exponentially as the swarm’s size increases. To solve this, instead of checking every path they now build a chain from each potential starting point and choose the shortest one. They first pick a starting point, A. robot can see B and C, but C is closer so C is added to the chain. Robot C can see A and B, but A is already in the chain, so B is added making the final order ACB. This removes the delay entirely allowing it to run comfortably on ESP32, at the cost of finding slightly worse paths in very rare cases.
What’s Next
With the core functionality in place, the next Devlog will likely be the last before I ship the project. I want to add UI and controls to the simulation, to make it more interactive. This will allow me to stress test the swarm in lots of different scenarios. A feature I’m particularly looking forward to is walls. The reason designing the communication took so long is because I had to account for cases where all the robots couldn’t see each other. Adding walls will let me see if the system works in practice.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.