I have an aircraft. After completing auto-tuning, L1 navigation adjustment, Arspd_Autocal, and calibrating the compass using the MAGFit web tool, I began adjusting the automatic landing. From the logs, I found that ArduPlane performs extremely poorly in handling altitude changes (especially during descent), and I am certain I have discovered a bug.
Judging from the logs, this poor performance is caused by two factors:
- In my understanding, during a descent, the trajectory should follow the straight line connecting two waypoints. However, looking at the TECS.hin log (which feeds the desired altitude “_hgt_dem_in_raw” to the TECS controller), my descent altitude appears overly conservative. It always selects (input) a higher descent altitude, resulting in the input demand still being above the target waypoint even when I reach it. Yet, the moment I fly past that waypoint, it immediately drops the input demand altitude to align with the trajectory toward the next waypoint, creating a terrifying precipitous jump in the TECS.hin log.
Furthermore, there is the poor performance of hdem (the output demand). I wish it could track hin more accurately, but in reality, there is significant error. I am certain this is not caused by parameters I set (such as cruise speed, maximum descent rate, pitch angle limits, etc.), nor is it due to excessive descent speed. During descent, the aircraft’s pitch angle remains around -5 to -8 degrees, with throttle output at 40-50%. My point is: I could clearly afford to slightly throttle back and pitch down a bit more and keep the arspd—so why isn’t my aircraft doing this?
I am attempting to pinpoint the core issue. I downloaded the ArduPlane 4.6.0 source code (Yes, I’m using 4.5.7, but according to the changelog, no relevant changes were made here). I located the section where TECS.hin
is logged:
_hgt_dem_in_raw
is from:hgt_afe is from:
this function is only used in ArduPlane.cpp:
and hgt_afe=tecs_hgt_afe(), so I go to check tecs_hgt_afe():
in line 830 is the most possible come from of hgt_afe, so for relative_altitude:
But I’m stuck here without further ideas.
But I also find a function:
This function should also be affecting the interpolation of
TECS.hin
between waypoints.In summary, I simply want the aircraft to achieve smooth altitude changes between waypoints, which is why I’m seeking your assistance.