How to read the kalman estimated position and use it in the code

Firmware/software/electronics/mechanics
Post Reply
giandoman
Member
Posts: 37
Joined: Wed Sep 27, 2017 1:23 pm

How to read the kalman estimated position and use it in the code

Post by giandoman »

Hello everybody i'm starting to understand better how the CF work and students here in L'Aquila also seem to appreciate labs with these drones.
I want to do a further step forward trying to understand how to read sensor data (particularly position estimation or z value from the flow deck).
I want to do a simple python script that makes the drone fly when it starts to read a z value greater than a certain treshold.
For example i have the drone in my hand and if i remove my hand it starts to fly keeping a certain position...before hitting the floor of course ;)
Thanks
Gianni
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: How to read the kalman estimated position and use it in the code

Post by arnaud »

Hi,
This can be done using the log subsystem. You can find examples on how to log variables in the Crazyflie lib examples folder: https://github.com/bitcraze/crazyflie-l ... r/examples. You can use the python client to discover the existing log variables, on the latest master the position estimate is in the variables "stateEstimate.x", "stateEstimate.y" and "stateEstimate.z" (there are also in the kalman group but we have created the stateEstimate variables to have some estimator-independant variables).
giandoman
Member
Posts: 37
Joined: Wed Sep 27, 2017 1:23 pm

Re: How to read the kalman estimated position and use it in the code

Post by giandoman »

arnaud wrote: Thu Oct 26, 2017 11:56 am Hi,
This can be done using the log subsystem. You can find examples on how to log variables in the Crazyflie lib examples folder: https://github.com/bitcraze/crazyflie-l ... r/examples. You can use the python client to discover the existing log variables, on the latest master the position estimate is in the variables "stateEstimate.x", "stateEstimate.y" and "stateEstimate.z" (there are also in the kalman group but we have created the stateEstimate variables to have some estimator-independant variables).
Thanks Arnaud. Indeed I thought about this just after submitting my question. I did the log of the variables and now the fun comes ;)
Ciao
Gianni
Post Reply