Can I increase the update frequency barometer sensor? 10Hz is too low for my purposes

Hi all! I am implementing variometer functionality into an app, which reads barometric pressure from ardupilot via mavlink communication. The SCALED_PRESSURE message includes the barometric pressure via the press_abs field. The issue is, if I increase the message frequency from 10x per second to 20x, I get 20 messages but the exact same readings in consecutive requests. It seems that ardupilot itself doesn’t have pressure readings with more than a 10hz granularity, which isn’t really enough for variometer accuracy. Is there a way to increase this to, say, 50hz?

EDIT: I would like to add, that there is also a climb rate I could use in the VFR_HUD message, but because the update frequency is too low and there’s too much variance in the readings, it is too unreliable. If anyone has any advice, that would be great.

Check out the SR parameters for stream rates.

Hi Shawn, indeed, I already tried setting those parameters. The stream rate is increased, but the values are duplicated. For example, if I set the stream rate to 20hz, it’ll give me pressure value X, then the same value X, then Y, then Y again, etc. With a stream rate of 40hz, I’ll get the value X 4x in a row.

After some digging, I found a hard-coded value that indicates the pressure readings from the barometer are done with a 100hz frequency, so I don’t understand why I’m getting outdated values with any stream rate higher than 10hz. The mavlink message is processed here, which gets the latest value straight from the latest barometer request, so this doesn’t make sense…

EDIT: found the cause. Although the barometer is read 100hz, the latest value is only loaded 10hz via the scheduler here. So I’ll need to build ArduPlane from source with this value changed if I want more frequent updates.

1 Like

I can see in a Copter log these two barometers are updating at about 5Hz. I’m not sure if that rate is a function of the chosen barometers or a fixed rate in the software. But either way, barometers are noisy so updating any faster is likely useless. I would have thought we are more likely to want a smoothed value.

I fail to understand why a calculated variometer needs to be updated so fast. Seems you’d want to filter several barometer samples and smooth the output, as Shawn suggests.