Tandem Helicopter PID Tuning

Hello everyone,

I’ve been tuning a tandem helicopter (two SAB Goblin 500 frames linked together) running Copter-3.5-rc6. This is the largest frame I have tuned, and while I can get the rate and angle PIDs to a decent level, and I can get somewhat acceptable throttle control, I’m having a lot of trouble with tuning Loiter performance.

The heli tends to drift to the left or right of the loiter point, then slowly come back, overshoot, and then continue with the same pattern. I’ve been tuning VEL_XY, but cannot get a rock-steady hover over the required point. I have two GPSs blended together, a Here and a Reach RTK in Fix mode - so the GPS information is as good as it can be.

Does anyone have experience with similar Loiter performance? Any help would be very appreciated :slight_smile:

Test logs:

Best parameter set:
bestparams.txt (20.1 KB)

If you haven’t read this yet

Ah yes I’ve seen this thread before, but that was good to read again. I think my problem lies in a different direction - it’s not so much that my rates and angles are causing instabilities or need to be higher (but that’s yet to be tested in forward flight), but that the higher level control loop in Loiter is inducing an oscillatory horizontal drift. What’s telling is that I can keep the copter steady under Alt-Hold, so the problem should lie in the higher-level PIDs.

Wait for Bill…
From what I learned from him, I suggest adding RLL_ILMI to 0.05 or 0.1.
The heli will want to lean a bit when taking off but will hold attitude better.

Are you the student that received the GSOC scholarship? Great project. So I am interested in learning about some of you param value choices.
This first one affects Althold and other modes that have altitude hold.
ACCEL_Z_P 0.700000
From what I’ve heard from other heli users this would be too high. It needs to be around 0.3. Otherwise the heli might bounce up and down. Better to start with a lower gain and raise it if you aren’t getting the performance you want.
So these next set of gains deal with the attitude controller. A tandem rotor heli is not that different from a conventional heli in the roll axis that is why I’m wondering why you modified these from the suggested values.
I would suggest putting these back to the default values of 110000 and 4.5
In yaw it looks like you are artificially limiting the yaw acceleration with this setting
I would set this back to its default value unless you have a good reason to keep it there. Differential lateral cyclic is probably pretty powereful. But I don’t know that I would limit it like this. There are better choices.
Now on to the rate controller parameters. Your P gains are way too low. In my opinion the should be at least 5 times there current value. I most of the time recommend at least 0.15 or better. But you will need to slowly increment them while watching for feedback instabilities. If you see bad oscillations then stop. The P gain will go a long way to help with the drifting. You are in the same situation as Pitt in regards to the yaw axis. What I mean is that since you rely on the rotors to control yaw, you will need to be careful raising the yaw P gain too because you could see feedback instabilities there as well.
For the I gains, they will need to be at least 0.1 and maybe as high as 0.4. But I would recommend getting the P gain set before messing with the I gain.
Change the IMAX values to 0.4. Let’s see what the integrator is doing in forward flight before making this any higher than 0.4.
So what do these do?
H_DCP_SCALER 0.250000
H_DCP_YAW 0.000000
Well those are my suggestions to start with. I would like to know what these parameters do so I can help set those properly.

DCP_SCALER controls the amount of differential collective used in pitch control.
DCP_YAW compensates yawing movement caused by different torque of differential collective.

So what is the value of DCP_scaler actually telling me? Does that mean 25% of the longitudinal control input is going to DCP and the rest to longitudinal cyclic? As for the DCP_ YAW, does this compensate for the unbalanced torque by using differential lateral cyclic?

Hey Bill, yep I’m from GSoC!

Yeah, the Alt-Hold PIDs aren’t too well set now, and we will definitely be changing them.

The main reason why Y_MAX is limited is because we have a frame that bends quite a bit when yaw is applied, and the yaw controller seems pretty good right now with the change. R_MAX is limited since we didn’t want any sudden roll movements, and the P is high because we weren’t getting enough response in the roll axis while flying in Stabilize mode, and increasing roll this much seems to help.

I think our rate PIDs are pretty close to a level that will cause oscillation, so I’m not sure how much higher I can push them. The main reason why I’m concerned about the Loiter PIDs specifically instead is because I can stably loiter in Alt-Hold, meaning my rates and angles respond to my inputs sufficiently well, but the Loiter controller isn’t. All our values look pretty low. but the frame is about 2 meters from blade tip to blade tip, and perhaps the size of the frame would require lower PIDs? Not too sure here.

