Cflib

Discussions about autonomous flight in general, regardless of positioning method
Post Reply
santiagorg2401
Beginner
Posts: 16
Joined: Sun Sep 08, 2019 2:28 pm

Cflib

Post 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.
kimberly
Bitcraze
Posts: 523
Joined: Fri Jul 06, 2018 11:13 am

Re: Cflib

Post 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.
santiagorg2401
Beginner
Posts: 16
Joined: Sun Sep 08, 2019 2:28 pm

Re: Cflib

Post 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.
santiagorg2401
Beginner
Posts: 16
Joined: Sun Sep 08, 2019 2:28 pm

Re: Cflib

Post by santiagorg2401 »

Here I attached the files
Attachments
pruebaEstadoCF.py
This one based on position_commander.demo.py
(700 Bytes) Downloaded 14 times
PruebaVueloSincronizado.py
This is the code based on swarmSequence.py
(4.93 KiB) Downloaded 14 times
kimberly
Bitcraze
Posts: 523
Joined: Fri Jul 06, 2018 11:13 am

Re: Cflib

Post 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
santiagorg2401
Beginner
Posts: 16
Joined: Sun Sep 08, 2019 2:28 pm

Re: Cflib

Post by santiagorg2401 »

What should be a good surface for the Flow Deck?
kimberly
Bitcraze
Posts: 523
Joined: Fri Jul 06, 2018 11:13 am

Re: Cflib

Post 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.
santiagorg2401
Beginner
Posts: 16
Joined: Sun Sep 08, 2019 2:28 pm

Re: Cflib

Post 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
kristoffer
Bitcraze
Posts: 322
Joined: Tue Jun 30, 2015 7:47 am

Re: Cflib

Post 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
santiagorg2401
Beginner
Posts: 16
Joined: Sun Sep 08, 2019 2:28 pm

Re: Cflib

Post 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"
Post Reply