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.