EKF blowout cause?

So, I finally got out tuning this and it’s promising.
Before that, I found that I hadn’t managed to zero out the P on pitch, hence the weird VFF. Once P was zero, then VFF=0.15 looked like a good rate.

First flight, with zeroed PIDs and VFF on 0.15 was actually easier than I thought. Wind was fairly swirly and while the heli was moving around a lot, it was still fairly predictable.
I then tried to download the log via the telemetry (I didn’t bring USB cable with me), but it kept timing out, so I skipped checking the rates. It felt ‘reasonable’ at 0.15.
However, this attempt also seemingly corrupted the log file and it didn’t record any of my subsequent tuning.

Started out with RLL_D. Started at 0.001, got oscillations at 0.006, so ended up with 0.003.
PIT_D was a lot more stable and I got oscillations at 0.012 and ended up with 0.006. Note,those oscillations were not very strong and fairly low frequency.

Repeated the process for RLL_P and PIT_P and got 0.045 on Roll, and 0.09 on Pitch.
Set I to my VFF at 0.15, did final AHRS trimming (as it was now very stable!) and it was hands off hovering.

Vibes are still higher in in Y with the VTX blades, but lower than before.
Loiter looked at little nervous, I saw some high frequency oscillations on the first one (not logged :/) and still looks like it on the second flight. Compass complained again and I re-calibrated and it seemed better.

I also need to re-tune the tail, but overall, this looks very promising and is an easy method to follow. Not sure if I’ll have time to fly again tomorrow.

I still need alot of compensation from the tail rotor.
10 degrees in the hover roll and 0.13 (~8 degrees) in the AHRS trim.
Seems a bit extreme?

Logs:


This the first flight with PID 0, VFF 0.15.


Last flight, where I test loiter. Hovers hands off in stabilize.

Final Params:

All in all, it took me about 45 mins, progressing very safely. D was done in steps of 0.001, P was in in steps of 0.02.

Sounds good that this tuning method seems promising for you as well. What I like about it is that you tune the rate first to insure that you have proper rate control. So when you tune the PID’s you’re not tuning a heli that has minimal control range - which can tend to get quite hairy and dangerous with a large heli.

The way I set the AHRS trims is to place the heli on a bench and using your digital pitch gauge place it on the top main bearing block, or frame (if it’s perpendicular to the mainshaft). Note the pitch and roll angle on the bench measured by the gauge. Now go into the settings and adjust the AHRS trims until the values shown in the ground station software agree with the actual angle measured with the gauge.

Then ensure that the swashplate is indeed level using a leveling tool that pilots on the mainshaft, or use a dial indicator or caliper to actually measure it. A swash being improperly leveled will cause need for excessive amounts of hover trim.

Edit to add info:
I want to edit this to add a bit of info, because I “cheat” on trimming a heli

  1. It is almost impossible to calibrate the IMU’s on the bench, install the Pixhawk in the heli and have it be accurate. The IMU’s are calibrated using that method but it needs to be adjusted to reflect the actual mount angle on the heli.

  2. I measure the actual frame angle as I outlined above and adjust the AHRS trims to get it to match the actual installation. I do no further adjustment of the AHRS trims.

  3. Set the ATC_HOVR_ROL_TRM to zero

  4. Take the heli out and hover it. If it drifts left adjust the H_SV1_TRIM up and/or the H_SV2_TRIM down (after leveling the swashplate on the bench with a tool). If it drifts ahead adjust the H_SV3_TRIM down. And etc, etc. etc… Making small adjustments to those servo trims, just like setting up a heli without a Pixhawk, finally gives you a heli that hovers hands off.

  5. Now, note the ACTUAL amount of roll required to compensate for the tail rotor side-blow in no wind. This is either in the logs, or you can play back the telemetry log and see it in the AI indicator.

  6. Adjust the ATC_HOVR_ROL_TRM to that value. If it was an average of 3.5 degrees roll, then set it to 350.

  7. Now go back and adjust those servo trims again to get it to hover hands off with the ATC_HOVR_ROL_TRM set properly.

I went to this method on the last three FBL heli’s I set up. And it works. If you adjust the AHRS trims only to get it to hover, then the actual vs desired attitude tracking is off in the logs by the amount that you adjusted the AHRS trim from actual. That setting should only be used to adjust for the Pixhawk mount in the frame and not further adjusted from that.

