Reset level calibration in flight

I was wondering if there is a way to reset the level calibration while the model is in flight, i.e. pitch trim for stabilized modes. Setting level with the model on the ground is just a rough guess, and if the wing incidence angle is off in the design, the model invariably ends up climbing or diving in those modes. It would be great to be able to hit a momentary switch and have level flight reset to the current attitude, especially if you could use Tx trim in manual mode, hit the switch, and have it set level for the other modes. Itā€™s a lot of work to trim, land, adjust, repeat.

I donā€™t think thatā€™s supported, but I hope someone chimes in to correct me if Iā€™m wrong.

Hereā€™s how Iā€™d tackle the issue:
Initially calibrate to a perfectly level reference.
Attempt to fly as level as possible in a stabilized mode.
Check the log for average pitch angle during that portion of the test flight.
Recalibrate using a level and protractor or digital gauge to set the new reference angle.

If the tune is trusted (probably not at this stage), you could also use an altitude hold mode to automatically maintain level and capture a reference pitch.

Or just let the climb/descent happen in a non-altitude holding mode and calculate the angle with a little trig (distance vs altitude delta on a somewhat calm wind day).

I try to contribute with my experience and if someone sees an error I will be glad to hear from you.

The first thing is to make clear that the ā€œattitudeā€ of the aircraft is linked to the airspeed at each moment; therefore at one speed one attitude and at another speed another attitude. For this reason what you can do is to look for the attitude that AT A CONCRETE SPEED allows the aircraft in modes WITHOUT ALTITUDE CONTROL to fly level without gaining or losing altitude.

The method is to fly in modes without attitude control at the desired speed and then ā€œplayā€ with the pitch until you get the plane at that speed to fly level. This can be done much easier flying in modes with altitude control but my experience has shown me that there is a 5Āŗ difference between the pitch obtained in one way and the other.

Now we have the pitch that at a certain speed makes the plane fly level. This has been achieved in a single flight.

In modes without altitude control the plane seeks to fly at 0Āŗ pitch. What we have to do now is to make the controller think that it is at 0Āŗ when in fact it is at the previously obtained degrees. This will be achieved by adjusting AHRS_TRIM_Y or TRIM_PITCH_CD (personally I prefer the first method). Note that after this modification it is convenient to reset all the parameters where the pitch degrees are present (STAB_PITCH_DOWN, LAND_PITCH_CD, LIM_PITCH_MAXā€¦); it is simply to apply the change of base between the old AHRS_TRIM_Y and the new one to all these angles.

Once this is done we fly again to adjust the attitude to maximum speed. Again we look for the pitch that in modes without attitude control allows to fly level. This pitch is used in KFF_THR2PTCH.

With all this we get that in modes without altitude control the aircraft flies level.

Thank you for your suggestions. Unfortunately, they all require an observation of the plane in flight followed by landing the plane and making parameter adjustments. To state my question more generally, the docs state ā€œNever adjust your Tx trims or subtrims or it will destroy your PID tuning.ā€ So, when flying in FBWA, Stabilize, Training, etc., how do you make your model fly level for a given throttle setting knowing that every change in throttle requires a new trim setting? I can understand that this is very difficult to do algorithmically with just a gyro and GPS, so having the plane fly toward the horizon line when the sticks are neutral is an acceptable alternative, which is what I think ArduPlane does currently. The problem is that I can only calibrate ā€œlevelā€ while on the ground. I guess what I want is the opposite of servo_auto_trim, where I can maneuver the plane into what looks level and set the level calibration to that attitude. Several transmitter systems support a similar feature for setting trim. I think we have established that this is not a supported feature currently, so I will submit a feature request and let the community decide if this is worthwhile to implement.

not at all

OSD based parameter menu ā€” Plane documentation (ardupilot.org)

Operation Using Only a Ground Control Station (GCS) ā€” Plane documentation (ardupilot.org)

