Cflib
-
- Member
- Posts: 46
- Joined: Sun Sep 08, 2019 2:28 pm
Cflib
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.
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
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: 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.
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)
-
- Member
- Posts: 46
- Joined: Sun Sep 08, 2019 2:28 pm
Re: Cflib
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.
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.
-
- Member
- Posts: 46
- Joined: Sun Sep 08, 2019 2:28 pm
Re: Cflib
Here I attached the files
- Attachments
-
- pruebaEstadoCF.py
- This one based on position_commander.demo.py
- (700 Bytes) Downloaded 174 times
-
- PruebaVueloSincronizado.py
- This is the code based on swarmSequence.py
- (4.93 KiB) Downloaded 162 times
-
- Member
- Posts: 46
- Joined: Sun Sep 08, 2019 2:28 pm
Re: Cflib
What should be a good surface for the Flow Deck?
-
- Member
- Posts: 46
- Joined: Sun Sep 08, 2019 2:28 pm
Re: Cflib
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
Mats examples
1. https://images-na.ssl-images-amazon.com ... SS350_.jpg
2. https://sc01.alicdn.com/kf/H9ce4587573a ... 3448bJ.jpg
-
- Bitcraze
- Posts: 630
- Joined: Tue Jun 30, 2015 7:47 am
Re: Cflib
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
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
-
- Member
- Posts: 46
- Joined: Sun Sep 08, 2019 2:28 pm
Re: Cflib
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"