I am continuing the process of porting the algorithm from the simulator (C#) to the Arduino (C++). Translation is actually fun. I'm learning some of the cool differences between C++ and C#. Dictionaries are now maps, Lists are now vectors, and queues are now deques. Oh, and Stack Overflow is super helpful :D
Not all is smooth sailing, unfortunately. The simulation is a "perfect" environment. Every packet will be delivered, in non-simultaneous fashion, with zero latency (except for the time the processor takes). Moving to hardware introduces problems like dropped packets, simultaneous transmissions, and latency. This means that I'm having to tweak the code a wee bit to get it to cooperate. For instance, if an algorithm sends out a request there should be a response. In hardware, that response might take a few ms to come through, but the code will keep going. The algorithm will be finished before the packet actually arrives at the radio. For this reason, I'm working to add "CheckForPackets" points in the code so that we can at least give them a chance to respond properly. I'm still having some trouble with this and with simultaneous transmissions (to one receiving node). The receiving node will (in this case) simply act like it heard nothing at all (this is maddening). I'm reaching out for help on that point, so maybe my contact will know how to avoid that issue.
There's also an issue with the mapping algorithm. It gets very slow after about 60 nodes. Mapping a mesh is profoundly complicated, and providing each node with the opportunity to map the network for itself multiplies the problem by n. While I'd like to get the algorithm better (and I have some ideas on how to do it) I have elected to proceed with implementing the current algorithm. I can always go back and modify it later to create a faster algorithm. That will require a separate process of forking the simulator, testing it (a lot) and then implementing it in C++ again. I'm already most of the way through that process with the current algorithm so I'm going to finish it out as-is and then start over if I believe the algorithm can be improved upon.
For up to two nodes (because of that simultaneous transmission bug mentioned above) the network works perfectly. A total transaction of 13 packets occurs to map the two nodes, and everything looks just like it does in the simulation. I am optimistic that once the current issues are solved, I will be very close to having a set of nodes that can map reliably and quickly. I have hardware enough for six nodes at the moment, so I can only test on a limited scale. If all goes well I might purchase enough hardware to cover my college campus in a mesh, which would be pretty cool, obviously.
Look for updates soon! I have a pretty cool one planned next.