Itā€™s a very dangerous idea because it could easily result in instantaneous, nearly uncontrollable flight if applied at an inopportune time.

The methods described above give you a single flightā€™s worth of observation to solve the issue without the pitfall of realigning AHRS mid flight.

Absolutely airspeed matters. With the method I gave, youā€™d use either a mid-range expected cruise speed or perhaps a near max speed, such that slower flight would always be at a slight pitch up reference (as is sometimes done in manned aviation).

1 Like

What is evident is that:

1Āŗ During a maneuver that requires high authority does not seem the right time to make changes.

2Āŗ If the change of parameters (e.g. AHRS_TRIM_Y) is very wrong, it doesnā€™t matter if it is done in flight or on the ground. On the ground it will be discovered at the next takeoff and in flight in the following moments. Maximum changes of about 6Āŗ (0.1047rad) up/down should not cause a radical uncontrollable attitude change, and if the change is the right one it will leave the aircraft in level flight.

I meant that AHRS realignment in flight is a dangerous idea.

Your suggestions regarding trim parameters are all perfectly reasonable.

1 Like

We all have our different styles of flying. Iā€™m not sure I could eyeball a cenidegree mechanical adjustment on a control surface, so my preference would be to do it inflight where I can immediately see the effect of the change. It canā€™t be any more dangerous than strapping an autopilot to a lawn mower (joking).

Iā€™m not trying to stir up strife with this idea, Iā€™m just seeing if there is an opportunity to innovate in a way that gives pilots more options to fly the way they want to. As @Lano suggested, if we could nudge AHRS_TRIM_Y or TRIM_PITCH_CD inflight, that would allow a quick set up trim for a maiden or if you are primarily flying in FBWA with lots of throttle changes. If they added these to the fixed wing tuning parameters as part of Transmitter Based Tuning, that would do the trick. Then as you suggested, @Yuri_Rage if you want to make the settings permanent, to dial in typical cruise trim for example, you can land and make the mechanical or parametric adjustments. The docs talk about something similar to your ā€œtrigā€ solution using the log charts.

My point about AHRS realignment in flight is this:

If that feature is on a switch, and it is either misunderstood or accidentally actuated in an attitude that is not approximately level, then I would expect the results to be possibly catastrophic. It would take an a very astute pilot to recognize/diagnose what had just happened and properly switch to manual mode for recovery.

Nudging the trim params in flight sounds like a very reasonable feature request.

1 Like

Thanks for the discussion. Enhancement #24655 has been submitted for consideration.

Iā€™d like to ask one more question if I may. Iā€™ve read about the perils of using transmitter trim in manual mode then switching to a stabilized mode. However, if I maiden my model in FBWA mode and never switch out of that mode during the flight, can I use transmitter trim to modify the level pitch attitude in flight? It seems logical since it is no different than me holding the stick forward or back the whole time when the model is not calibrated correctly. It would allow me to complete the maiden with much less distraction, and then once I have landed, I could use the trim setting to modify the AHRS pitch setting and return the transmitter trim to zero. If this is the case, then there is no need for the enhancement that I filed.

Although the correct thing to do when using flight controllers is to fly with the TRIMs at zero, there is no problem in doing what you suggest: make adjustments via transmitter trims and once on the ground make the precise adjustments (AHRS_TRIM_Y? / mechanical adjustments) and revert the trims to zero.

If the degree of trim you need is high, two things can be good; while testing increase the DEADZONE and once on the ground make mechanical adjustment of the control surfaces. The reason for the latter is that the SERVO_AUTO_TRIM function only handles 20% of the total servo travel and if your servos are too far off center you can lose much of this functionality or lose it completely.

What I do not quite understand is your interest in the ā€œlevelnessā€ of the aircraft; if what you are looking for is a specific levelness I think it is better to look for a level flight (neither gaining nor losing altitude) and from there a specific levelness arises.

