Page 1 of 1

Cflib

Posted: Sat Jul 25, 2020 4:15 pm
by santiagorg2401
Hi,
I started devoloping with the cflib, but I have a doubt, what is the "guideline" to start typing code?, and, what class can I use in order to fly a swarm with Flow deck but sending individual orders to each crazyflie?
Thank you.

Re: Cflib

Posted: Mon Jul 27, 2020 9:47 am
by kimberly
Hi!

Actually we started to write tutorials for the cflib. This is the first one for the parameter and logging: https://www.bitcraze.io/documentation/r ... log_param/. But we are not at swarming yet.

You can look into the CFLIB example folder and the swarm folder. There are some examples in there that you can use like this one

But individual orders to each crazyflie might be a bit tough through this class though. You can give different parameters/settings to each crazyflie, but not on the fly give it completely different commands. You would need read their URIs in the function that is in the parallel which you can do like this:

Code: Select all

print(scf.cf.link_uri)  
and then write different instructions within a IF statement that checks which crazyflie is connected. Then within that IF statement you can write crazyflie specific commands.

Re: Cflib

Posted: Thu Jul 30, 2020 7:00 pm
by santiagorg2401
Hi,
I tried to use that code as a reference, but it doesn't work well with Flow Deck, for example if I send
sequence1 = [
(0.0, 0.0, 1.0, 3.0)
]
The Crazyflie takes off but then it flies randomly to any direction, I've changed the propellers, the motor mounts and the battery is well balanced.
For example if I set the same position but with motion_commander or position_hl_commander the crazyfllie flies perfect.
Is it because swarmSequence is a version of AutonomousSequence and this one is designed for LPS System?
The surface is a ceramic white floor.

Re: Cflib

Posted: Thu Jul 30, 2020 7:09 pm
by santiagorg2401
Here I attached the files

Re: Cflib

Posted: Fri Jul 31, 2020 7:46 am
by kimberly
A Ceremic white floor sounds like something that has no texture on it, which the flowdeck will have very difficult time handling it. You can test this out on different surfaces using the assist mode described in this tutorial here

Re: Cflib

Posted: Tue Aug 04, 2020 1:43 am
by santiagorg2401
What should be a good surface for the Flow Deck?

Re: Cflib

Posted: Tue Aug 04, 2020 7:02 am
by kimberly
Anything with good texture and vivid colors. Wood floors usually work well but the best are children play mats. You can also print some colorful posters and put them on the floor. Avoid big black areas though.

Re: Cflib

Posted: Wed Aug 05, 2020 12:28 am
by santiagorg2401
Ok I will test it with the children play mats, there are fabric and plastic mats, which one would work better?, and according with the code, is anything wrong with it or the Class is not designed for flow deck?

Mats examples
1. https://images-na.ssl-images-amazon.com ... SS350_.jpg
2. https://sc01.alicdn.com/kf/H9ce4587573a ... 3448bJ.jpg

Re: Cflib

Posted: Wed Aug 05, 2020 6:58 am
by kristoffer
The flow deck uses an optical flow sensor that outputs relative motion in x and y, and absolute distance in z. The Crazyflie will calculate an absolute position based on the relative motion data it gets, but it will accumulate errors over time. The coordinate system will be based on the starting position orientation of the Crazyflie, so if you want to fly multiple Crazyflies with flow decks, they will NOT share the same global coordinate system.

The scripts you have provided are using absolute set points, which should work. Another option is to use velocity set points by using the MotionCommander class. See the tutorial mentioned earlier or https://github.com/bitcraze/crazyflie-l ... er_demo.py. You can also take a look at https://github.com/bitcraze/crazyflie-l ... nceSync.py

Re: Cflib

Posted: Wed Aug 05, 2020 2:01 pm
by santiagorg2401
I understand, but when running "PruebaVueloSincronizado.py" the Crazyflie takes off, then goes to any random position and after that continues the orders in sequence = [...], thing that does not happen with "pruebaEstadoCF.py"