Changing IMAX seems like a good idea - will try that on our next run!

DCP_SCALER, as far as I can understand from the code, is a multiplier applied to the requested pitch, and the result is sent to each servo. So if we wanted 100% of our maximum pitch and DCP_SCALER was 0.25, each servo would use 25% of its maximum output for differential collective pitch. DCP_YAW does exactly as you said.

why don’t you want sudden roll movement? is it a structural thing like yaw. So I could definitely see that you could have a LOT of structural bending modes at play and could really affect your tuning. most of the conventional configurations have pretty stiff frames that help out with this. so when you start seeing these oscillations, what is the frequency? I don’t have time to look at your logs now. Maybe tonight but I’m very interested in seeing what’s going on. I may be wrong but in my humble opinion, I doubt your PIDs are optimized for loiter or any of the auto modes to work effectively. If your PIDs are tuned well, the desired and actual attitudes should be within 1 to 2 deg maybe as much as 5 deg during gusty conditions.
can you give me some design data?
rotor diameter
amount of rotor overlap
flying weight
rotor speed
blade chord length (blade width)

Ah, the roll restriction was just a precautionary measure - perhaps we can ease up on it and see if that was affecting us. Also, I’m afraid we didn’t analyze the frequency of the oscillations - we just backed off and lowered the P.

You’ve got far more experience: I’ll check the rate/angle PIDs out again :slight_smile:

As for the design data - I don’t have some of the numbers off-hand right now but:
Rotor diameter: ~1.1m
Overlap: no overlap
Flying weight: about 5-7 kg.
Rotor speed: ~1700 rpm
Chord length: 43mm

If u have more accurate numbers, I will take them. But this gets me into the ball park

Thanks for your help Bill, i’ll try and get you more accurate numbers when I see the copter again.

The numbers won’t impact my recommendations on tuning. They just are for my curiosity regarding performance

Sure, no problem. Tridge mentioned that I could do a writeup on the Ardupilot blog about the social enterprise i’m involved in, Yonah, and our use of tandem helis. That’d have more details about this frame and others we’re testing :slight_smile:

I looked at one of the logs and it looks like you have some work to do with tuning. I would have one of the developers look at your log, specifically IMU3 accels. There is something going on there that I don’t have the expertise to figure out.

I would start trying to get the P gain increased. Once you get it as high as you can then work on the I gain. If you plan to not ever fly this in acro or sport mode then you can start increasing the I gain to as much as 0.4. This should not cause feedback instabilities but it is always good practice to increase the gain slowly. You’ll want to set ILMI to maybe 0.05 or 0.1 but be careful as this might make the aircraft want to lean during takeoff.

Hm, I’m using the Pixhawk2 so IMU1/2 is dampened, but IMU3 is not and will likely show very different values from the other two. Is that what you’re referring to? @tridge or @Rob_Lefebvre’s help would be great given their heli experience :slight_smile:

Okay, so the priority for the rates would be raise the P as much as possible without any significant I-term input, and then to raise the I-term once I reach the highest possible P without instabilities?

Great, thanks for the help Bill, will be trying this after the weekend!

That is most likely what I’m seeing. I’m not sure if that will affect the EKF. Just be cautious because if your EKF starts having issues, that might be part of the problem.

Yes that is how I approach tuning. You can try putting the FILT param at 4 hz and that may help you get a little higher P gains.

Hey @bnsgeyer,

Can’t tune today, so I was taking a look at my logs again. I see that for both my DesRoll vs Roll, and DesPitch vs Pitch, the actual roll and pitches do seem to follow the shape of the desired value plots really closely, just that it is offset by a few degrees. I have some trim from my transmitter with the Save Trim function, does that affect the shown desired vs actual in any way? Or is this just incorrect PIDs?

So changing your trim will change the reference for the center point of your stick on you transmitter. All the Pixhawk is seeing is a change is PWM from what it knows is the trim PWM. That’s why if you change trim in the transmitter you should recal your radio in mission planner. So I still think this is a tuning issue. You’ll need to either increase I gain quite a bit and use a non zero ILMI like 0.05 or 0.1. Be careful going too high with this be cause it will affect the aircraft leaning on takeoff when taking off from uneven terrain.