thotro / arduino-dw1000

A library that offers functionality to use Decawave's DW1000 chips/modules with Arduino.
Apache License 2.0
528 stars 287 forks source link

multiple Tags - best way to achieve it #181

Open prideofisland opened 7 years ago

prideofisland commented 7 years ago

Hey, My friend and I are struggling with implementation of multiple Tags in DW1000. Actually, we have already done it once by switching the channel. It goes as follows:

In general, it works. The main drawback is time resolution which really sucks. System initialization after channel switching lasts about two seconds.

We want to try sth different. We tought about dividing tags to time slots or introducing a variable 'it s your turn'. Do you have some better ideas than that?

Best regards, Piotr

xforus commented 7 years ago

Hello @prideofisland, I'm also interested in implementing more tags.

As you said, best way was dividing tags in time slots in order to have only one Tag speaking in one time. But first you must know how many tags there are in system, and then, assign an order number to each tag to speak to anchors. There are some ways to do... It will be perfect to do a dinamically system, not close, that every tag will be able to know this information by itself...

I have found this protocol I think is very interesting for this system. It's call Token Ring Protocol: http://www-verimag.imag.fr/~tripakis/papers/its01.pdf

prideofisland commented 7 years ago

Hi @xforus

As you said, best way was dividing tags in time slots in order to have only one Tag speaking in one time.

You're right. It would be a good solution but the time resolution will be two times lower when we want to use two tags.

I have found this protocol I think is very interesting for this system. It's call Token Ring Protocol Thanks for the link.

We are going to implement something different. As you now Tag saves all Anchors in networkDevicesNumber variable. We want to add the similar feature to Anchors (they will save messages from few Tags).

//each devices have a different reply delay time.
            _networkDevices[i].setReplyTime((2*i+1)*DEFAULT_REPLY_DELAY_TIME);

To get the system working we have to set other replay delay time for Tags too. 20170403_104325

xforus commented 7 years ago

Hi @prideofisland, I'm happy to know you also want implement more tags. I would more time to dedicate with this but only have some time at some weekends.

Time ago, I also tried to do what you say about doing a list of tags in anchor device, but it don't work for me. There are more thing to keep in mind. Tags finally speaks in a kaos way...

I think that Tags have to sincronize between them. If there is a master Tag, this is easy... But I dont want to have a Master and what I have now is a system that every Tag generates an order number position reading its own short adress and from other tags. In this way every tag knows when start to do blinks or polls.

Tell me if you get something with method you say using reply delay time

prideofisland commented 7 years ago

Hey @xforus . That's nice to hear. Hope, we ll have more luck. After two days of coding it can certainly be said that it's really complex thing to do. Despite this,we managed to establish first connection. multiple_tags_404 Our system is composed of two Tags(B1 and B3) and one Anchor(A2).

  1. Anchor receives two BLINKs from B1 and B2
  2. Anchor sends one Ranging_INIT to both of them (broadcast)
  3. Anchor receives two Poll messages from each of Tags
  4. Anchor sends one PollAck message (broadcast to all Tags)
  5. Anchor receives first Range(from B1 for example) msg and calculates the distance
  6. Anchor receives second Range(from B3 for example) msg and calculates the distance Measurement starts from third point.

There are still a lot of things to improve. I hope that I can share my results with you in the following week.

xforus commented 7 years ago

Hi @prideofisland , this is perfect! Is exactly what I wanted to achieve. Are you using an old MAC version of code? Could you give me more details or make a branch? I would like to try your method and see what I could do.. Thanks!

ghost commented 7 years ago

Hi@prideofisland Good to hear your idea. I am building one anchor and multi tag connections, too. The broadcast way is exactly what I reflect these days. I consider that this way: the anchor broadcast to multi tag and match the message to decide which tag to work, in another word, to control which distance to measure. It sounds like that the teacher call a student within lots to answer the question on class. (But I am not sure whether the response time is satisfying. ) :)

xforus commented 7 years ago

Hi! I'm trying to add more than one Tag but I can't, I don't know how to control times. I have one Tag speaking with up to 6 Anchors. But when I try to coordinate more Tags, system is going too bad...

@prideofisland , @KeyYD Do you have better results? Could you give me more details how to implement this?

Thank you!!!

prideofisland commented 7 years ago

