Virtual pitot refactor + other pitot improvements - #11668
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Test firmware build ready — commit Download firmware for PR #11668 244 targets built. Find your board's
|
|
@error414 Have you tested this with a real pitot by any chance ? Would be useful to double check this works with actual hardware before merging. |
|
@breadoven I'm on vacation now, I will return next week, I will be able to test it from 13.8. If you would like I will add this PR to my test FW. |
|
@error414 It would be useful if you could test this. The Virtual pitot stuff works fine in HITL and I tested as far as I could using the Fake pitot but the only real way of double checking actual hardware pitot is with hardware ... that I don't have. |
|
Thanks for this refactor — the direction is nice (dropping the pressure round-trip for virtual pitot makes a lot of sense, and moving It looks like Separately, it looks like Fake/Simulator airspeed might read 0 for the first ~4 seconds after boot? The Fake/Simulator override ( One more small thing: virtual pitot detection now requires |
Good spot ! You're correct. I'll move
I need to check this again because testing in HITL with virtual pitot stops the simulator pitot options working. Could have sworn this was working before but looking at the code now there's no reason why it would given the proto thread isn't used with virtual pitot. Fix needed. As for the zero issue during calibration I wouldn't think it really matters, it's what you'd expect during calibration surely.
|
Simplifies virtual pitot by removing current driver style implementation and instead runs it as a simple function. The benefit is simplified logic and removal of essentially unnecessary and repetitive code. It also avoids the illogical conversion from airspeed to pressure than back to airspeed which makes little sense when virtual pitot provides airspeed directly from GPS and wind estimates.
PR also includes changes to the pitot protothread to simplify implementation of Fake pitot and Simulator pitot. Simulator airspeed is moved and handled directly within
pitotUpdate. Fake pitot pressure conversions are removed and only Fake pitot airspeed used instead. This involves movingptYield()to the end of the thread rather than have it in the middle. It's not clear why it was placed in the middle originally other than possibly to avoid time delta issues for filtering on the first iteration. Moving it doesn't seem to affect how the pitot protothread works when tested in HITL. However, the real test will be with pitot hardware which hasn't been tested (don't have one). Pressure based airspeed calculations are skipped if Fake airspeeds are used.Virtual airspeed is based on the Virtual pitot driver logic using -> wind estimated airspeed falling back to -> GPS 3D speed if no wind estimate and finally ->
fixedWingReferenceAirspeedif no GPS available. Not sure about usingfixedWingReferenceAirspeed, it may be better to only use this for a Virtual pitot and otherwise use 0.HITL testing shows the Virtual pitot works as expected as do HITL pitot functions, i.e. pitot simulation and pitot failure. Still needs fully testing properly with actual pitot hardware.