Page 1 of 1

Developping with Craziflie2.0 and Sniffer-node for the study of communication channel

Posted: Wed Oct 25, 2017 10:27 am
by alexpic
Hi everybody :)
I'm a telecommunication engineering student, and i'm studying the communication channel between Crazyflie 2.0, CrazyRadio and Loco Positioning System. I work on Linux (not in VM), and i have familiarity with the Crazyflie2.0, the client and i know how to flash the drone and the LPS nodes (with the tool). I haven't experience about C (but i'm studying how modify the firmware with your wiki), python and any RTOS.

My equipment is composed by:
-Crazyflie2.0;
-CrazyRadio;
-Loco Position deck;
-Zranger deck;
-7 Loco Position nodes (6 in Anchor-mode and one in Sniffer-mode, already configured);

My goal is to solve these doubts:
-How the crazyflie communicates with crazyradio and Sniffer-node?
-What is the job of Sniffer-mode? How it works?
-What are the parameters in the cfclient that can give me an estimation of the channel quality?
-What files (and part of these) should i modify to increase (or include if there aren't) the parameters that give me an estimation of the channel quality?

Thanks a lot for anyone that can provide me some suggestions/documentation/support!!

Re: Developping with Craziflie2.0 and Sniffer-node for the study of communication channel

Posted: Thu Oct 26, 2017 9:10 am
by arnaud
Hi and welcome!

First of all, when you are using the Crazyflie with LPS there is two radio, two channels and two very different goals.
  • Crazyradio is using a quite common narrow-band 2.4GHz communication channel. It is used to communicate from the computer to the Crazyflie to control it, send parameters and get logs. There is no sniffer mode in the Crazradio though there is some solution to get 'sniffer-ish' capabilities by logging all packet sent and received in python.
  • The LPS deck implements an Ultra-Wide-Band radio that communicates with LPS anchors. The data transfered are exclusively related to ranging. The LPS nodes implements a sniffer function.
Now, to answer your questions:

-How the crazyflie communicates with crazyradio and Sniffer-node?
Crazylie 2.0 has a 2.4GHz radio onboard (using an nRF51 microprocessor), it is used to communicate with Crazyradio. The communication protocol is implemented in the python lib and documented in the wiki: https://wiki.bitcraze.io/doc:crazyflie:crtp:index.

There is no sniffer mode in the Crazyradio and it would not be obvious to implement with the nRF24LU1 chip implemented in the Crazyradio (though it would be possible to implement in an nRF51/52 chip, those are now common, for example in the BBC micro bits, but that is another subject....).

A more advanced way is to use an SDR radio to really sniff the 2.4GHZ channel: https://www.hackster.io/ataffanel/sniff ... lue-4d77df. If you are into low level radio channel analysis this can interest you, though as a data packet sniffer it is not as performant as an nRF51 would be.

The Crazyflie client has a 'sniffer' mode that prints all packets communicated to and from the Crazyradio. It is not an over-the-air sniffer but it allows to inspect everything that is communicated between the computer and the Crazyflie. You can open it with view->toolbox->crtp sniffer. The save functionality is not implemented yet.

-What is the job of Sniffer-mode? How it works?
I will assume you are referring to the LPS node sniffer mode. It will print all packets that are decoded by the radio, it allows you to observe the ranging packets and the arrival timestamp. One nice thing is that with TDoA, getting the anchor packet and timestamps is enough info to calculate the sniffer position. There is a binary mode for the sniffer (in the master branch) that is much quicker, you can find the receiving python script in the tools folder of the LPS node source code repos.

-What are the parameters in the cfclient that can give me an estimation of the channel quality?
For the 2.4GHz radio, there is a log variable in the Crazyflie called "radio.rssi", it reports the received packet power as measured by the nRF51. The value is in dBm with 46 meaning -46dBm (this is the max power measurable) and 100 is -100dBm.

There is no way to measure the receive power in Crazyradio (there is one bit power detector, nothing more precise), but you could also measure packet loss by changing the python code that handles communication.

There is a power measurement for the UWB radio but it is not exposed.

-What files (and part of these) should i modify to increase (or include if there aren't) the parameters that give me an estimation of the channel quality?
For the 2.4GHz radio you can look in the low level radio code of the python lib: https://github.com/bitcraze/crazyflie-l ... odriver.py. This file is handling the radio communication and so it will see lost packet. One tip is to reduce the number of retry done in the radio itself, this will allow you to see more packet loss (the radio is retrying automatically), it could give a better idea of the real link quality. The number of retry is set there: https://github.com/bitcraze/crazyflie-l ... er.py#L194.

For the UWB LPS radio, you can look in the LPS node firmware and in the LPS deck driver (https://github.com/bitcraze/crazyflie-f ... rivers/src), the libdw1000 contains function that allows to get the receive power and there is some statistics already implemented to count packet loss.

Re: Developping with Craziflie2.0 and Sniffer-node for the study of communication channel

Posted: Wed Nov 15, 2017 10:22 pm
by alexpic
Hi Arnaud! :)
Thanks a lot for your answer! Sorry for my reply after so much!!
Anyway, i studyed the TWR mode for the Loco Position System, and now i'm trying to understand the behavior of Crazyflie and LPS Nodes (in Anchor mode) in their communication. In fact, my work is focalized only in the communication between Crazyflie and LPS Anchor (not the Crazyradio).
For the UWB LPS radio, you can look in the LPS node firmware and in the LPS deck driver (https://github.com/bitcraze/crazyflie-f ... rivers/src), the libdw1000 contains function that allows to get the receive power...
In this lib. i found some interesting things, in particular the function "dwGetReceivePower". Searching in crazyflie-firmware and lps-node-firmware, i found that this function is used in the function "dwCorrectTimestamp", which is in turn used in "dwGetReceiveTimestamp", used both in "lpsTwrTag.c" (in crazyflie-firmware) and "uwb_twr_anchor.c" (in lps-node-firmware).
So, i would ask to you: does the function "dwGetReceivePower" concern the received power in both decawave antennas of LPS Deck (in theCrazyflie) and LPS Node (in Anchor mode)???
...and there is some statistics already implemented to count packet loss.
Could you tell me what statistics are, or how can i find they?
Thanks a lot again for your support, and sorry for my basic English!!!! :D