Hi @xforus and @KeyYD , Yes, we managed to achieve the 2 Tags ranging with 3 Anchors. System works like as illustrated above. We set a fixed delay time for each Tag (7ms for Tag1 and 21ms). You have to do it in order to prevent signal collisions (microprocessor needs some time to process the signal. First thing you have to do is analayse MAC frames and find there timestemps.

2 Tags+3 Anchors --> 6 measurements in one cycle. Our data rate is about 20 measurements pro s. So about 3,3 cycles/s. It's not much faster than 'token' strategy but much more complicated to implement. It seems to me that it was not a perfect decision. We're going to upload a short video with our sensors. I'll post a link here.

prideofisland commented 7 years ago

Here is the video: youtube

ghost commented 7 years ago

Happy to hear @prideofisland . @prideofisland @xforus My system contains two tag and one anchor. And it can work, too! I didn't use POLL_ACK message but broadcasting way with time line controlled. Some of the point should be cared: Software:

  1. it will be better that the addresses of tag or anchor are decided by you, and not randomly.
  2. some part of library code should be adjusted to run the multi tag/anchor.
  3. the time line should be controlled.

Hardware:

  1. the current while working in the receiving mode is about 0.12A (You can see this in the picture) Here is my test version of anchor. (the DC regulated power supply shows that the current is about 120mA) anchor

    Still hacking : )

kuek commented 7 years ago

we also implemted multi-tag. this will be available on the website in the next days. https://youtu.be/vubk64ok1TA

prideofisland commented 7 years ago

Could you give me more details or make a branch? I would like to try your method and see what I could do..

Hey, Some people ask me to upload my code. I'm ready to do it. Should I make a branch? or a new repository? There are pretty much changes in code, new unit etc. I have also some MATLAB code for user interface and reducing errors. I've finished my adventure with DW1000 chip and will probably never again work with it. Anyway, I want to share my knowledge (and code) to help you develop this amazing project.

Rotzbua commented 7 years ago

@prideofisland Sounds good, the best way would be to split your new stuff into different topics and according branches.

For example I suggest following topics:

AlexisTM commented 7 years ago

To use multiple tags localization on the same band I made a "Synchronizer". One tag that triggers the other tags in a synchronous way.

kerr4huo commented 7 years ago

@AlexisTM , I am also exploring on similar ideas now but hasn't found a solution. If possible, could you share some references you have used, please? Thanks.

AlexisTM commented 7 years ago

I am using Pozyx devices (DWM1000 + IMU).

I am not sure it is part of the default Firmware; but the Pozyx allows to call functions remotely.

Therefore I have one more device I am just using to synchronise. I send to the devices: Take your position measurement. The the foreign robot, I have a Python script polling for the interruption bit. When there is an interruption, I read the position.

Yet, the GPS like solution is the one which is scalable. Instead of ranging, you can send position and timestamps. Then, you have 2 solutions:

robintzeng commented 6 years ago

Hello ~@prideofisland
I see that you did some amazing projects I want to do something like you recently
,but when i download your project (multiple_Tags) I cannot use it the two tags can not work at the same time !! Can you please teach me how to use it ???

Note: i add the missing DW1000.cpp by myself because i see you deleted it and use the example DW1000Ranging_TAG

AlexisTM commented 6 years ago

@robintzeng The way I'm doing it for N tags is having N+1 tags.

N tags are waiting and the "+1" is triggering them one by one at a certain frequency. Therefore, only one tag at the same time is using the channel.

robintzeng commented 6 years ago

hello !! @AlexisTM thanks for your reply I tried to change the channel to prevent the signal from being interrupted but when I used 2 Anchors on channel 5, 1 tag on channel 5, 1 tag on channel 3 they couldn't communicate well. And when I turned off the channel 3 tag the tags and Anchors on channel 5 can work well . Do you have any idea to deal with it ?? and can you tell me what channel you set the N+1 tag and your tags and Anchors on ??
Thanks !!  

AlexisTM commented 6 years ago

I.never said anything about channels, keep the same channel for all!

robintzeng commented 6 years ago

ques

@AlexisTM
Is the system I drawn same as the system you talk about ???

AlexisTM commented 6 years ago

Yes; with 4+ anchors for 3D and 3+ anchors for 2D

pipsitel commented 6 years ago

Like it. I will also try this also with my additional Localinos I have soon. The channel thingy makes sense for sure ;-)

Aaron101010 commented 6 years ago

image

Right now I am testing the library for multiTags with all the anchors and tags on same channel. My understanding of the UWB is that

  1. On one channel only one tag can polI all the anchors at the same time, then the anchor pollAck
  2. Then tag add the anchor's Id into the network, and recognize anchors. And anchors also add tag into the network.
  3. Then tag transmit poll to all the anchors again.
  4. Anchor transmit Range message to the specify tag ID .
  5. Tag calculate the TOF and print the range value. So I just modified the code like the picture, trying to use Serial input to control the poll from tag. In my test, once I Serial input '0' to stop communication, then both the anchor and tag delete Device Id, Then I want to restore the poll, I Serial input '1', but can't restore. How can I control the poll from tag? By the way, I use Channel_5. I think once I can control the poll from tag then I can design a Synchronizer with Timer to control multiTags. All suggestions are welcome! Thanks!

