How to read barometer values on Python API?

Post here to get support
Post Reply
dasmehdix
Beginner
Posts: 1
Joined: Fri Nov 08, 2019 12:52 pm

How to read barometer values on Python API?

Post by dasmehdix »

Hi, I have crazyflie 2.0.I can use Python API as a beginner.At the example of (this)https://github.com/bitcraze/crazyflie-l ... logSync.py,I understand that I can recieve, roll, pitch and yaw parameters, but I also want to achieve the barometer values interval on time or it can be a converted value as distance on z-axis.How can I recieve these values?

I understand that I have to use "LogConfig" and "LogConfig.add_parameters("etc")" but I do not know the name of parameter to recieve barometer.

Code: Select all

 lg_stab =LogConfig(name='ranges',period_in_ms=100)
 lg_stab.add_variable('ranges.zrange','uint16_t')
Basicly, How can I recieve the barometer data in Python API?

Thanks.
Note: I search about this topic, but I couldn't find any solution.Sorry if duplicated.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: How to read barometer values on Python API?

Post by arnaud »

Hi,
You need to log either the variable "baro.asl" if you are interested in 'Above Sea Level' measurement in meter or "baro.pressure" if you want to raw pressure measurement.

The best if you want to see what log variable is available is to connect with the Crazyflie client and to look at the "Log TOC" tab, it lists all variable and the name usually allows to find out if what you are looking for is already available as a log variable. The client can also plot log variables which is useful to see what to expect when using the values.
Post Reply