I have a question about rewriting the program to get the position of the crazyflie.
I browsed this post
viewtopic.php?t=2867.
I understood that parameters in any example python file need rewriting to stateEstimate.x, stateEstimate.y and stateEstimate.z, but I don’t know which part on files.
The variables list of logTOC tab in the client includes stateEstimate.x, stateEstimate.y and stateEstimate.z.
I’m a program beginner, so I would like to know in detail.
Thank you.
How to rewrite the examples to get the position of the crazy
-
- Beginner
- Posts: 4
- Joined: Wed Jul 01, 2020 6:24 am
Re: How to rewrite the examples to get the position of the crazy
Hi!
So you need to look at the examples folder of this repository. Make sure that the you follow the readme to install cflib or have done
You can use both the basiclog.py or basiclogSync.py (the last one is easier to understand I think). Make sure that you try out one of these to check if you can connect to your crazyflie (if you haven't changed your uri yet:
In both files you have the following lines:
You simply change those to:
hope this is clear enough to get you started!
So you need to look at the examples folder of this repository. Make sure that the you follow the readme to install cflib or have done
Code: Select all
pip3 install cflib
Code: Select all
python3 examples/basiclog.py
Code: Select all
self._lg_stab = LogConfig(name='Stabilizer', period_in_ms=10)
self._lg_stab.add_variable('stabilizer.roll', 'float')
self._lg_stab.add_variable('stabilizer.pitch', 'float')
self._lg_stab.add_variable('stabilizer.yaw', 'float')
Code: Select all
self._lg_stab = LogConfig(name='Position', period_in_ms=10)
self._lg_stab.add_variable('stateEstimate.x', 'float')
self._lg_stab.add_variable('stateEstimate.y', 'float')
self._lg_stab.add_variable('stateEstimate.z', 'float')
-
- Beginner
- Posts: 4
- Joined: Wed Jul 01, 2020 6:24 am
Re: How to rewrite the examples to get the position of the crazy
Thank you for your kind reply.
Thanks to you, we can now see the positions of crazie.
I have additional quastion.
I want to get the flight position at the same time when performing flight control using initial_position.py, but I don't know how to rewrite it.
Could you give me some insight into this?
Thanks to you, we can now see the positions of crazie.
I have additional quastion.
I want to get the flight position at the same time when performing flight control using initial_position.py, but I don't know how to rewrite it.
Could you give me some insight into this?
Re: How to rewrite the examples to get the position of the crazy
You can setup a callback function for your logging variable in that case.
By the way, I would highly suggest you to try out this new tutorial: https://www.bitcraze.io/documentation/r ... log_param/. It is brand new and still tested, so therefore not in the tutorial list yet, but teaches you how to work with the parameters and logging framework, so afterwards you will be able to implement this in your own code.
By the way, I would highly suggest you to try out this new tutorial: https://www.bitcraze.io/documentation/r ... log_param/. It is brand new and still tested, so therefore not in the tutorial list yet, but teaches you how to work with the parameters and logging framework, so afterwards you will be able to implement this in your own code.