On all three I have used this method on, rechecking the swash level after trimming, I have found the swash is so close to level with the tool that it really doesn’t matter. Doing it dynamically in hover flight compensates for flexing of the heli’s frame under loading and yields a more accurate adjustment of actual swash level in dynamic flight vs on the bench.

I reviewed your logs better. The first one shows the pitch rate to be about right on. The roll rate is just a tiny bit too fast. Probably drop the RAT_RLL_FF to .14.

The fastforward setting is what determines how well the heli tracks attitude. It is all a flybar heli uses, and you have now seen it makes the heli completely flyable with no damping. With FBL all that PID loop does is replace the flybar with electronics, which does the damping and prevents over-shoot, and makes it smooth.

The fastforward is the single most important rate setting for helicopters. It is the reason heli’s have that setting and multi’s don’t. Multi’s can’t be flown without electronic stabilization. Helicopters can. It is a shame the current wiki has people attempting to tune heli’s like multi’s when the one and only similarity between the two is that they both have fans on 'em going around. The result is that people are flying heli’s that are overdamped like flying a flybar with big lead weights on the paddles. And just like a flybar the thing doesn’t respond properly with big weights on it. So like flying pure flybar that’s over-damped, you turn up the rate in the radio, which is nothing more than a stick rate multiplier (FF or VFF with FBL), to get it to respond. That is wrong, wrong, wrong.

Tuning using @Leonardthall 's method results in a heli that has the proper rate response and gives you enough room to adjust the damping for a FBL, just like a flybar. If it tends to overshoot the attitude target it is under-damped, it needs a notch more weight on the flybar (tiny bit more rate P gain). If it tends to undershoot the attitude target it is over-damped and reduce the weight on the flybar (tiny bit less rate P gain). If the thing is overall sloppy and sort of tracks attitude target, but not quite, increase the headspeed (flybar) or I-gain (FBL).

A bunch of us trad heli pilots need to get a community effort going and fix that wiki on tuning helicopters.

1 Like

I’ve added to the docs before and can start a write-up. The ‘new’ method is simple enough.
I’ll start a new thread here when I get it started.

I also found the culprit with my AHRS trim. (After I had dismantled the whole drive train). My swash plate trims also got whacked when I upgraded to 3.5.
I still have a minor issue with the left servo not giving me same range of motion as the right & front, but I can certainly get it leveled out enough.

What caused that? There should’ve been no scaling changes 3.4 → 3.5 (I didn’t think). There was extra stuff thrown in for tandems, but that should not affect it. I’m flying my own custom code so I haven’t been trying to keep up with the rapid mainstream releases.

Well, I actually replaced the pixhawk with a unit with a fresh version of 3.5 and then loaded in the parameter file. A bunch of parameters didn’t get copied over.

Yeah. In 3.3 with HSV_MAN set to 5 it used to operate the servos at full swash ring range alternately at maximum and minimum collective so you could diagnose problems with servo range and fix it. That got broken in 3.4 and later and never got fixed. All it does now is move the cyclic and doesn’t check range at max and min collective, which kind of defeats the purpose of the function.

So, weather finally cleared last weekend and I got out again. I’d ‘upgraded’ to 6S and a new canopy.

Iit took a little tweaking to get the CoG/trim sorted out, but otherwise good…except, it would not get anything that resembled a solid GPS lock or compass orientation.

So, took it home and tried to calibrate it. Could not get anything sensible. Unplugged everything and it would either be +10 or - 45 degrees off. Swapped GPS/Compass unit. Same thing. Swapped pixhawk. Same thing.
Placed the GPS on a boom out in front. Same thing.
So, I made a new rig:

Much easier to handle when calibrating, easier to move around in a tight workshop and no metal/electronics to cause interference.
Same issue.
Then I learned that by clicking on the EKF symbol in the mission planner, it will pop up a window that will show the individual EKF status’

This made it very easy to see the Compass variation as I moved it around in the workshop and oh boy, did it move. Depending on where I was, vary over 50 degrees. and the EKF warning would often freak out as I moved it around.
On my work desk alone, if I moved it towards my power supplies (powering the 3D printer and battery chargers), would be a guaranteed blow-out.
Now that I do have this rather mobile unit, I will take it out in the parking lot today and try the same thing.
I also have a new mRobotics pixhawk and GPS on the way, with the newer compass units and I’m curious to see if they’re as sensitive.
The compass on my phone is seemingly mostly oblivious to the environment, unless I put an actual magnet near it.

And doing the calibration outside was flawless. Rain returned before I could try it with the pixhawk remounted on the heli.