And I still confuse about different channel's communication. Is channel's bandwidth overlapping, then can communicate with each other? or the central frequency? or preamble codes? Really needs help!

27016483_1102414213227634_1622179924_o

AlexisTM commented 6 years ago

@robintzeng Reverse TDOA implementation: The anchors are messaging and the tags are passive (only listen). This means you can have as many tags as you want.

This is done by the Loco positioning system by Bitcraze for CrazyFlies, using the DWM1000.

Anchor software:

Tag software:

AaronZhu2018 commented 6 years ago

I put three Anchors around the 2m*3m competition venue。 (0,0) (2,0) (1,3) with height of 0.35m And the tag is on the robot with height 0.35m。The picture below is one of the 3 Anchors p_20180428_041735

The test video is with only 3 anchors and 1 tag in channel_7. https://drive.google.com/open?id=1TxSGrx_w0xiMKlBBKkp-kTj5YrbTJhDZ It works great.

Then I am trying to implement 6 Anchors 2 tags system. 3 Anchors and 1 tag are all in channel_7 and the other set of 3 Anchors and 1 tag are all in channel_4. Both tags works well with around 3 minutes. Then one set of the tag starts not to receive one of the 3 Anchors in same channel. Below picture is the two Anchors. I put 2 Anchors in same point. (0,0) (0,0) (2,0) (2,0) (1,3) (1,3) with height of 0.35m and 0.3m p_20180428_041745

I think maybe the problem is I put two anchors too close? And the electromagnetic wave is too strong, so it interrupt?

AaronZhu2018 commented 6 years ago

Hellow @prideofisland @kuek @AlexisTM. Above is the problem I encounter. Any advice is welcome. Really thanks!!!!

AlexisTM commented 6 years ago

I've no clue on perturbation. Yet, the antennas are not omnidirectional. For best results, use the antennas straight. (Up to 5dBm difference)

Also, you can just do as I said before: start the localisation from a master device.

AaronZhu2018 commented 6 years ago

@AlexisTM Thanks for your advice. I know what you suggest. But I think that your device is all on the same channel with the view to minimize the number of DWM module used. What about the update rate with your multi tags? And even I try one tag and one anchor on channel_7 and another tag and Anchor on channel_4 they still seems to interrupt after about ten minutes later. Have you ever meet this kind of problem? Thanks for your advice.

AlexisTM commented 6 years ago

The rate is divided by N tags.

The other solution is using the Bitcraze firmware and have as many tags as you want.

TimotF commented 6 years ago

@Arsenezhu I used 4 anchors and 2 tags for locating my robots within the 2*3m area. I used the same channel for every device and implemented tag synchronization as follow :

This is a kind of multiple tag connection with a dynamic master tag. the update rate i get is about 6 to 9 Hz, which is enough for locating robots considering their max velocity.

ZizziWang commented 6 years ago

@Aaron101010 I am also confuse about different channel's bandwidth overlapping issue. I used 1 tag, 6 anchors and 1 receiver, 6 anchors were separated into channel 1,3 and 5 (2 anchors on each channel), and the receiver on channel 7. The tag will scan channel 1, 3 and 5 for ranging, then send all ranging data to receiver through channel 7. But the fact is tag always range the anchors on other channels.... I tried add the tag's channel into data transmited by the tag byte DW1000RangingClass::deviceChannel; data[LEN_DATA] = deviceChannel; and verify it with the anchor's channel by anchor when it receive any type of message if(data[LEN_DATA] != deviceChannel){ return; } but it does not work since data[LEN_DATA] received is always '12'. Any advice is welcome, thanks in advance.

carbonadam commented 5 years ago

@ AlexisTM Did you attempt to get the bitcraze code working at all? Im so curious to see their system in action.

AlexisTM commented 5 years ago

@carbonadam They recently released the "roadrunner", a crazyflie with the DWM1000 without motors: https://store.bitcraze.io/collections/positioning/products/roadrunner

I did not try it yet but we are planning on buying one setup for AGVs.

Two videos they published:

https://www.youtube.com/watch?v=eWKTFT0CnU4

https://www.youtube.com/watch?v=hIH3bwq2B6U

carbonadam commented 5 years ago

Yes there whole system looks great. I know that they used the code here to make their system so it should be possible to recreate the tdoa 2 or 3 ourselves no ? Decawave also has the mdek1001 for 270 euros and I thought to try it just to get some stable test results to start. Apart from a good crystal oscillator and sync Im not sure why doing the hardware ourselves is so so hard