PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.29k stars 13.43k forks source link

Airspeed Calibration not working on Pixhawk 5X VTOL Firmware #19088

Open poyatabrizi opened 2 years ago

poyatabrizi commented 2 years ago

Issue Details When performing a calibration, the process just goes through without me having to blow into the pitot After above-mentioned calibration, the speed with no wind reads at ~9m/s or ~30km/h I have tested Ardupilot firmware and my standby airspeed reads around ~2m/s.

To Reproduce -Connect the 45250 airspeed sensor via I2C -Navigate to sensors and airspeed -After sensor calibration, reboot -Check airspeed value on the main screen

Expected behaviour I expect the calibration will take into account the offset of the sensor and result in close to 0 airspeeds when there are no wind (i.e. indoor)

Log Files and Screenshots Refer to forum chat where multiple people are experiencing this and there are screenshots provided. https://discuss.px4.io/t/airspeed-sensor-is-off-by-9m-s-or-30km-h/25901

Drone (please complete the following information): Pixhawk 5X flight controller VTOL - Generic Quadplane VTOL 45250 5A1 airspeed sensor Qground Stable Version 4.0 PX4 Firmware: Standard VTOL (Generic Quadplane) Firmware 1.12.3

Additional context Add any other context about the problem here.

gruffymax commented 2 years ago

It looks as though the calibration is working as SENS_DPRES_OFF is set to the zero differential pressure value sent from the sensor. In my case the 4525 sensor reports 145 pa at rest and my SENS_DPRES_OFF is also set to 145. It seems as though this offset value is not being subtracted from the raw differential pressure before being used to calculate the airspeed. Manually changing SENS_DPRES_OFF to any value makes no difference to the airspeed displayed in QGroundControl.

gruffymax commented 2 years ago

Looking through the driver for the MS4525 shows that a differential pressure is subtracted from the raw pressure in drivers/differential_pressure/ms4525/ms4525_airspeed.cpp:215 report.differential_pressure_filtered_pa = _filter.apply(diff_press_pa_raw) - _diff_pres_offset;

Tracing _diff_pres_offset back leads to the function Airspeed::ioctl, lib/drivers/airspeed/airspeed.cpp:114 which sets _diff_pres_offset. This function does not appear to be called anywhere so _diff_pres_offset stays as 0.0f.

ryanjAA commented 2 years ago

Which version of px4 are you running. I’ll give this a try tomorrow.

poyatabrizi commented 2 years ago

Sorry, I forgot to mention the Firmware details. it is now added to my original comment and it is v 1.12.3

vincentpoont2 commented 2 years ago

Sorry, I forgot to mention the Firmware details. it is now added to my original comment and it is v 1.12.3

I just reproduced it, it seems like it is only happening with v1.12.3 and not with Master firmware. Can you use try using Dev build (master)? @bkueng @dagar Was there something that was change recently related to this?

1.12.3 https://user-images.githubusercontent.com/46874772/153453307-5b7527b4-2c97-41f3-add6-a69098815077.mp4

Master FMuv5x Firmware https://user-images.githubusercontent.com/46874772/153453635-55c37c05-9603-45be-9d59-18fa2a458546.mp4

jhoexp commented 2 years ago

Same problem here, Holybro 5x, 4525 airspeed sensor, 1.12.3, vtol standard quadplane airframe: calibration does not complete correctly (the process concludes without letting you blow into the pitot). The result is that aispeed reads large offset from 0, even when there is no wind indoor and the vehicle is standing perfectly still.

SJ-Jang commented 2 years ago

I am currently having the same problem. Do we have a modified version?

VTOLDavid commented 1 year ago

Same problem here with Cube orange, Px4 1.14 beta and Sensirion sdp33

junwoo091400 commented 1 year ago

Tracing _diff_pres_offset back leads to the function Airspeed::ioctl, lib/drivers/airspeed/airspeed.cpp:114 which sets _diff_pres_offset. This function does not appear to be called anywhere so _diff_pres_offset stays as 0.0f.

I have just checked and this is correct. The offset variable isn't getting properly updated in v1.12.3.

However, for v1.14 beta this should have been resolved, as the offset is now decoupled from the airspeed sensor driver, and is taken into account inside airspeed calibration code alone.

https://github.com/PX4/PX4-Autopilot/blob/18898f1876ec1be9f86d89aedc56b4918c983afa/src/modules/sensors/sensors.cpp#L59-L61

@VTOLDavid Did you indeed experience the problem of Airspeed calibration skipping the step of "blow into the pitot tube" on it's own using v1.14 beta?

junwoo091400 commented 1 year ago

Also, this should have been fixed starting on v1.13, from this commit: https://github.com/PX4/PX4-Autopilot/commit/d1d15a6f6d46588a68458f069796213de0ba1cbf

For now I don't know if it would be valuable to backport and fix this bug in v1.12 🤷

junwoo091400 commented 1 year ago

However, for v1.14 beta this should have been resolved, as the offset is now decoupled from the airspeed sensor driver, and is taken into account inside airspeed calibration code alone.

@VTOLDavid @SPuigUAVW could you check again whether this problem is indeed present in v1.14? It should not be here, but I don't have the setup to confirm that :cry:

DronecodeBot commented 1 year ago

This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-maintainers-call-july-11-2023/33057/1

VTOLDavid commented 1 year ago

We installed v1.14 last week. We had different problems with pitot calibration and USB connection:

Sems that the USB driver problem with cubeorange is interfering here, something changed in QGC and we had some random problems...

junwoo091400 commented 1 year ago

@ryanjAA provided this log of an Airspeed calibration working fine with the latest release/1.14 branch, using the same SDP33 sensor: https://review.px4.io/plot_app?log=079cea16-699f-47c8-93b6-9639f5d57d00, and as you reported, the problem seems to be in QGC.

Could you create another issue on QGC repo and tag me there? @VTOLDavid

DronecodeBot commented 1 year ago

This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-maintainers-call-july-18-2023/33189/1