Calibrating level from loiter

Hello,

So this is a snapshot of the desired roll/pitch values in hover in loiter

Can I just add the mean values to AHRS_TRIM?

No. What makes you think that? That is a snapshot of the wind conditions of the moment you did that flight at that location. That is not related to the FC level.

Because I did it indoors with no wind. If I switch to althold, the copter will start accelerating to the direction expected. Just want to get level as close as possible because there is a chance that the translation motion the drone makes after I yaw for more than a second is related to the integral windup on the position controller as I saw on another post.

My problem is not as profound as this here. My copter only starts the slide either if the yaw rate is high enough or I yawed for something like three quarters of a rotation.

Hi @StrikeEagle,

In general it’s not necessary to manually set the AHRS_TRIM values because this is done during the first step of the accelerometer calibration. The copter firmware still includes the auto trim feature but it is rarely used these days.

I don’t use landing legs so the drone is slightly off-level to begin with. So I did the calibration as level as possible and disabled level calibration on every startup

Also indoors you can have heavy turbolences produced by the downwash of your drone and the walls of your facility

That’s probably true though but since althold drifts in the expected direction, the general offset seem to be right.

Hi @StrikeEagle,

By “disabled level calibration on every startup” do you mean “boat mode”? If “yes” that’s probably not a good idea. Boat mode is necessary in situations where the vehicle is moving even during startup. It is not necessary if the vehicle is simply not level during startup.

Okay so then I misunderstood it but I changed INS_TRIM_OPTION to 1 from 2 because the options looked like they did the level trims. But now reading the description again, I see that it was meant for the accel calibration so I should probably make it 2 again.

Can you please check out the posts I linked? I am just trying to fix that

I would suggest you do the auto trim.

I am not sure why this would be other than people aren’t flying in alt hold and the level calibration during accel calibration is good enough for most people. I do personally find it good enough but I also use a bubble level to ensure it is very close to perfect. Aircraft without the convenient reference planes would find it much more difficult.

3 Likes

At least for me, it’s never perfectly calm, so auto trim would simply trim to current wind conditions (even if slight).

I admit I only recently learned of the feature in the first place, but I find little value in it over simply statically calibrating as you suggest with a level or reference surface.

I was thinking about this and I thing the only issue here is… manual control. What exactly is the benefit of using stabilize with fully manual control, when all of that can be done automatically? At the end in stabilize You still require basically what loiter does.

If You have the ability to hold position almost perfectly in loiter, what is the point of using less precise manual control?

Perhaps in loiter this might be even kind of automatic calibration procedure, similar to autotune a bit. flip a switch and loiter is performed with 360deg yaw rotation to eliminate wind affecting results.

Anyway, this is something that personally I am waiting for to be included in some release.

@Adam_Borowski This was not wind. This is because of the slightly off level calibration. So what he suggested was to use AutoTrim which can only be run in Stabilize to finally get a good level calibration

I know it was not the wind. My point was that using autotrim or saving trim You will trim out not only off level calibration but also wind, as you need to keep drone position.

Second - comment was about to using loiter to keep the position for trim purposes instead of doing it manually, which probably in most cases will be less precise.

Stbilize itself will not give You a good level, but will only try to keep FC leveled as calibrated. If it would do that, there will be no problem with hoovering indors in place in stabilize as it would be able to keep the position more or less by itself, but that is not the case.

Yes, I will try to make sure there is no wind.

By the way I think I read that level calibration in loiter is going to be a new feature in v4.7 but not sure.

I believe that Auto-trim can work from both Stabilize or Alt_Hold. This appears to be the case looking at the code and from memory. But I have not tested it recently.

This is very old code and it could definatly be done much better now. Probably the best way would be to do a 360 degree yaw rotation without touching the roll and pitch sticks in Loiter.

2 Likes

Oh okay then that makes stuff a lot easier. But I think the documentation only mentions Stabilize

My thoughts exactly.

@Leonardthall Surprise, surprise! I checked the code and found that not only Stabilize and ALthold, but also Loiter and PosHold support autotrim!

2 Likes

I tried to do this in the other modes today but I found that only Stabilize actually allows to enter AutoTrim by holding the rudder right for about 10s even though the code says the other three modes allow it. So its either due to my custom firmware or is it only enabled for stabilize in some other code?