peer2peer for relative position measurments

Firmware/software/electronics/mechanics
Post Reply
Maximiliandio
Beginner
Posts: 8
Joined: Sun Oct 18, 2020 1:51 pm

peer2peer for relative position measurments

Post by Maximiliandio »

Hello, I would like to implement a peer2peer communication between multiple cf (assume 2 for a moment)
Can I use the p2pAPI to communicate the absolute positions between the agents (I have a loco position system and flow decks) The example file says p2p communication is only possible if connected to USB??!

If you know if this is possible and have a pointer where something similar was implemented I would be very grateful

Max
arnaud
Bitcraze
Posts: 2392
Joined: Tue Feb 06, 2007 12:36 pm

Re: peer2peer for relative position measurments

Post by arnaud »

P2P communication is available even without USB, the problem is that currently, P2P and Crazyradio communication do not play very well together so if you want logging access to one of your two Crazyflies it is better done over USB. The idea is that you can connect one drone via USB to debug and when everything is working you can have both drone working autonomously.

If you really need Crazyradio connection, the easiest for now is to reduce the crazyradio communication rate, which will both reduce drastically the downlink bandwidth and allow Crazyflie to communicate with each-other using the P2P API. There is no easy settings for that but the change to the lib is small, if you set these two waitTime to a non 0 value, it will free time for the Crazylfie to send P2P packets: https://github.com/bitcraze/crazyflie-l ... #L628-L630. You can experiment with values, 0.01 (10ms) should already work quite well, less might still work and allow for more downlink bandwidth.
Maximiliandio
Beginner
Posts: 8
Joined: Sun Oct 18, 2020 1:51 pm

Re: peer2peer for relative position measurments

Post by Maximiliandio »

Thanks for the answer so do you think if I use 3 cf where one is connected via USB which is then connected to the other two cf via p2p would work the best instead of trying to fiddle around with the crazy radio? At the End I need to log the position of both cf which are in the air.
arnaud
Bitcraze
Posts: 2392
Joined: Tue Feb 06, 2007 12:36 pm

Re: peer2peer for relative position measurments

Post by arnaud »

If you already have 3 Crazyflie at hands the easiest would be to make an app for the thirds one that listen to the p2p packets and store the positions in log variables. This way you can easily connect to it with the client or a python script and log the positions that are being sent by the two other Crazyflies.

Otherwise, the hack I proposed should work and allow you to log at slow rate the positions but would create some packet loss in the P2P communication.
Post Reply