Questions about data and coding

Good morning,
I am curious on how airspeed and air density is calculated. when I convert the ulog files to csv so I can see the flight data on excel and I see a bunch of different spreadsheets and different speeds and pressure differences and temperatures. I want to know for true_airspeed, what pressure difference, and what rho is used to calculate that, and where can that data be found?

My second question is what Pressure and what temperature is used to calculate Rho(density) in the ideal gas law as well, and where can that be found in either the code files or the csv converted ulogs?

Hi John,

Which PX4 version is this? And do you know which airspeed sensor?

For the calculation, I’m tagging @sfuhrer, he knows better than me.

Hi @johnseals

I want to know for true_airspeed, what pressure difference, and what rho is used to calculate that, and where can that data be found?

The raw pressure difference is logged as differential_pressure.differential_pressure_pa (this data has to come from a differential pressure sensor, aka airspeed sensor), and rho you can see in vehicle_air_data.rho (this data comes from the barometer). That’s the code method that calculates true airspeed from calibrated airspeed.

what temperature is used to calculate Rho(density) in the ideal gas law as well, and where can that be found in either the code files or the csv converted ulogs?

It takes the temperature reading from the barometer, and the pressure as well. See PX4-Autopilot/src/modules/sensors/vehicle_air_data/VehicleAirData.cpp at 710286da722beae72a488af52b6c1e603f68eea7 · PX4/PX4-Autopilot · GitHub.
The baro data are logged in the vehicle_air_data topic.

1 Like