Hi. I desperately need help in understanding why Ardupilot lose altitude when in Auto mode. I have tuned both the airspeed, pitch and roll to reasonable values.
This has happened several times now. The strangest is that I had successful previous flights before the failure. I changed the batteries, reboot and did a pre-flight calibration. After this I had to recover the plane several times from dangerous low flights. I attach the log of the last flight. In the log it seems that there is no correct implementation between nav.pitch and pitch. I have studied the previous correct flights and there was a direct correlation between both pitch values, as expected. However, I immediately notice with this flight a definite deviation between nav.pitch and pitch. The moment I disable the airspeed sensor (close to the end of the log) I saw better control in altitude. I have rebooted Pixhawk and restarted the mission but without success.
From my limited understanding I cannot find a possible hardware error from the log. The airspeed seem to be correct indicating that it is working. This is definitely related to the implementation of the speed sensor and TECS, so I would expect to start look in this direction. Can someone please point me in the right direction in terms of the log file?
Your elevator trim position (RC2_TRIM parameter ) is almost 50% down elevator.
You need to trim your plane and verify it flies in FBWA before going into auto. Setting TRIM_AUTO to 1, trimming in manual and entering FBWA with sticks centred is the fastest way to do this. Don’t forget to set TRIM_AUTO to 0 after you have finished trimming as it takes the last control position in manual as the trim position which can be bad if you accidentally have the sticks deflected when you switch to auto.
It has nothing to do with TECS. The reason it works a little better without the airspeed sensor is that without airspeed it isn’t addjusting the gains with airspeed as much which increases the elevator response at the higher speeds.
Thank you for your valuable insight. I was not aware that there was a trim used in auto mode as the plane seemed to fly ok in manual mode. This is clearly my mistake and as much as it is a frustration learning the system, it is also much fun. Do you refer to the servo output differences on channel 2 from the centre (1500)? Does this also explain why the plane did not achieve the target height as seen in attitude_pitch.png?
If you are confident flying it manually, then trim the plane in manual mode and repeat the RC calibration procedure in mission planner. That way the autopilot will be using the same servo trim and travel range as the manual pilot for all the control surfaces and in FBWA mode you will have full control over the demanded roll and pitch angle.
The way you have it set up at the moment, the RC2_TRIM parameter (which sets the zero elevator position in FBW and AUTO modes) has a big offset compared to where it is when you are flying manually (1500 is the centre position for the servo) and it is likely that your other RC trims and ranges are incorrect as well.