Communication with multiple Crazyflies

Firmware/software/electronics
cookednoodle
Beginner
Posts: 2
Joined: Sat Nov 09, 2013 1:44 am

Communication with multiple Crazyflies

Post by cookednoodle » Sat Nov 09, 2013 2:21 am

Hello,

I am a grad student at the University of Texas. My research group has purchased a couple of Crazyflies to evaluate as a platform to test optimization and swarm algorithms. We have them flying around in a feedback loop with a motion capture system (lots of fun). Now, we would like to command both of our vehicles simultaneously. It is my understanding that this is technically possible but unimplemented. I am about to start looking through the source to see what that will take, but I am unfamiliar with pretty much all aspects of this code (Python, communication protocols, embedded systems...). So, I thought I would ask if someone could summarize what would need to be done. Anybody?

Thanks!



arnaud
Bitcraze
Posts: 2028
Joined: Tue Feb 06, 2007 12:36 pm

Re: Communication with multiple Crazyflies

Post by arnaud » Mon Nov 11, 2013 9:30 pm

Hi, Interesting stuff, do not hesitate to post more info/video about your project :).

There are at least two ways you can control many copter with one computer:
  • Using one Crazyradio per Crazyflie. Each copter is on its own channel.
  • Using only one Crazyradio but having the Crazyflies setup with different addresses
Using many dongles was working originaly but broken at some point, I fixed it and tested it today so you can fetch the last dev version of cflib (https://bitbucket.org/bitcraze/crazyfli ... 7e389eec58). Basically all you have to do is to setup the copters on different channels, connect a second radio dongle to the computer and to use the link uri radio://1/channel/bitcrate for the second copter. So far only 2 radios have been tested but it should work for as much radio as you can plug on the computer.

Using only one dongle would require more work, mostly to make it well integrated in the existing software stack. The radio chip has some addressing capabilities but we currently always use the default address. The Crazyradio dongle firmware has the capabilities to use other address. However you would need to implement a way to setup the address in the copter and a new data transfert loop in the python radio link object to handle more than one copter on the same radio.

If you have as much radio dongle as copter to control I would recomend to use the first solution, it should work righ away. You got us thinking about the way of implementing multiple copter on one radio so it is something we might look at soon :).

Good luck with your project and keep us posted!

cookednoodle
Beginner
Posts: 2
Joined: Sat Nov 09, 2013 1:44 am

Re: Communication with multiple Crazyflies

Post by cookednoodle » Wed Nov 13, 2013 11:15 pm

We are hoping to fly tens of vehicles, so using one radio to address many quads is a must.

To make this happen, we will need to modify the quad firmware and the client, but not the dongle firmware? I have not had the time yet to sit down and look at the relevant bits of code, so I don't have any technical questions yet, but I do have some general questions.
  • Will there be a different channel for each address or will there be some sort of multiplexing in a single channel for each address?
  • Is there any framework in place for quad-to-quad communication?

arnaud
Bitcraze
Posts: 2028
Joined: Tue Feb 06, 2007 12:36 pm

Re: Communication with multiple Crazyflies

Post by arnaud » Fri Nov 15, 2013 8:50 am

