Page 1 of 2

External communication not only CF Radio Dongle

Posted: Mon Apr 01, 2019 10:58 am
by colorsound
Hello Guys, will it be possible to connect the CF or RR to a custom wifi AP similar to what esp32... do , or are there any plans for this in the future ?

This way you could create the network as big and robust as your project needs.

For example, in a bigger area or with many obstacles , i think ideally the transmision should be made via redistribuited wifi so you could use external powerfull solutions like ubiquiti and you enforce the wifi as your need for your setup and ideally the option of 5G will rock to avoid 2.4G conflict used everywhere , so you dont depend on the crazyradio only .

Devices like that could be used to enforce the signal and area so no more transmision problems from CF to computer host ... or between CF to CF or RR :


Re: External communication not only CF Radio Dongle

Posted: Mon Apr 01, 2019 2:16 pm
by arnaud

We have had a prototype of a Wifi deck using an ESP2866 module for a while, but it never passed the stage of prototype because we could not find a good use-case.

Nowadays, with the Crazyflie being used more and more for swarm and localization there is more use case where a Wifi link can be advantageous. We are playing around a little bit with the ESP32 but nothing concrete for now.

Attaching a WIFI module to the Crazyflie is actually quite easy: you can solder a cheap ESP module to a breakout or a prototyping deck. The harder part is to design the communication between the Crazyflie and the rest of the world and all the details like setting SSID/password/security... Getting a one-to-one link between the PC and each Crazyflie by communicating CRTP packets in a TCP socket should be quite easy to get going though with microPython or nodeMcu and would not be too hard to integrate in the Crazyflie. If you are interested in trying, I can give pointers for how to implement it.

Re: External communication not only CF Radio Dongle

Posted: Tue Apr 02, 2019 7:47 am
by colorsound
Hi Arnaud, thanks.

I,m actually interested in doing a ESP32 Crazyflie bridge experiement.

We did some other bridges with ESp32 Serial-udp --- Udp-serial in other applications so we are positive on this.

i would like to take the data from CF and RR from any serial pins if available ?

Then send it via wifi ESP32 collect this data in the computer and do they same for sending back, so basicly substitute the bridge from the Crazyflie radio in this experiment to ESp32.

The wifi setting etc is no problem as is made already in the esp32 we just need to do a sort of tunnel the CF raw data , so get the the data that is send via the CF radio in one side and another and send it via the ESp32 .

Since we already have lots of staff done with your python lib we would like to keep using it just substitute the data bridge for the esp32.

anything you can guide us to achieve that ?

Re: External communication not only CF Radio Dongle

Posted: Tue Apr 02, 2019 8:44 pm
by Redferne
Hands up here as well. I'm currently experimenting with a tiny LTE Cat M1 modem. Would really appreciate any pointers on routing CTRP to one of the serialports. I have a separate STM32 handling the modem, LwIP. I was thinking of just shoving the CTRP packets into UDP and send them on their merry way :mrgreen: Not sure about the actual bandwidth needed, but I'm guessing that it should be possible to reduce the amount of chatter to a bare minimum for a proof of concept.

Re: External communication not only CF Radio Dongle

Posted: Thu Apr 04, 2019 8:00 am
by tobias
My initial thought is that it shouldn't be to hard to do. Easiest is probably to hook in to the syslink layer. There you could send the radio packets to another UART and also call the syslinkRouteIncommingPacket from this UART when new packages are received. You could probably copy a lot of the code from the uart_syslink to assemble into packets.

Re: External communication not only CF Radio Dongle

Posted: Thu Apr 04, 2019 11:23 am
by arnaud
I do not think hooking on Syslink is a good idea: syslink is already a serial protocol that implements framing, that is a plus, but it is used for more than CRTP in the Crazyflie, power management and one wire memory access.

The CRTP communication stack is already modular in the Crazyflie, there is actually already two different low level link: USB and Radio (through syslink), adding a third one should be no problem and it is even possible to implement dynamic switching (it is done by USB).

The easiest would be to create a new CRTP link on serial port, the best to start with is to duplicate the USB link and make it work on serial port instead: ... /usblink.c. The only technical 'challenge' here is that CRTP is a packet based protocol and that a serial port is just streaming bytes, a framing protocol needs to be implemented to frame packets on the serial link. Syslink has a framing protocol but anything else would do as well (for instance I have seen a protocol using SLIP for that purpose recently).

To use your newly created link, it should be initialized and enabled instead of the radio link in the comm.c file: ... .c#L51-L59.

This should be enough to redirect all CRTP communication to a serial port. Eventually one might want dynamic switching that can be implemented similar to what the USB link is doing.

Re: External communication not only CF Radio Dongle

Posted: Thu Apr 04, 2019 8:43 pm
by Redferne
Thanks for the very detailed input. I've followed @arnaud advice and made a copy of usblink. Initially I'm just sending the CRTP packet (as is) over the Uart2 @ 115200. Since the first byte is the actual length of the packet it makes it easier to frame it on the receiver. Simply stuff it inside a UDP packet and send it uplink. Same goes for downlink. Next step is to implement a simple packet forwarder on the LTE deck MCU. And finally I probably need some cool ideas on how to define a new interface in the CFClient, so that the CRTP link is sent over IP/UDP instead of the CrazyRadio. I think this is very doable at this point :lol:

Re: External communication not only CF Radio Dongle

Posted: Tue Apr 23, 2019 10:05 am
by arnaud
Sorry for the late answer, I have been away a couple of weeks.

The client side is also quite modular, the drivers are there in the lib: ... cflib/crtp. There is a list of driver, and the URI is used to select what driver to use. So it should be quite possible to make a udp driver and to connect a crazyflie with an URI like "udp://". Same as for the Crazyflie, you can take the usb driver as an example to get going :).

Re: External communication not only CF Radio Dongle

Posted: Fri Apr 26, 2019 7:17 pm
by Redferne
Yes! Quickly glanced through the Python code and it should be a fairly easy task to add a 'special' UDP driver there. Nicely packaged code, kudos! Been busy implementing a quick and dirty TURN client in C and Python so that should fit nicely. I'm thinking about how the message flow is done during connection phase. Lazy me have not searched the available archives. But the initial probe is done from cflib/client(?) and the crazyflie responds back with something? Cheers!

Re: External communication not only CF Radio Dongle

Posted: Mon Apr 29, 2019 8:56 am
by arnaud
Thanks, the communication architecture was designed to be extended with more links but there is never enough time apparently ....

The message flow is mainly driven by the client: there is no 'connection' state per se, the Crazyflie will answer any messages it receives and most subsystem in the Crazyflie are state-less (param, setpoint, ...). The logging subsystem is one subsystem that is stateful, since it keeps track of the log blocks and sends back log packet at regular interval, it exposes a reset command that is called early when the client connects in order to start from 0.