I have a few drones and usually I fly them in loiter mode, however…. Somtimes I would like to use just alt hold and in general there is always some kind of horizontal drift, even without wind.
Just an idea - is there a way to automatically calibrate trims using loiter mode? Drone keeps it’s position very well and it should be possible to get trims out of it when there is no wind as ardupilot knows how much it is correcting to get stable position.
I know there is more manual option to do this process that automatic one would be so much nicer.
Calibrating “trim” for ALTITUDE HOLD mode is done on the ground by calibrating level. With the RC sticks within the neutral deadzone, altitude hold simply seeks a level attitude.
There is really no further calibration available airborne, and any technique used to attempt such a thing in LOITER would require extremely precise wind measurement. What you’re seeing is simply wind drift, even when you perceive the wind to be perfectly calm (it rarely if ever is). If you are in an enclosed environment where you can guarantee no wind (including that induced by HVAC or your own prop wash) and still see some drift, it is an artifact of less than perfect calibration, physical imperfections, small perturbations, and/or inertia from any lateral motion upon entering ALT HOLD that really can’t be trimmed out, so just use LOITER mode as intended if you need to hold position.
EDIT:
I suppose if you could guarantee a perfectly calm environment and reliably/repeatably measure nearly identical LOITER mode attitude, you could offset the level calibration by that amount. I’d guess that amount would be very small fractions of a degree, possibly at or near the noise level, so such adjustments may be futile. Seems if you’re going to that trouble, you should probably address physical concerns first, like adjusting prop planes to be level/even with respect to the IMU orientation.
One key to discovering asymmetric prop orientation is to review logged motor outputs in a stable hover. If two motors (on a quadcopter) are always commanded to a higher output than the other two, it often indicates twisted motor mounts and a yaw bias. Again, this should be addressed physically rather than trimming in software (which is essentially automatic anyway, hence the observed log output).
tldr; The near impossibility of achieving extremely precise wind measurement and/or a truly undisturbed environment makes working on an automatic “trim” feature as described untenable as far as I can see.
I do realize trim values are very small. I did all the calibration also “level” calibration.
AHRS_TRIM_X,0.003792945
AHRS_TRIM_Y,-0.003205475
I guess manipulating FC mount manually to keep IMU perfectly flat to the props plane to get corrections at 10^-3 level of those values is basically not doable. However… I could take off in loiter mode inside without wind and let it hoover to get some averaging on corrections AP does for loiter and save it as trims to get lower drift in althold.
Loiter is not always possible, and I do not always want to use it.
I would not agree on that. I would say this is more often sign of not perfect mass distribution and motor output is not very usefull in terms of trim adjustment.
The only difference is that it relays on pilot input in stabilize to average trim correction instead of input from position holding mode.
I do realize that eliminating drift completly is not possible, but limiting it to minimum is exactly what I would like to do. Just more automatically than manually in stabilize.
Thank you for pointing out the auto trim feature - I didn’t realize it exists (and it’s a little hard to believe it could be used to any great effect, but I’m happy to be proven wrong).
This is a fairly simple Lua script (or log analysis exercise), but I wrote all that because I think you’re chasing ghosts.
If you’d like to upload a log with a loiter flight that you think meets the criteria for such analysis, I could do a quick and dirty analysis for you (and hopefully prove my point, but let’s try and prove me wrong, first…).
Coincidentally, I tried this earlier today and it works great enough (its not magic but, realistically) if you manage to hover exactly in one spot in stabilize using fine stick controls.
Also, after all this gnashing of teeth, the feature you want exists (but only in the master 4.7 branch). If you wish to use it, load 4.7-dev and simply execute the auto trim procedure in LOITER mode.
Well, that’s the slightly off part, it Althold doesnt seem to be pretty good at holding my trims, either manual or auto. Don’t know if this is because of MIX_MAN is still set to 0.1 instead of 0.5.
It did seem better in Stabilize at that time but I flew just now and yeah its not as great as earlier but yeah I see this feature as a good initial trim setting before you may manually fine tune further. I will report back in about 10 mins after I do the procedure again and check the behaviour in althold
It used to see some use. My 1st multirotor had 10min of flight time and faffing around with this feature had no real value. “Use the sticks Luke” I recall someone saying.
This is the chasing of ghosts to which I was referring. ALT HOLD literally USES the trim values to set level attitude. Try it with ATC_THR_MIX_MAN,0.5.
Okay so how does the autopilot’s architecture enable it to be slightly better off in stabilize than althold as I experienced? Or this experience invalidated as my copter is not tuned
Huh, I guess depends on the build. For me its definitely lead to slightly less frequent corrections anyway. Yours was probably well balanced, so the trims shouldn’t (or so I would intuitively expect) improve anything much