How close together is important. I saw the range of 0-5m, but if you're suggesting that they might touch, or just barely not touch, then you're going to have difficulties. Lightweight is also a vague term which will need to be defined better in order to adequately answer your question. Still, there are some things to keep in mind:
- Augmented GPS can get you sub-inch accuracy. This will likely involve an extra antenna, so space and weight might be a concern. You also have to make sure you don't lose GPS accuracy at the wrong time, which I've seen with some systems.
- As geez suggests, IMU is very useful for the 6-DOF tracking.
- You almost certainly know this, but 3D movement makes this a tricky problem. Avoiding collisions is relatively easy, but ensuring the proper formation between the two means sensing the other vehicle will require a wide range of detection.
- A sensor such as MS's Kinect will get you some around .6m to 3m 3D sensing, but in a relatively narrow cone, so you'd need several to cover the all around the planes. Also, they're not all that fast and will have trouble in difficult weather. Most weather, really. I don't know of any variants that are outdoor rated, especially in cold/damp (condensation on a lens would kill that sensor).
- Which also brings me to another question: speed. Planes are all reasonably fast, but there's glider fast and there's supersonic jet fast and all ranges in between. Refresh rate vs. distance between UAVs will be a very important consideration. Is 30-60hz enough time for your UAVs to correct when they're a few meters apart, or do they need something close to 100hz?
- If 30-60Hz is enough, you could potentially mark your UAVs with a distinctive pattern and use optics to detect that pattern and, combined with GPS etc, use that for close-range stuff. The problem with straight image detection is that it's computationally intensive and sometimes tricky to do, especially depending on your math skills. You'd have to have a way to keep the lens clear of condensation, like the Kinect, but I don't believe that's an intractable problem in this case, because you have a lot of options on cameras. Not saying it'd be easy, but easier than with a Kinect-style sensor.
- XBee is cool, but it's all packet based, so there's a maximum refresh rate on transmitting between units. You'd probably need some tolerance on lost packets, as well.
So, no sure answers yet, but possibly with some domain narrowing we could help you more. Size, weight, minimum distance, and maximum speed limits will all wildly affect what solution you might go with.
UPDATE based on additional information:
Hmmm. I don't think there's an ideal solution. An array of ultrasonics could get you collision avoidance, but there's no high-refresh rate 3D sensor that I know of that could make a bubble around your plane in the 0-5m range. If you were scaling up, you could use something like a Velodyne laser to do something like the equivalent, but environmental conditions would make that less than ideal without work on the software end.
Think hard about tolerances. Is it vital they be able to fly within X cm of wingtip to wingtip? Do they need to be coplanar, or would it be okay if one were, for example, +/- a meter above the other as long as they don't collide? You might also see if you have options on the navigational smarts of the planes, so that, as long as they're following their flight plans within tolerance, they are quiet, but if they are blown off course (or whatever), then they send out an alert to the other UAVs with what they know to be wrong. A differential system might be enough, though I imagine the test cycle for that will be exciting.
Also, do a check on Augmented GPS systems to see if someone makes a lightweight version. Most of the ones I've seen are for agricultural use, so they're more keen to make it ideal for putting on a tractor, but it's worth checking.