I would say do not use the trim. If you are flying in FBWA the servo auto trim should take care of the servos. If that reaches the 20% limit and you still have to hold significant pitch or roll then you have a C of G or mechanical issue that needs to be addressed. In FBWA you should not need to apply any kind of trim. obviously this takes some time to do, so your first few moments after take off may need some help, but if the plane is mechanically sound then it shouldnā€™t be an issue.

In FBWA you are not commanding the elevators or the ailerons. You are requesting a pitch or a roll angle. The flight controller is calculating how best to achieve that. Thatā€™s why rudder is also automatically mixed into roll inputs to counteract adverse yaw. For example, full aileron stick deflection should roll the plane to itā€™s maximum bank angle.

If you are using trim, then you are in effect continuously requesting some pitch or roll. And depending on your radio setup, however far you are trimmed off center you may actually lose as travel on the opposite stick deflection.

I disable the trims on my Arduplanes (and copters), and since Iā€™m using EdgeTX I use those trim switches for other things like zooming into maps in Yaapu or clearing timers.

Thank you both for your input. You have given me enough insight that I can put this to rest now. I still like the idea of the enhancement though because I will not have to convert from PWM in servo outputs to degrees in AHRS trim, I just let Ardupilot make the calculation.

@Lano my use of the term leveling was because FBWA is a horizon or attitude hold mode and FBWB is an altitude hold mode. I didnā€™t want the discussion to move toward ā€œif you want to hold altitude, just use FBWB.ā€ One of the other nice benefits of using FBWA is in landing once you get lined up on the runway and down to your flare height, Ardupilot will keep your wings level and your plane straight on the runway (assuming you have a compass). Itā€™s great to just control those last critical feet of descent by adjusting your throttle and not worry about anything else. Since I beta-test a lot of new models, given a proper Ardupilot configuration, I can now rely on FBWA for the best chance of success on maiden and move procedurally toward full manual flight.

Manual >>>>> Manual control surface movement, passthrough
FBWA >>>>>>Roll and pitch follow stick input, up to set limits
FBWB >>>>>>like FBWA, but with automatic height and speed control
CRUISE>>>>>like FBWB, but with ground course tracking and terrain followin

I think weā€™re saying the same thing, just getting there different ways. To help anyone whoā€™s watching along, hereā€™s a better explanation of my point.

The two graphs are from the same plane, same flight, same log, and most important the same parameters.

In manual mode itā€™s clear the control surface (RCOU.C8) is following the roll stick input (RCIN.C1). Passthrough. (Note: ATT.DesRoll value is not on this graph because itā€™s not part of manual mode flight, thereā€™s no data to show)

In FBWA, the flight controllerā€™s Desired Roll angle is following the roll stick input. The control surface is in itā€™s own world. You can see trends where it follows along, especially during significant changes in the desired angle. But for the most part itā€™s doing what the controller needs to hold the desired angle.

Hope that helps!

As one of the posters mention earlier: Attitude is directly linked to airspeed (for a given wing profile and airframe weight). You can NOT change the attitude in level flight at a given speed. The forces MUST balance. With this in mind, re-visit the flight mode description and reconsider your wish to calibrate the level calibration.

No need to reconsider. The request that I have agreed to with the developers is to enable the save_trims feature in Plane that already exists in Copter. It just resets calibrated level to 0 based on the current trims. The problem is that I am not in level flight when Plane flies at what it thinks is calibrated level. This solution will reset the plane to fly level at a given airspeed and I can trim for all others.

i often wondered why i had to do this manually, too. arduplane has all these other ā€˜autoā€™ features and iā€™m still required to set level on the ground. wut?
setting level on the ground does not accomodate for attitude changes for different airspeeds, either. iā€™d like to have it auto set level at a given speed (trim?) when ā€˜enabledā€™ at least, then be turned off.
but, i see, you may have accomplished the solution. great.

1 Like