# How can robots communicate, locate and identify each other?

I'm planning to build some simple robotic boats. They will be travelling some distance alone but should also be able to group and physically connect together to form one boat. When they are near each other I want them to be able to "know" that they are near each other, identify each other, communicate and locate each other so that they know how to physically connect to each other.

As an example, let's say that we've got 3 boats: X, Y and Z. Boat X should be able to say for example the following:

Boat Y is located at 90 degrees and boat Z is located at 210 degrees from me.


and similarly, boat Y should be able to say:

Boat X is at 270 degrees and boat Z is located at 230 degrees from me.


My idea was to use bluetooth to make boats identify each other, wifi to communicate and send each other their GPS location to locate each other. I thought it could work like this:

1. Each boat makes itself permanently discoverable with bluetooth, using a number as bluetooth name (e.g.: boat_1, boat_48, boat_285).
2. When a boat "sees" at least one other boat with a lower number and no boat with a higher number (i.e.: the boat realizes it's the highest number of the group) it sets up a wifi hotspot to which the other boats can connect. This boat becomes the "master" boat hosting the connections to all the boats that are near.
3. The master boat then hosts an API endpoint on the internal network to which all boats can post their information and from which they can retrieve the information of the other boats.
4. All boats continuously post their gps coordinates and continuously retrieve the gps coordinates of the other boats.
5. Using the GPS coordinates the master boat decides what the physical order will be in which the boats should physically connect with each other. So boat X connects to boat Y and boat Z connects to boat X.
6. Every boat moves behind the boat to which he is assigned by the master boat and connects to the boat in front of him.

Apart from some obvious security and failover issues, to me this sounds like something that could work. I have no experience with this though, so I wonder whether anybody knows any better ideas to let boat-robots identify, communicate and locate each other when they're near each other? I read about Zigbee Mesh Networks but since I'm familiar with wifi I thought of starting with that.

All tips are welcome!

The idea is very interesting, and I wish you good luck implementing it.

However, it is not (very) simple to implement. Some reasons:

• GPS is not at all accurate;
• smartphones usually have a positioning error of +- 10 meters (30 feet). Unless your boats are actually some transatlantic beasts, this error is unacceptable;
• GPS receivers with (very) high accuracy cost in the thousands of dollars range - each;
• it is important to know the alignment of the longitudinal axis of the boat (e.g. its angle to the N-S line); consider that a boat can move sideways (unlike a car), so only the GPS signal is not good enough;
• instead of BT you might be able to use NFC (probably losing some range);
• to be able to maximize the chances of having a physical connection (between boats), any boat should be able to connect to any boat - an additional level of complexity, but manageable;
• option to consider during the design phase: when 2 boats are already connected, they will function like 2 boats, or like one?
• are the dimensions of the boats relevant? should they be exactly of the same size?

So the biggest problem in your case might be the accuracy of (x,y) coordinates, given by the GPS. That accuracy is essential in making a connection.

For measuring relative positions, you may use some IR sensor, which can give you some good accuracies. To add tot he coolness factor, the sensor may rotate like a radar, so the robot can map the surroundings better.

• Thanks for your thoughts. I already figured the same about the lack of GPS accuracy. I was thinking of using some kind of sound triangulation to locate each other more accurately, but IR might be a good idea as well. Do you have any thoughts on the usage of BT/NFC to let the boats know that they are near each other and then use wifi to actually talk to each other? Is wifi a common way to let robots talk to each other, or are other technologies more common? I was basically thinking of a way to let them "shout" around: "I'm X and I'm hanging around here!".. – kramer65 Apr 11 at 15:43
• Triangulation is good, of course. You just need to understand how it works. You will certainly need several "something" to make it work: several transmitters, several receivers, or both. For each object you want triangulated.Simplification: you use some kind of a base station, which has the several something, and which is able to see al boats at the same time. The disadvantage is that it might NOT be able to see all boats at the same time, and therefore some boats might get lost. Workaround: boats are "told" when they are about to exit the coverage area, so they can return. – virolino Apr 12 at 5:17
• What is common for communication is not really relevant. The important questions are: will it work? Do you have the money to implement it? I know nothing about the precision of distance measurement using BT or NFC. To "simplify" the WiFi handling, you can use the "GSM" (data) communication. With the added trouble of getting some additional data plans, provided there is coverage on the lake where you will play :) You probably already thought of it, but cheap smartphones are quite "ideal" for implementing the "brain" in each boat. But Arduino, Raspberry Pi and others similar are equally fine. – virolino Apr 12 at 5:22
• I'm using a raspi and I've Indeed also got some SIM800 modules on the way to my house to use GSM for a data connection. The main thing is that I want to make them communicate directly because I ultimately want to make them cross the ocean.. :-) – kramer65 Apr 12 at 11:30
• :)) You are really going for the high fences. I admire you for your ambition. In that case, you might want to study alternative (wireless) communication methods - I cannot give you any guidance, unfortunately. In the case of a storm, the boats might get very far apart from each other, and GPS localization will definitely help - to get them in communication range, when the other technologies will kick in. You might want to build them "symmetrical", so they work equally good if up-side-up or up-side-down - in which case, left will become right, north might become south... – virolino Apr 12 at 11:36