Page 1 of 1

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

Posted: Thu Oct 26, 2017 8:31 am
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

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

Posted: Thu Oct 26, 2017 11:56 am
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).

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

Posted: Thu Oct 26, 2017 12:38 pm
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