This is my solution to SWARM Software Task Round 2021.
I managed to solve all the levels. I used file handling (2 txt files) to establish communication among bots.
- I used basic A* for path planning. I even explored RRT and it seemed like a pretty cool method. I tried an approach of combining RRT with A*, as in, RRT with a high step value gave checkpoints in the map, in just 50-100 iterations and A* was used to find path from checkpoint to next checkpoint (pretty fast as start and goal are not far away and there are mostly no obstacles along the way). It worked well but since its an iterative method, it will obviously give an approximate solution quickly rather than the optimal solution after taking relatively longer.
-
I was told that we could use a centralized approach rather than actual coordination among bots. But the bots were running in parallel threads and we weren't allowed to change other files, such as
api.py
orcontroller.py
(yeah I am not touchingapp.py
, thank you). So the approach I used was using two txt files, one as status indicator of the bots, other as achieved goals. It is created on its own if it doesnt exist in your folder. And its reset to proper format as soon as the mission is complete.
As of now there are two major issues, that I think I cannot fix, no matter how much time I am given.
- Bot-bot collision is not taken care of, because to be honest, they are just points and what are the odds of collision, given the map is 200 X 200. Anyway precaution measures have been taken in goal assignment so as to try and avoid bot collision as much as possible.
- Yeah my code does random stuff sometimes, I honestly do not know why. Its the pain every fellow programmer has felt once in life atleast, right? No? I'm the only one? FFFFFF. So it works as expected 80% of the times and sometimes does unexpected stuff, I checked everything, I spent days finding the issue, but I couldnt find any, guess I'll just move on (to find newer issues).
- Well, follow this repository TotALly NOt a RIckROll shhhh (Trust me 🙂).
- Follow all the instructions there.
- Next just copy paste the
code.py
code from this repository. And you're good to go!
Swarm.Demo.-.2.mp4
POG