Multiple crazyradio PAs connect to one crazyflie

Discussions and questions about the Crazyflie Nano Quadcopter
Post Reply
Barry
Beginner
Posts: 28
Joined: Tue Apr 06, 2021 9:19 am

Multiple crazyradio PAs connect to one crazyflie

Post by Barry »

Hi all,

I was wondering if it is possible to use multiple crazyradio PAs to connect single crazyflie.

The reason why I want to do that is I want crazyflie to fly away as far as possible by using many crazyradio PAs.

It looks like when crazyflie runs away from the range of one crazyradio then enters the zone of another crazyradio so that the command send from one crazyradio switches to another crazyradio. Is it possible?

I would appreciate it if someone could give me some ideas.

Cheers!
kimberly
Bitcraze
Posts: 1050
Joined: Fri Jul 06, 2018 11:13 am

Re: Multiple crazyradio PAs connect to one crazyflie

Post by kimberly »

Hi!

I'm not so sure that this is possble.... perhsaps if the crazyradios are far enough that they don't overlap, so that you travel from one crazyradio to another?

I think this is a good question for @arnaud! But he is on a holiday now, so he will be back next week.
Barry
Beginner
Posts: 28
Joined: Tue Apr 06, 2021 9:19 am

Re: Multiple crazyradio PAs connect to one crazyflie

Post by Barry »

kimberly wrote: Tue Jul 06, 2021 1:16 pm Hi!

I'm not so sure that this is possble.... perhsaps if the crazyradios are far enough that they don't overlap, so that you travel from one crazyradio to another?

I think this is a good question for @arnaud! But he is on a holiday now, so he will be back next week.
Thank you for your reply kimberly :D !!!
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Multiple crazyradio PAs connect to one crazyflie

Post by arnaud »

Hi,

This is a very interesting project, I have been thinking of playing with that but never had the time or a use-case for it.

Using multiple radio to communicate with one Crazyflie is not implemented but it is technically possible and depending of your requirements it might not be too hard to implement.

To start with the theory, I described the Crazyflie communication stack in these blog-post: https://www.bitcraze.io/2021/02/communi ... liability/ and https://www.bitcraze.io/2020/08/crazyfl ... unication/.

The game here will be to split the stack in order to have 2 physical radio on the PC side. Since everything above physical has a state, the simplest would be to split only the physical layer. This is going to be less efficient that, say, splitting at the link level, but it will be much simpler.

Assuming you want to setup your radios from computers (ie raspberry pies) connected over the network, the simplest solution I can think about is to make the radio send_packet function available on a ZMQ Rep/Req socket. One reason for using ZMQ is will round-robin automatically through all the connected radio, this means that the communication will automatically use all radio available. The advantage is that this should pretty much work out of the box. The disadvantage is that it will not be the most efficient: a more advanced implementation will try to track which radio leads to the best performance and use this one in priority. But as a fist approach round-robin will work.

I do not have an implementation for all of that, but if you are interested, I already have bits and pieces. For the radio part, the commit 10987ac of my crazyradio-server does allow to send packet over with the radio using JsonRpc over a ZMQ Rep/req socket. It is written in Rust but it should be very easy to run (cargo run --release -- --help) if you have rust installed. Otherwise a similar service could be written in python as well. I could build the server and upload it as a release to github if you want.

This is an example of how to use the server, in this example I connect 2 local server to demonstrate that the 2 radios are indeed used:

Code: Select all

import zmq

context = zmq.Context();

socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:7777")
socket.connect("tcp://localhost:7778")

for _ in range(100):
    socket.send_json({
        'jsonrpc': '2',
        'method': 'sendPacket',
        'params': {
            'channel': 80,
            'address': [0xe7,]*5,
            'payload': [0xff,],
        }
    })

    answer = socket.recv_json()

    print(answer)

    if 'result' in answer:
        print(f"Acked: {answer['result']['acked']}, Payload: {answer['result']['payload']}")
For the lib part, the radio driver needs to be modified to talk to the radio over ZMQ instead of directly to it. The radio driver is already quite modular and so the only class that needs to be modified is the shared_radio and shared_radio_instance: https://github.com/bitcraze/crazyflie-l ... y#L79-L176. Currently these two classes handle sharing a physical radio between multiple Crazyflies connection, it can be modified to communicate to a ZMQ socket instead.
Post Reply