The current dongle firmware should be able to do the job, even if it could be a bit more efficient. Currently you will need to set channel and address between packets (http://wiki.bitcraze.se/projects:crazyr ... io_channel).

The addresses in this radio chip are a bit like MAC addresses, they discriminate packets on the same channel. The receivers has 6 pipes to receive from 6 different addresses which make possible to implement things like broadcast address (all would have a pipe configured to the same address). Changing address or changing channel will take the same time in the dongle so doing multi-channel or multi-address or both is up to your use case. For the client modification one trick is that there will still be only one radio communication thread (https://bitbucket.org/bitcraze/crazyfli ... ult#cl-251) but there should be many RadioDriver object connected to it (one per copter).

There are nothing yet for copter-to-copter communication. To do so you would need to switch the radio of the copter in PTX mode to send packets and switch back in PRX just after. It will require modification of the firmware radio link.

prashant7891
Beginner
Posts: 3
Joined: Mon Oct 28, 2013 6:01 pm

Re: Communication with multiple Crazyflies

Post by prashant7891 » Thu Jan 23, 2014 4:51 pm

Hi,
I am also trying to implement the same thing as cookednoodle. I have been able to use multiple dongles to control multiple crazyflies. Currently, I also have only two crazyflies and it is working. However, I am also planning to implement these on swarms. Even assuming that I use a dongle for each quad, I have a few questions.

1. Given that the computer has limited ports, can I connect a USB hub and still address the link uri as radio://1/channel/bitrate, radio://2/channel/bitrate and so on?
2. If so, will there be any interference when I am trying out multiple crazyflies?

For controlling multiple crazyflies with one dongle:
I am a bit new to all this. So can you please elaborate a little more on how to do this? I have written a very simple code which will just ramp up the throttle and ramp it down again (taken from http://wiki.bitcraze.se/projects:crazyf ... tils:pylib). The code is at the very end of that page. What am I supposed to change in this to get this working? Aso, how many such crazyflies can I control using one dongle?

arnaud
Bitcraze
Posts: 2028
Joined: Tue Feb 06, 2007 12:36 pm

Re: Communication with multiple Crazyflies

Post by arnaud » Sat Jan 25, 2014 5:36 pm

Hi,

1. Yes you can use a USB hub, there should be no problem putting dozens of dongle on a high-speed usb2 hub.
2. The nordic chip 'leaks' a little bit on neightbour channel (see documentation for exact figure but I remember something like -20db on the adjacent channel). So as long as you keep a couple of channel between copters I won't expect any interferences. (note: in the case of many copter on one dongle, no problem using adjacent channel as they will be on time division).

As for controlling many Crazyflie for one dongle I have been saying for too long that the problem is "only software", I finally found the time to implement it and push it to the repos: https://bitbucket.org/bitcraze/crazyfli ... 0cdeb3a8bd. This implementation allows for creating multiple link on the same dongle and with different channel, which allow for connecting more than one copter with the same dongle.

I also uploaded to the source code repos the ramp example and a new multiramp example that shows how to connect more than one copter with one dongle.

Of course the cost of using one dongle for many copter is that the bandwith per copter will be reduced. This is even more the case because of the current dongle implementation that requires 1 to 2 milliseconds to change channel/datarate. However that should be enough to get things running and it is possible to use both solutions: multiple dongles with multiple copter for each dongle.

Also to be noted: it currently doesn't support changing addresses so each copter has to be on a different radio channel which prevents direct inter-copter communication. I plan to look at that over the next couple of weeks.

yuvadm
Beginner
Posts: 1
Joined: Wed Feb 05, 2014 4:03 pm

Re: Communication with multiple Crazyflies

Post by yuvadm » Wed Feb 05, 2014 4:05 pm

thanks for the multi-copter patch!

unfortunately, when i try to run the example, the first copter throttles up as it should, but the second one throws "link already in use".

any thoughts on how i can debug/fix this scenario?

EDIT: ignore, i forgot to change to the proper branch :)

Dom
Beginner
Posts: 2
Joined: Thu Feb 27, 2014 12:09 pm

Re: Communication with multiple Crazyflies

Post by Dom » Thu Feb 27, 2014 12:28 pm

@CookedNoodle : what you are doing is really interesting, imagine when even smaller devices are available and 100s are able to swarm like bees or flies!. With these kinds of numbers it could be more practical to have the 'flys' behave autonomously.

I have a software development background with a Crazyflie on order, and am thinking to get some PS3 60fps cameras to accurately locate its position. Would you be able to share your method of identifying device location eg do you use a marker or LED?. I assume this method would also need to be able to uniquely identify multiple targets. Would also be interested to know if you are using a vision procession framework or building from scratch.

Thanks

marco.tognon
Member
Posts: 38
Joined: Mon Sep 16, 2013 10:22 am

Re: Communication with multiple Crazyflies

Post by marco.tognon » Thu Feb 27, 2014 4:36 pm

Hi guy, I'm dealing with multiple connection with multiple dongles. I'm using my own code to control the crazyflie, wich use an holde version of the library. Since it work fine with one quad I never update it. Now that I want to control more than one quad I have some difficults.

At first I modified the library as suggested before
arnaud wrote: There are at least two ways you can control many copter with one computer:
  • Using one Crazyradio per Crazyflie. Each copter is on its own channel.
  • Using only one Crazyradio but having the Crazyflies setup with different addresses
Using many dongles was working originaly but broken at some point, I fixed it and tested it today so you can fetch the last dev version of cflib (https://bitbucket.org/bitcraze/crazyfli ... 7e389eec58). Basically all you have to do is to setup the copters on different channels, connect a second radio dongle to the computer and to use the link uri radio://1/channel/bitcrate for the second copter. So far only 2 radios have been tested but it should work for as much radio as you can plug on the computer.
Then I setted the links as
quad0= //0/10/1M
quad1= //1/100/1M

but really often one connection doesn't work. Moreover, if both the connections are up, after a while one falls.

Could you help me?

arnaud
Bitcraze
Posts: 2028
Joined: Tue Feb 06, 2007 12:36 pm

Re: Communication with multiple Crazyflies

Post by arnaud » Tue Mar 04, 2014 10:42 am

Hi marco,

You need to use the radio_multilink branch for that to work. At some point I was assuming it should work out of the box with two radio (and to my defence it did long time ago : ) but when doing the implementation for communicating with two copters using one radio I found a couple bug that prevented creating two independent Crazyflie object.

This is the multilink branch: https://github.com/bitcraze/crazyflie-c ... _multilink
This is what I had to fix to allow more than one Crazyflie object (if you don't want to update your lib you can try to fix it, basically I removed all class attributes): https://github.com/bitcraze/crazyflie-c ... 67c29eaca0

Post Reply