Skip to content
This repository has been archived by the owner on Aug 3, 2021. It is now read-only.

Higher packege loss in crazyflie_ros than in python-lib #73

Closed
diasdm opened this issue Oct 18, 2017 · 5 comments
Closed

Higher packege loss in crazyflie_ros than in python-lib #73

diasdm opened this issue Oct 18, 2017 · 5 comments

Comments

@diasdm
Copy link

diasdm commented Oct 18, 2017

Hello,

As I said before in this issue I'm working in high frequency streaming from the Crazyflie and up until a few weeks ago I was working with the bitcraze python library.

I'm streaming at around 370 packets/sec from the Crazyflie to the computer and as expected at higher rates I have some packets losses. My problem is that when using the python library the packet loss is at around 1-4% but when using crazyflie_ros is at 22-30%. I don't know if it is relevant but I'm using ROS indigo.

My questions are:

  1. Do you have any idea what is causing this?
  2. Can you explain why you choose to implement your own radio software to connect a Crazyflie to ROS rather than using the python library?

Thank you!

@diasdm diasdm changed the title Higher packege loss Higher packege loss in crazyflie_ros than in python-lib Oct 18, 2017
@whoenig
Copy link
Owner

whoenig commented Oct 18, 2017

Hi,
That is a very interesting problem! I have no idea what might cause this, but let me elaborate on your second question first.

The python library is more feature complete, but doesn't support multiple Crazyflies well, for two reasons: a) there is no support for connecting to multiple CFs using a single radio, and b) there are serious performance issues when trying to control more than 5 CFs using the python lib. The C++ implementation fixes both issues. We have used it to control 49 CFs with just 3 radios in the Crazyswarm project (see http://crazyswarm.readthedocs.io/en/latest/). Also, I want to point out that the re-implementation is fairly straight-forward. In particular, the python lib uses bindings to lib-usb and crazyflie_ros uses lib-usb natively. Most of the low-level code is a 1-to-1 code transfer. Thus, I am not sure where a packet loss would come from.

How do you measure packet loss and which (low-level) functions in crazyflie_ros are you calling to send/receive packets? Did you look at RSSI (in both python and crazyflie_ros)?

Best,
Wolfgang

@diasdm
Copy link
Author

diasdm commented Oct 19, 2017

I wasn't aware of much of that information. Thank you.

I measure packet loss by incrementing the value for the first byte of each packet. I keep track of that value for the previous received packet and by comparing the two I know if any packet were lost. This means that I have to receive the packets in order.

The packet data flow is:

  1. Queued by queueGenericPacket function.
  2. Published by publishPackets function.
  3. I have this python script which subscribes to the topic and then calls the incoming function for each packet published.

The code I use for the python library is pretty much the same except for the way it receives the data.

An important note which I found very odd: I had to add a condition to check if the incremented value was the same for two consecutive packets because the incoming function was being called twice for some packets.

@diasdm
Copy link
Author

diasdm commented Oct 19, 2017

I'm so stupid... I'm sorry for wasting your time. I forgot to set the logging for the rest of the stuff (battery, temperature, ...) to false. Once I did this the packet loss percentage is pretty much the same as when using the python library.

Btw for some reason there is nothing being published in the /rssi topic. I haven't looked at it in either of them.

@ataffanel
Copy link
Contributor

Just a note @whoenig for your point a): There is now support for connecting multiple Crazyflie using a single or multiple radio in the python lib. There might still be performance problem with a massive amount of connection, but the functionality exists.

@whoenig
Copy link
Owner

whoenig commented Oct 23, 2017

That's good to know - thanks Arnaud! I'll close this issue since it seems to be resolved now.

@whoenig whoenig closed this as completed Oct 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants